@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,12 +1,27 @@
1
1
  import { AppSyncClient } from '../appsync';
2
2
  import { Session } from '../types';
3
3
  import { OrchestrationStore } from './store';
4
+ import type { ImageAttachment } from './types';
5
+ import { type GroupDecisionSubmitDeps } from './gate-decision-submit';
6
+ import { type ContinuationCliResult, type ContinuationCliDeps } from './slash-routes/continuation';
7
+ import { loadReviewerWizardData } from './slash-routes/reviewers';
4
8
  import { createShellEventEmitter } from './emit-shell-event';
9
+ import { type RunAuditBrowserResult } from './audit-runner';
5
10
  import { Tier } from './types';
11
+ import type { PendingClarification } from './types';
12
+ import { type GatePromptEnvelope, type DecryptedReviewSummaryInput } from './gate-prompts';
13
+ import type { Event } from '../types/events';
6
14
  import { type StructuralSummaryGenerator } from '../structural-summary';
7
15
  import type { PlannerAdapter } from '../planner/adapter';
8
16
  import type { PlannerCacheLayer } from '../planner/cache';
9
17
  import type { PlannerInput, PlannerDecision as PlannerDecisionRuntime } from '../planner/types';
18
+ import type { LocalGemmaAdvisoryRunner } from '../planner/local-advisory';
19
+ import type { LocalExecutor } from '../local-executor';
20
+ import type { WorkItemInput, DisjointnessRejection, RevertManifestStore } from '../local-executor';
21
+ import type { QuorumLoop } from './quorum-loop';
22
+ import { ensureFreshContextStore } from './context-store';
23
+ import type { EnsureFreshResult } from './context-store';
24
+ import { type TaskProgressEvent } from './task-progress';
10
25
  export interface RunOrchestrationShellArgs {
11
26
  /** Authenticated AppSync client (caller is responsible for `authenticateWithStoredTokens`). */
12
27
  appsyncClient: AppSyncClient;
@@ -33,22 +48,478 @@ export interface RunOrchestrationShellArgs {
33
48
  * finally-block cleanup).
34
49
  */
35
50
  plannerCache?: PlannerCacheLayer;
51
+ /**
52
+ * Local Gemma planner M1/M2 — disables automatic structural-summary refreshes
53
+ * at shell startup and before natural-language classification. The local
54
+ * planner path must not scan or summarize the repository before route-source
55
+ * safety and an accepted local route exist. Accepted local routes such as
56
+ * `familiarize` may still run their own route-scoped refresh.
57
+ */
58
+ disableStructuralContextRefresh?: boolean;
59
+ /**
60
+ * Local Gemma planner migration state. `hosted` keeps the legacy backend
61
+ * planner semantics. `local_gemma_qat` means natural-language decisions came
62
+ * from the local runtime and need shell-owned M1 safety/milestone gates.
63
+ * `local_unavailable` means the user opted into local-model orchestration but
64
+ * the verified runtime is not usable; no hosted fallback is allowed.
65
+ */
66
+ plannerRuntimeKind?: 'hosted' | 'local_gemma_qat' | 'local_unavailable';
67
+ /**
68
+ * TUI redesign (2026-06-29) — display label for the local planner model
69
+ * (e.g. `gemma4`), surfaced in the status-bar planner badge. Set by `cli.ts`
70
+ * from the resolved local-model config; absent on hosted/legacy callers.
71
+ */
72
+ plannerRuntimeLabel?: string;
73
+ /**
74
+ * TUI redesign (2026-06-29) — the PLAINTEXT working directory for the status
75
+ * bar (process.cwd() captured at shell entry). Threaded explicitly because
76
+ * `session.projectPath` is AES-GCM-encrypted at rest in E2E sessions and is
77
+ * never decrypted (Stage-1 HIGH). Absent → the component falls back to
78
+ * process.cwd().
79
+ */
80
+ cwd?: string;
81
+ /**
82
+ * Local Gemma M3 advisory runtime. This is intentionally separate from the
83
+ * planner adapter interface: classification remains schema-only, while
84
+ * familiarization uses a bounded read-only advisory prompt after route
85
+ * safety, local runtime eligibility, and repository context refresh pass.
86
+ */
87
+ localAdvisoryRunner?: LocalGemmaAdvisoryRunner;
88
+ /**
89
+ * CP-12 W3 §3.5 — the team-mode Local Executor. Present ONLY for an
90
+ * Agent-Teams session: `cli.ts` constructs ONE per session (honoring the
91
+ * CP-1.a singleton-per-sessionId guard) and threads it here ALONG WITH its
92
+ * team deps wired. When present, `runOrchestrationShell`:
93
+ * (a) subscribes `subscribeToClassBPackets(session.userId)` →
94
+ * `localExecutor.consumeClassB(packet)` (item 2) + teardown cleanup;
95
+ * (b) enables the `/team` slash command (item 5).
96
+ * A single-track/Companion/stub session OMITS this — no Class B
97
+ * subscription, no team mode, no status node (byte-identical behavior).
98
+ */
99
+ localExecutor?: LocalExecutor;
100
+ /**
101
+ * CP-12 W3 §3.5 — store-tap installed by `cli.ts` so the team-mode LE's
102
+ * per-track shell events (W2.b `emitTrackProgress` NOTIFICATIONs carrying
103
+ * `metadata.track_index` + `task_id`, and the `task_group_halted`
104
+ * NOTIFICATION) are routed into THIS shell's store. `cli.ts` builds the LE
105
+ * with an emitter that calls `teamShellEventTap.fn(args)` BEFORE the real
106
+ * emit chokepoint; `runOrchestrationShell` installs the store-dispatching
107
+ * `fn` at startup. Omitted for non-team sessions.
108
+ */
109
+ teamShellEventTap?: {
110
+ fn: (args: TeamTapEvent) => void;
111
+ };
112
+ /**
113
+ * CP-1.f §3.C.20 — the desktop reviewer-quorum loop driver. Present for a
114
+ * real Max session (constructed in `cli.ts` alongside the team LE). When
115
+ * present, `runOrchestrationShell`:
116
+ * (a) wires its `classBConsumerDeps` (real Ed25519 verify + GATE_DISPATCH
117
+ * gateDispatch + REVIEWER_DISPATCH spawnReviewers + REVISE_FEEDBACK
118
+ * runReviseRound) into the LE consumer;
119
+ * (b) runs `recoverInReviewAssignments` on Class B (re)connect (§3.C.21b);
120
+ * (c) drives `startTask` on a `start_task` planner decision (§3.C.20); the
121
+ * round-0 implementor spawn then fires from the GATE_DISPATCH consumer.
122
+ * A non-Max / stub / Companion session OMITS this.
123
+ */
124
+ quorumLoop?: QuorumLoop;
125
+ /**
126
+ * CP-1.f live progress surfacing — the desktop-local progress tap holder
127
+ * (`cli.ts` builds it alongside the loop). When present,
128
+ * `runOrchestrationShell` installs the store-dispatching `fn` so the loop's
129
+ * `onProgress` events render as an ephemeral spinner line + persisted
130
+ * milestones, and emits `waiting_user` when a gate prompt arrives. A non-loop
131
+ * / Companion / stub session OMITS this — no spinner line ever renders.
132
+ */
133
+ progressTap?: {
134
+ fn: (event: TaskProgressEvent) => void;
135
+ };
136
+ /**
137
+ * Audited-path fix (Fix 1) — the desktop-local PolicyRejection tap holder
138
+ * (`cli.ts` builds it alongside the loop). When present,
139
+ * `runOrchestrationShell` installs the store-dispatching `fn` so a hosted-side
140
+ * PolicyRejection becomes a classified `SHELL_ADVISORY` in the conversation
141
+ * (the existing mobile NOTIFICATION path is unchanged). The shadow-discard side
142
+ * is handled by `cli.ts` (which holds the QuorumLoop reference). A non-loop /
143
+ * Companion / stub session OMITS this.
144
+ */
145
+ policyRejectionTap?: {
146
+ fn: (info: {
147
+ detail: string;
148
+ category: string;
149
+ recommendedRecovery: string;
150
+ }) => void;
151
+ };
152
+ /**
153
+ * PHASE-589/469 W3.2 — the two-phase group-escalation decision deps, built in
154
+ * `cli.ts` alongside the team LE (the keychain/E2E/signing-heavy assembly:
155
+ * `claimGroupDecision` SDK client, the `revertGroup` runner over the durable
156
+ * manifest, `markAccepted`, the per-track render flip via
157
+ * `driveGroupDecisionConvergence`, and the `reissueTeam` callback). Threaded
158
+ * into the SHARED `gateDecisionDeps.groupDecision` so a synthesized
159
+ * `task_group_halted` 5-option prompt resolves through `submitGroupDecision`
160
+ * on BOTH the TTY + non-TTY surfaces. A non-team session OMITS this — no group
161
+ * prompt can ever appear, so it is never consulted.
162
+ *
163
+ * The `store` is OMITTED here — it is created INSIDE `runOrchestrationShell`,
164
+ * which completes the deps with its own store (mirroring how `gateDecisionDeps`
165
+ * is assembled). `cli.ts` supplies only the keychain/E2E/signing-heavy half
166
+ * (`claimClient` / `revertGroup` / `markAccepted` / `driveGroupConvergence` /
167
+ * `reissueTeam` / `getSessionKey`).
168
+ */
169
+ groupDecisionDeps?: Omit<GroupDecisionSubmitDeps, 'store'>;
170
+ /**
171
+ * PHASE-589/469 W3.1 (C4) — the startup reconcile-before-GC over the durable
172
+ * revert manifests (LOCK #589-I). Built in `cli.ts` over the same
173
+ * `RevertManifestStore` + `revertGroup` runner the group decision uses, plus a
174
+ * `probeEngineState` that asks the engine for each group's terminal view. Run
175
+ * ONCE at team-wiring startup, BEFORE the live Class B loop consumes packets,
176
+ * so a backend lease-timeout `Halted` (driven while the desktop was offline)
177
+ * reverts the applied tree before its manifest could be GC'd. A non-team
178
+ * session OMITS this. NEVER throws.
179
+ */
180
+ reconcileRevertManifests?: () => Promise<void>;
181
+ }
182
+ /**
183
+ * CP-12 W3 — the minimal shape `runOrchestrationShell` inspects when routing
184
+ * the team-mode LE's emitted shell events into the store. Structural subset of
185
+ * the LE's `EmitShellEventFn` arg (we only read `metadata`).
186
+ */
187
+ export interface TeamTapEvent {
188
+ metadata?: Record<string, unknown>;
36
189
  }
