specrails-desktop 2.55.0 → 2.55.1

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 (360) hide show
  1. package/cli/dist/args.js +80 -0
  2. package/cli/dist/desktop-client.js +125 -0
  3. package/cli/dist/desktop-control.js +339 -0
  4. package/cli/dist/format.js +45 -0
  5. package/cli/dist/help.js +68 -0
  6. package/cli/dist/output.js +47 -0
  7. package/cli/dist/run-command.js +340 -0
  8. package/cli/dist/specrails-desktop.js +41 -1107
  9. package/cli/dist/status.js +111 -0
  10. package/client/dist/assets/{ActivityFeedPage-ILXMZXcb.js → ActivityFeedPage-DmJcQpNe.js} +1 -1
  11. package/client/dist/assets/{AgentBrowserCapture-UcsupCy7.js → AgentBrowserCapture-NxBHrU-V.js} +1 -1
  12. package/client/dist/assets/{AgentModeAnalyticsPane-CQuxYh8B.js → AgentModeAnalyticsPane-CGAKTJfU.js} +2 -2
  13. package/client/dist/assets/{AgentModeCodePane-zPWbW7ei.js → AgentModeCodePane-DNSs5_oe.js} +2 -2
  14. package/client/dist/assets/{AgentModeJobsPane-CInByIdl.js → AgentModeJobsPane-DLoVYDnG.js} +1 -1
  15. package/client/dist/assets/{AgentsPage-BWvgxaBv.js → AgentsPage-CAzMn9Gg.js} +1 -1
  16. package/client/dist/assets/{AnalyticsPage-DP3jakv-.js → AnalyticsPage-C06KT4Y0.js} +1 -1
  17. package/client/dist/assets/{CodePage-BKXiwE5a.js → CodePage-aX1mxGyT.js} +1 -1
  18. package/client/dist/assets/{DesktopAnalyticsPage-DryJOaMz.js → DesktopAnalyticsPage-BtscfiQD.js} +1 -1
  19. package/client/dist/assets/{DocsDialog-BsCG9ksG.js → DocsDialog-CNOcXhp-.js} +1 -1
  20. package/client/dist/assets/{DocsPage-Cc-GeKYl.js → DocsPage-C2BugxaI.js} +1 -1
  21. package/client/dist/assets/{ExportDropdown-ClahJdDn.js → ExportDropdown-BVGKEgkd.js} +1 -1
  22. package/client/dist/assets/{InteractiveJobComposer-DfLF6N0f.js → InteractiveJobComposer-CCncBqNu.js} +1 -1
  23. package/client/dist/assets/{JobDetailModal-DHeur9YK.js → JobDetailModal-Cn_k3-RM.js} +1 -1
  24. package/client/dist/assets/{JobDetailPage-CraDKzeG.js → JobDetailPage-BogJFBsk.js} +1 -1
  25. package/client/dist/assets/{JobsPage-CcbuSwj7.js → JobsPage-DL4E8ZyU.js} +1 -1
  26. package/client/dist/assets/{LoopBuilderPage-BKtNp494.js → LoopBuilderPage-9L6URQLY.js} +1 -1
  27. package/client/dist/assets/{LoopPreviewModal-DbZd9isy.js → LoopPreviewModal-CAPqTIgL.js} +1 -1
  28. package/client/dist/assets/{LoopsPage-DEg6sIkG.js → LoopsPage-aU8dYw7L.js} +1 -1
  29. package/client/dist/assets/{MinimizedChatsContext-BGtEjWsc.js → MinimizedChatsContext-D3QzgV0B.js} +1 -1
  30. package/client/dist/assets/{PluginsPage-BVqSsPzL.js → PluginsPage-D_tsW9B5.js} +1 -1
  31. package/client/dist/assets/{ProjectSettingsDialog-CAjLgJAZ.js → ProjectSettingsDialog-_ZbNuspP.js} +1 -1
  32. package/client/dist/assets/{RepositoryDeliveries-DrcrxLe0.js → RepositoryDeliveries-Du2UCf1a.js} +1 -1
  33. package/client/dist/assets/{RepositoryScopeSelector-CAGY3xW6.js → RepositoryScopeSelector-hPGZNRBm.js} +1 -1
  34. package/client/dist/assets/ReviewPacketPage-CG-Dv0El.js +4 -0
  35. package/client/dist/assets/{TemplatePreviewModal-Bqs-9fhn.js → TemplatePreviewModal-C19H2b2o.js} +1 -1
  36. package/client/dist/assets/{TicketDetailModalContext-C0jQ5yOk.js → TicketDetailModalContext-DAK-NoK6.js} +1 -1
  37. package/client/dist/assets/{Trans-DtWlCJN9.js → Trans-DEbgkuAY.js} +1 -1
  38. package/client/dist/assets/{dashboard-CTfEtkqX.js → dashboard-B9uWNGO2.js} +1 -1
  39. package/client/dist/assets/{dashboard-DMklepmz.js → dashboard-BIwmO9wc.js} +1 -1
  40. package/client/dist/assets/{dashboard-DBAP2_SQ.js → dashboard-BV4vOZkR.js} +1 -1
  41. package/client/dist/assets/{dashboard-D40HP2ks.js → dashboard-Bf6MPVsM.js} +1 -1
  42. package/client/dist/assets/{dashboard-Csf1yGSN.js → dashboard-C8klWVvZ.js} +1 -1
  43. package/client/dist/assets/{dashboard-C29Qwa-L.js → dashboard-D1ORhPF0.js} +1 -1
  44. package/client/dist/assets/{dashboard-Cr4D8oMn.js → dashboard-DSubvs9x.js} +1 -1
  45. package/client/dist/assets/{dashboard-CSJzf5OT.js → dashboard-px_vlRx_.js} +1 -1
  46. package/client/dist/assets/{formatDistanceToNow-DYmvOA3R.js → formatDistanceToNow-Cc2u5FwQ.js} +1 -1
  47. package/client/dist/assets/{getTimezoneOffsetInMilliseconds-BAhW5E6V.js → getTimezoneOffsetInMilliseconds-BHm2U-w1.js} +1 -1
  48. package/client/dist/assets/{index-BfAZg5DG.js → index-BcligJ3-.js} +29 -29
  49. package/client/dist/assets/index-C51x61Bz.css +2 -0
  50. package/client/dist/assets/{jira-api-B27Za5FP.js → jira-api-DrGxiD9p.js} +1 -1
  51. package/client/dist/assets/packet-8nn9RsU7.js +1 -0
  52. package/client/dist/assets/packet-B0H15elv.js +1 -0
  53. package/client/dist/assets/packet-BQvBgrwh.js +1 -0
  54. package/client/dist/assets/packet-BR7mO0-a.js +1 -0
  55. package/client/dist/assets/packet-BgcQ6q_K.js +1 -0
  56. package/client/dist/assets/packet-D2s92Jnn.js +1 -0
  57. package/client/dist/assets/packet-YbtcD1HS.js +1 -0
  58. package/client/dist/assets/packet-c0Qj_9eX.js +1 -0
  59. package/client/dist/assets/{project-repositories-DixIZHTA.js → project-repositories-9Wzs0coQ.js} +1 -1
  60. package/client/dist/assets/{spending-BGmZBX5B.js → spending-T5GM7wpn.js} +1 -1
  61. package/client/dist/assets/{useDesktop-CPB4cnwI.js → useDesktop-QogiN0zR.js} +1 -1
  62. package/client/dist/assets/{useRuntimeRuns-DEQ9HdAM.js → useRuntimeRuns-Dqmz9fS9.js} +1 -1
  63. package/client/dist/assets/{useSharedWebSocket-DcPRKR8R.js → useSharedWebSocket-Dz-HI6De.js} +2 -2
  64. package/client/dist/index.html +17 -17
  65. package/docs/codex.md +5 -5
  66. package/docs/customizing.md +1 -1
  67. package/docs/gemini-cli-provider-study.md +14 -14
  68. package/docs/gemini-core-support-evaluation.md +1 -1
  69. package/docs/gemini.md +5 -5
  70. package/docs/internals/README.md +6 -2
  71. package/docs/internals/adding-a-provider.md +15 -15
  72. package/docs/internals/agent-runtime-framework-evaluation.md +8 -8
  73. package/docs/internals/api-reference.md +2 -2
  74. package/docs/internals/architecture.md +9 -9
  75. package/docs/internals/browser-capture-performance.md +3 -3
  76. package/docs/internals/code-explorer-story.md +2 -2
  77. package/docs/internals/companion-rails-as-loops-contract.md +2 -2
  78. package/docs/internals/embedded-browser-native-webview-evaluation.md +5 -5
  79. package/docs/internals/gemini-mcp-registration.md +2 -2
  80. package/docs/internals/global-artifacts-alignment-contract.md +1 -1
  81. package/docs/internals/global-artifacts-relocation-evaluation.md +1 -1
  82. package/docs/internals/interactive-jobs.md +8 -8
  83. package/docs/internals/legacy-implementation-notes.md +722 -0
  84. package/docs/internals/loop-step-log-explorer.md +8 -8
  85. package/docs/internals/mission-rail-cards.md +14 -14
  86. package/docs/internals/modular-architecture.md +107 -0
  87. package/docs/internals/profiles.md +1 -1
  88. package/docs/internals/project-builder.md +18 -18
  89. package/docs/internals/review-packet.md +8 -8
  90. package/docs/internals/safe-pr-review-flow.md +11 -11
  91. package/docs/internals/source-architecture.md +131 -0
  92. package/docs/internals/source-map.md +1354 -0
  93. package/docs/internals/spec-addenda.md +65 -9
  94. package/docs/internals/switch-to-agent-mode-design.md +11 -11
  95. package/docs/tracking-cost.md +1 -1
  96. package/package.json +5 -2
  97. package/server/dist/agent-mcp-config.js +1 -1
  98. package/server/dist/attachment-manager.js +1 -1
  99. package/server/dist/build-dirs.js +2 -2
  100. package/server/dist/config.js +0 -3
  101. package/server/dist/core-completion.js +1 -1
  102. package/server/dist/core-execution.js +1 -1
  103. package/server/dist/db/activity.js +39 -0
  104. package/server/dist/db/connection.js +41 -0
  105. package/server/dist/db/conversations.js +48 -0
  106. package/server/dist/db/jobs.js +251 -0
  107. package/server/dist/db/migrations.js +1521 -0
  108. package/server/dist/db/proposals.js +50 -0
  109. package/server/dist/db/settings.js +15 -0
  110. package/server/dist/db/stats.js +61 -0
  111. package/server/dist/db/telemetry.js +56 -0
  112. package/server/dist/db/templates.js +37 -0
  113. package/server/dist/db/types.js +2 -0
  114. package/server/dist/db.js +66 -2224
  115. package/server/dist/desktop-db.js +3 -3
  116. package/server/dist/desktop-router.js +8 -8
  117. package/server/dist/git-diagnostics.js +1 -1
  118. package/server/dist/index.js +11 -11
  119. package/server/dist/integration-branch.js +3 -14
  120. package/server/dist/jira/jira-issue-fields.js +0 -1
  121. package/server/dist/jira/jira-materializer.js +1 -1
  122. package/server/dist/jira/jira-sync-manager.js +1 -1
  123. package/server/dist/mcp/mcp-admin-router.js +1 -1
  124. package/server/dist/mcp/mcp-server.js +1 -1
  125. package/server/dist/mcp/tools/jobs.js +1 -1
  126. package/server/dist/mcp/tools/rails.js +2 -2
  127. package/server/dist/mcp/tools/specs.js +2 -2
  128. package/server/dist/mcp/tools/types.js +3 -3
  129. package/server/dist/mobile/mobile-gateway.js +1 -1
  130. package/server/dist/mobile/mobile-missions.js +1 -1
  131. package/server/dist/{desktop-analytics.js → modules/accounting/runtime/desktop-analytics.js} +2 -2
  132. package/server/dist/{pricing.js → modules/accounting/runtime/pricing.js} +1 -1
  133. package/server/dist/{result-event.js → modules/accounting/runtime/result-event.js} +3 -3
  134. package/server/dist/{spending.js → modules/accounting/runtime/spending.js} +0 -3
  135. package/server/dist/{telemetry-compactor.js → modules/accounting/runtime/telemetry-compactor.js} +1 -1
  136. package/server/dist/{telemetry-receiver.js → modules/accounting/runtime/telemetry-receiver.js} +2 -2
  137. package/server/dist/{agent-runtime-bridge.js → modules/agent-runtime/runtime/agent-runtime-bridge.js} +2 -2
  138. package/server/dist/{agent-runtime-controls.js → modules/agent-runtime/runtime/agent-runtime-controls.js} +7 -7
  139. package/server/dist/{agent-runtime-effective-config.js → modules/agent-runtime/runtime/agent-runtime-effective-config.js} +1 -1
  140. package/server/dist/{agent-runtime-loader.js → modules/agent-runtime/runtime/agent-runtime-loader.js} +3 -3
  141. package/server/dist/{agent-runtime-paths.js → modules/agent-runtime/runtime/agent-runtime-paths.js} +1 -1
  142. package/server/dist/{agent-runtime-settings-router.js → modules/agent-runtime/runtime/agent-runtime-settings-router.js} +2 -2
  143. package/server/dist/{agent-runtime-settings.js → modules/agent-runtime/runtime/agent-runtime-settings.js} +3 -3
  144. package/server/dist/{agent-runtime-settlement.js → modules/agent-runtime/runtime/agent-runtime-settlement.js} +6 -6
  145. package/server/dist/{agent-defaults.js → modules/agents/runtime/agent-defaults.js} +3 -3
  146. package/server/dist/{agent-generator.js → modules/agents/runtime/agent-generator.js} +7 -7
  147. package/server/dist/{agent-refine-manager.js → modules/agents/runtime/agent-refine-manager.js} +5 -5
  148. package/server/dist/{agent-store.js → modules/agents/runtime/agent-store.js} +1 -1
  149. package/server/dist/{profile-manager.js → modules/agents/runtime/profile-manager.js} +2 -2
  150. package/server/dist/{profiles-router.js → modules/agents/runtime/profiles-router.js} +5 -5
  151. package/server/dist/{browser-capture-manager.js → modules/browser/runtime/browser-capture-manager.js} +2 -4
  152. package/server/dist/{browser-playwright.js → modules/browser/runtime/browser-playwright.js} +1 -1
  153. package/server/dist/{blueprint-chat-manager.js → modules/builder/runtime/blueprint-chat-manager.js} +7 -7
  154. package/server/dist/{blueprint-commit.js → modules/builder/runtime/blueprint-commit.js} +8 -8
  155. package/server/dist/{blueprint-draft-parser.js → modules/builder/runtime/blueprint-draft-parser.js} +1 -1
  156. package/server/dist/{blueprint-generation.js → modules/builder/runtime/blueprint-generation.js} +1 -1
  157. package/server/dist/{blueprint-operator-prompt.js → modules/builder/runtime/blueprint-operator-prompt.js} +1 -1
  158. package/server/dist/{blueprint-router.js → modules/builder/runtime/blueprint-router.js} +3 -3
  159. package/server/dist/{blueprint-spec-quality.js → modules/builder/runtime/blueprint-spec-quality.js} +1 -1
  160. package/server/dist/{milestone-chain.js → modules/builder/runtime/milestone-chain.js} +1 -1
  161. package/server/dist/{milestone-progress.js → modules/builder/runtime/milestone-progress.js} +6 -6
  162. package/server/dist/{code-activity.js → modules/code/runtime/code-activity.js} +1 -1
  163. package/server/dist/{code-explorer-router.js → modules/code/runtime/code-explorer-router.js} +5 -5
  164. package/server/dist/{file-provenance.js → modules/code/runtime/file-provenance.js} +1 -1
  165. package/server/dist/{file-story-manager.js → modules/code/runtime/file-story-manager.js} +2 -2
  166. package/server/dist/{file-story.js → modules/code/runtime/file-story.js} +2 -2
  167. package/server/dist/{file-summary-generator.js → modules/code/runtime/file-summary-generator.js} +3 -3
  168. package/server/dist/{file-summary-manager.js → modules/code/runtime/file-summary-manager.js} +3 -3
  169. package/server/dist/{project-code-discovery.js → modules/code/runtime/project-code-discovery.js} +2 -2
  170. package/server/dist/modules/conversations/domain/draft-stream.js +91 -0
  171. package/server/dist/modules/conversations/domain/recovery-context.js +101 -0
  172. package/server/dist/modules/conversations/index.js +10 -0
  173. package/server/dist/{chat-manager.js → modules/conversations/runtime/chat-manager.js} +32 -216
  174. package/server/dist/{context-budget.js → modules/conversations/runtime/context-budget.js} +1 -1
  175. package/server/dist/{explore-cwd-manager.js → modules/conversations/runtime/explore-cwd-manager.js} +1 -1
  176. package/server/dist/{explore-smash.js → modules/conversations/runtime/explore-smash.js} +1 -1
  177. package/server/dist/{explore-stdin-session.js → modules/conversations/runtime/explore-stdin-session.js} +1 -1
  178. package/server/dist/modules/delivery/adapters/decisions/chains.js +138 -0
  179. package/server/dist/modules/delivery/adapters/decisions/contracts.js +2 -0
  180. package/server/dist/modules/delivery/adapters/decisions/create.js +234 -0
  181. package/server/dist/modules/delivery/adapters/decisions/discard.js +251 -0
  182. package/server/dist/modules/delivery/adapters/decisions/dispatch.js +107 -0
  183. package/server/dist/modules/delivery/adapters/decisions/evidence.js +205 -0
  184. package/server/dist/modules/delivery/adapters/decisions/merge-local.js +338 -0
  185. package/server/dist/modules/delivery/adapters/decisions/metadata.js +109 -0
  186. package/server/dist/modules/delivery/adapters/decisions/observations.js +260 -0
  187. package/server/dist/modules/delivery/adapters/decisions/ownership.js +83 -0
  188. package/server/dist/modules/delivery/adapters/decisions/publish.js +242 -0
  189. package/server/dist/modules/delivery/adapters/decisions/recovery.js +425 -0
  190. package/server/dist/modules/delivery/adapters/decisions/retry.js +112 -0
  191. package/server/dist/modules/delivery/adapters/decisions/transitions.js +94 -0
  192. package/server/dist/modules/delivery/domain/decision-policy.js +50 -0
  193. package/server/dist/modules/delivery/domain/state.js +2 -0
  194. package/server/dist/modules/delivery/index.js +7 -0
  195. package/server/dist/{active-pr-continuation.js → modules/delivery/runtime/active-pr-continuation.js} +2 -2
  196. package/server/dist/{delivery-evidence.js → modules/delivery/runtime/delivery-evidence.js} +3 -3
  197. package/server/dist/{multi-repo-bases.js → modules/delivery/runtime/multi-repo-bases.js} +1 -1
  198. package/server/dist/{multi-repo-checkout.js → modules/delivery/runtime/multi-repo-checkout.js} +4 -4
  199. package/server/dist/{multi-repo-delivery.js → modules/delivery/runtime/multi-repo-delivery.js} +4 -4
  200. package/server/dist/{multi-repo-execution.js → modules/delivery/runtime/multi-repo-execution.js} +8 -8
  201. package/server/dist/{pr-body.js → modules/delivery/runtime/pr-body.js} +1 -1
  202. package/server/dist/{pr-follow-up-scope.js → modules/delivery/runtime/pr-follow-up-scope.js} +2 -2
  203. package/server/dist/{pr-follow-up.js → modules/delivery/runtime/pr-follow-up.js} +1 -1
  204. package/server/dist/{pr-naming.js → modules/delivery/runtime/pr-naming.js} +1 -1
  205. package/server/dist/{pr-publisher.js → modules/delivery/runtime/pr-publisher.js} +2 -2
  206. package/server/dist/{rail-isolated-launch.js → modules/delivery/runtime/rail-isolated-launch.js} +29 -27
  207. package/server/dist/{rail-launch-parser.js → modules/delivery/runtime/rail-launch-parser.js} +2 -2
  208. package/server/dist/{rail-merge-orchestrator.js → modules/delivery/runtime/rail-merge-orchestrator.js} +5 -5
  209. package/server/dist/modules/delivery/runtime/rail-pr-decision.js +12 -0
  210. package/server/dist/{rail-pr-delivery.js → modules/delivery/runtime/rail-pr-delivery.js} +1 -1
  211. package/server/dist/{rail-pr-store.js → modules/delivery/runtime/rail-pr-store.js} +2 -2
  212. package/server/dist/{rail-pr-ticket-effects.js → modules/delivery/runtime/rail-pr-ticket-effects.js} +3 -3
  213. package/server/dist/{rail-worktree-release.js → modules/delivery/runtime/rail-worktree-release.js} +4 -4
  214. package/server/dist/{rails-router.js → modules/delivery/runtime/rails-router.js} +66 -67
  215. package/server/dist/{review-packet.js → modules/delivery/runtime/review-packet.js} +3 -3
  216. package/server/dist/modules/execution/adapters/budget-storage.js +21 -0
  217. package/server/dist/modules/execution/adapters/usage-reader.js +38 -0
  218. package/server/dist/modules/execution/application/enforce-budget.js +14 -0
  219. package/server/dist/modules/execution/application/record-job-invocations.js +64 -0
  220. package/server/dist/modules/execution/application/recover-job-usage.js +200 -0
  221. package/server/dist/modules/execution/domain/job-accounting.js +2 -0
  222. package/server/dist/modules/execution/domain/scheduling.js +24 -0
  223. package/server/dist/modules/execution/domain/usage.js +21 -0
  224. package/server/dist/modules/execution/index.js +14 -0
  225. package/server/dist/modules/execution/ports.js +2 -0
  226. package/server/dist/{accept-ladder.js → modules/execution/runtime/accept-ladder.js} +1 -1
  227. package/server/dist/{interactive-job-session.js → modules/execution/runtime/interactive-job-session.js} +11 -11
  228. package/server/dist/{job-phase-breakdown.js → modules/execution/runtime/job-phase-breakdown.js} +1 -1
  229. package/server/dist/{queue-manager.js → modules/execution/runtime/queue-manager.js} +74 -491
  230. package/server/dist/{revision-seed.js → modules/execution/runtime/revision-seed.js} +1 -1
  231. package/server/dist/{spawn-lifecycle.js → modules/execution/runtime/spawn-lifecycle.js} +3 -3
  232. package/server/dist/{stuck-run-detector.js → modules/execution/runtime/stuck-run-detector.js} +1 -1
  233. package/server/dist/{loop-command-catalog.js → modules/loops/runtime/loop-command-catalog.js} +1 -1
  234. package/server/dist/{loop-executors.js → modules/loops/runtime/loop-executors.js} +17 -17
  235. package/server/dist/{loop-factory.js → modules/loops/runtime/loop-factory.js} +2 -21
  236. package/server/dist/{loop-graph.js → modules/loops/runtime/loop-graph.js} +25 -0
  237. package/server/dist/{loop-role-engines.js → modules/loops/runtime/loop-role-engines.js} +4 -4
  238. package/server/dist/{loop-run-manager.js → modules/loops/runtime/loop-run-manager.js} +101 -26
  239. package/server/dist/{loop-runs-store.js → modules/loops/runtime/loop-runs-store.js} +1 -1
  240. package/server/dist/{loop-shell-invocation.js → modules/loops/runtime/loop-shell-invocation.js} +2 -2
  241. package/server/dist/{loop-step-idle.js → modules/loops/runtime/loop-step-idle.js} +1 -1
  242. package/server/dist/{loop-templates.js → modules/loops/runtime/loop-templates.js} +24 -29
  243. package/server/dist/{loops-router.js → modules/loops/runtime/loops-router.js} +2 -2
  244. package/server/dist/{agent-chat-manager.js → modules/missions/runtime/agent-chat-manager.js} +19 -19
  245. package/server/dist/{agent-chat-router.js → modules/missions/runtime/agent-chat-router.js} +6 -6
  246. package/server/dist/{agent-context-resolver.js → modules/missions/runtime/agent-context-resolver.js} +8 -8
  247. package/server/dist/{agent-fence-promotion.js → modules/missions/runtime/agent-fence-promotion.js} +1 -1
  248. package/server/dist/{agent-input-store.js → modules/missions/runtime/agent-input-store.js} +1 -1
  249. package/server/dist/{agent-operator-prompt.js → modules/missions/runtime/agent-operator-prompt.js} +17 -7
  250. package/server/dist/{agent-spec-framing.js → modules/missions/runtime/agent-spec-framing.js} +4 -4
  251. package/server/dist/{agent-steering.js → modules/missions/runtime/agent-steering.js} +1 -1
  252. package/server/dist/{mission-run-notify.js → modules/missions/runtime/mission-run-notify.js} +1 -1
  253. package/server/dist/modules/project-settings/adapters/http.js +24 -0
  254. package/server/dist/modules/project-settings/adapters/sqlite.js +120 -0
  255. package/server/dist/modules/project-settings/application.js +11 -0
  256. package/server/dist/modules/project-settings/domain.js +95 -0
  257. package/server/dist/modules/project-settings/index.js +11 -0
  258. package/server/dist/modules/project-settings/ports.js +2 -0
  259. package/server/dist/{contract-refine-runner.js → modules/specs/runtime/contract-refine-runner.js} +12 -12
  260. package/server/dist/{proposal-manager.js → modules/specs/runtime/proposal-manager.js} +8 -8
  261. package/server/dist/{smash-runner.js → modules/specs/runtime/smash-runner.js} +26 -58
  262. package/server/dist/{spec-addenda-core.js → modules/specs/runtime/spec-addenda-core.js} +2 -2
  263. package/server/dist/{spec-addenda.js → modules/specs/runtime/spec-addenda.js} +3 -3
  264. package/server/dist/{spec-launcher-manager.js → modules/specs/runtime/spec-launcher-manager.js} +8 -8
  265. package/server/dist/{spec-models.js → modules/specs/runtime/spec-models.js} +1 -1
  266. package/server/dist/{ticket-watcher.js → modules/specs/runtime/ticket-watcher.js} +1 -1
  267. package/server/dist/{background-process-control.js → modules/terminals/runtime/background-process-control.js} +1 -1
  268. package/server/dist/{background-process-service.js → modules/terminals/runtime/background-process-service.js} +3 -3
  269. package/server/dist/{background-process-store.js → modules/terminals/runtime/background-process-store.js} +1 -1
  270. package/server/dist/{background-windows-bootstrap.js → modules/terminals/runtime/background-windows-bootstrap.js} +3 -3
  271. package/server/dist/{terminal-manager.js → modules/terminals/runtime/terminal-manager.js} +3 -3
  272. package/server/dist/project-git.js +1 -1
  273. package/server/dist/project-profile-support.js +32 -0
  274. package/server/dist/project-registry.js +34 -40
  275. package/server/dist/project-router-background-processes.js +1 -1
  276. package/server/dist/project-router-chat.js +6 -6
  277. package/server/dist/project-router-git.js +1 -1
  278. package/server/dist/project-router-helpers.js +2 -2
  279. package/server/dist/project-router-jobs.js +14 -12
  280. package/server/dist/project-router-loop-runs.js +12 -12
  281. package/server/dist/project-router-settings.js +15 -75
  282. package/server/dist/project-router-setup.js +2 -2
  283. package/server/dist/project-router-spending.js +4 -4
  284. package/server/dist/project-router-terminals.js +4 -4
  285. package/server/dist/project-router-tickets.js +14 -14
  286. package/server/dist/project-router.js +13 -13
  287. package/server/dist/providers/codex-adapter.js +3 -3
  288. package/server/dist/providers/gemini-adapter.js +1 -1
  289. package/server/dist/providers/telemetry-env.js +55 -0
  290. package/server/dist/runtime-role-prompts-router.js +2 -2
  291. package/server/dist/setup-manager.js +2 -48
  292. package/server/dist/shared/git-branch-name.js +16 -0
  293. package/server/dist/transient-children.js +3 -3
  294. package/server/dist/util/distribute-int.js +33 -0
  295. package/client/dist/assets/ReviewPacketPage-D-UjTef3.js +0 -4
  296. package/client/dist/assets/index-BAtqmAZR.css +0 -2
  297. package/client/dist/assets/packet-CjS_478C.js +0 -1
  298. package/client/dist/assets/packet-D69dKsHN.js +0 -1
  299. package/client/dist/assets/packet-D9rU6Oxo.js +0 -1
  300. package/client/dist/assets/packet-DMDFoamg.js +0 -1
  301. package/client/dist/assets/packet-Dd2RMs1h.js +0 -1
  302. package/client/dist/assets/packet-DjC9OibC.js +0 -1
  303. package/client/dist/assets/packet-DwPtJoDz.js +0 -1
  304. package/client/dist/assets/packet-ceahDg8_.js +0 -1
  305. package/server/dist/rail-pr-decision.js +0 -2377
  306. package/server/dist/ticket-broadcast.js +0 -47
  307. /package/server/dist/{ai-invocations.js → modules/accounting/runtime/ai-invocations.js} +0 -0
  308. /package/server/dist/{codex-otel-bridge.js → modules/accounting/runtime/codex-otel-bridge.js} +0 -0
  309. /package/server/dist/{metrics.js → modules/accounting/runtime/metrics.js} +0 -0
  310. /package/server/dist/{telemetry-export.js → modules/accounting/runtime/telemetry-export.js} +0 -0
  311. /package/server/dist/{agent-runtime-accounting.js → modules/agent-runtime/runtime/agent-runtime-accounting.js} +0 -0
  312. /package/server/dist/{agent-runtime-controls-router.js → modules/agent-runtime/runtime/agent-runtime-controls-router.js} +0 -0
  313. /package/server/dist/{agent-runtime-events.js → modules/agent-runtime/runtime/agent-runtime-events.js} +0 -0
  314. /package/server/dist/{agent-runtime-history.js → modules/agent-runtime/runtime/agent-runtime-history.js} +0 -0
  315. /package/server/dist/{agent-runtime-metrics.js → modules/agent-runtime/runtime/agent-runtime-metrics.js} +0 -0
  316. /package/server/dist/{agent-runtime-package.js → modules/agent-runtime/runtime/agent-runtime-package.js} +0 -0
  317. /package/server/dist/{agent-runtime-repositories.js → modules/agent-runtime/runtime/agent-runtime-repositories.js} +0 -0
  318. /package/server/dist/{agent-runtime-verification-suggestions.js → modules/agent-runtime/runtime/agent-runtime-verification-suggestions.js} +0 -0
  319. /package/server/dist/{agent-refine-db.js → modules/agents/runtime/agent-refine-db.js} +0 -0
  320. /package/server/dist/{browser-capture-types.js → modules/browser/runtime/browser-capture-types.js} +0 -0
  321. /package/server/dist/{browser-context-pool.js → modules/browser/runtime/browser-context-pool.js} +0 -0
  322. /package/server/dist/{browser-network.js → modules/browser/runtime/browser-network.js} +0 -0
  323. /package/server/dist/{browser-viewport.js → modules/browser/runtime/browser-viewport.js} +0 -0
  324. /package/server/dist/{blueprint-render.js → modules/builder/runtime/blueprint-render.js} +0 -0
  325. /package/server/dist/{blueprint-spec-fixtures.js → modules/builder/runtime/blueprint-spec-fixtures.js} +0 -0
  326. /package/server/dist/{blueprint-store.js → modules/builder/runtime/blueprint-store.js} +0 -0
  327. /package/server/dist/{blueprint-types.js → modules/builder/runtime/blueprint-types.js} +0 -0
  328. /package/server/dist/{builder-cwd-manager.js → modules/builder/runtime/builder-cwd-manager.js} +0 -0
  329. /package/server/dist/{milestone-chain-store.js → modules/builder/runtime/milestone-chain-store.js} +0 -0
  330. /package/server/dist/{changes-reader.js → modules/code/runtime/changes-reader.js} +0 -0
  331. /package/server/dist/{context-scope.js → modules/conversations/runtime/context-scope.js} +0 -0
  332. /package/server/dist/{explore-contract-refine.js → modules/conversations/runtime/explore-contract-refine.js} +0 -0
  333. /package/server/dist/{explore-draft-title.js → modules/conversations/runtime/explore-draft-title.js} +0 -0
  334. /package/server/dist/{merge-manager.js → modules/delivery/runtime/merge-manager.js} +0 -0
  335. /package/server/dist/{multi-repo-execution-store.js → modules/delivery/runtime/multi-repo-execution-store.js} +0 -0
  336. /package/server/dist/{pr-lifecycle.js → modules/delivery/runtime/pr-lifecycle.js} +0 -0
  337. /package/server/dist/{rail-isolation.js → modules/delivery/runtime/rail-isolation.js} +0 -0
  338. /package/server/dist/{rail-pr-recovery-git.js → modules/delivery/runtime/rail-pr-recovery-git.js} +0 -0
  339. /package/server/dist/{rail-worktrees-store.js → modules/delivery/runtime/rail-worktrees-store.js} +0 -0
  340. /package/server/dist/{rails-store.js → modules/delivery/runtime/rails-store.js} +0 -0
  341. /package/server/dist/{job-listing.js → modules/execution/runtime/job-listing.js} +0 -0
  342. /package/server/dist/{job-spawn-idempotency.js → modules/execution/runtime/job-spawn-idempotency.js} +0 -0
  343. /package/server/dist/{run-duration-stats.js → modules/execution/runtime/run-duration-stats.js} +0 -0
  344. /package/server/dist/{verification-sentinel.js → modules/execution/runtime/verification-sentinel.js} +0 -0
  345. /package/server/dist/{loop-constants.js → modules/loops/runtime/loop-constants.js} +0 -0
  346. /package/server/dist/{loop-decider.js → modules/loops/runtime/loop-decider.js} +0 -0
  347. /package/server/dist/{loop-effect.js → modules/loops/runtime/loop-effect.js} +0 -0
  348. /package/server/dist/{loop-preview.js → modules/loops/runtime/loop-preview.js} +0 -0
  349. /package/server/dist/{loop-templates-ported.js → modules/loops/runtime/loop-templates-ported.js} +0 -0
  350. /package/server/dist/{loops-store.js → modules/loops/runtime/loops-store.js} +0 -0
  351. /package/server/dist/{agent-chat-registry.js → modules/missions/runtime/agent-chat-registry.js} +0 -0
  352. /package/server/dist/{agent-cwd-manager.js → modules/missions/runtime/agent-cwd-manager.js} +0 -0
  353. /package/server/dist/{agent-failure-briefing.js → modules/missions/runtime/agent-failure-briefing.js} +0 -0
  354. /package/server/dist/{agent-tier.js → modules/missions/runtime/agent-tier.js} +0 -0
  355. /package/server/dist/{spec-contract-prompt.js → modules/specs/runtime/spec-contract-prompt.js} +0 -0
  356. /package/server/dist/{spec-draft-parser.js → modules/specs/runtime/spec-draft-parser.js} +0 -0
  357. /package/server/dist/{ticket-store.js → modules/specs/runtime/ticket-store.js} +0 -0
  358. /package/server/dist/{terminal-marks-store.js → modules/terminals/runtime/terminal-marks-store.js} +0 -0
  359. /package/server/dist/{terminal-osc-parser.js → modules/terminals/runtime/terminal-osc-parser.js} +0 -0
  360. /package/server/dist/{terminal-settings.js → modules/terminals/runtime/terminal-settings.js} +0 -0
@@ -10,29 +10,29 @@ const readline_1 = require("readline");
10
10
  const os_1 = require("os");
11
11
  const node_path_1 = __importDefault(require("node:path"));
12
12
  const promises_1 = require("node:fs/promises");
13
- const win_spawn_1 = require("./util/win-spawn");
14
- const providers_1 = require("./providers");
15
- const runtime_1 = require("./providers/runtime");
16
- const registry_1 = require("./providers/registry");
17
- const spawn_lifecycle_1 = require("./spawn-lifecycle");
18
- const live_session_1 = require("./providers/live-session");
19
- const live_session_types_1 = require("./providers/live-session-types");
20
- const cli_prompt_1 = require("./util/cli-prompt");
21
- const result_event_1 = require("./result-event");
22
- const desktop_db_1 = require("./desktop-db");
23
- const feature_flags_1 = require("./feature-flags");
13
+ const win_spawn_1 = require("../../../util/win-spawn");
14
+ const providers_1 = require("../../../providers");
15
+ const runtime_1 = require("../../../providers/runtime");
16
+ const registry_1 = require("../../../providers/registry");
17
+ const spawn_lifecycle_1 = require("../../execution/runtime/spawn-lifecycle");
18
+ const live_session_1 = require("../../../providers/live-session");
19
+ const live_session_types_1 = require("../../../providers/live-session-types");
20
+ const cli_prompt_1 = require("../../../util/cli-prompt");
21
+ const result_event_1 = require("../../accounting/runtime/result-event");
22
+ const desktop_db_1 = require("../../../desktop-db");
23
+ const feature_flags_1 = require("../../../feature-flags");
24
24
  const agent_cwd_manager_1 = require("./agent-cwd-manager");