37
190
  export { processMarkers, withRoleMarker } from './process-markers';
38
191
  export { emitShellEvent, createShellEventEmitter, type ShellEventEmit, type NewEventTypeKind, } from './emit-shell-event';
39
192
  export { pickMode, TierError, type ParsedModeArgs, type ModeSelectionDeps, } from './mode-selection';
40
193
  export { readStickyPreference, writeStickyPreference, stickyPreferenceFilePath, } from './sticky-preference';
41
194
  export { getCohortFlag, cohortFlagFilePath } from './cohort-flag';
195
+ export { deriveWorkspaceId, deriveRepoId, normalizeRepoRelativePath, contextStoreDir, loadContextStore, writeContextStore, computeSummaryInputHash, probeFreshness, ensureFreshContextStore, mintContextRef, resolveContextRef, sliceSummary, type ContextRef, type SliceSelector, type SliceSelectorEntry, type ContextStoreMetadata, type ContextStoreEntry, type ResolvedContextSlice, type FreshnessProbeResult, type EnsureFreshResult, type EnsureFreshDeps, } from './context-store';
42
196
  export { routeSlashCommand, applySlashOutput, type SlashOutput, type ShellAction, } from './slash-router';
197
+ export { buildAuditBrowserModel, routeAuditEntry, auditKindLabel, auditKindCopy, renderAuditBrowserText, renderAuditEntryText, ENTRY_DETAILS_UNAVAILABLE, NO_AUDIT_ENTRIES, AUDIT_LOG_TOO_LARGE, AUDIT_LOG_TITLE, AUDIT_BROWSER_MAX_HEADLINE, WIRE_PUBLIC_PLAINTEXT_KINDS, type AuditBrowserModel, type AuditEntryModel, type AuditReviewerVerdictModel, type AuditTaskAuthorizedModel, type DecryptContentFn, } from './audit-browser';
198
+ export { runAuditBrowser, renderAuditResultText, AUDIT_BROWSER_UPGRADE_HINT, type RunAuditBrowserResult, type RunAuditBrowserDeps, } from './audit-runner';
199
+ export { AuditLogPanel } from './components/AuditLogPanel';
43
200
  export { reducer } from './reducer';