25
25
  const agent_operator_prompt_1 = require("./agent-operator-prompt");
26
- const agent_mcp_config_1 = require("./agent-mcp-config");
27
- const codex_spawn_1 = require("./plugins/codex-spawn");
28
- const workspace_resolution_1 = require("./workspace-resolution");
29
- const external_mcp_1 = require("./external-mcp");
26
+ const agent_mcp_config_1 = require("../../../agent-mcp-config");
27
+ const codex_spawn_1 = require("../../../plugins/codex-spawn");
28
+ const workspace_resolution_1 = require("../../../workspace-resolution");
29
+ const external_mcp_1 = require("../../../external-mcp");
30
30
  const agent_tier_1 = require("./agent-tier");
31
- const agent_capability_1 = require("./mcp/agent-capability");
32
- const attachment_manager_1 = require("./attachment-manager");
31
+ const agent_capability_1 = require("../../../mcp/agent-capability");
32
+ const attachment_manager_1 = require("../../../attachment-manager");
33
33
  const agent_context_resolver_1 = require("./agent-context-resolver");
34
- const agent_store_1 = require("./agent-store");
35
- const explore_draft_title_1 = require("./explore-draft-title");
34
+ const agent_store_1 = require("../../agents/runtime/agent-store");
35
+ const explore_draft_title_1 = require("../../conversations/runtime/explore-draft-title");
36
36
  const agent_input_store_1 = require("./agent-input-store");
37
37
  const agent_steering_1 = require("./agent-steering");
38
38
  /**
@@ -8,13 +8,13 @@ exports.createAgentChatRouter = createAgentChatRouter;
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const multer_1 = __importDefault(require("multer"));
10
10
  const express_1 = require("express");
11
- const providers_1 = require("./providers");
12
- const provider_selection_1 = require("./provider-selection");
11
+ const providers_1 = require("../../../providers");
12
+ const provider_selection_1 = require("../../../provider-selection");
13
13
  const agent_tier_1 = require("./agent-tier");
14
- const feature_flags_1 = require("./feature-flags");
15
- const attachment_manager_1 = require("./attachment-manager");
16
- const agent_store_1 = require("./agent-store");
17
- const transient_children_1 = require("./transient-children");
14
+ const feature_flags_1 = require("../../../feature-flags");
15
+ const attachment_manager_1 = require("../../../attachment-manager");
16
+ const agent_store_1 = require("../../agents/runtime/agent-store");
17
+ const transient_children_1 = require("../../../transient-children");
18
18
  const agent_input_store_1 = require("./agent-input-store");
19
19
  function isAgentChatEnabled() {
20
20
  return process.env.SPECRAILS_AGENT_CHAT !== 'false';
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildResolvedAgentContextBlock = buildResolvedAgentContextBlock;
4
4
  exports.buildAgentProjectContextBlock = buildAgentProjectContextBlock;
5
5
  exports.buildAgentHistoryBlock = buildAgentHistoryBlock;
6
- const agent_store_1 = require("./agent-store");
7
- const spec_addenda_core_1 = require("./spec-addenda-core");
8
- const db_1 = require("./db");
9
- const desktop_db_1 = require("./desktop-db");
10
- const workspace_resolution_1 = require("./workspace-resolution");
11
- const ticket_store_1 = require("./ticket-store");
12
- const project_repositories_1 = require("./project-repositories");
13
- const code_explorer_router_1 = require("./code-explorer-router");
6
+ const agent_store_1 = require("../../agents/runtime/agent-store");
7
+ const spec_addenda_core_1 = require("../../specs/runtime/spec-addenda-core");
8
+ const db_1 = require("../../../db");
9
+ const desktop_db_1 = require("../../../desktop-db");
10
+ const workspace_resolution_1 = require("../../../workspace-resolution");
11
+ const ticket_store_1 = require("../../specs/runtime/ticket-store");
12
+ const project_repositories_1 = require("../../../project-repositories");
13
+ const code_explorer_router_1 = require("../../code/runtime/code-explorer-router");
14
14
  const MAX_BLOCK_CHARS = 28_000;
15
15
  const MAX_DESCRIPTION_CHARS = 7_000;
16
16
  const MAX_EVENT_PAYLOAD_CHARS = 1_200;
@@ -7,7 +7,7 @@
7
7
  // refuses because no frame was ever registered. This pass re-tags a CLOSED
8
8
  // generic fence whose body unambiguously has one protocol shape. Anything
9
9
  // ambiguous is left untouched; fences already carrying a protocol tag are
10
- // never rewritten. Mirror: server/agent-fence-promotion.ts (keep in sync).
10
+ // never rewritten. Mirror: server/modules/missions/runtime/agent-fence-promotion.ts (keep in sync).
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.detectProtocolShape = detectProtocolShape;
13
13
  exports.promoteAgentProtocolFences = promoteAgentProtocolFences;
@@ -14,7 +14,7 @@ exports.cancelPendingAgentInputs = cancelPendingAgentInputs;
14
14
  exports.recoverPendingAgentInputs = recoverPendingAgentInputs;
15
15
  exports.decorateAgentInputMessages = decorateAgentInputMessages;
16
16
  const crypto_1 = require("crypto");
17
- const agent_store_1 = require("./agent-store");
17
+ const agent_store_1 = require("../../agents/runtime/agent-store");
18
18
  exports.MAX_PENDING_AGENT_INPUTS = 50;
19
19
  class AgentInputConflictError extends Error {
20
20
  code = 'agent_input_conflict';
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RAIL_LAUNCH_CARD_SYSTEM_CLAUSE = exports.RAIL_LAUNCH_CARD_SECTION = exports.OPERATOR_SYSTEM_PROMPT = exports.OPERATOR_INSTRUCTIONS = void 0;
4
4
  exports.buildOperatorInstructions = buildOperatorInstructions;
5
5
  exports.buildOperatorSystemPrompt = buildOperatorSystemPrompt;
6
- const spec_contract_prompt_1 = require("./spec-contract-prompt");
6
+ const spec_contract_prompt_1 = require("../../specs/runtime/spec-contract-prompt");
7
7
  // ─── Single source of truth for the in-app operator agent prompts ─────────────
8
8
  // OPERATOR_INSTRUCTIONS is the CANONICAL prompt written to CLAUDE.md,
9
9
  // AGENTS.md, and GEMINI.md in ~/.specrails/agent-cwd/. Kimi's native
@@ -18,7 +18,7 @@ const spec_contract_prompt_1 = require("./spec-contract-prompt");
18
18
  // interpolation, no live data) so Anthropic prompt caching hits on turns 2+.
19
19
  // Dynamic per-turn state (pinned project, permission level, provider) rides the
20
20
  // user-turn prefix in AgentChatManager — never add it here.
21
- const feature_flags_1 = require("./feature-flags");
21
+ const feature_flags_1 = require("../../../feature-flags");
22
22
  exports.OPERATOR_INSTRUCTIONS = `# Specrails Operator Agent
23
23
 
24
24
  You are the Specrails operator: an agent embedded INSIDE the Specrails Desktop
@@ -562,8 +562,8 @@ summary later.
562
562
  (usually Freestyle for implementation-only work, SDD Quick (OpenSpec) when
563
563
  OpenSpec artifacts are in play).
564
564
  - **SDD Quick (OpenSpec) launch path.** It requires a local ticket. Update or
565
- create the ticket first so it describes the follow-up. If the target OpenSpec
566
- change is known, store it in ticket metadata as \`openspecChangeName\` before
565
+ create the ticket first (for an existing spec, attach an addendum instead of rewriting it). If the target OpenSpec
566
+ change is known AND there are no open addenda, store it in ticket metadata as \`openspecChangeName\` before
567
567
  launch. Then propose \`specrails_rails(launch, mode:'loop',
568
568
  loopId:'factory:sdd-quick-openspec')\`. The confirmation prompt must include
569
569
  the ticket, OpenSpec target (or "new/unknown"), launch strategy, engine/model,
@@ -603,15 +603,15 @@ summary later.
603
603
  relaunch strategy even when \`main\` did not have that spec before the PR. If
604
604
  asked why a strategy was chosen, verify against active PR contents before
605
605
  answering.
606
- - **"Change something about work already delivered" = a REVISION launch.** When
606
+ - **"Change something about work already delivered" = a Quick SDD continuation.** When
607
607
  the user asks for a modification to a delivery that is awaiting their decision
608
608
  (any non-terminal card: \`on_review\`, \`pr_draft\`, \`pr_ready\`, \`no_changes\`,
609
609
  \`implementation_failed\`), call \`specrails_rails(launch)\` with
610
610
  \`revisionOfDeliveryId\` = that card's \`prDeliveryId\` and \`revisionNote\` = what
611
611
  they asked for, in their own words. Do NOT tell them to publish, discard or
612
612
  merge first, and do NOT relaunch the ordinary implement/batch mode: a revision
613
- runs a dedicated Architect-less loop that builds on the existing branch instead
614
- of re-planning from scratch. The rail must still carry exactly that delivery's
613
+ always uses Quick SDD: pass \`loopId:'factory:sdd-quick-openspec'\` alongside the delivery
614
+ target. The server preserves the branch while running Quick SDD. The rail must still carry exactly that delivery's
615
615
  specs; a mismatch returns \`invalid_revision_target\`, which means re-check the
616
616
  rail's spec assignment rather than retrying blindly.
617
617
  - **"Resolve / fix the review comments on this PR" = a FOLLOW-UP launch, never a
@@ -652,6 +652,16 @@ summary later.
652
652
  \`dismiss_addendum\` withdraws it. Prefer an addendum + normal launch over a
653
653
  \`revisionNote\` when the change should stay attached to the spec for later
654
654
  runs; the two combine freely.
655
+ **Addenda on an existing branch/open PR ALWAYS run Quick SDD**, never Revision.
656
+ Use \`loopId:'factory:sdd-quick-openspec'\`; the server routes addenda there
657
+ even if the rail stores a different loop. A same-spec pending delivery is
658
+ continued without requiring publish/discard first. Keep the exact ticket and
659
+ repository scope; pass the delivery id when known. The runtime assigns a NEW
660
+ run-specific OpenSpec change for the frozen addenda, so NEVER edit
661
+ \`openspecChangeName\` to work around an old proposal. Every phase receives
662
+ the full addendum text and verification must report each id with files/tests.
663
+ Do not claim an addendum is applied merely because the run archived a change;
664
+ inspect its per-addendum evidence and report missing/partial/blocked work.
655
665
  - \`pr_decision_pending\` therefore only blocks a launch that is neither a
656
666
  revision nor a continuation of an open PR head. A delivery that failed
657
667
  BEFORE any work was prepared (a busy branch, a refused worktree) is closed
@@ -22,9 +22,9 @@
22
22
  // model can emit on the user's behalf. It is a command word, not sentiment.
23
23
  //
24
24
  // The frame validation below MIRRORS the client parser in
25
- // client/src/components/agent-chat/agent-problem-frame.ts — the same
25
+ // client/src/features/missions/components/agent-problem-frame.ts — the same
26
26
  // server/client parser pair the spec-draft protocol already maintains between
27
- // server/spec-draft-parser.ts and client/src/lib/spec-draft.ts.
27
+ // server/modules/specs/runtime/spec-draft-parser.ts and client/src/features/specs/lib/spec-draft.ts.
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.SPEC_FRAMING_MARKER_KIND = exports.FRAMING_RESTORE_TOKEN = exports.FRAMING_WAIVER_TOKEN = void 0;
30
30
  exports.hasValidProblemFrame = hasValidProblemFrame;
@@ -32,9 +32,9 @@ exports.evaluateFramingState = evaluateFramingState;
32
32
  exports.framingRefusalMessage = framingRefusalMessage;
33
33
  exports.checkSpecFraming = checkSpecFraming;
34
34
  exports.recordSpecCommitted = recordSpecCommitted;
35
- const agent_store_1 = require("./agent-store");
35
+ const agent_store_1 = require("../../agents/runtime/agent-store");
36
36
  const agent_fence_promotion_1 = require("./agent-fence-promotion");
37
- const registry_1 = require("./providers/registry");
37
+ const registry_1 = require("../../../providers/registry");
38
38
  /** User-typed command word that switches framing off for the conversation. */