44
201
  export { createOrchestrationStore, type OrchestrationStore } from './store';
45
- export type { Mode, Tier, PlannerDecision, AgentKind, PlannerHealthState, RunningTaskState, ReviewerSeatState, GateState, ExecutionEventEntry, RefusalEventEntry, BypassEventEntry, MobileEventEntry, EventStreamEntry, ConversationEntry, QueuedTask, PendingClarification, OrchestrationState, OrchestrationAction, LastModeFile, } from './types';
202
+ export type { Mode, Tier, PlannerDecision, AgentKind, PlannerHealthState, RunningTaskState, ReviewerSeatState, GateState, ExecutionEventEntry, RefusalEventEntry, BypassEventEntry, MobileEventEntry, EventStreamEntry, ConversationEntry, QueuedTask, PendingClarification, OrchestrationState, OrchestrationAction, LastModeFile, TeamState, TeamTrackEntry, TeamTrackState, TeamMergeGateStatus, LiveProgress, } from './types';
203
+ export { formatElapsed, isSpinnerPhase, renderProgressLine, type TaskProgressEvent, type OnProgress, } from './task-progress';
204
+ export { runDeclaredTestSurfaces, DECLARED_TEST_TIMEOUT_MS, type DeclaredTestResult, type DeclaredTestReason, type RunDeclaredTestSurfacesArgs, } from './declared-test-runner';
46
205
  /**
47
206
  * §5 lines 336-365 LOCK + §16 LOCK #14. Single entrypoint that wires
48
207
  * the store + emit chokepoint + slash router and either mounts the
49
208
  * Ink TUI (TTY) or falls back to line-log (non-TTY).
50
209
  */
51
210
  export declare function runOrchestrationShell(args: RunOrchestrationShellArgs): Promise<void>;
211
+ /**
212
+ * PHASE-CP-1-F.1 Part B (LOCK L7) — the bound on the async per-round summary
213
+ * fetch fired AFTER a final-approval prompt is queued. The decision never
214
+ * blocks on this; if the fetch doesn't resolve within the bound, the prompt
215
+ * simply renders with no review panel (fail-open).
216
+ */
217
+ export declare const TASK_REVIEW_SUMMARY_FETCH_TIMEOUT_MS = 5000;
218
+ /**
219
+ * Plaintext-first dispatcher per #C8M-7 (Stage 1 R1 M6 lock):
220
+ * 1. If `event.metadata` is an object, use it directly. Otherwise try
221
+ * `JSON.parse` (AWSJSON delivery path is typically already-parsed,
222
+ * but accept both).
223
+ * 2. If `metadata.prompt_kind` is one of the two orchestration
224
+ * constants, call `extractGatePromptEnvelope`. If it returns an
225
+ * envelope, dispatch `GATE_PROMPT_RECEIVED`; if it returns null
226
+ * (defensive validation tripped), dispatch a malformed-prompt
227
+ * `advisory` per #C8M-1 via `SHELL_ADVISORY`.
228
+ * 3. Anything else (other prompt_kinds, USER_PROMPT, etc.) returns
229
+ * without further action — see "Stage 2 r1 Codex HIGH-2 scope
230
+ * clarification" below for why this is correct.
231
+ *
232
+ * Plaintext-first is safe because orchestration prompts are wire-public
233
+ * per CP-0 §2.F.12 and the AppSync subscription is Cognito-auth-gated
234
+ * (an attacker capable of injecting plaintext fakes already has
235
+ * `createEvent` rights and can do arbitrary harm).
236
+ *
237
+ * ──────────────────────────────────────────────────────────────────────
238
+ * Stage 2 r1 Codex HIGH-2 scope clarification (Hendry-approved 2026-05-19):
239
+ *
240
+ * The locked design #C8M-7 dispatcher contract says "Otherwise (any other
241
+ * prompt_kind, OR plaintext parse failed, OR metadata wrapped in
242
+ * `{ encrypted: "..." }`): route to the existing decrypt path
243
+ * (`cryptoService.decryptMetadata(...)`) and dispatch as
244
+ * `kind:'subagent-event'`/`kind:'mobile-event-replay'` per the prior
245
+ * `ConversationEntry` variants."
246
+ *
247
+ * [RESOLVED — CP-8 full §A.6 (#472)] CP-8 min deferred the non-gate
248
+ * INTERACTIVE_PROMPT decrypt path because the shell had no session-key
249
+ * plumbing at the dispatcher. CP-8 full §A.6 closes it: the dispatcher now
250
+ * accepts a `sessionKeyResolver` (`keychainManager.getSessionKey`, the same
251
+ * path the gate-prompt notes submit uses) and routes the agent's OWN
252
+ * AskUserQuestion prompts (E2E-encrypted `{ encrypted: "..." }` metadata,
253
+ * UNLIKE the plaintext server gate metadata) through
254
+ * `cryptoService.decryptMetadata` → a `MobileEventEntry` dispatched via
255
+ * `EVENT_RECEIVED` (which the reducer renders as a `subagent-event`
256
+ * ConversationEntry). The gate path (plaintext) is UNCHANGED — only the
257
+ * non-gate encrypted path is added.
258
+ *
259
+ * Fail-closed: when the session key is unavailable OR `decryptMetadata`
260
+ * throws, the dispatcher logs + pushes a `SHELL_ADVISORY` (mirroring the
261
+ * malformed-gate advisory below) — it NEVER crashes and NEVER renders
262
+ * ciphertext.
263
+ * ──────────────────────────────────────────────────────────────────────
264
+ */
265
+ /**
266
+ * PHASE-CP-1-F.1 Part B (LOCK L7) — the bounded review-summary fetcher the
267
+ * dispatcher fires AFTER the base final-approval prompt is queued. Returns the
268
+ * DECRYPTED summary on success, or `null`/throws on any failure (the
269
+ * dispatcher fails OPEN — no panel, never a blocked decision). Injected so the
270
+ * dispatcher stays decoupled from the SDK + session-key plumbing (and is
271
+ * unit-testable with a mock).
272
+ */
273
+ export type ReviewSummaryFetcher = (taskId: string, gateId: string, sessionId: string) => Promise<DecryptedReviewSummaryInput | null>;
274
+ export declare function handleSubscribedEvent(event: Event, store: OrchestrationStore, sessionKeyResolver?: (sessionId: string) => Promise<string | null>, reviewSummaryFetcher?: ReviewSummaryFetcher, maybeAutoContinue?: (envelope: GatePromptEnvelope) => boolean): void;
275
+ /**
276
+ * Route ONE team-mode LE shell event into the store's minimal `team` state.
277
+ * The W2.b `emitTrackProgress` emits a NOTIFICATION carrying
278
+ * `metadata.track_index` + `task_id` (+ `source: 'track_progress'`); the
279
+ * `haltTaskGroup` path emits a NOTIFICATION with `source: 'task_group_halted'`.
280
+ * We discriminate on `metadata.source` so non-team NOTIFICATIONs (planner
281
+ * health, late-arrival audits) are IGNORED — they have no team `source` tag.
282
+ *
283
+ * Pure mapping → store dispatch; no rich rendering (that is [DEFERRED → CP-8
284
+ * #469]). Called from the `teamShellEventTap.fn` installed at startup.
285
+ */
286
+ export declare function routeTeamShellEventToStore(store: OrchestrationStore, evt: TeamTapEvent): void;
287
+ /**
288
+ * PHASE-590 §3.D step 0 / §4.4 — compose the LOSSLESS implementation brief.
289
+ *
290
+ * Factored from the existing `start_task` brief-compose logic (formerly inline
291
+ * at the routing branch): when THIS turn answered a live clarification
292
+ * (`pending` non-null + answered), rebuild a unified brief = the original
293
+ * request + the answered rounds; otherwise the brief is just the latest turn.
294
+ *
295
+ * Reused by THREE call sites with IDENTICAL semantics (no behavior change at the
296
+ * `start_task` site): the `start_task` branch, the `team_decompose` decomposer
297
+ * input + single-task fallback, AND the `groupIdempotencyKey` hash. Never use
298
+ * the raw latest turn — after a clarification loop it drops the original request
299
+ * and collides on common answers like "yes".
300
+ *
301
+ * `pending` is the PRE-`PLANNER_DECISION` snapshot (the live store may have
302
+ * cleared `pendingClarification` on the dispatch); the caller passes whether
303
+ * THIS turn answered it (`answered`) so a stale/in-flight pending is treated as
304
+ * a fresh prompt (the brief is the latest turn).
305
+ */
306
+ export declare function composeImplementationBrief(pending: PendingClarification | null, latestTurn: string, answered: boolean, options?: {
307
+ priorWorkflowHandoffTurns?: string[];
308
+ priorBrainstormTurns?: string[];
309
+ attachments?: ImageAttachment[];
310
+ attachmentPaths?: string[];
311
+ }): string;
312
+ export declare function composeTeamTrackBrief(trackDescription: string, sourceBrief: string): string;
313
+ /**
314
+ * PHASE-590 §3.D / §3.E / §4.4 — the STRUCTURED outcome of `launchTeamFromWorkItems`.
315
+ *
316
+ * The manual `/team` `handleTeamCommand` collapses BOTH a server `accepted:false`
317
+ * (disjointness rejection — no group exists) AND any thrown/transport error to
318
+ * `null`. The PLANNER auto-launch path MUST distinguish them, because the safety
319
+ * of auto-falling-back differs (a disjointness reject is safe to fall back; an
320
+ * unknown create error MAY have created the group → falling back would double-run).
321
+ */
322
+ export type LaunchTeamOutcome = {
323
+ kind: 'accepted';
324
+ taskGroupId: string;
325
+ } | {
326
+ kind: 'disjointness_rejected';
327
+ rejection: DisjointnessRejection;
328
+ } | {
329
+ kind: 'unknown_create_error';
330
+ err: unknown;
331
+ };
332
+ /**
333
+ * PHASE-590 §3.D / §4.4 — the SHARED `/team` launch block, factored WHOLE from
334
+ * the live `/team` dispatch so both the manual command AND the planner path
335
+ * reuse it verbatim: `markTeamSessionActive` → brief-encrypt loop →
336
+ * `runTeamCreateUnderSeedBarrier(createTaskGroup)` → `setTeamBriefs` +
337
+ * `armB1Recovery`. The #593 seed-barrier ordering is load-bearing (a round-0
338
+ * GateDispatch can race the create response).
339
+ *
340
+ * Unlike `handleTeamCommand`, this returns a STRUCTURED `LaunchTeamOutcome` union
341
+ * so the caller distinguishes accepted / disjointness-rejected / unknown-create-
342
+ * error and only auto-falls-back on the SAFE classes (§3.E).
343
+ *
344
+ * `workItems` MUST already be the wire shape (no `description`); briefs are
345
+ * passed separately in `briefsByTrackIndex` and E2E-encrypted here under the
346
+ * team session key (the PLAINTEXT brief NEVER goes on the wire).
347
+ */
348
+ export declare function launchTeamFromWorkItems(deps: {
349
+ store: OrchestrationStore;
350
+ appsyncClient: AppSyncClient;
351
+ quorumLoop?: QuorumLoop;
352
+ sessionId: string;
353
+ workItems: WorkItemInput[];
354
+ briefsByTrackIndex: Map<number, string>;
355
+ groupIdempotencyKey: string;
356
+ /**
357
+ * PHASE-589/469 W3.2 RESIDUAL 1 — the durable store the ORIGINAL launch spec is
358
+ * retained onto (keyed by the created `taskGroupId`), so a later `REJECT_RESTART`
359
+ * can re-dispatch the WHOLE team from it (the engine retains nothing). ABSENT
360
+ * (single-impl / tests / non-team) → no retention (a restart degrades to the
361
+ * user re-running `/team`, the design-accepted fallback). Best-effort: a
362
+ * retention error NEVER blocks the launch (mirrors the brief-encrypt degrade).
363
+ */
364
+ durableStore?: RevertManifestStore;
365
+ /**
366
+ * IMAGE-ATTACHMENT-DESIGN.md §5 — GROUP-wide image attachments. Armed on the
367
+ * loop (`setTeamAttachments`) before any TrackAssigned so each track's round-0
368
+ * spawn copies them, AND retained in the durable launch spec so a REJECT_RESTART
369
+ * reissue re-copies from `sourcePath`. Absent/empty on non-image launches.
370
+ */
371
+ attachments?: ImageAttachment[];
372
+ /**
373
+ * §13 Option-2 — the ordered-with-DUPLICATES resolved carried-path list aligned with
374
+ * the `[Image #N]` chip numbers in the per-track briefs, so the number-based chip
375
+ * rewrite resolves each chip to the right ref. Retained for REJECT_RESTART reissue.
376
+ */
377
+ attachmentPaths?: string[];
378
+ }): Promise<LaunchTeamOutcome>;
379
+ /**
380
+ * PHASE-589/469 W3.2 RESIDUAL 1 — re-dispatch the WHOLE team for a
381
+ * `REJECT_RESTART` decision, from the desktop's OWN retained original `/team`
382
+ * launch spec (the engine retains nothing). Reads the retained
383
+ * `{ workItems, briefs }` off the durable store (persisted at the original launch,
384
+ * survives a restart), then drives the SAME validated launch path
385
+ * `launchTeamFromWorkItems` — exactly as if the user re-ran the original `/team`
386
+ * (same brief-encrypt + seed-barrier + createTaskGroup; disjointness re-validated
387
+ * server-side). A FRESH per-launch idempotency key (timestamp) mints a NEW group;
388
+ * the new group's spec is retained durably too (so a restart of the restart still
389
+ * works).
390
+ *
391
+ * THROWS when no retained spec exists OR the re-launch did not produce a fresh
392
+ * group — `submitGroupDecision` catches the throw and surfaces the design-accepted
393
+ * "re-run /team" advisory (the single source of that user message).
394
+ */
395
+ export declare function reissueTeamFromRetainedSpec(deps: {
396
+ store: OrchestrationStore;
397
+ appsyncClient: AppSyncClient;
398
+ quorumLoop?: QuorumLoop;
399
+ sessionId: string;
400
+ durableStore: RevertManifestStore;
401
+ }, taskGroupId: string): Promise<void>;
402
+ /**
403
+ * PHASE-590 §3.D — the `team_decompose` routing path. Runs the local decomposer,
404
+ * shape-checks (the schema is applied inside the decomposer parse) +
405
+ * availability-validates agents, computes the deterministic per-turn idempotency
406
+ * key, and auto-launches via `launchTeamFromWorkItems` — distinguishing the
407
+ * structured outcome union and only auto-falling-back on SAFE classes. Any
408
+ * irreparable decomposition (no-decompose / parse-fail / empty / no-agent /
409
+ * pass-error) → synthesized single `start_task`.
410
+ */
411
+ export declare function routeTeamDecompose(deps: {
412
+ store: OrchestrationStore;
413
+ appsyncClient: AppSyncClient;
414
+ quorumLoop: QuorumLoop;
415
+ localExecutor: LocalExecutor;
416
+ sessionId: string;
417
+ rationale: string;
418
+ composedBrief: string;
419
+ /** IMAGE-ATTACHMENT-DESIGN.md §5/§7.5 — group attachments; the decomposer brief is text-only, tracks get the images. */
420
+ attachments?: ImageAttachment[];
421
+ /** §13 Option-2 — ordered-with-dups carried paths for the number-based chip rewrite (decomposer briefs are chip-free, so usually unused; threaded for the single-fallback + robustness). */
422
+ attachmentPaths?: string[];
423
+ /**
424
+ * The brief for a team→single FALLBACK (Stage-2 agy MED): carries the in-worktree
425
+ * REL-REFS (not the decomposer's text-only marker). Defaults to `composedBrief`.
426
+ */
427
+ singleFallbackBrief?: string;
428
+ /** Stage-2 R3 HIGH — the loop's durable store, so the live launch persists the retained spec + attachments. */
429
+ durableStore?: RevertManifestStore;
430
+ }): Promise<void>;
431
+ /**
432
+ * CP-4 §4.1 (#600) — `familiarize` desktop route: the context-priming task.
433
+ *
434
+ * "read the codebase to get familiar" used to mis-route to
435
+ * `summarize_current_status` (the deterministic workflow-state answerer) because
436
+ * the 6-action taxonomy had no home for "read the repo to build context". The
437
+ * planner-proxy now emits the 7th `familiarize` action; this route is its
438
+ * desktop handler (placed beside `routeTeamDecompose`, the precedent for a
439
+ * desktop-intercepted action that never reaches the engine).
440
+ *
441
+ * Behavior (v1 — the LOAD-BEARING #600 fix):
442
+ * 1. advisory "Reading the codebase to get familiar…".
443
+ * 2. write-or-reuse the CP-4 §4.2 context store via `refreshStructuralSummaryIntoStore`
444
+ * (the SINGLE refresh entry point — Codex r1 M1). Because the SAME function
445
+ * runs in the pre-classify step immediately before this route is reached,
446
+ * this call is a CACHE HIT on the unchanged tree — it renders from the
447
+ * already-refreshed store and DOES NOT re-walk. (Pre-unify, this route ran a
448
+ * SECOND `runStructuralSummarySessionStart` walk on top of pre-classify's,
449
+ * which itself walked because session-start never seeded the store — three
450
+ * walks for one familiarize. Now: at most one walk, gated by the probe.)
451
+ * 3. surface the deterministic structural-summary preview as the answer (the
452
+ * "I'm now familiar with X repos / Y files" overview). This is the
453
+ * ALWAYS-AVAILABLE floor (§4.1 fallback) — it depends on no local agent and
454
+ * no planner availability.
455
+ *
456
+ * SCOPE NOTE (separable follow-ons, NOT required for #600 to be fixed):
457
+ * - The §4.1 happy-path local-AGENT prose render (a read-only `spawnImplementor`
458
+ * plan-mode pass for a richer overview) is the quality UPGRADE; the design
459
+ * makes it explicitly best-effort with this deterministic preview as the
460
+ * floor. Not built here.
461
+ *
462
+ * Best-effort: a structural-summary failure is recorded as STRUCTURAL_SUMMARY_FAILED
463
+ * by the refresh; the preview renderer surfaces that failure text, so the user
464
+ * always gets *some* answer and the route never throws.
465
+ */
466
+ export declare function routeFamiliarize(deps: {
467
+ store: OrchestrationStore;
468
+ args: RunOrchestrationShellArgs;
469
+ emitShellEventBound: ReturnType<typeof createShellEventEmitter>;
470
+ generator: StructuralSummaryGenerator;
471
+ /**
472
+ * Test seam — the SINGLE refresh entry point. Defaults to
473
+ * `refreshStructuralSummaryIntoStore` (probe → recompute-if-stale → persist →
474
+ * mirror into the orchestration store). The probe makes this a no-op walk when
475
+ * the store is already fresh (the unify — Codex r1 M1).
476
+ */
477
+ refreshFn?: typeof refreshStructuralSummaryIntoStore;
478
+ /** Test seam — forwarded to the refresh (the pre-classify context-store seam). */
479
+ ensureFreshContextStoreFn?: typeof ensureFreshContextStore;
480
+ /** Current user turn, used only for the local familiarization advisory prompt. */
481
+ userPrompt?: string;
482
+ }): Promise<void>;
483
+ export declare function routeBrainstorm(deps: {
484
+ store: OrchestrationStore;
485
+ args: RunOrchestrationShellArgs;
486
+ emitShellEventBound: ReturnType<typeof createShellEventEmitter>;
487
+ generator: StructuralSummaryGenerator;
488
+ refreshFn?: typeof refreshStructuralSummaryIntoStore;
489
+ ensureFreshContextStoreFn?: typeof ensureFreshContextStore;
490
+ userPrompt: string;
491
+ needsRepositoryContext?: boolean;
492
+ priorTurns?: string[];
493
+ /** RAW base64 images (IMAGE-ATTACHMENT-DESIGN.md §6) — Ollama-runtime only; text-mode. */
494
+ images?: string[];
495
+ }): Promise<void>;
496
+ /**
497
+ * The MULTIMODAL image answerer for `advisory_response` + ≥1 attached image
498
+ * (IMAGE-ATTACHMENT-DESIGN.md §6 Role B). "Describe this screenshot / read this
499
+ * diagram / what does this error say" is normally answered inline by the
500
+ * classifier's `advisory_summary` — but that path is blind to the image. When an
501
+ * image is attached, the reducer's inline render is suppressed (strip
502
+ * summary+clarifying_question+rationale, §6/rev-13) and THIS produces the sole
503
+ * answer: text-mode `generateAdvisory` with the RAW base64 `images[]` to the LOCAL
504
+ * Ollama model, image framed as untrusted data, output `sanitizeForTerminal`-scrubbed.
505
+ * 100% on-device. `browse`/`familiarize` are excluded (their answer is grounded on
506
+ * other context). All-images-failed → the caller passes an empty `images` and we
507
+ * proceed text-only.
508
+ */
509
+ export declare function routeAdvisory(deps: {
510
+ store: OrchestrationStore;
511
+ args: RunOrchestrationShellArgs;
512
+ userPrompt: string;
513
+ images: string[];
514
+ }): Promise<void>;
515
+ export declare function parseTeamWorkItems(rawArg: string): {
516
+ ok: true;
517
+ workItems: WorkItemInput[];
518
+ briefsByTrackIndex: Map<number, string>;
519
+ } | {
520
+ ok: false;
521
+ error: string;
522
+ };
52
523
  /**
53
524
  * Higher-level entrypoint used by the `cli.ts` glue. CP-1.a ships the
54
525
  * basic argv parse — full plumbing (session resume, AppSync client
@@ -78,6 +549,13 @@ interface StructuralSummaryRunDeps {
78
549
  */