39
39
  exports.FRAMING_WAIVER_TOKEN = '#noframe';
40
40
  /** User-typed command word that switches it back on. */
@@ -8,7 +8,7 @@ exports.acknowledgeAgentSteering = acknowledgeAgentSteering;
8
8
  exports.acknowledgeAgentInputsRead = acknowledgeAgentInputsRead;
9
9
  exports.runWithAgentSteering = runWithAgentSteering;
10
10
  const crypto_1 = require("crypto");
11
- const agent_capability_1 = require("./mcp/agent-capability");
11
+ const agent_capability_1 = require("../../../mcp/agent-capability");
12
12
  // Database OBJECT identity isolates independent desktop instances even when a
13
13
  // conversation id matches. A turn is keyed by its verified capability, never
14
14
  // a client-supplied conversation/project header or an MCP transport session.
@@ -23,7 +23,7 @@ exports.postRunCard = postRunCard;
23
23
  exports.settleRunCard = settleRunCard;
24
24
  exports.notifyMissionRunFailure = notifyMissionRunFailure;
25
25
  const agent_chat_registry_1 = require("./agent-chat-registry");
26
- const feature_flags_1 = require("./feature-flags");
26
+ const feature_flags_1 = require("../../../feature-flags");
27
27
  const agent_failure_briefing_1 = require("./agent-failure-briefing");