79
550
  export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
80
551
  text: string;
552
+ /**
553
+ * IMAGE-ATTACHMENT-DESIGN.md §13 (Option 2) — resolved image path(s) carried
554
+ * out-of-band from the InputBar's `[Image #N]` chips. When present, the ingest
555
+ * builds attachments from THESE (the `text` holds chip labels, not raw paths),
556
+ * and the `[Image #N]` labels are stripped from the classify prompt.
557
+ */
558
+ images?: string[];
81
559
  /** Test seam — defaults to the real `addBodyPath`. */
82
560
  addBodyPathFn?: (path: string, tier: Tier) => Promise<unknown>;
83
561
  /** Test seam — defaults to the real `regenerateStructuralSummary`. */
@@ -89,6 +567,44 @@ export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
89
567
  * without spinning up the BackendPlannerClient.
90
568
  */
91
569
  classifyFn?: (input: PlannerInput) => Promise<PlannerDecisionRuntime>;
570
+ /**
571
+ * CP-6 Stage 2 R1 H-2 fix — Test seam for the async
572
+ * `/continuation status/show/verify` dispatch. Defaults to building
573
+ * a `ContinuationPacketReader` over `args.appsyncClient` and calling
574
+ * `runContinuationCli`. Tests inject a stub to drive the rewrite of
575
+ * the PENDING placeholder without spinning up real reader I/O.
576
+ */
577
+ runContinuationCliFn?: (args: string[]) => Promise<ContinuationCliResult>;
578
+ /**
579
+ * CP-8 Slice C (#570) — Test seam for the async `/audit <task-id>` dispatch.
580
+ * Defaults to `runAuditBrowser` over `args.appsyncClient` + `args.tier` +
581
+ * `args.session.sessionId`. Tests inject a stub to drive the PENDING-marker
582
+ * rewrite without live fetch / decrypt.
583
+ */
584
+ runAuditBrowserFn?: (taskId: string) => Promise<RunAuditBrowserResult>;
585
+ /**
586
+ * CP-4 §4.2 — Test seam for the pre-classify context-store refresh. Defaults
587
+ * to the real `ensureFreshContextStore` (probe → recompute-if-stale → persist
588
+ * the store → return the fresh digest). Tests inject a stub to drive the
589
+ * `structuralSummaryDigest` + `ask_user`-on-refresh-failure paths without
590
+ * touching the filesystem / git.
591
+ */
592
+ ensureFreshContextStoreFn?: typeof ensureFreshContextStore;
593
+ /**
594
+ * `/reviewer-setup` wizard (2026-06-29) — Test seam for the async wizard-open
595
+ * data load. Defaults to the real `loadReviewerWizardData` (detect installed
596
+ * agents → `updateAvailableAgents` round-trip). Tests inject a stub to drive
597
+ * the REVIEWER_WIZARD_OPEN dispatch (and the no-agents / error advisory) without
598
+ * a real PATH probe or transport call.
599
+ */
600
+ loadReviewerWizardDataFn?: typeof loadReviewerWizardData;
601
+ /**
602
+ * `/reviewer-setup` wizard (2026-06-29) — Test seam for the TTY check that gates
603
+ * the Ink modal (non-TTY → advisory instead of a silent store flag). Defaults to
604
+ * the real `isInteractiveTty`. Tests inject `() => true` to exercise the open
605
+ * path (vitest runs non-TTY) and `() => false` for the fallback advisory.
606
+ */
607
+ isInteractiveTtyFn?: () => boolean;
92
608
  }