28
28
  exports.RUN_CARD_ID_PREFIX = 'run:';
29
29
  function runCardId(runId) { return `${exports.RUN_CARD_ID_PREFIX}${runId}`; }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerProjectSettingsHttp = registerProjectSettingsHttp;
4
+ const __1 = require("..");
5
+ /** Inbound adapter: translate HTTP into use cases and domain errors into HTTP. */
6
+ function registerProjectSettingsHttp(router, serviceForRequest) {
7
+ router.get('/:projectId/settings', (req, res) => {
8
+ res.json(serviceForRequest(req).getSettings());
9
+ });
10
+ router.patch('/:projectId/settings', (req, res) => {
11
+ try {
12
+ const settings = serviceForRequest(req).updateSettings(req.body);
13
+ res.json({ ok: true, settings });
14
+ }
15
+ catch (error) {
16
+ if (error instanceof __1.SettingsValidationError) {
17
+ res.status(400).json({ error: error.message });
18
+ return;
19
+ }
20
+ console.error('[project-router] settings patch error:', error);
21
+ res.status(500).json({ error: 'Failed to update settings' });
22
+ }
23
+ });
24
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProjectSettings = getProjectSettings;
4
+ exports.getFreestylePrePrompt = getFreestylePrePrompt;
5
+ exports.updateProjectSettings = updateProjectSettings;
6
+ exports.getQuickContractRefineLast = getQuickContractRefineLast;
7
+ exports.hasQuickContractRefineLast = hasQuickContractRefineLast;
8
+ exports.setQuickContractRefineLast = setQuickContractRefineLast;
9
+ exports.createSqliteProjectSettingsRepository = createSqliteProjectSettingsRepository;
10
+ const domain_1 = require("../domain");
11
+ function parseWorktreeEnvPassthrough(raw) {
12
+ if (!raw)
13
+ return [];
14
+ try {
15
+ return (0, domain_1.normalizeWorktreeEnvPassthrough)(JSON.parse(raw));
16
+ }
17
+ catch {
18
+ return [];
19
+ }
20
+ }
21
+ function getProjectSettings(db) {
22
+ // Read the settings as one snapshot instead of preparing six separate queries.
23
+ const rows = db.prepare(`
24
+ SELECT key, value FROM queue_state WHERE key IN (
25
+ 'config.pipeline_telemetry_enabled', 'config.orchestrator_model',
26
+ 'config.pre_prompt', 'config.freestyle_pre_prompt',
27
+ 'config.integration_branch', 'config.worktree_env_passthrough'
28
+ )
29
+ `).all();
30
+ const settings = new Map(rows.map(row => [row.key, row]));
31
+ const telemetryRow = settings.get('config.pipeline_telemetry_enabled');
32
+ const modelRow = settings.get('config.orchestrator_model');
33
+ const prePromptRow = settings.get('config.pre_prompt');
34
+ const freestylePrePromptRow = settings.get('config.freestyle_pre_prompt');
35
+ const integrationBranchRow = settings.get('config.integration_branch');
36
+ const worktreeEnvPassthroughRow = settings.get('config.worktree_env_passthrough');
37
+ return {
38
+ pipelineTelemetryEnabled: telemetryRow?.value !== 'false',
39
+ orchestratorModel: modelRow?.value ?? 'sonnet',
40
+ orchestratorModelExplicit: modelRow?.value !== undefined,
41
+ prePrompt: prePromptRow?.value ?? '',
42
+ freestylePrePrompt: freestylePrePromptRow?.value ?? '',
43
+ integrationBranch: integrationBranchRow?.value ?? '',
44
+ worktreeEnvPassthrough: parseWorktreeEnvPassthrough(worktreeEnvPassthroughRow?.value),
45
+ };
46
+ }
47
+ /** Resolve the effective Freestyle pre-prompt: the per-project override when
48
+ * set, otherwise the built-in default. */
49
+ function getFreestylePrePrompt(db) {
50
+ const override = getProjectSettings(db).freestylePrePrompt.trim();
51
+ return override || domain_1.DEFAULT_FREESTYLE_PRE_PROMPT;
52
+ }
53
+ function updateProjectSettings(db, patch) {
54
+ if (patch.pipelineTelemetryEnabled !== undefined) {
55
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.pipeline_telemetry_enabled', ?)`).run(patch.pipelineTelemetryEnabled ? 'true' : 'false');
56
+ }
57
+ if (patch.orchestratorModel !== undefined) {
58
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.orchestrator_model', ?)`).run(patch.orchestratorModel);
59
+ }
60
+ if (patch.prePrompt !== undefined) {
61
+ if (patch.prePrompt.trim() === '') {
62
+ db.prepare(`DELETE FROM queue_state WHERE key = 'config.pre_prompt'`).run();
63
+ }
64
+ else {
65
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.pre_prompt', ?)`).run(patch.prePrompt);
66
+ }
67
+ }
68
+ if (patch.freestylePrePrompt !== undefined) {
69
+ if (patch.freestylePrePrompt.trim() === '') {
70
+ db.prepare(`DELETE FROM queue_state WHERE key = 'config.freestyle_pre_prompt'`).run();
71
+ }
72
+ else {
73
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.freestyle_pre_prompt', ?)`).run(patch.freestylePrePrompt);
74
+ }
75
+ }
76
+ if (patch.integrationBranch !== undefined) {
77
+ if (patch.integrationBranch.trim() === '') {
78
+ db.prepare(`DELETE FROM queue_state WHERE key = 'config.integration_branch'`).run();
79
+ }
80
+ else {
81
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.integration_branch', ?)`).run(patch.integrationBranch.trim());
82
+ }
83
+ }
84
+ if (patch.worktreeEnvPassthrough !== undefined) {
85
+ const names = (0, domain_1.normalizeWorktreeEnvPassthrough)(patch.worktreeEnvPassthrough);
86
+ if (names.length === 0) {
87
+ db.prepare(`DELETE FROM queue_state WHERE key = 'config.worktree_env_passthrough'`).run();
88
+ }
89
+ else {
90
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.worktree_env_passthrough', ?)`).run(JSON.stringify(names));
91
+ }
92
+ }
93
+ }
94
+ // ─── Explore Spec acceleration ────────────────────────────────────────────────
95
+ /**
96
+ * Per-project last-used value for the Quick mode Contract Refine toggle in
97
+ * the Add Spec modal. Default `false` when never set.
98
+ */
99
+ function getQuickContractRefineLast(db) {
100
+ const row = db.prepare(`SELECT value FROM queue_state WHERE key = 'config.add_spec_quick_contract_refine_last'`).get();
101
+ return row?.value === 'true';
102
+ }
103
+ function hasQuickContractRefineLast(db) {
104
+ const row = db.prepare(`SELECT 1 FROM queue_state WHERE key = 'config.add_spec_quick_contract_refine_last'`).get();
105
+ return !!row;
106
+ }
107
+ function setQuickContractRefineLast(db, enabled) {
108
+ db.prepare(`INSERT OR REPLACE INTO queue_state (key, value) VALUES ('config.add_spec_quick_contract_refine_last', ?)`).run(enabled ? 'true' : 'false');
109
+ }
110
+ /** Bind one project's connection. No global registry or cross-project cache. */
111
+ function createSqliteProjectSettingsRepository(db) {
112
+ const update = db.transaction((patch) => {
113
+ updateProjectSettings(db, patch);
114
+ return getProjectSettings(db);
115
+ });
116
+ return {
117
+ read: () => getProjectSettings(db),
118
+ update,
119
+ };
120
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProjectSettingsService = createProjectSettingsService;
4
+ const domain_1 = require("./domain");
5
+ /** Application use cases. No HTTP request, SQL connection or global registry. */
6
+ function createProjectSettingsService(repository) {
7
+ return {
8
+ getSettings: () => repository.read(),
9
+ updateSettings: (input) => repository.update((0, domain_1.parseProjectSettingsPatch)(input)),
10
+ };
11
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsValidationError = exports.WORKTREE_ENV_NAME_RE = exports.DEFAULT_FREESTYLE_PRE_PROMPT = void 0;
4
+ exports.normalizeWorktreeEnvPassthrough = normalizeWorktreeEnvPassthrough;
5
+ exports.parseProjectSettingsPatch = parseProjectSettingsPatch;
6
+ const git_branch_name_1 = require("../../shared/git-branch-name");
7
+ /**
8
+ * Default pre-prompt used by provider-capable Freestyle rails when the project
9
+ * has no per-project override. Freestyle skips the OpenSpec pipeline entirely:
10
+ * it hands the selected autonomous provider the spec text plus this instruction and lets it work
11
+ * autonomously end-to-end.
12
+ */
13
+ exports.DEFAULT_FREESTYLE_PRE_PROMPT = [
14
+ 'You are operating in FREESTYLE: fully autonomous, end-to-end implementation.',
15
+ 'Implement the following spec COMPLETELY in this repository. You have full access to the codebase and tools.',
16
+ 'Work independently until the feature is done: write the code, the tests, update docs as needed, and make sure everything builds and the test suite passes.',
17
+ 'Do NOT follow any structured architect/developer/reviewer pipeline — use your own judgement and the repo conventions.',
18
+ 'Never ask for confirmation; there is no human to answer. Choose the recommended option and proceed.',
19
+ 'Run every command in the FOREGROUND and wait for it to finish — never background a command (no run_in_background, no trailing `&`): your reply ends the step and anything still running is killed with its output lost.',
20
+ ].join('\n');
21
+ exports.WORKTREE_ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
22
+ const WORKTREE_ENV_MAX_NAMES = 64;
23
+ const WORKTREE_ENV_MAX_NAME_LENGTH = 128;
24
+ function normalizeWorktreeEnvPassthrough(value) {
25
+ if (!Array.isArray(value))
26
+ throw new Error('worktreeEnvPassthrough must be an array of environment variable names');
27
+ const out = [];
28
+ const seen = new Set();
29
+ for (const raw of value) {
30
+ if (typeof raw !== 'string')
31
+ throw new Error('worktreeEnvPassthrough entries must be strings');
32
+ const name = raw.trim();
33
+ if (!name)
34
+ continue;
35
+ if (name.length > WORKTREE_ENV_MAX_NAME_LENGTH)
36
+ throw new Error(`environment variable name is too long: ${name.slice(0, 24)}...`);
37
+ if (!exports.WORKTREE_ENV_NAME_RE.test(name))
38
+ throw new Error(`invalid environment variable name: ${name}`);
39
+ if (seen.has(name))
40
+ continue;
41
+ seen.add(name);
42
+ out.push(name);
43
+ if (out.length > WORKTREE_ENV_MAX_NAMES)
44
+ throw new Error(`worktreeEnvPassthrough can contain at most ${WORKTREE_ENV_MAX_NAMES} names`);
45
+ }
46
+ return out;
47
+ }
48
+ class SettingsValidationError extends Error {
49
+ constructor(message) {
50
+ super(message);
51
+ this.name = 'SettingsValidationError';
52
+ }
53
+ }
54
+ exports.SettingsValidationError = SettingsValidationError;
55
+ /** Preserve the existing PATCH contract, including boolean coercion and ignored
56
+ * unknown fields. Validate the whole input before the repository can write. */
57
+ function parseProjectSettingsPatch(input) {
58
+ const values = (input ?? {});
59
+ const patch = {};
60
+ if (values.pipelineTelemetryEnabled !== undefined) {
61
+ patch.pipelineTelemetryEnabled = Boolean(values.pipelineTelemetryEnabled);
62
+ }
63
+ const validModels = ['sonnet', 'opus', 'haiku'];
64
+ if (values.orchestratorModel !== undefined) {
65
+ if (typeof values.orchestratorModel !== 'string' || !validModels.includes(values.orchestratorModel)) {
66
+ throw new SettingsValidationError(`orchestratorModel must be one of: ${validModels.join(', ')}`);
67
+ }
68
+ patch.orchestratorModel = values.orchestratorModel;
69
+ }
70
+ for (const key of ['prePrompt', 'freestylePrePrompt']) {
71
+ if (values[key] !== undefined) {
72
+ if (typeof values[key] !== 'string')
73
+ throw new SettingsValidationError(`${key} must be a string`);
74
+ patch[key] = values[key];
75
+ }
76
+ }
77
+ if (values.worktreeEnvPassthrough !== undefined) {
78
+ try {
79
+ patch.worktreeEnvPassthrough = normalizeWorktreeEnvPassthrough(values.worktreeEnvPassthrough);
80
+ }
81
+ catch (error) {
82
+ throw new SettingsValidationError(error instanceof Error ? error.message : 'invalid worktreeEnvPassthrough');
83
+ }
84
+ }
85
+ if (values.integrationBranch !== undefined) {
86
+ const branch = values.integrationBranch;
87
+ if (typeof branch !== 'string')
88
+ throw new SettingsValidationError('integrationBranch must be a string');
89
+ if (branch.trim() !== '' && !(0, git_branch_name_1.isValidBranchName)(branch)) {
90
+ throw new SettingsValidationError('integrationBranch is not a valid branch name');
91
+ }
92
+ patch.integrationBranch = branch;
93
+ }
94
+ return patch;
95
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsValidationError = exports.normalizeWorktreeEnvPassthrough = exports.WORKTREE_ENV_NAME_RE = exports.DEFAULT_FREESTYLE_PRE_PROMPT = exports.createProjectSettingsService = void 0;
4
+ // Public application API. Infrastructure adapters are wired only at composition roots.
5
+ var application_1 = require("./application");
6
+ Object.defineProperty(exports, "createProjectSettingsService", { enumerable: true, get: function () { return application_1.createProjectSettingsService; } });
7
+ var domain_1 = require("./domain");
8
+ Object.defineProperty(exports, "DEFAULT_FREESTYLE_PRE_PROMPT", { enumerable: true, get: function () { return domain_1.DEFAULT_FREESTYLE_PRE_PROMPT; } });
9
+ Object.defineProperty(exports, "WORKTREE_ENV_NAME_RE", { enumerable: true, get: function () { return domain_1.WORKTREE_ENV_NAME_RE; } });
10
+ Object.defineProperty(exports, "normalizeWorktreeEnvPassthrough", { enumerable: true, get: function () { return domain_1.normalizeWorktreeEnvPassthrough; } });
11
+ Object.defineProperty(exports, "SettingsValidationError", { enumerable: true, get: function () { return domain_1.SettingsValidationError; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -23,19 +23,19 @@ exports.runContractRefineForQuick = runContractRefineForQuick;
23
23
  const node_crypto_1 = require("node:crypto");
24
24
  const node_readline_1 = require("node:readline");
25
25
  const tree_kill_1 = __importDefault(require("tree-kill"));
26
- const cli_prompt_1 = require("./util/cli-prompt");
27
- const spawn_lifecycle_1 = require("./spawn-lifecycle");
28
- const providers_1 = require("./providers");
29
- const runtime_1 = require("./providers/runtime");
30
- const explore_contract_refine_1 = require("./explore-contract-refine");
31
- const db_1 = require("./db");
32
- const explore_cwd_manager_1 = require("./explore-cwd-manager");
33
- const ai_invocations_1 = require("./ai-invocations");
34
- const result_event_1 = require("./result-event");
26
+ const cli_prompt_1 = require("../../../util/cli-prompt");
27
+ const spawn_lifecycle_1 = require("../../execution/runtime/spawn-lifecycle");
28
+ const providers_1 = require("../../../providers");
29
+ const runtime_1 = require("../../../providers/runtime");
30
+ const explore_contract_refine_1 = require("../../conversations/runtime/explore-contract-refine");
31
+ const db_1 = require("../../../db");
32
+ const explore_cwd_manager_1 = require("../../conversations/runtime/explore-cwd-manager");
33
+ const ai_invocations_1 = require("../../accounting/runtime/ai-invocations");
34
+ const result_event_1 = require("../../accounting/runtime/result-event");
35
35
  const ticket_store_1 = require("./ticket-store");
36
- const workspace_resolution_1 = require("./workspace-resolution");
37
- const process_admission_1 = require("./process-admission");
38
- const transient_children_1 = require("./transient-children");
36
+ const workspace_resolution_1 = require("../../../workspace-resolution");
37
+ const process_admission_1 = require("../../../process-admission");
38
+ const transient_children_1 = require("../../../transient-children");
39
39
  const REFINE_TIMEOUT_MS = 60_000;
40
40
  const CLAUDE_MISSING_SESSION_DIAGNOSTIC = 'No conversation found with session ID';
41
41
  /**
@@ -7,14 +7,14 @@ exports.ProposalManager = void 0;
7
7
  const readline_1 = require("readline");
8
8
  const crypto_1 = require("crypto");
9
9
  const tree_kill_1 = __importDefault(require("tree-kill"));
10
- const cli_prompt_1 = require("./util/cli-prompt");
11
- const db_1 = require("./db");
12
- const command_resolver_1 = require("./command-resolver");
13
- const providers_1 = require("./providers");
14
- const runtime_1 = require("./providers/runtime");
15
- const result_event_1 = require("./result-event");
16
- const ai_invocations_1 = require("./ai-invocations");
17
- const workspace_resolution_1 = require("./workspace-resolution");
10
+ const cli_prompt_1 = require("../../../util/cli-prompt");
11
+ const db_1 = require("../../../db");
12
+ const command_resolver_1 = require("../../../command-resolver");
13
+ const providers_1 = require("../../../providers");
14
+ const runtime_1 = require("../../../providers/runtime");
15
+ const result_event_1 = require("../../accounting/runtime/result-event");
16
+ const ai_invocations_1 = require("../../accounting/runtime/ai-invocations");
17
+ const workspace_resolution_1 = require("../../../workspace-resolution");
18
18
  // ─── ProposalManager ──────────────────────────────────────────────────────────
19
19
  class ProposalManager {
20
20
  _broadcast;