93
609
  /**
94
610
  * Slash + natural-language dispatch. Extracted from `runOrchestrationShell`
@@ -97,4 +613,100 @@ export interface HandleShellUserInputDeps extends StructuralSummaryRunDeps {
97
613
  * up the full TUI. Behaves identically to the inline closure in
98
614
  * `runOrchestrationShell`.
99
615
  */
616
+ /**
617
+ * CP-1.f (Stage-2 Codex r3+r4) — wrap a shell input handler so natural-language
618
+ * submissions are processed STRICTLY SEQUENTIALLY (one planner turn in flight at
619
+ * a time). The TTY fires `onUserInput` fire-and-forget (InputBar
620
+ * `onSubmit: (text) => void`), so without serialization two handler invocations
621
+ * could overlap and interleave the clarification state machine
622
+ * (USER_INPUT bookkeeping + classify + PLANNER_DECISION), corrupting it.
623
+ *
624
+ * Slash commands (`text.startsWith('/')`, matching `handleShellUserInput`'s own
625
+ * routing) bypass the queue: they're fast, never trigger a planner classify,
626
+ * never touch clarification state, and include `/quit` — so they must stay
627
+ * responsive instead of waiting behind a slow/hung planner turn.
628
+ *
629
+ * The returned function preserves the caller-visible contract: it returns the
630
+ * promise for THIS submission's processing (so an awaiting caller still gets the
631
+ * real result/rejection), while the internal queue swallows rejections so one
632
+ * failed turn can't break serialization for later submissions.
633
+ */
634
+ export declare function serializeShellSubmissions(handler: (text: string, images?: string[]) => Promise<void>): (text: string, images?: string[]) => Promise<void>;
635
+ /**
636
+ * Process one shell submission (slash command or natural-language → planner).
637
+ *
638
+ * IMPORTANT (Stage-2 Codex r5): natural-language submissions MUST be serialized.
639
+ * Concurrent invocations interleave the clarification state machine (USER_INPUT
640
+ * bookkeeping + classify + PLANNER_DECISION) and corrupt it. Production callers
641
+ * MUST route through `serializeShellSubmissions` (as `runOrchestrationShell`
642
+ * does). The reducer's non-mutating defensive path + the dispatcher's
643
+ * `answeredThisTurn` gate are defense-in-depth only — they do NOT make it safe to
644
+ * call this directly with overlapping NL turns. Tests may call it directly
645
+ * because they await each call sequentially.
646
+ */
647
+ /**
648
+ * PHASE-CP-10-MIN (#585) #C10M-9/16 — build the `/continue request` + `/continue
649
+ * accept` action deps for `runContinuationCli`. Wires the QuorumLoop's
650
+ * `requestContinuation` / `resumeFromContinuation` + the `applyUserDecision`
651
+ * mutation. Returns empty (no action capability) when no loop is wired (the
652
+ * slash route then reports "unavailable").
653
+ */
654
+ export declare function buildContinuationActionDeps(args: RunOrchestrationShellArgs, store: OrchestrationStore): Partial<ContinuationCliDeps>;
655
+ /**
656
+ * WEB-BROWSING deterministic fast-path detector (docs/WEB-BROWSING-DESIGN.md).
657
+ * Returns the http(s) URL(s) to read when the prompt is unambiguously a "read
658
+ * this URL" request, else null. Tight by design:
659
+ * - SUPPRESSED while a clarification is pending (don't hijack a pending
660
+ * start_task whose answer happens to be a URL) — the classifier handles it.
661
+ * This is correct for EVERY pending clarification: a `browse` decision never
662
+ * emits a clarifying_question (the parser invariant forbids advisory_summary/
663
+ * clarifying_question on browse), so a pending clarification is ALWAYS from a
664
+ * non-browse route — there is no "pending browse clarification" to preserve.
665
+ * - fires ONLY when the prompt is URL-leading OR a read-intent verb governs the
666
+ * URL clause (so "fix the CORS bug, API at https://…" stays start_task).
667
+ * The URL regex is copied from `protectUrls` (unexported in local-advisory.ts).
668
+ */
669
+ export declare function detectBrowseFastPath(text: string, pending: PendingClarification | null): string[] | null;
100
670
  export declare function handleShellUserInput(deps: HandleShellUserInputDeps): Promise<void>;
671
+ /**
672
+ * CP-4 §4.2 (Codex r1 M1 — the double-walk unify) — the SINGLE structural-
673
+ * summary refresh entry point. Drives the context store via
674
+ * `ensureFreshContextStore` (probe → recompute-if-stale → persist) and mirrors
675
+ * its result into the orchestration store so the `/structural-summary` preview,
676
+ * the familiarize overview, and the classify packet all read ONE summary.
677
+ *
678
+ * Before this unify there were up to THREE walks for a single familiarize after
679
+ * startup: session-start walked (but never seeded the store), pre-classify
680
+ * walked again (store still empty → cold), then `routeFamiliarize` walked a
681
+ * THIRD time via `runStructuralSummarySessionStart`. Now session-start AND
682
+ * pre-classify both go through this one function — which write-or-reuses the
683
+ * store — so a cache HIT on the unchanged tree means NO redundant walk, and
684
+ * `routeFamiliarize` renders from the already-refreshed store.
685
+ *
686
+ * - On a RECOMPUTE (cold / drift / input-hash change): dispatch
687
+ * STRUCTURAL_SUMMARY_GENERATED + emit the wire event + slow/truncation
688
+ * notifications (preserving the §4.8 session-start behavior).
689
+ * - On a CACHE REUSE (`reason: 'fresh'`): dispatch STRUCTURAL_SUMMARY_GENERATED
690
+ * so the in-memory store reflects the reused summary, but DO NOT re-emit the
691
+ * wire event (nothing changed for mobile) and DO NOT re-walk.
692
+ * - On a REFRESH FAILURE: dispatch STRUCTURAL_SUMMARY_FAILED (the familiarize
693
+ * floor renders the failure text). Best-effort — never throws.
694
+ *
695
+ * Returns the `EnsureFreshResult` so the pre-classify caller reads the fresh
696
+ * `digest` (FAIL-CLOSED empty on failure → the Lambda's empty-digest gate).
697
+ */
698
+ declare function refreshStructuralSummaryIntoStore(deps: StructuralSummaryRunDeps & {
699
+ ensureFreshContextStoreFn?: typeof ensureFreshContextStore;
700
+ /**
701
+ * Emit the `STRUCTURAL_SUMMARY_GENERATED` WIRE event even when the store was
702
+ * REUSED (cache hit, not recomputed). Session-start passes `true` to
703
+ * preserve the legacy `runStructuralSummarySessionStart` behavior (it
704
+ * emitted on EVERY boot) so a mobile device connecting during a reuse-launch
705
+ * still receives the session's summary timeline event (Stage-1 r1 MEDIUM).
706
+ * The per-NL-turn callers (pre-classify / familiarize) leave it `false` so a
707
+ * `"hi"`/status turn on a fresh store does NOT spam a duplicate event. The
708
+ * slow/truncation NOTIFICATIONs stay gated on `recomputed` regardless (they
709
+ * describe the walk that just ran).
710
+ */
711
+ emitOnReuse?: boolean;
712
+ }): Promise<EnsureFreshResult>;