@apralabs/apra-fleet 0.4.2 → 0.4.4

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 (997) hide show
  1. package/README.md +103 -34
  2. package/dist/agents/backlog-groomer.md +87 -14
  3. package/dist/agents/ci-watcher.md +35 -9
  4. package/dist/agents/deployer.md +63 -11
  5. package/dist/agents/doer.md +99 -41
  6. package/dist/agents/harvester.md +47 -27
  7. package/dist/agents/integ-test-runner.md +38 -10
  8. package/dist/agents/kb-reconciler.md +37 -7
  9. package/dist/agents/plan-reviewer.md +145 -32
  10. package/dist/agents/planner.md +180 -69
  11. package/dist/agents/regression-test-runner.md +98 -64
  12. package/dist/agents/reviewer.md +117 -45
  13. package/dist/agents/schemas/backlog-groomer-output.json +1 -1
  14. package/dist/agents/schemas/doer-output.json +32 -0
  15. package/dist/agents/schemas/harvester-input.json +1 -5
  16. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  17. package/dist/agents/schemas/planner-output.json +1 -1
  18. package/dist/agents/schemas/regression-test-runner-output.json +41 -7
  19. package/dist/agents/schemas/reviewer-output.json +62 -3
  20. package/dist/cli/agent-transform.d.ts +90 -2
  21. package/dist/cli/agent-transform.js +310 -20
  22. package/dist/cli/auth.d.ts +1 -0
  23. package/dist/cli/auth.js +66 -17
  24. package/dist/cli/beads-install.d.ts +35 -0
  25. package/dist/cli/beads-install.js +125 -0
  26. package/dist/cli/beads-pin.d.ts +5 -0
  27. package/dist/cli/beads-pin.js +27 -0
  28. package/dist/cli/call.d.ts +27 -0
  29. package/dist/cli/call.js +177 -0
  30. package/dist/cli/config.d.ts +31 -6
  31. package/dist/cli/config.js +113 -36
  32. package/dist/cli/dolt-install.d.ts +18 -2
  33. package/dist/cli/dolt-install.js +46 -15
  34. package/dist/cli/fleet-se-guard.d.ts +51 -0
  35. package/dist/cli/fleet-se-guard.js +215 -0
  36. package/dist/cli/install-guard.d.ts +54 -0
  37. package/dist/cli/install-guard.js +132 -4
  38. package/dist/cli/install.d.ts +100 -11
  39. package/dist/cli/install.js +864 -139
  40. package/dist/cli/kb-commit.d.ts +2 -1
  41. package/dist/cli/kb-commit.js +1 -1
  42. package/dist/cli/kb-directives.js +2 -1
  43. package/dist/cli/kb-import.d.ts +2 -1
  44. package/dist/cli/kb-import.js +1 -1
  45. package/dist/cli/register-member.js +26 -5
  46. package/dist/cli/remove-member.d.ts +4 -0
  47. package/dist/cli/remove-member.js +63 -0
  48. package/dist/cli/secret.js +9 -0
  49. package/dist/cli/start.js +59 -4
  50. package/dist/cli/status.d.ts +3 -0
  51. package/dist/cli/status.js +45 -12
  52. package/dist/cli/stop.js +64 -9
  53. package/dist/cli/uninstall.js +101 -15
  54. package/dist/cli/update.js +33 -2
  55. package/dist/cli/watch.js +1 -1
  56. package/dist/cli/workflow.js +3 -2
  57. package/dist/commands/kb-server.d.ts +3 -0
  58. package/dist/commands/kb-server.js +52 -5
  59. package/dist/hub-service/http-server.d.ts +5 -1
  60. package/dist/hub-service/http-server.js +55 -5
  61. package/dist/index.js +158 -11
  62. package/dist/os/child-env-bound.d.ts +77 -0
  63. package/dist/os/child-env-bound.js +171 -0
  64. package/dist/os/linux.d.ts +13 -2
  65. package/dist/os/linux.js +75 -16
  66. package/dist/os/macos.d.ts +1 -1
  67. package/dist/os/macos.js +2 -11
  68. package/dist/os/os-commands.d.ts +78 -4
  69. package/dist/os/windows-gitbash.d.ts +6 -0
  70. package/dist/os/windows-gitbash.js +32 -3
  71. package/dist/os/windows-wrapper.d.ts +0 -4
  72. package/dist/os/windows-wrapper.js +2 -1
  73. package/dist/os/windows.d.ts +11 -2
  74. package/dist/os/windows.js +121 -32
  75. package/dist/paths.d.ts +21 -0
  76. package/dist/paths.js +35 -0
  77. package/dist/providers/agy.d.ts +120 -7
  78. package/dist/providers/agy.js +741 -86
  79. package/dist/providers/claude-permission-denial.d.ts +7 -0
  80. package/dist/providers/claude-permission-denial.js +137 -0
  81. package/dist/providers/claude.d.ts +132 -6
  82. package/dist/providers/claude.js +644 -48
  83. package/dist/providers/codex.d.ts +4 -2
  84. package/dist/providers/codex.js +23 -2
  85. package/dist/providers/copilot.d.ts +4 -2
  86. package/dist/providers/copilot.js +24 -2
  87. package/dist/providers/none.d.ts +4 -2
  88. package/dist/providers/none.js +17 -2
  89. package/dist/providers/opencode.d.ts +12 -2
  90. package/dist/providers/opencode.js +135 -54
  91. package/dist/providers/provider.d.ts +368 -35
  92. package/dist/providers/provider.js +219 -2
  93. package/dist/services/agent-provisioner.d.ts +29 -0
  94. package/dist/services/agent-provisioner.js +107 -0
  95. package/dist/services/agent-shadow.d.ts +96 -0
  96. package/dist/services/agent-shadow.js +479 -0
  97. package/dist/services/agy-project.d.ts +103 -0
  98. package/dist/services/agy-project.js +354 -0
  99. package/dist/services/auth-socket.d.ts +25 -0
  100. package/dist/services/auth-socket.js +72 -27
  101. package/dist/services/auth-web.js +2 -2
  102. package/dist/services/budget-awareness.d.ts +11 -11
  103. package/dist/services/budget-awareness.js +15 -3
  104. package/dist/services/claude-local-scope-mcp.d.ts +19 -0
  105. package/dist/services/claude-local-scope-mcp.js +91 -0
  106. package/dist/services/cloud/aws.js +2 -1
  107. package/dist/services/cloud/lifecycle.js +52 -6
  108. package/dist/services/cloud/task-wrapper.d.ts +0 -9
  109. package/dist/services/cloud/task-wrapper.js +15 -6
  110. package/dist/services/credential-cleanup.js +35 -17
  111. package/dist/services/event-loop-watchdog.d.ts +32 -0
  112. package/dist/services/event-loop-watchdog.js +140 -0
  113. package/dist/services/exit-drain.d.ts +44 -0
  114. package/dist/services/exit-drain.js +52 -0
  115. package/dist/services/github-app.js +32 -4
  116. package/dist/services/http-transport.d.ts +50 -1
  117. package/dist/services/http-transport.js +238 -25
  118. package/dist/services/in-flight-agents.d.ts +2 -0
  119. package/dist/services/in-flight-agents.js +4 -0
  120. package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
  121. package/dist/services/knowledge/bible-basis-filter.js +134 -0
  122. package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
  123. package/dist/services/knowledge/bible-blob-id.js +113 -0
  124. package/dist/services/knowledge/bible-import.d.ts +65 -0
  125. package/dist/services/knowledge/bible-import.js +211 -0
  126. package/dist/services/knowledge/file-hash.d.ts +31 -0
  127. package/dist/services/knowledge/file-hash.js +153 -23
  128. package/dist/services/knowledge/http-provider.d.ts +4 -3
  129. package/dist/services/knowledge/http-provider.js +17 -5
  130. package/dist/services/knowledge/kb-config.d.ts +42 -0
  131. package/dist/services/knowledge/kb-config.js +54 -0
  132. package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
  133. package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
  134. package/dist/services/knowledge/kb-providers.d.ts +11 -1
  135. package/dist/services/knowledge/kb-providers.js +199 -17
  136. package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
  137. package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
  138. package/dist/services/knowledge/kb-scopes.d.ts +14 -0
  139. package/dist/services/knowledge/kb-scopes.js +47 -0
  140. package/dist/services/knowledge/kb-self.d.ts +91 -0
  141. package/dist/services/knowledge/kb-self.js +198 -0
  142. package/dist/services/knowledge/member-bible-view.d.ts +21 -0
  143. package/dist/services/knowledge/member-bible-view.js +194 -0
  144. package/dist/services/knowledge/pre-init.js +1 -0
  145. package/dist/services/knowledge/project-slug.js +2 -2
  146. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  147. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  148. package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
  149. package/dist/services/knowledge/sqlite-provider.js +303 -41
  150. package/dist/services/knowledge/types.d.ts +45 -2
  151. package/dist/services/member-access-secret.d.ts +70 -0
  152. package/dist/services/member-access-secret.js +195 -0
  153. package/dist/services/member-call-counts.d.ts +24 -0
  154. package/dist/services/member-call-counts.js +58 -0
  155. package/dist/services/member-config-io.d.ts +192 -0
  156. package/dist/services/member-config-io.js +443 -0
  157. package/dist/services/member-fleet-install.d.ts +710 -0
  158. package/dist/services/member-fleet-install.js +1895 -0
  159. package/dist/services/member-secret-env.d.ts +42 -0
  160. package/dist/services/member-secret-env.js +68 -0
  161. package/dist/services/member-tool-allowlist.d.ts +49 -0
  162. package/dist/services/member-tool-allowlist.js +111 -0
  163. package/dist/services/model-pricing.d.ts +19 -0
  164. package/dist/services/model-pricing.js +60 -10
  165. package/dist/services/port-holder.d.ts +86 -0
  166. package/dist/services/port-holder.js +351 -0
  167. package/dist/services/preflight-check.js +2 -0
  168. package/dist/services/registry.d.ts +13 -2
  169. package/dist/services/registry.js +27 -1
  170. package/dist/services/relay-strategy.d.ts +2 -0
  171. package/dist/services/relay-strategy.js +8 -0
  172. package/dist/services/secret-token.d.ts +38 -0
  173. package/dist/services/secret-token.js +51 -0
  174. package/dist/services/server-lifecycle.d.ts +26 -0
  175. package/dist/services/server-lifecycle.js +85 -0
  176. package/dist/services/service-manager/index.d.ts +7 -1
  177. package/dist/services/service-manager/index.js +17 -4
  178. package/dist/services/service-manager/linux.d.ts +1 -1
  179. package/dist/services/service-manager/linux.js +15 -7
  180. package/dist/services/service-manager/macos.d.ts +11 -1
  181. package/dist/services/service-manager/macos.js +45 -7
  182. package/dist/services/service-manager/service-path.d.ts +24 -0
  183. package/dist/services/service-manager/service-path.js +55 -0
  184. package/dist/services/service-manager/types.d.ts +39 -2
  185. package/dist/services/service-manager/types.js +29 -0
  186. package/dist/services/service-manager/windows.d.ts +194 -3
  187. package/dist/services/service-manager/windows.js +705 -30
  188. package/dist/services/service-notice.d.ts +14 -0
  189. package/dist/services/service-notice.js +62 -0
  190. package/dist/services/service-start-guard.d.ts +20 -0
  191. package/dist/services/service-start-guard.js +86 -0
  192. package/dist/services/session-cost.d.ts +24 -0
  193. package/dist/services/session-cost.js +105 -0
  194. package/dist/services/session-mcp-config.d.ts +83 -0
  195. package/dist/services/session-mcp-config.js +211 -0
  196. package/dist/services/sftp.d.ts +34 -0
  197. package/dist/services/sftp.js +304 -76
  198. package/dist/services/shell-probe.d.ts +0 -24
  199. package/dist/services/shell-probe.js +28 -3
  200. package/dist/services/singleton.d.ts +68 -2
  201. package/dist/services/singleton.js +168 -11
  202. package/dist/services/sprint-coordination.js +9 -3
  203. package/dist/services/ssh.d.ts +27 -0
  204. package/dist/services/ssh.js +287 -40
  205. package/dist/services/stall/find-log-file.js +12 -5
  206. package/dist/services/stall/index.d.ts +1 -1
  207. package/dist/services/stall/read-log-tail.d.ts +23 -0
  208. package/dist/services/stall/read-log-tail.js +53 -12
  209. package/dist/services/stall/stall-detector.d.ts +78 -5
  210. package/dist/services/stall/stall-detector.js +296 -39
  211. package/dist/services/stall/stall-poller.d.ts +16 -0
  212. package/dist/services/stall/stall-poller.js +50 -6
  213. package/dist/services/stopped-marker.d.ts +16 -0
  214. package/dist/services/stopped-marker.js +55 -0
  215. package/dist/services/strategy.d.ts +33 -1
  216. package/dist/services/strategy.js +165 -19
  217. package/dist/services/substitution-engine.js +2 -2
  218. package/dist/services/supervisor-service-cleanup.d.ts +52 -0
  219. package/dist/services/supervisor-service-cleanup.js +332 -0
  220. package/dist/services/tool-registry.d.ts +8 -1
  221. package/dist/services/tool-registry.js +164 -61
  222. package/dist/services/tool-scope.d.ts +58 -0
  223. package/dist/services/tool-scope.js +99 -0
  224. package/dist/services/vcs/azure-devops.d.ts +66 -1
  225. package/dist/services/vcs/azure-devops.js +192 -21
  226. package/dist/services/vcs/types.d.ts +1 -1
  227. package/dist/services/watch/project-resolver.js +1 -0
  228. package/dist/skills/auto-sprint-args/SKILL.md +2 -2
  229. package/dist/skills/fleet-sprint-cli/SKILL.md +48 -6
  230. package/dist/skills/pm/SKILL.md +4 -4
  231. package/dist/skills/pm/cost.md +0 -3
  232. package/dist/skills/pm/fleet-addendum.md +2 -2
  233. package/dist/skills/pm/index.md +4 -2
  234. package/dist/skills/pm/kb-reconcile.md +29 -14
  235. package/dist/skills/pm/kb-review.md +1 -0
  236. package/dist/skills/pm/sprint.md +5 -5
  237. package/dist/tools/check-status.d.ts +60 -9
  238. package/dist/tools/check-status.js +211 -52
  239. package/dist/tools/child-id-allocator.d.ts +2 -2
  240. package/dist/tools/child-id-allocator.js +1 -1
  241. package/dist/tools/code-index-heal.d.ts +8 -0
  242. package/dist/tools/code-index-heal.js +21 -0
  243. package/dist/tools/code-index-state.d.ts +45 -0
  244. package/dist/tools/code-index-state.js +115 -0
  245. package/dist/tools/code-intelligence-codebase-memory.js +6 -33
  246. package/dist/tools/code-intelligence-freshness.js +1 -1
  247. package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
  248. package/dist/tools/code-intelligence-gitnexus.js +333 -57
  249. package/dist/tools/code-intelligence-kb-enrich.js +7 -6
  250. package/dist/tools/code-intelligence-readiness.d.ts +99 -0
  251. package/dist/tools/code-intelligence-readiness.js +206 -0
  252. package/dist/tools/code-intelligence-reindex.d.ts +195 -0
  253. package/dist/tools/code-intelligence-reindex.js +530 -50
  254. package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
  255. package/dist/tools/code-intelligence-telemetry.js +12 -3
  256. package/dist/tools/code-intelligence.d.ts +81 -31
  257. package/dist/tools/code-intelligence.js +156 -52
  258. package/dist/tools/compose-permissions.d.ts +63 -2
  259. package/dist/tools/compose-permissions.js +673 -72
  260. package/dist/tools/credential-store-set.js +1 -1
  261. package/dist/tools/execute-command.d.ts +11 -0
  262. package/dist/tools/execute-command.js +111 -32
  263. package/dist/tools/execute-prompt.d.ts +69 -12
  264. package/dist/tools/execute-prompt.js +1610 -895
  265. package/dist/tools/kb-bible-commit.d.ts +65 -0
  266. package/dist/tools/kb-bible-commit.js +239 -0
  267. package/dist/tools/kb-capture.d.ts +15 -11
  268. package/dist/tools/kb-capture.js +71 -16
  269. package/dist/tools/kb-context.d.ts +27 -7
  270. package/dist/tools/kb-context.js +60 -9
  271. package/dist/tools/kb-export.d.ts +98 -9
  272. package/dist/tools/kb-export.js +230 -92
  273. package/dist/tools/kb-feedback.d.ts +13 -9
  274. package/dist/tools/kb-feedback.js +16 -8
  275. package/dist/tools/kb-freshness-sweep.d.ts +11 -7
  276. package/dist/tools/kb-freshness-sweep.js +10 -8
  277. package/dist/tools/kb-harvest.d.ts +11 -7
  278. package/dist/tools/kb-harvest.js +7 -7
  279. package/dist/tools/kb-import.d.ts +26 -10
  280. package/dist/tools/kb-import.js +170 -159
  281. package/dist/tools/kb-invalidate.d.ts +17 -10
  282. package/dist/tools/kb-invalidate.js +41 -8
  283. package/dist/tools/kb-list.d.ts +14 -10
  284. package/dist/tools/kb-list.js +33 -11
  285. package/dist/tools/kb-promote.d.ts +11 -7
  286. package/dist/tools/kb-promote.js +14 -8
  287. package/dist/tools/kb-query.d.ts +21 -11
  288. package/dist/tools/kb-query.js +76 -13
  289. package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
  290. package/dist/tools/kb-reconcile-prefilter.js +13 -9
  291. package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
  292. package/dist/tools/kb-resolve-contradiction.js +10 -8
  293. package/dist/tools/kb-session-prime.d.ts +14 -7
  294. package/dist/tools/kb-session-prime.js +44 -44
  295. package/dist/tools/kb-setup.d.ts +11 -4
  296. package/dist/tools/kb-setup.js +146 -27
  297. package/dist/tools/kb-stats.d.ts +11 -10
  298. package/dist/tools/kb-stats.js +84 -82
  299. package/dist/tools/list-members.d.ts +2 -2
  300. package/dist/tools/list-members.js +6 -2
  301. package/dist/tools/member-detail.d.ts +5 -2
  302. package/dist/tools/member-detail.js +105 -17
  303. package/dist/tools/member-reservation.d.ts +60 -3
  304. package/dist/tools/member-reservation.js +61 -20
  305. package/dist/tools/provision-auth.d.ts +118 -1
  306. package/dist/tools/provision-auth.js +402 -92
  307. package/dist/tools/provision-vcs-auth.d.ts +93 -3
  308. package/dist/tools/provision-vcs-auth.js +209 -49
  309. package/dist/tools/receive-files.js +3 -1
  310. package/dist/tools/register-member.d.ts +44 -15
  311. package/dist/tools/register-member.js +175 -70
  312. package/dist/tools/remove-member.js +118 -15
  313. package/dist/tools/send-email.d.ts +2 -2
  314. package/dist/tools/send-files.js +6 -4
  315. package/dist/tools/session-stats.d.ts +17 -0
  316. package/dist/tools/session-stats.js +27 -0
  317. package/dist/tools/setup-git-app.js +11 -7
  318. package/dist/tools/shutdown-server.d.ts +2 -0
  319. package/dist/tools/shutdown-server.js +28 -1
  320. package/dist/tools/update-agent-cli.d.ts +19 -0
  321. package/dist/tools/update-agent-cli.js +59 -2
  322. package/dist/tools/update-member.d.ts +23 -17
  323. package/dist/tools/update-member.js +181 -18
  324. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  325. package/dist/tools/vcs-credential-exec.js +203 -0
  326. package/dist/types.d.ts +111 -1
  327. package/dist/utils/agent-helpers.js +2 -0
  328. package/dist/utils/auth-env.d.ts +15 -4
  329. package/dist/utils/auth-env.js +52 -23
  330. package/dist/utils/find-on-path.d.ts +37 -0
  331. package/dist/utils/find-on-path.js +85 -0
  332. package/dist/utils/log-helpers.d.ts +37 -0
  333. package/dist/utils/log-helpers.js +108 -22
  334. package/dist/utils/owner-only-fs.d.ts +56 -0
  335. package/dist/utils/owner-only-fs.js +98 -0
  336. package/dist/utils/process-utils.d.ts +28 -0
  337. package/dist/utils/process-utils.js +68 -0
  338. package/dist/utils/prompt-errors.js +11 -2
  339. package/dist/utils/session-caller.d.ts +4 -2
  340. package/dist/utils/session-caller.js +3 -2
  341. package/dist/utils/shell-escape.d.ts +58 -3
  342. package/dist/utils/shell-escape.js +91 -5
  343. package/dist/utils/ssh-error-messages.js +3 -0
  344. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  345. package/dist/utils/vcs-provider-detect.js +109 -0
  346. package/dist/utils/workspace-trust.d.ts +26 -0
  347. package/dist/utils/workspace-trust.js +91 -1
  348. package/dist/workflows/auto-sprint.js +397 -56
  349. package/package.json +15 -10
  350. package/packages/apra-fleet-client/package.json +2 -2
  351. package/packages/apra-fleet-client/src/client/api.mjs +864 -31
  352. package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
  353. package/packages/apra-fleet-client/src/client/client.mjs +9 -0
  354. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  355. package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
  356. package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
  357. package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
  358. package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
  359. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  360. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +87 -14
  361. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +35 -9
  362. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +63 -11
  363. package/packages/apra-fleet-se/apra-pm/agents/doer.md +99 -41
  364. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +47 -27
  365. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +38 -10
  366. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +37 -7
  367. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +145 -32
  368. package/packages/apra-fleet-se/apra-pm/agents/planner.md +180 -69
  369. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +98 -64
  370. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -45
  371. package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
  372. package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
  373. package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
  374. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  375. package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
  376. package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
  377. package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
  378. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +4 -4
  379. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
  380. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
  381. package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
  382. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
  383. package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
  384. package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
  385. package/packages/apra-fleet-se/bin/cli.mjs +326 -48
  386. package/packages/apra-fleet-se/bin/serve.mjs +218 -11
  387. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +517 -0
  388. package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
  389. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +646 -0
  390. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +825 -0
  391. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +217 -0
  392. package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
  393. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +745 -0
  394. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +447 -0
  395. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  396. package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
  397. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +20 -0
  398. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +121 -15
  399. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +539 -0
  400. package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
  401. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +204 -0
  402. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1310 -0
  403. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  404. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +53 -15
  405. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +281 -0
  406. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
  407. package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
  408. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  409. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  410. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1327 -44
  411. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +470 -4
  412. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  413. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  414. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  415. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +747 -0
  416. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +543 -0
  417. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +613 -0
  418. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  419. package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
  420. package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
  421. package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
  422. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1684 -0
  423. package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
  424. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  425. package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
  426. package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
  427. package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
  428. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +699 -0
  429. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +802 -0
  430. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  431. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  432. package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
  433. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  434. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +218 -0
  435. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +869 -0
  436. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +295 -0
  437. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +466 -0
  438. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +212 -0
  439. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  440. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +395 -0
  441. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +345 -0
  442. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +264 -0
  443. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +179 -0
  444. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +230 -0
  445. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +365 -0
  446. package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
  447. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +617 -0
  448. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1434 -0
  449. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  450. package/packages/apra-fleet-se/fleet-sprint/runner.js +2289 -9928
  451. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
  452. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +147 -12
  453. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
  454. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +347 -0
  455. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +48 -6
  456. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +98 -25
  457. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +590 -0
  458. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +339 -0
  459. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +185 -0
  460. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  461. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +218 -0
  462. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1445 -0
  463. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +284 -23
  464. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +170 -21
  465. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  466. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +354 -0
  467. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +189 -16
  468. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +9 -4
  469. package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
  470. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +311 -22
  471. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  472. package/packages/apra-fleet-se/package.json +2 -2
  473. package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
  474. package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
  475. package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
  476. package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
  477. package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
  478. package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
  479. package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
  480. package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
  481. package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
  482. package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
  483. package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
  484. package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
  485. package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
  486. package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
  487. package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
  488. package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
  489. package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
  490. package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
  491. package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
  492. package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
  493. package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
  494. package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
  495. package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
  496. package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
  497. package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
  498. package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
  499. package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
  500. package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
  501. package/packages/apra-fleet-workflow/package.json +1 -1
  502. package/packages/apra-fleet-workflow/src/viewer/index.mjs +81 -15
  503. package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
  504. package/packages/apra-fleet-workflow/src/workflow/index.mjs +118 -10
  505. package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
  506. package/skills/fleet/SKILL.md +8 -8
  507. package/skills/fleet/auth-azdevops.md +14 -3
  508. package/skills/fleet/auth-bitbucket.md +2 -2
  509. package/skills/fleet/auth-github.md +5 -4
  510. package/skills/fleet/onboarding.md +3 -3
  511. package/skills/fleet/permissions.md +14 -1
  512. package/skills/fleet/profiles/node.json +1 -1
  513. package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
  514. package/skills/fleet/troubleshooting.md +3 -3
  515. package/version.json +1 -1
  516. package/dist/cli/agent-transform.d.ts.map +0 -1
  517. package/dist/cli/agent-transform.js.map +0 -1
  518. package/dist/cli/auth.d.ts.map +0 -1
  519. package/dist/cli/auth.js.map +0 -1
  520. package/dist/cli/config.d.ts.map +0 -1
  521. package/dist/cli/config.js.map +0 -1
  522. package/dist/cli/dolt-install.d.ts.map +0 -1
  523. package/dist/cli/dolt-install.js.map +0 -1
  524. package/dist/cli/install-guard.d.ts.map +0 -1
  525. package/dist/cli/install-guard.js.map +0 -1
  526. package/dist/cli/install.d.ts.map +0 -1
  527. package/dist/cli/install.js.map +0 -1
  528. package/dist/cli/join.d.ts.map +0 -1
  529. package/dist/cli/join.js.map +0 -1
  530. package/dist/cli/kb-commit.d.ts.map +0 -1
  531. package/dist/cli/kb-commit.js.map +0 -1
  532. package/dist/cli/kb-directives.d.ts.map +0 -1
  533. package/dist/cli/kb-directives.js.map +0 -1
  534. package/dist/cli/kb-import.d.ts.map +0 -1
  535. package/dist/cli/kb-import.js.map +0 -1
  536. package/dist/cli/register-member.d.ts.map +0 -1
  537. package/dist/cli/register-member.js.map +0 -1
  538. package/dist/cli/restart.d.ts.map +0 -1
  539. package/dist/cli/restart.js.map +0 -1
  540. package/dist/cli/secret.d.ts.map +0 -1
  541. package/dist/cli/secret.js.map +0 -1
  542. package/dist/cli/spoke.d.ts.map +0 -1
  543. package/dist/cli/spoke.js.map +0 -1
  544. package/dist/cli/start.d.ts.map +0 -1
  545. package/dist/cli/start.js.map +0 -1
  546. package/dist/cli/status.d.ts.map +0 -1
  547. package/dist/cli/status.js.map +0 -1
  548. package/dist/cli/stop.d.ts.map +0 -1
  549. package/dist/cli/stop.js.map +0 -1
  550. package/dist/cli/uninstall.d.ts.map +0 -1
  551. package/dist/cli/uninstall.js.map +0 -1
  552. package/dist/cli/update.d.ts.map +0 -1
  553. package/dist/cli/update.js.map +0 -1
  554. package/dist/cli/watch.d.ts.map +0 -1
  555. package/dist/cli/watch.js.map +0 -1
  556. package/dist/cli/workflow-assets.d.ts.map +0 -1
  557. package/dist/cli/workflow-assets.js.map +0 -1
  558. package/dist/cli/workflow.d.ts.map +0 -1
  559. package/dist/cli/workflow.js.map +0 -1
  560. package/dist/commands/kb-server.d.ts.map +0 -1
  561. package/dist/commands/kb-server.js.map +0 -1
  562. package/dist/delivery-mode.d.ts.map +0 -1
  563. package/dist/delivery-mode.js.map +0 -1
  564. package/dist/hub-service/activity.d.ts.map +0 -1
  565. package/dist/hub-service/activity.js.map +0 -1
  566. package/dist/hub-service/audit-log.d.ts.map +0 -1
  567. package/dist/hub-service/audit-log.js.map +0 -1
  568. package/dist/hub-service/db/pool.d.ts.map +0 -1
  569. package/dist/hub-service/db/pool.js.map +0 -1
  570. package/dist/hub-service/enrollment.d.ts.map +0 -1
  571. package/dist/hub-service/enrollment.js.map +0 -1
  572. package/dist/hub-service/envelope-routes.d.ts.map +0 -1
  573. package/dist/hub-service/envelope-routes.js.map +0 -1
  574. package/dist/hub-service/handlers/installers.d.ts.map +0 -1
  575. package/dist/hub-service/handlers/installers.js.map +0 -1
  576. package/dist/hub-service/http-server.d.ts.map +0 -1
  577. package/dist/hub-service/http-server.js.map +0 -1
  578. package/dist/hub-service/hub-jwt.d.ts.map +0 -1
  579. package/dist/hub-service/hub-jwt.js.map +0 -1
  580. package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
  581. package/dist/hub-service/jwt-revocation.js.map +0 -1
  582. package/dist/hub-service/machines.d.ts.map +0 -1
  583. package/dist/hub-service/machines.js.map +0 -1
  584. package/dist/hub-service/main.d.ts.map +0 -1
  585. package/dist/hub-service/main.js.map +0 -1
  586. package/dist/hub-service/member-tokens.d.ts.map +0 -1
  587. package/dist/hub-service/member-tokens.js.map +0 -1
  588. package/dist/hub-service/member-view.d.ts.map +0 -1
  589. package/dist/hub-service/member-view.js.map +0 -1
  590. package/dist/hub-service/members.d.ts.map +0 -1
  591. package/dist/hub-service/members.js.map +0 -1
  592. package/dist/hub-service/presence.d.ts.map +0 -1
  593. package/dist/hub-service/presence.js.map +0 -1
  594. package/dist/hub-service/project-view.d.ts.map +0 -1
  595. package/dist/hub-service/project-view.js.map +0 -1
  596. package/dist/hub-service/projects.d.ts.map +0 -1
  597. package/dist/hub-service/projects.js.map +0 -1
  598. package/dist/hub-service/relay-queue.d.ts.map +0 -1
  599. package/dist/hub-service/relay-queue.js.map +0 -1
  600. package/dist/hub-service/session-jwt.d.ts.map +0 -1
  601. package/dist/hub-service/session-jwt.js.map +0 -1
  602. package/dist/hub-service/usage.d.ts.map +0 -1
  603. package/dist/hub-service/usage.js.map +0 -1
  604. package/dist/hub-service/users.d.ts.map +0 -1
  605. package/dist/hub-service/users.js.map +0 -1
  606. package/dist/hub-service/workspaces.d.ts.map +0 -1
  607. package/dist/hub-service/workspaces.js.map +0 -1
  608. package/dist/index.d.ts.map +0 -1
  609. package/dist/index.js.map +0 -1
  610. package/dist/onboarding/text.d.ts.map +0 -1
  611. package/dist/onboarding/text.js.map +0 -1
  612. package/dist/os/git-bash-candidates.d.ts.map +0 -1
  613. package/dist/os/git-bash-candidates.js.map +0 -1
  614. package/dist/os/index.d.ts.map +0 -1
  615. package/dist/os/index.js.map +0 -1
  616. package/dist/os/linux.d.ts.map +0 -1
  617. package/dist/os/linux.js.map +0 -1
  618. package/dist/os/macos.d.ts.map +0 -1
  619. package/dist/os/macos.js.map +0 -1
  620. package/dist/os/os-commands.d.ts.map +0 -1
  621. package/dist/os/os-commands.js.map +0 -1
  622. package/dist/os/windows-gitbash.d.ts.map +0 -1
  623. package/dist/os/windows-gitbash.js.map +0 -1
  624. package/dist/os/windows-wrapper.d.ts.map +0 -1
  625. package/dist/os/windows-wrapper.js.map +0 -1
  626. package/dist/os/windows.d.ts.map +0 -1
  627. package/dist/os/windows.js.map +0 -1
  628. package/dist/paths.d.ts.map +0 -1
  629. package/dist/paths.js.map +0 -1
  630. package/dist/providers/agy.d.ts.map +0 -1
  631. package/dist/providers/agy.js.map +0 -1
  632. package/dist/providers/claude.d.ts.map +0 -1
  633. package/dist/providers/claude.js.map +0 -1
  634. package/dist/providers/codex.d.ts.map +0 -1
  635. package/dist/providers/codex.js.map +0 -1
  636. package/dist/providers/copilot.d.ts.map +0 -1
  637. package/dist/providers/copilot.js.map +0 -1
  638. package/dist/providers/email/headers.d.ts.map +0 -1
  639. package/dist/providers/email/headers.js.map +0 -1
  640. package/dist/providers/email/index.d.ts.map +0 -1
  641. package/dist/providers/email/index.js.map +0 -1
  642. package/dist/providers/email/provider.d.ts.map +0 -1
  643. package/dist/providers/email/provider.js.map +0 -1
  644. package/dist/providers/email/sendgrid.d.ts.map +0 -1
  645. package/dist/providers/email/sendgrid.js.map +0 -1
  646. package/dist/providers/email/smtp.d.ts.map +0 -1
  647. package/dist/providers/email/smtp.js.map +0 -1
  648. package/dist/providers/index.d.ts.map +0 -1
  649. package/dist/providers/index.js.map +0 -1
  650. package/dist/providers/none.d.ts.map +0 -1
  651. package/dist/providers/none.js.map +0 -1
  652. package/dist/providers/opencode.d.ts.map +0 -1
  653. package/dist/providers/opencode.js.map +0 -1
  654. package/dist/providers/provider.d.ts.map +0 -1
  655. package/dist/providers/provider.js.map +0 -1
  656. package/dist/services/agent-provisioner.d.ts.map +0 -1
  657. package/dist/services/agent-provisioner.js.map +0 -1
  658. package/dist/services/auth-socket.d.ts.map +0 -1
  659. package/dist/services/auth-socket.js.map +0 -1
  660. package/dist/services/auth-web.d.ts.map +0 -1
  661. package/dist/services/auth-web.js.map +0 -1
  662. package/dist/services/budget-awareness.d.ts.map +0 -1
  663. package/dist/services/budget-awareness.js.map +0 -1
  664. package/dist/services/cloud/activity.d.ts.map +0 -1
  665. package/dist/services/cloud/activity.js.map +0 -1
  666. package/dist/services/cloud/aws.d.ts.map +0 -1
  667. package/dist/services/cloud/aws.js.map +0 -1
  668. package/dist/services/cloud/cost.d.ts.map +0 -1
  669. package/dist/services/cloud/cost.js.map +0 -1
  670. package/dist/services/cloud/idle-manager.d.ts.map +0 -1
  671. package/dist/services/cloud/idle-manager.js.map +0 -1
  672. package/dist/services/cloud/lifecycle.d.ts.map +0 -1
  673. package/dist/services/cloud/lifecycle.js.map +0 -1
  674. package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
  675. package/dist/services/cloud/task-wrapper.js.map +0 -1
  676. package/dist/services/cloud/types.d.ts.map +0 -1
  677. package/dist/services/cloud/types.js.map +0 -1
  678. package/dist/services/cloud-sync.d.ts.map +0 -1
  679. package/dist/services/cloud-sync.js.map +0 -1
  680. package/dist/services/context-admission.d.ts.map +0 -1
  681. package/dist/services/context-admission.js.map +0 -1
  682. package/dist/services/credential-cleanup.d.ts.map +0 -1
  683. package/dist/services/credential-cleanup.js.map +0 -1
  684. package/dist/services/credential-store.d.ts.map +0 -1
  685. package/dist/services/credential-store.js.map +0 -1
  686. package/dist/services/event-bus.d.ts.map +0 -1
  687. package/dist/services/event-bus.js.map +0 -1
  688. package/dist/services/file-chunker.d.ts.map +0 -1
  689. package/dist/services/file-chunker.js.map +0 -1
  690. package/dist/services/file-transfer-relay.d.ts.map +0 -1
  691. package/dist/services/file-transfer-relay.js.map +0 -1
  692. package/dist/services/file-transfer.d.ts.map +0 -1
  693. package/dist/services/file-transfer.js.map +0 -1
  694. package/dist/services/git-config.d.ts.map +0 -1
  695. package/dist/services/git-config.js.map +0 -1
  696. package/dist/services/github-app.d.ts.map +0 -1
  697. package/dist/services/github-app.js.map +0 -1
  698. package/dist/services/http-transport.d.ts.map +0 -1
  699. package/dist/services/http-transport.js.map +0 -1
  700. package/dist/services/hub-client.d.ts.map +0 -1
  701. package/dist/services/hub-client.js.map +0 -1
  702. package/dist/services/icons.d.ts.map +0 -1
  703. package/dist/services/icons.js.map +0 -1
  704. package/dist/services/jwt.d.ts.map +0 -1
  705. package/dist/services/jwt.js.map +0 -1
  706. package/dist/services/knowledge/audn.d.ts.map +0 -1
  707. package/dist/services/knowledge/audn.js.map +0 -1
  708. package/dist/services/knowledge/file-hash.d.ts.map +0 -1
  709. package/dist/services/knowledge/file-hash.js.map +0 -1
  710. package/dist/services/knowledge/http-provider.d.ts.map +0 -1
  711. package/dist/services/knowledge/http-provider.js.map +0 -1
  712. package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
  713. package/dist/services/knowledge/kb-providers.js.map +0 -1
  714. package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
  715. package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
  716. package/dist/services/knowledge/kb-scope-input.js +0 -11
  717. package/dist/services/knowledge/kb-scope-input.js.map +0 -1
  718. package/dist/services/knowledge/kb-service.d.ts.map +0 -1
  719. package/dist/services/knowledge/kb-service.js.map +0 -1
  720. package/dist/services/knowledge/path-validation.d.ts.map +0 -1
  721. package/dist/services/knowledge/path-validation.js.map +0 -1
  722. package/dist/services/knowledge/pre-init.d.ts.map +0 -1
  723. package/dist/services/knowledge/pre-init.js.map +0 -1
  724. package/dist/services/knowledge/project-slug.d.ts.map +0 -1
  725. package/dist/services/knowledge/project-slug.js.map +0 -1
  726. package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
  727. package/dist/services/knowledge/sqlite-provider.js.map +0 -1
  728. package/dist/services/knowledge/types.d.ts.map +0 -1
  729. package/dist/services/knowledge/types.js.map +0 -1
  730. package/dist/services/known-hosts.d.ts.map +0 -1
  731. package/dist/services/known-hosts.js.map +0 -1
  732. package/dist/services/known-sessions.d.ts.map +0 -1
  733. package/dist/services/known-sessions.js.map +0 -1
  734. package/dist/services/member-home.d.ts.map +0 -1
  735. package/dist/services/member-home.js.map +0 -1
  736. package/dist/services/member-remote-url.d.ts.map +0 -1
  737. package/dist/services/member-remote-url.js.map +0 -1
  738. package/dist/services/model-pricing.d.ts.map +0 -1
  739. package/dist/services/model-pricing.js.map +0 -1
  740. package/dist/services/onboarding.d.ts.map +0 -1
  741. package/dist/services/onboarding.js.map +0 -1
  742. package/dist/services/orphan-recovery.d.ts.map +0 -1
  743. package/dist/services/orphan-recovery.js.map +0 -1
  744. package/dist/services/pending-responses.d.ts.map +0 -1
  745. package/dist/services/pending-responses.js.map +0 -1
  746. package/dist/services/preflight-check.d.ts.map +0 -1
  747. package/dist/services/preflight-check.js.map +0 -1
  748. package/dist/services/registry.d.ts.map +0 -1
  749. package/dist/services/registry.js.map +0 -1
  750. package/dist/services/relay-context.d.ts.map +0 -1
  751. package/dist/services/relay-context.js.map +0 -1
  752. package/dist/services/relay-executor.d.ts.map +0 -1
  753. package/dist/services/relay-executor.js.map +0 -1
  754. package/dist/services/relay-request.d.ts.map +0 -1
  755. package/dist/services/relay-request.js.map +0 -1
  756. package/dist/services/relay-strategy.d.ts.map +0 -1
  757. package/dist/services/relay-strategy.js.map +0 -1
  758. package/dist/services/service-manager/index.d.ts.map +0 -1
  759. package/dist/services/service-manager/index.js.map +0 -1
  760. package/dist/services/service-manager/linux.d.ts.map +0 -1
  761. package/dist/services/service-manager/linux.js.map +0 -1
  762. package/dist/services/service-manager/macos.d.ts.map +0 -1
  763. package/dist/services/service-manager/macos.js.map +0 -1
  764. package/dist/services/service-manager/types.d.ts.map +0 -1
  765. package/dist/services/service-manager/types.js.map +0 -1
  766. package/dist/services/service-manager/windows.d.ts.map +0 -1
  767. package/dist/services/service-manager/windows.js.map +0 -1
  768. package/dist/services/session-registry.d.ts.map +0 -1
  769. package/dist/services/session-registry.js.map +0 -1
  770. package/dist/services/sftp.d.ts.map +0 -1
  771. package/dist/services/sftp.js.map +0 -1
  772. package/dist/services/shell-probe.d.ts.map +0 -1
  773. package/dist/services/shell-probe.js.map +0 -1
  774. package/dist/services/singleton.d.ts.map +0 -1
  775. package/dist/services/singleton.js.map +0 -1
  776. package/dist/services/sprint-coordination.d.ts.map +0 -1
  777. package/dist/services/sprint-coordination.js.map +0 -1
  778. package/dist/services/ssh.d.ts.map +0 -1
  779. package/dist/services/ssh.js.map +0 -1
  780. package/dist/services/stall/find-log-file.d.ts.map +0 -1
  781. package/dist/services/stall/find-log-file.js.map +0 -1
  782. package/dist/services/stall/index.d.ts.map +0 -1
  783. package/dist/services/stall/index.js.map +0 -1
  784. package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
  785. package/dist/services/stall/log-path-resolver.js.map +0 -1
  786. package/dist/services/stall/read-log-tail.d.ts.map +0 -1
  787. package/dist/services/stall/read-log-tail.js.map +0 -1
  788. package/dist/services/stall/stall-detector.d.ts.map +0 -1
  789. package/dist/services/stall/stall-detector.js.map +0 -1
  790. package/dist/services/stall/stall-poller.d.ts.map +0 -1
  791. package/dist/services/stall/stall-poller.js.map +0 -1
  792. package/dist/services/stall/time-utils.d.ts.map +0 -1
  793. package/dist/services/stall/time-utils.js.map +0 -1
  794. package/dist/services/statusline.d.ts.map +0 -1
  795. package/dist/services/statusline.js.map +0 -1
  796. package/dist/services/strategy.d.ts.map +0 -1
  797. package/dist/services/strategy.js.map +0 -1
  798. package/dist/services/substitution-engine.d.ts.map +0 -1
  799. package/dist/services/substitution-engine.js.map +0 -1
  800. package/dist/services/task-cleanup.d.ts.map +0 -1
  801. package/dist/services/task-cleanup.js.map +0 -1
  802. package/dist/services/token-issuer.d.ts.map +0 -1
  803. package/dist/services/token-issuer.js.map +0 -1
  804. package/dist/services/tool-registry.d.ts.map +0 -1
  805. package/dist/services/tool-registry.js.map +0 -1
  806. package/dist/services/update-check.d.ts.map +0 -1
  807. package/dist/services/update-check.js.map +0 -1
  808. package/dist/services/user-config.d.ts.map +0 -1
  809. package/dist/services/user-config.js.map +0 -1
  810. package/dist/services/vcs/azure-devops.d.ts.map +0 -1
  811. package/dist/services/vcs/azure-devops.js.map +0 -1
  812. package/dist/services/vcs/bitbucket.d.ts.map +0 -1
  813. package/dist/services/vcs/bitbucket.js.map +0 -1
  814. package/dist/services/vcs/constants.d.ts.map +0 -1
  815. package/dist/services/vcs/constants.js.map +0 -1
  816. package/dist/services/vcs/github.d.ts.map +0 -1
  817. package/dist/services/vcs/github.js.map +0 -1
  818. package/dist/services/vcs/types.d.ts.map +0 -1
  819. package/dist/services/vcs/types.js.map +0 -1
  820. package/dist/services/version-check.d.ts.map +0 -1
  821. package/dist/services/version-check.js.map +0 -1
  822. package/dist/services/watch/fleet-log.d.ts.map +0 -1
  823. package/dist/services/watch/fleet-log.js.map +0 -1
  824. package/dist/services/watch/project-resolver.d.ts.map +0 -1
  825. package/dist/services/watch/project-resolver.js.map +0 -1
  826. package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
  827. package/dist/services/watch/transcript-formatter.js.map +0 -1
  828. package/dist/smoke-test.d.ts.map +0 -1
  829. package/dist/smoke-test.js.map +0 -1
  830. package/dist/tools/check-status.d.ts.map +0 -1
  831. package/dist/tools/check-status.js.map +0 -1
  832. package/dist/tools/child-id-allocator.d.ts.map +0 -1
  833. package/dist/tools/child-id-allocator.js.map +0 -1
  834. package/dist/tools/cloud-control.d.ts.map +0 -1
  835. package/dist/tools/cloud-control.js.map +0 -1
  836. package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
  837. package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
  838. package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
  839. package/dist/tools/code-intelligence-freshness.js.map +0 -1
  840. package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
  841. package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
  842. package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
  843. package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
  844. package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
  845. package/dist/tools/code-intelligence-reindex.js.map +0 -1
  846. package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
  847. package/dist/tools/code-intelligence-telemetry.js.map +0 -1
  848. package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
  849. package/dist/tools/code-intelligence-tests.js.map +0 -1
  850. package/dist/tools/code-intelligence.d.ts.map +0 -1
  851. package/dist/tools/code-intelligence.js.map +0 -1
  852. package/dist/tools/compose-permissions.d.ts.map +0 -1
  853. package/dist/tools/compose-permissions.js.map +0 -1
  854. package/dist/tools/credential-store-delete.d.ts.map +0 -1
  855. package/dist/tools/credential-store-delete.js.map +0 -1
  856. package/dist/tools/credential-store-list.d.ts.map +0 -1
  857. package/dist/tools/credential-store-list.js.map +0 -1
  858. package/dist/tools/credential-store-set.d.ts.map +0 -1
  859. package/dist/tools/credential-store-set.js.map +0 -1
  860. package/dist/tools/credential-store-update.d.ts.map +0 -1
  861. package/dist/tools/credential-store-update.js.map +0 -1
  862. package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
  863. package/dist/tools/dolt-push-mutex.js.map +0 -1
  864. package/dist/tools/execute-command.d.ts.map +0 -1
  865. package/dist/tools/execute-command.js.map +0 -1
  866. package/dist/tools/execute-prompt.d.ts.map +0 -1
  867. package/dist/tools/execute-prompt.js.map +0 -1
  868. package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
  869. package/dist/tools/get-member-model-pricing.js.map +0 -1
  870. package/dist/tools/kb-capture.d.ts.map +0 -1
  871. package/dist/tools/kb-capture.js.map +0 -1
  872. package/dist/tools/kb-context.d.ts.map +0 -1
  873. package/dist/tools/kb-context.js.map +0 -1
  874. package/dist/tools/kb-export.d.ts.map +0 -1
  875. package/dist/tools/kb-export.js.map +0 -1
  876. package/dist/tools/kb-feedback.d.ts.map +0 -1
  877. package/dist/tools/kb-feedback.js.map +0 -1
  878. package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
  879. package/dist/tools/kb-freshness-sweep.js.map +0 -1
  880. package/dist/tools/kb-harvest.d.ts.map +0 -1
  881. package/dist/tools/kb-harvest.js.map +0 -1
  882. package/dist/tools/kb-import.d.ts.map +0 -1
  883. package/dist/tools/kb-import.js.map +0 -1
  884. package/dist/tools/kb-invalidate.d.ts.map +0 -1
  885. package/dist/tools/kb-invalidate.js.map +0 -1
  886. package/dist/tools/kb-list.d.ts.map +0 -1
  887. package/dist/tools/kb-list.js.map +0 -1
  888. package/dist/tools/kb-promote.d.ts.map +0 -1
  889. package/dist/tools/kb-promote.js.map +0 -1
  890. package/dist/tools/kb-query.d.ts.map +0 -1
  891. package/dist/tools/kb-query.js.map +0 -1
  892. package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
  893. package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
  894. package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
  895. package/dist/tools/kb-resolve-contradiction.js.map +0 -1
  896. package/dist/tools/kb-session-prime.d.ts.map +0 -1
  897. package/dist/tools/kb-session-prime.js.map +0 -1
  898. package/dist/tools/kb-setup.d.ts.map +0 -1
  899. package/dist/tools/kb-setup.js.map +0 -1
  900. package/dist/tools/kb-stats.d.ts.map +0 -1
  901. package/dist/tools/kb-stats.js.map +0 -1
  902. package/dist/tools/list-members.d.ts.map +0 -1
  903. package/dist/tools/list-members.js.map +0 -1
  904. package/dist/tools/member-detail.d.ts.map +0 -1
  905. package/dist/tools/member-detail.js.map +0 -1
  906. package/dist/tools/member-reservation.d.ts.map +0 -1
  907. package/dist/tools/member-reservation.js.map +0 -1
  908. package/dist/tools/monitor-task.d.ts.map +0 -1
  909. package/dist/tools/monitor-task.js.map +0 -1
  910. package/dist/tools/provision-auth.d.ts.map +0 -1
  911. package/dist/tools/provision-auth.js.map +0 -1
  912. package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
  913. package/dist/tools/provision-vcs-auth.js.map +0 -1
  914. package/dist/tools/receive-files.d.ts.map +0 -1
  915. package/dist/tools/receive-files.js.map +0 -1
  916. package/dist/tools/register-member.d.ts.map +0 -1
  917. package/dist/tools/register-member.js.map +0 -1
  918. package/dist/tools/remove-member.d.ts.map +0 -1
  919. package/dist/tools/remove-member.js.map +0 -1
  920. package/dist/tools/report-status.d.ts.map +0 -1
  921. package/dist/tools/report-status.js.map +0 -1
  922. package/dist/tools/respond-to-message.d.ts.map +0 -1
  923. package/dist/tools/respond-to-message.js.map +0 -1
  924. package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
  925. package/dist/tools/revoke-vcs-auth.js.map +0 -1
  926. package/dist/tools/send-email.d.ts.map +0 -1
  927. package/dist/tools/send-email.js.map +0 -1
  928. package/dist/tools/send-files.d.ts.map +0 -1
  929. package/dist/tools/send-files.js.map +0 -1
  930. package/dist/tools/send-message.d.ts.map +0 -1
  931. package/dist/tools/send-message.js.map +0 -1
  932. package/dist/tools/setup-git-app.d.ts.map +0 -1
  933. package/dist/tools/setup-git-app.js.map +0 -1
  934. package/dist/tools/setup-ssh-key.d.ts.map +0 -1
  935. package/dist/tools/setup-ssh-key.js.map +0 -1
  936. package/dist/tools/shutdown-server.d.ts.map +0 -1
  937. package/dist/tools/shutdown-server.js.map +0 -1
  938. package/dist/tools/stop-prompt.d.ts.map +0 -1
  939. package/dist/tools/stop-prompt.js.map +0 -1
  940. package/dist/tools/update-agent-cli.d.ts.map +0 -1
  941. package/dist/tools/update-agent-cli.js.map +0 -1
  942. package/dist/tools/update-member.d.ts.map +0 -1
  943. package/dist/tools/update-member.js.map +0 -1
  944. package/dist/tools/version.d.ts.map +0 -1
  945. package/dist/tools/version.js.map +0 -1
  946. package/dist/types.d.ts.map +0 -1
  947. package/dist/types.js.map +0 -1
  948. package/dist/utils/agent-helpers.d.ts.map +0 -1
  949. package/dist/utils/agent-helpers.js.map +0 -1
  950. package/dist/utils/ansi.d.ts.map +0 -1
  951. package/dist/utils/ansi.js.map +0 -1
  952. package/dist/utils/auth-env.d.ts.map +0 -1
  953. package/dist/utils/auth-env.js.map +0 -1
  954. package/dist/utils/collect-secret.d.ts.map +0 -1
  955. package/dist/utils/collect-secret.js.map +0 -1
  956. package/dist/utils/credential-validation.d.ts.map +0 -1
  957. package/dist/utils/credential-validation.js.map +0 -1
  958. package/dist/utils/crypto.d.ts.map +0 -1
  959. package/dist/utils/crypto.js.map +0 -1
  960. package/dist/utils/deep-merge.d.ts.map +0 -1
  961. package/dist/utils/deep-merge.js.map +0 -1
  962. package/dist/utils/file-permissions.d.ts.map +0 -1
  963. package/dist/utils/file-permissions.js.map +0 -1
  964. package/dist/utils/gpu-parser.d.ts.map +0 -1
  965. package/dist/utils/gpu-parser.js.map +0 -1
  966. package/dist/utils/log-helpers.d.ts.map +0 -1
  967. package/dist/utils/log-helpers.js.map +0 -1
  968. package/dist/utils/oob-timeout.d.ts.map +0 -1
  969. package/dist/utils/oob-timeout.js.map +0 -1
  970. package/dist/utils/opencode-model-validation.d.ts.map +0 -1
  971. package/dist/utils/opencode-model-validation.js.map +0 -1
  972. package/dist/utils/pid-helpers.d.ts.map +0 -1
  973. package/dist/utils/pid-helpers.js.map +0 -1
  974. package/dist/utils/platform.d.ts.map +0 -1
  975. package/dist/utils/platform.js.map +0 -1
  976. package/dist/utils/process-utils.d.ts.map +0 -1
  977. package/dist/utils/process-utils.js.map +0 -1
  978. package/dist/utils/prompt-errors.d.ts.map +0 -1
  979. package/dist/utils/prompt-errors.js.map +0 -1
  980. package/dist/utils/resolve-member.d.ts.map +0 -1
  981. package/dist/utils/resolve-member.js.map +0 -1
  982. package/dist/utils/secure-input.d.ts.map +0 -1
  983. package/dist/utils/secure-input.js.map +0 -1
  984. package/dist/utils/session-caller.d.ts.map +0 -1
  985. package/dist/utils/session-caller.js.map +0 -1
  986. package/dist/utils/shell-escape.d.ts.map +0 -1
  987. package/dist/utils/shell-escape.js.map +0 -1
  988. package/dist/utils/skill-matrix.d.ts.map +0 -1
  989. package/dist/utils/skill-matrix.js.map +0 -1
  990. package/dist/utils/ssh-error-messages.d.ts.map +0 -1
  991. package/dist/utils/ssh-error-messages.js.map +0 -1
  992. package/dist/utils/work-folder-validation.d.ts.map +0 -1
  993. package/dist/utils/work-folder-validation.js.map +0 -1
  994. package/dist/utils/workspace-trust.d.ts.map +0 -1
  995. package/dist/utils/workspace-trust.js.map +0 -1
  996. package/dist/version.d.ts.map +0 -1
  997. package/dist/version.js.map +0 -1
@@ -85,8 +85,8 @@
85
85
  * ASCII only.
86
86
  */
87
87
 
88
- import { DoltDivergedError, DoltSyncError } from './errors.mjs';
89
- import { classifyFailure, toDoltVerdict } from './vcs-module.mjs';
88
+ import { DoltDivergedError, DoltSyncError, UnpublishedSchemaMigrationsError } from './errors.mjs';
89
+ import { classifyFailure, toDoltVerdict, commandBinary } from './vcs-module.mjs';
90
90
  import { buildSettleCallback } from './dolt-settle.mjs';
91
91
 
92
92
  // ---------------------------------------------------------------------------
@@ -194,32 +194,300 @@ export function classifyDoltFailure(output) {
194
194
  * @returns {Promise<boolean>}
195
195
  */
196
196
  export async function isMemberSyncRemoteConfigured(member, opts) {
197
- const { command, log = () => {} } = opts;
197
+ return (await readMemberSyncRemote(member, opts)).configured;
198
+ }
199
+
200
+ // ---------------------------------------------------------------------------
201
+ // sync.remote probe memoization (apra-fleet-akuv)
202
+ // ---------------------------------------------------------------------------
203
+ //
204
+ // `bd config get sync.remote --json` used to be spawned FRESH on every call --
205
+ // once per D-pull pre-gate, once per D-push pre-gate, once per status() probe,
206
+ // and every dispatch is bracketed -- which measured out at roughly 90-160
207
+ // spawns (about 0.6s each) per sprint re-reading a value that never changes
208
+ // mid-run. A codebase-wide search confirmed no production path in this package
209
+ // writes sync.remote during a live sprint; only test fixtures and one-time
210
+ // setup/seed scripts do. So the result is memoized PER MEMBER for the process
211
+ // lifetime, with explicit invalidation rather than a TTL (a TTL would re-add
212
+ // spawns for no real safety).
213
+ //
214
+ // WHAT IS CACHED, deliberately narrow: ONLY a positively parsed answer -- a
215
+ // clean JSON parse of the command's output. Every fail-safe path (command()
216
+ // threw, a failSoft error result, no output at all, unparseable output) reports
217
+ // "configured" WITHOUT caching, so a transient probe failure can never pin the
218
+ // fail-safe answer for the rest of the run; the next call re-probes. This
219
+ // preserves isMemberSyncRemoteConfigured's fail-CLOSED contract exactly.
220
+ //
221
+ // INVALIDATION -- three HARD seams that drop BOTH this memo and the member's
222
+ // recorded remote-tip fingerprint (see the invariant below), plus one SOFT
223
+ // seam that drops nothing and instead marks the member for a lazy re-check:
224
+ // 1. noteMemberCommand() -- called from the runner's central command()
225
+ // wrapper; drops the entry for any `bd config set` / `bd dolt remote` /
226
+ // `bd init` / `bd bootstrap` the ORCHESTRATOR issues against that member.
227
+ // 2. the auth self-heal path in runDoltStep(), when onAuthFailure fires for
228
+ // a member (re-provisioning credentials can rewire the remote).
229
+ // 3. repair(), the operator/tool remediation entry point.
230
+ // 4. (soft) noteMemberDispatchCompleted() -- called from the runner's
231
+ // central agent() wrapper the moment ANY dispatch to a member settles.
232
+ // A dispatched agent runs its `bd` commands in its own session on the
233
+ // member, never through the command() wrapper, so seam 1 cannot see an
234
+ // agent-side `bd config set sync.remote`. This seam therefore marks the
235
+ // member DISPATCHED-SINCE-VERIFIED; the memo stays, and is re-read
236
+ // (one `bd config get`, a plain config.yaml read) only at the one
237
+ // decision a stale answer could turn into stale DATA -- the moment a
238
+ // D-pull is about to be SKIPPED on the strength of the fingerprint. See
239
+ // noteMemberDispatchCompleted for why this is the right trigger and
240
+ // why an unconditional per-dispatch wipe was replaced.
241
+ //
242
+ // INVARIANT: the hard seams forget the two per-member memos (this one and
243
+ // lastSyncedTips) TOGETHER. Any event that can rewire a member's remote or
244
+ // replace its local clone invalidates both; a seam that dropped only one
245
+ // would leave a fingerprint that was minted against the other, stale, answer.
246
+ // The fingerprint additionally carries the URL it was minted against, so a
247
+ // memo that is later re-read to a DIFFERENT url can never validate it.
248
+ //
249
+ // The same cache entry carries the remote URL, which the remote-tip
250
+ // fingerprint (see readRemoteDoltTip below) needs -- one probe answers both
251
+ // questions, so the fingerprint costs no extra `bd config get`.
252
+
253
+ /** member -> { configured: boolean, url: string|null } (positively parsed only) */
254
+ const syncRemoteCache = new Map();
255
+
256
+ /** Members dispatched to since their sync.remote memo was last POSITIVELY
257
+ * read. Set by noteMemberDispatchCompleted(); cleared by any positive
258
+ * re-read of the memo and by the hard seams. Consulted only on the
259
+ * D-pull skip path (see confirmSkipAfterDispatch). */
260
+ const dispatchedSinceVerified = new Set();
261
+
262
+ /** Commands whose success can change a member's bd-level sync.remote wiring.
263
+ *
264
+ * Deliberately NOT left-anchored (dolt sync budget review round 2, item 5):
265
+ * member-bound command strings are routinely COMPOUND, because a member's cwd
266
+ * has to be established in the same string (its shell may be PowerShell or a
267
+ * POSIX shell). scripts/dolt-settle-integration.mjs already issues exactly
268
+ * that shape --
269
+ * cd "<dir>" && bd dolt remote add origin "<url>" && bd config set sync.remote "<url>"
270
+ * Set-Location "<dir>"; bd dolt remote add origin "<url>"; bd config set ...
271
+ * -- both of which the old `^\s*bd` anchor silently failed to recognize,
272
+ * leaving a rewired member answering from a stale memo. The leading
273
+ * `(?:^|[\s;&|(])` keeps the match word-bounded (so `abd bootstrap` or
274
+ * `--bd init` never match) while allowing anything to precede the invocation.
275
+ */
276
+ const SYNC_REMOTE_INVALIDATING_COMMAND_RE = /(?:^|[\s;&|(])bd\s+(?:config\s+set|dolt\s+remote|init|bootstrap)\b/i;
277
+
278
+ /**
279
+ * Drop the memoized sync.remote answer for `member` (or for every member when
280
+ * called with no argument -- test hygiene, and the operator-repair path).
281
+ *
282
+ * @param {string} [member]
283
+ * @returns {number} how many cache entries were dropped
284
+ */
285
+ export function invalidateSyncRemoteCache(member) {
286
+ if (member === undefined) {
287
+ const n = syncRemoteCache.size;
288
+ syncRemoteCache.clear();
289
+ return n;
290
+ }
291
+ return syncRemoteCache.delete(member) ? 1 : 0;
292
+ }
293
+
294
+ /**
295
+ * Invalidation seam for the runner's central command() wrapper: hand every
296
+ * member-bound command string here and the sync.remote memo is dropped when the
297
+ * command could have rewired that member's remote. A non-matching command (the
298
+ * overwhelming majority) is a cheap regex test and no cache change.
299
+ *
300
+ * The recorded remote-tip fingerprint is dropped alongside the memo (dolt sync
301
+ * budget review round 2, item 4): `bd init` / `bd bootstrap` can REPLACE the
302
+ * member's local Dolt clone outright, and a freshly recreated (empty) clone is
303
+ * not current with anything -- yet the remote tip it is compared against has
304
+ * not moved, so a surviving fingerprint would match and skip the very pull that
305
+ * clone needs most. Forgetting it only ever costs one real pull.
306
+ *
307
+ * @param {string} member
308
+ * @param {string} cmd
309
+ * @returns {boolean} whether the command invalidated the memo
310
+ */
311
+ export function noteMemberCommand(member, cmd) {
312
+ if (typeof member !== 'string' || member.length === 0) return false;
313
+ if (typeof cmd !== 'string') return false;
314
+ if (!SYNC_REMOTE_INVALIDATING_COMMAND_RE.test(cmd)) return false;
315
+ forgetMemberSyncState(member);
316
+ return true;
317
+ }
318
+
319
+ /**
320
+ * Drop BOTH per-member memos (the sync.remote answer and the recorded
321
+ * remote-tip fingerprint) for `member`. The one primitive every invalidation
322
+ * seam calls, so the two can never drift apart.
323
+ *
324
+ * @param {string} member
325
+ */
326
+ function forgetMemberSyncState(member) {
327
+ invalidateSyncRemoteCache(member);
328
+ clearLastSyncedTip(member);
329
+ dispatchedSinceVerified.delete(member);
330
+ tipProbeFailures.delete(member);
331
+ }
332
+
333
+ /**
334
+ * Soft invalidation seam for the runner's central agent() wrapper: called
335
+ * once per dispatch, the moment the dispatch settles (fulfilled OR rejected),
336
+ * and BEFORE the post-dispatch D-push bracket for that member runs. Marks
337
+ * `member` as dispatched-since-verified. It forgets NOTHING.
338
+ *
339
+ * THE DESIGN DECISION (dolt sync budget review round 4). Round 3 made this
340
+ * seam an unconditional wipe of both memos, on the argument that an agent
341
+ * runs its `bd` commands in its own session (invisible to noteMemberCommand)
342
+ * and might `bd bootstrap` / `bd init` / `bd config set sync.remote` the
343
+ * member's clone. Combined with "a push never mints a fingerprint" (correct,
344
+ * see doltPullBefore's section comment), that left the fingerprint EMPTY at
345
+ * the start of every dispatch bracket -- the module's primary path -- and
346
+ * re-spawned `bd config get` once per dispatch (the golden mock-sprint
347
+ * transcript went from 1 probe to 14). The primary path then paid one
348
+ * ls-remote MORE than before this feature existed and skipped nothing.
349
+ *
350
+ * The wipe was the wrong tool because the hazards it guarded are not what
351
+ * they were assumed to be. Taking each agent-side event in turn, against
352
+ * what bd actually does (verified against the beads source):
353
+ *
354
+ * * `bd bootstrap` -- the one self-heal this repo's agent instructions
355
+ * prescribe ("database exists" -> retry with `--database <name>`) -- is
356
+ * NON-DESTRUCTIVE. With a DB present it validates and reports; it never
357
+ * replaces the clone. Where it does create a DB it CLONES it from the
358
+ * configured sync.remote, i.e. the result is current with the remote by
359
+ * construction. In neither case can a fingerprint that still equals the
360
+ * remote's tip describe a clone that is not at that tip. A surviving
361
+ * fingerprint stays TRUE across a bootstrap.
362
+ * * `bd init` REFUSES on an existing DB unless forced (`--reinit-local` /
363
+ * `--force`). A forced re-init yields a clone with an UNRELATED history:
364
+ * no `bd dolt pull` can bring it current (there is nothing to
365
+ * fast-forward), so skipping that pull changes nothing, and the clone's
366
+ * next push diverges into the terminals that already forget the tip and
367
+ * run settle. The fingerprint is not the deciding factor there either.
368
+ * * `bd config set sync.remote <other>` -- the ONE event where a skip would
369
+ * suppress a pull that WOULD have helped (the clone should now follow a
370
+ * different remote). This is handled, not accepted: the fingerprint is
371
+ * bound to the URL it was minted against, and a member marked here has
372
+ * its sync.remote RE-READ before any skip is taken on its fingerprint
373
+ * (confirmSkipAfterDispatch). A changed URL forgets the fingerprint and
374
+ * forces a real pull; an unreadable answer forces a real pull too.
375
+ *
376
+ * WHY LAZY, AND WHY ONLY ON THE SKIP PATH. A stale memo can only turn into
377
+ * stale DATA at one decision: "skip this pull". Every other consumer fails
378
+ * closed -- a wrong "configured" answer merely issues a real pull/push
379
+ * against whatever remote bd itself has configured, which is the right
380
+ * remote regardless of what we cached. So the re-read is paid exactly where
381
+ * it buys correctness: once per skip-after-dispatch (one `bd config get`, a
382
+ * plain config.yaml read with no Dolt engine start, instead of a real pull
383
+ * that opens the whole chunk store), never per dispatch. A bracket whose
384
+ * remote tip MOVED pays nothing extra; consecutive orchestrator-side reads
385
+ * with no dispatch in between pay nothing extra. The golden transcript is
386
+ * back to one probe per member per process.
387
+ *
388
+ * THE ABSENT CASE (round-4 review, finding 1). A member whose sync.remote
389
+ * was positively ABSENT when first read never reaches the skip path -- both
390
+ * pre-gates take the no-remote exit first -- so the lazy re-check above
391
+ * cannot cover it, and a first cut of this design accepted that as
392
+ * residual. It is not acceptable: an agent that wires a remote mid-dispatch
393
+ * (a `bd init --remote` / `bd config set sync.remote` in its own session)
394
+ * would leave every later D-push of that member reporting `{ ok: true,
395
+ * skipped: true, reason: 'no-remote' }` -- success -- while its bead closes
396
+ * never left the clone, for the rest of the process. So a memoized ABSENT
397
+ * answer is re-read once after any dispatch to the member, at the next
398
+ * pre-gate (readMemberSyncRemote). Cost: one config.yaml read per dispatch,
399
+ * paid ONLY by members with no remote (sandboxes, the no-remote mock
400
+ * sprint -- whose golden transcript therefore shows one probe per dispatch);
401
+ * a member with a remote still pays one probe per process.
402
+ *
403
+ * @param {string} member
404
+ * @returns {boolean} whether the member was marked (false for a non-member)
405
+ */
406
+ export function noteMemberDispatchCompleted(member) {
407
+ if (typeof member !== 'string' || member.length === 0) return false;
408
+ dispatchedSinceVerified.add(member);
409
+ return true;
410
+ }
411
+
412
+ /**
413
+ * Has `member` been dispatched to since its sync.remote memo was last
414
+ * positively read? Exposed for tests and operator tooling.
415
+ * @param {string} member
416
+ * @returns {boolean}
417
+ */
418
+ export function isMemberDispatchedSinceVerified(member) {
419
+ return dispatchedSinceVerified.has(member);
420
+ }
421
+
422
+ /**
423
+ * Read `member`'s bd-level sync.remote, memoized per member (see the section
424
+ * comment above). Returns both the fail-closed boolean the pre-gates consult
425
+ * and the remote URL string the tip fingerprint needs.
426
+ *
427
+ * `configured: true` with `url: null` means "could not be positively read, so
428
+ * treated as configured" -- the fail-safe answer, never cached. `positive`
429
+ * says whether the answer came from a clean parse (live or memoized) rather
430
+ * than the fail-safe fallback.
431
+ *
432
+ * `opts.verify: true` bypasses the memo and re-reads the member (the lazy
433
+ * post-dispatch check, see confirmSkipAfterDispatch). Any positive read --
434
+ * a cache miss or a verify -- refreshes the memo and clears the member's
435
+ * dispatched-since-verified mark.
436
+ *
437
+ * @param {string} member
438
+ * @param {{ command: Function, log?: Function, verify?: boolean }} opts
439
+ * @returns {Promise<{ configured: boolean, url: string|null, positive: boolean }>}
440
+ */
441
+ export async function readMemberSyncRemote(member, opts) {
442
+ const { command, log = () => {}, verify = false } = opts;
443
+ const cached = verify ? undefined : syncRemoteCache.get(member);
444
+ // A memoized ABSENT answer is re-read once after any dispatch to the
445
+ // member (round-4 review, finding 1). Nothing downstream of a cached
446
+ // "absent" ever reaches the fingerprint's lazy re-check -- both pre-gates
447
+ // take the no-remote exit first -- so an agent that wires a remote
448
+ // mid-dispatch would otherwise leave every later D-push of that member
449
+ // reporting a benign no-remote skip while its bead closes never left the
450
+ // clone. A memoized PRESENT answer needs no re-read here: a wrong
451
+ // "configured" answer fails closed (a real pull/push against whatever
452
+ // remote bd itself has), and the skip path re-verifies on its own.
453
+ const absentAfterDispatch = cached && cached.configured === false && dispatchedSinceVerified.has(member);
454
+ if (cached && !absentAfterDispatch) return { ...cached, positive: true };
455
+
198
456
  let res;
199
457
  try {
200
458
  res = await command('bd config get sync.remote --json', { member_name: member, silent: true, failSoft: true });
201
459
  } catch (err) {
202
460
  log(`[Dolt] could not query bd-level sync.remote for member '${member}' (fail-safe: treating as configured): ${err.message}`);
203
- return true;
461
+ return { configured: true, url: null, positive: false };
204
462
  }
205
463
  if (res && typeof res === 'object' && res.ok === false) {
206
464
  log(`[Dolt] 'bd config get sync.remote' failed for member '${member}' (fail-safe: treating as configured): ${res.error}`);
207
- return true;
465
+ return { configured: true, url: null, positive: false };
208
466
  }
209
467
  const output = res && typeof res === 'object' ? res.output : res;
210
468
  if (!output) {
211
469
  // No output to positively parse (e.g. a no-op/unmocked command()):
212
470
  // sync.remote cannot be confirmed absent, so do not treat it as
213
- // neutralized.
214
- return true;
471
+ // neutralized -- and do not cache a non-answer.
472
+ return { configured: true, url: null, positive: false };
215
473
  }
474
+ let parsed;
216
475
  try {
217
- const parsed = JSON.parse(output);
218
- return !(typeof parsed.value === 'string' && parsed.value.trim().length === 0);
476
+ parsed = JSON.parse(output);
219
477
  } catch (err) {
220
478
  log(`[Dolt] could not parse 'bd config get sync.remote --json' output for member '${member}' (fail-safe: treating as configured): ${err.message}`);
221
- return true;
479
+ return { configured: true, url: null, positive: false };
222
480
  }
481
+ const value = typeof parsed.value === 'string' ? parsed.value.trim() : null;
482
+ const entry = {
483
+ configured: !(value !== null && value.length === 0),
484
+ url: value !== null && value.length > 0 ? value : null,
485
+ };
486
+ // Only a positively parsed answer is memoized -- and a positive read is
487
+ // by definition a verification, so the dispatch mark is cleared with it.
488
+ syncRemoteCache.set(member, entry);
489
+ dispatchedSinceVerified.delete(member);
490
+ return { ...entry, positive: true };
223
491
  }
224
492
 
225
493
  // Bounded exponential backoff between TRANSIENT retries (apra-fleet-417.3.1).
@@ -235,11 +503,151 @@ export async function isMemberSyncRemoteConfigured(member, opts) {
235
503
  // The original 8s cap meant even 5 retries covered at most ~15s of backoff,
236
504
  // structurally unable to span an outage an order of magnitude longer; the
237
505
  // sprint kept dying with retries correctly firing but exhausted. Raised to
238
- // 30s so a realistic retry budget (see maxTransientRetries below) can
239
- // actually outlast one of these windows instead of just softening it.
506
+ // 30s so a realistic retry budget can actually outlast one of these windows
507
+ // instead of just softening it.
508
+ //
509
+ // TIME-BOXED, NOT COUNT-BOXED (dolt sync budget review, section A.3)
510
+ // -------------------------------------------------------------------------
511
+ // Widening the ladder to `maxTransientRetries = 8` with a 30s cap fixed the
512
+ // spawn-outage case but applied that budget to EVERY transient kind, and the
513
+ // cost was demonstrated immediately: the unit suite went from 80s to 6m15s,
514
+ // because an ordinary transient in a test fixture now walked the full 8-retry
515
+ // x 30s-cap ladder (91.5s of pure sleep in one exhausted ladder, before
516
+ // counting the 600s per-attempt timeout). The retry budget was never really
517
+ // about a COUNT -- it was about spanning a wall-clock outage window.
518
+ //
519
+ // So the ladder is split by error CLASS, and only the class that motivated the
520
+ // widening gets the long budget:
521
+ //
522
+ // * SPAWN OUTAGE (`fork/exec ...`, "Not enough memory resources") -- the OS
523
+ // refused to start git.exe at all. Retried against a WALL-CLOCK budget
524
+ // (DOLT_SPAWN_OUTAGE_BUDGET_MS, 3 min, matching the measured 1-3 min
525
+ // window) with the 30s backoff cap. The bound is elapsed time, so it is
526
+ // the same 3 minutes whether each attempt returns instantly or sits on a
527
+ // long timeout -- the old count-based bound multiplied out to a worst case
528
+ // of 9 attempts x the 600s step timeout.
529
+ // * EVERY OTHER TRANSIENT (network blip, busy server, held row lock) keeps
530
+ // the short ladder it always had before the widening: 5 retries, 8s cap.
531
+ // These were never the failure the long budget was bought for, and giving
532
+ // them the long one is exactly what caused the suite regression.
533
+ //
534
+ // `maxTransientRetries` still bounds the generic class and is still honored
535
+ // when a caller passes it explicitly, so every existing test seam keeps
536
+ // working; only the DEFAULT drops back from 8 to the pre-widening 5.
537
+ //
538
+ // ROUND-3 CORRECTION (dolt sync budget review round 3, item 4): "honored when
539
+ // passed explicitly" now applies to BOTH classes. The round-2 cut let an
540
+ // explicit `maxTransientRetries` cap only the generic ladder while the
541
+ // spawn-outage ladder ignored it and always ran to its own wall-clock budget
542
+ // and 30-attempt backstop -- a caller asking for a tight bound could still sit
543
+ // in a 3-minute retry loop. An explicit value is now a hard attempt cap on the
544
+ // spawn-outage ladder too (min(explicit, DOLT_SPAWN_OUTAGE_MAX_RETRIES), with
545
+ // the wall-clock budget still applying on top). Left UNSPECIFIED -- the
546
+ // production default, since no runner call site passes it -- the spawn-outage
547
+ // class keeps the full wall-clock budget; the "hard attempt backstop" below is
548
+ // then the only count in play. runDoltStep() therefore distinguishes "not
549
+ // passed" (undefined) from "passed", which is why the bracket entry points no
550
+ // longer fill in the default themselves.
551
+ //
552
+ // ROUND-2 CORRECTION (dolt sync budget review round 2, item 3): the first cut
553
+ // of this split set the generic default to 2, describing it as "the ladder it
554
+ // always had before the widening". That was wrong -- `git show 3f49419b`
555
+ // (bump D-pull/D-push transient-retry budget from 1 to 5) shows the
556
+ // pre-widening default was 5 (~15.5s of backoff), not 2 (~1.5s). The suite
557
+ // regression that motivated the reduction came from the SPAWN-OUTAGE class's
558
+ // 3-minute wall-clock budget, a test-fixture problem (fixtures sleeping
559
+ // through real backoff), not from this ladder -- so the generic class is back
560
+ // at 5 and any slow test injects its own `sleep`/`backoffBaseMs` instead.
240
561
  const DOLT_BACKOFF_BASE_MS = 500;
241
562
  const DOLT_BACKOFF_MAX_MS = 30000;
242
563
 
564
+ /** Backoff cap for the ordinary transient class -- the pre-widening value. */
565
+ const DOLT_GENERIC_BACKOFF_MAX_MS = 8000;
566
+
567
+ /** Retry count for the ordinary transient class (the default for
568
+ * `maxTransientRetries`). The pre-widening baseline -- see the note above,
569
+ * including why the round-1 value of 2 was a mis-restoration. */
570
+ export const DOLT_GENERIC_TRANSIENT_MAX_RETRIES = 5;
571
+
572
+ /** Total wall-clock retry budget for the spawn-outage class, sized to the
573
+ * measured 1-3 minute Windows git.exe spawn outage with headroom. */
574
+ export const DOLT_SPAWN_OUTAGE_BUDGET_MS = 180000;
575
+
576
+ /** Hard attempt backstop for the spawn-outage ladder. The real bound is the
577
+ * wall-clock budget above (~10 retries at the 30s cap); this only keeps a
578
+ * non-advancing clock from spinning. */
579
+ const DOLT_SPAWN_OUTAGE_MAX_RETRIES = 30;
580
+
581
+ /** The spawn-outage class: the OS refused to START the git subprocess, as
582
+ * opposed to anything that happened once it was running. Deliberately broad
583
+ * on the `fork/exec` line: any process-spawn refusal is the same class
584
+ * regardless of the OS's phrasing for why it refused.
585
+ *
586
+ * Exactly ONE pattern, on purpose (dolt sync budget review round 3, item
587
+ * 5). An earlier cut also matched the Windows wording "Not enough memory
588
+ * resources" on its own, but that pattern was dead: isSpawnOutageFailure()
589
+ * only runs on a failure the 'dolt' provider already classified 'transient',
590
+ * and that provider's TRANSIENT table carries `fork/exec ` and NOT the
591
+ * memory-resources wording -- so a text with the wording but no fork/exec
592
+ * line classifies 'unknown', is never retried, and never reaches this
593
+ * check. It is also redundant in practice: Go's os/exec formats every spawn
594
+ * refusal as `fork/exec <path>: <os error>`, so the live incident text
595
+ * (test/dolt-remote-unreachable.test.mjs) always carries both halves on
596
+ * the same line. Matching fork/exec alone is therefore complete for the
597
+ * class, and this list stays in lock-step with what can actually arrive. */
598
+ const DOLT_SPAWN_OUTAGE_PATTERNS = [
599
+ /fork\/exec /i,
600
+ ];
601
+
602
+ /**
603
+ * Is this failure text the spawn-outage class that earns the long wall-clock
604
+ * retry budget? Callers must already have classified the failure as
605
+ * 'transient'; this only sub-classifies WITHIN that verdict and never widens
606
+ * what counts as retryable (see DOLT_SPAWN_OUTAGE_PATTERNS for why the list
607
+ * must not carry a pattern the provider's TRANSIENT table cannot deliver).
608
+ *
609
+ * @param {string} output - raw stderr/stdout of the failed command
610
+ * @returns {boolean}
611
+ */
612
+ export function isSpawnOutageFailure(output) {
613
+ const text = String(output == null ? '' : output);
614
+ return DOLT_SPAWN_OUTAGE_PATTERNS.some((re) => re.test(text));
615
+ }
616
+
617
+ /** The Windows CreateProcess ERROR_NOT_ENOUGH_MEMORY wording. */
618
+ const WINDOWS_SPAWN_LIMIT_RE = /Not enough memory resources are available/i;
619
+
620
+ /** Lines Dolt/git append after a failed git spawn that point at credentials
621
+ * (`hint: dolt does not support interactive credential prompts`, Git
622
+ * Credential Manager notes). After a CreateProcess refusal git never ran, so
623
+ * no credential was ever consulted and these lines only mislead. */
624
+ const MISLEADING_CREDENTIAL_HINT_RE = /^\s*hint:|credential manager|\bgcm\b/i;
625
+
626
+ /** Prefix naming the real cause of a Windows spawn refusal. Deliberately free
627
+ * of any wording the 'dolt' provider's rule tables match (auth, remote,
628
+ * divergence), so re-classifying the surfaced text gives the same verdict as
629
+ * the raw text. */
630
+ export const WINDOWS_SPAWN_LIMIT_MESSAGE =
631
+ 'Windows refused to start a child process (CreateProcess ERROR_NOT_ENOUGH_MEMORY): this is the Windows process-creation resource limit, '
632
+ + 'NOT a credential or remote problem, and free RAM does not rule it out. The usual causes are an oversized environment block handed to the '
633
+ + 'child (duplicated PATH, oversized inherited variables) or desktop-heap exhaustion in a non-interactive session; it is retried as a transient spawn outage.';
634
+
635
+ /**
636
+ * The text a failed `bd dolt` step surfaces (logs, DoltSyncError messages).
637
+ * Identity for every failure except the Windows process-creation limit, which
638
+ * gets WINDOWS_SPAWN_LIMIT_MESSAGE prepended and its misleading credential
639
+ * hint lines removed. Classification must still run on the RAW text.
640
+ *
641
+ * @param {string} output - raw stderr/stdout of the failed command
642
+ * @returns {string}
643
+ */
644
+ export function surfaceDoltFailureText(output) {
645
+ const text = String(output == null ? '' : output);
646
+ if (!WINDOWS_SPAWN_LIMIT_RE.test(text)) return text;
647
+ const kept = text.split(/\r?\n/).filter((line) => !MISLEADING_CREDENTIAL_HINT_RE.test(line)).join('\n').trim();
648
+ return `${WINDOWS_SPAWN_LIMIT_MESSAGE} Original output (credential hints removed): ${kept}`;
649
+ }
650
+
243
651
  // apra-fleet-jxdf.2: every `bd dolt pull`/`bd dolt push` this module issues
244
652
  // used to inherit whatever generic default the injected command() primitive
245
653
  // falls back to when no timeout is specified (120s, sized for an ordinary
@@ -299,29 +707,84 @@ const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
299
707
  * 'diverged' classification remains excluded and is still returned
300
708
  * immediately, never retried.
301
709
  *
302
- * @returns {Promise<{ ok: boolean, output: string, error: string|null, kind?: 'no-remote'|'empty-remote'|'remote-unreachable'|'diverged'|'auth'|'transient'|'unknown' }>}
710
+ * @returns {Promise<{ ok: boolean, output: string, error: string|null, kind?: 'no-remote'|'empty-remote'|'remote-unreachable'|'diverged'|'auth'|'transient'|'missing-tool'|'unknown', missingTool?: string }>}
303
711
  */
304
- async function runDoltStep({ command, member, cmd, label, log, maxTransientRetries, onAuthFailure, sleep = defaultSleep, backoffBaseMs = DOLT_BACKOFF_BASE_MS, timeoutS = DOLT_STEP_TIMEOUT_S }) {
712
+ async function runDoltStep({ command, member, cmd, label, log, maxTransientRetries, onAuthFailure, sleep = defaultSleep, backoffBaseMs = DOLT_BACKOFF_BASE_MS, timeoutS = DOLT_STEP_TIMEOUT_S, spawnOutageBudgetMs = DOLT_SPAWN_OUTAGE_BUDGET_MS, now = Date.now }) {
305
713
  let attempt = 0;
306
714
  let authHealAttempted = false;
715
+ /** The info the self-heal was invoked with, reported back on a failed retry. */
716
+ let healTrigger = null;
717
+ const startedAt = now();
718
+ // An explicitly passed `maxTransientRetries` caps BOTH ladders (see the
719
+ // ROUND-3 CORRECTION in the constants block); left undefined, the generic
720
+ // class gets its default and the spawn-outage class keeps its own
721
+ // backstop, bounded by wall clock.
722
+ const explicitRetryCap = maxTransientRetries !== undefined && maxTransientRetries !== null;
723
+ const genericMaxRetries = explicitRetryCap ? Number(maxTransientRetries) : DOLT_GENERIC_TRANSIENT_MAX_RETRIES;
724
+ const spawnOutageMaxRetries = explicitRetryCap
725
+ ? Math.min(Number(maxTransientRetries), DOLT_SPAWN_OUTAGE_MAX_RETRIES)
726
+ : DOLT_SPAWN_OUTAGE_MAX_RETRIES;
307
727
  // eslint-disable-next-line no-constant-condition
308
728
  while (true) {
309
729
  const res = await command(cmd, { member_name: member, silent: true, failSoft: true, label, timeout_s: timeoutS });
310
- if (res && res.ok) return res;
311
- const error = res ? res.error : 'unknown command failure';
312
- const kind = classifyDoltFailure(error);
313
- if (kind === 'transient' && attempt < maxTransientRetries) {
314
- attempt += 1;
315
- const delayMs = doltBackoffDelayMs(attempt, backoffBaseMs);
316
- log(`[Dolt] transient failure for member '${member}' (${label}); retry ${attempt}/${maxTransientRetries} after ${delayMs}ms backoff: ${error}`);
317
- if (delayMs > 0 && typeof sleep === 'function') await sleep(delayMs);
318
- continue;
730
+ if (res && res.ok) {
731
+ if (authHealAttempted) log(`[Dolt] self-heal recovered: ${label} succeeded for member '${member}' on the retry after re-provisioning credentials.`);
732
+ return res;
733
+ }
734
+ const rawError = res ? res.error : 'unknown command failure';
735
+ // Same verdict classifyDoltFailure() returns, read once here so a
736
+ // missing-tool failure can also name the binary. Classified on the
737
+ // RAW text; everything surfaced below uses `error`, which names the
738
+ // real cause of a Windows process-creation refusal instead of the
739
+ // credential hints dolt appends to it (surfaceDoltFailureText).
740
+ const classified = classifyFailure(rawError, { provider: 'dolt', tool: commandBinary(cmd) });
741
+ const kind = toDoltVerdict(classified.kind);
742
+ const error = surfaceDoltFailureText(rawError);
743
+ if (kind === 'missing-tool') {
744
+ // GitHub #616: a missing binary is never retried and never sent to
745
+ // the credential self-heal -- neither can install it.
746
+ const tool = classified.missingTool || commandBinary(cmd);
747
+ log(`[Dolt] ${label} FAILED (missing-tool): '${tool}' was not found on member '${member}' -- install it on that member or put it on that member's PATH. Not retrying and not re-provisioning credentials. Raw: ${error}`);
748
+ return { ok: false, output: res ? res.output : '', error, kind, missingTool: tool, selfHealed: false };
749
+ }
750
+ if (kind === 'transient') {
751
+ // Sub-classify WITHIN the transient verdict: only the spawn-outage
752
+ // class gets the long wall-clock budget (see the constants block
753
+ // above for why the count-based ladder was replaced).
754
+ if (isSpawnOutageFailure(rawError)) {
755
+ const elapsedMs = now() - startedAt;
756
+ // The attempt ceiling is a backstop, not the policy: at the 30s
757
+ // backoff cap a 3-minute budget spends itself in ~10 retries, so
758
+ // this can only ever fire if the injected clock does not
759
+ // advance. It exists so a broken clock degrades to the old
760
+ // bounded ladder rather than spinning forever.
761
+ if (elapsedMs < spawnOutageBudgetMs && attempt < spawnOutageMaxRetries) {
762
+ attempt += 1;
763
+ const delayMs = doltBackoffDelayMs(attempt, backoffBaseMs, DOLT_BACKOFF_MAX_MS);
764
+ log(`[Dolt] transient SPAWN-OUTAGE failure for member '${member}' (${label}); retry ${attempt} after ${delayMs}ms backoff (${Math.round(elapsedMs / 1000)}s of a ${Math.round(spawnOutageBudgetMs / 1000)}s wall-clock budget used${explicitRetryCap ? `, capped at ${spawnOutageMaxRetries} retries by the caller` : ''}): ${error}`);
765
+ if (delayMs > 0 && typeof sleep === 'function') await sleep(delayMs);
766
+ continue;
767
+ }
768
+ log(`[Dolt] spawn-outage retry budget (${Math.round(spawnOutageBudgetMs / 1000)}s wall clock, ${spawnOutageMaxRetries} retries max) EXHAUSTED for member '${member}' (${label}) after ${attempt} retries; giving up: ${error}`);
769
+ } else if (attempt < genericMaxRetries) {
770
+ attempt += 1;
771
+ const delayMs = doltBackoffDelayMs(attempt, backoffBaseMs, DOLT_GENERIC_BACKOFF_MAX_MS);
772
+ log(`[Dolt] transient failure for member '${member}' (${label}); retry ${attempt}/${genericMaxRetries} after ${delayMs}ms backoff: ${error}`);
773
+ if (delayMs > 0 && typeof sleep === 'function') await sleep(delayMs);
774
+ continue;
775
+ }
319
776
  }
320
777
  if ((kind === 'auth' || kind === 'unknown') && typeof onAuthFailure === 'function' && !authHealAttempted) {
321
778
  authHealAttempted = true;
779
+ // Re-provisioning a member's VCS auth can rewire its remote, so
780
+ // neither memo may survive a self-heal: the sync.remote answer AND
781
+ // the remote-tip fingerprint minted against it (round 3, item 6 --
782
+ // this used to drop only the former, unlike repair()).
783
+ forgetMemberSyncState(member);
322
784
  log(`[Dolt] ${kind} failure for member '${member}' (${label}); invoking self-heal (provision_vcs_auth) once before a single bounded retry: ${error}`);
785
+ healTrigger = { member, label, cmd, error, source: 'dolt', failureKind: kind };
323
786
  try {
324
- await onAuthFailure({ member, label, cmd, error, kind: 'dolt' });
787
+ await onAuthFailure(healTrigger);
325
788
  } catch (healErr) {
326
789
  log(`[Dolt] self-heal for member '${member}' (${label}) failed; not retrying further: ${healErr.message}`);
327
790
  log(`[Dolt] ${label} FAILED (${kind}) -- reads/writes for member '${member}' may be stale until this is resolved. Raw: ${error}`);
@@ -339,11 +802,49 @@ async function runDoltStep({ command, member, cmd, label, log, maxTransientRetri
339
802
  // through, so a degraded read/write is always visible to whoever is
340
803
  // watching a live sprint -- independent of whether the caller treats
341
804
  // it as fatal.
805
+ //
806
+ // `selfHealed` reports whether the bounded one-shot auth self-heal
807
+ // above actually RAN TO COMPLETION for this step -- i.e. credentials
808
+ // were re-provisioned and the command was then retried and STILL
809
+ // failed. It is deliberately false on the `catch (healErr)` path
810
+ // above (that returns early): a self-heal that THREW never
811
+ // re-provisioned anything, so a credential problem remains a live
812
+ // explanation there. Callers use this to tell "the credentials are
813
+ // stale" apart from "the credentials were just refreshed and the
814
+ // failure text is lying" -- see doltPushGuarded's post-reconcile
815
+ // re-push branch.
816
+ if (authHealAttempted) {
817
+ log(`[Dolt] self-heal did not recover: ${label} still failed for member '${member}' after re-provisioning credentials.`);
818
+ // Let the self-heal remember this futile heal for the rest of the
819
+ // run, so the next step failing the same way is not re-healed.
820
+ if (typeof onAuthFailure.recordHealOutcome === 'function') {
821
+ try { await onAuthFailure.recordHealOutcome({ ...healTrigger, recovered: false }); }
822
+ catch (recordErr) { log(`[Dolt] could not record the failed self-heal for member '${member}': ${recordErr.message}`); }
823
+ }
824
+ }
342
825
  log(`[Dolt] ${label} FAILED (${kind}) -- reads/writes for member '${member}' may be stale until this is resolved. Raw: ${error}`);
343
- return { ok: false, output: res ? res.output : '', error, kind };
826
+ return { ok: false, output: res ? res.output : '', error, kind, selfHealed: authHealAttempted };
344
827
  }
345
828
  }
346
829
 
830
+ /**
831
+ * The terminal error for a D-pull/D-push whose binary is missing on the member
832
+ * (GitHub #616): names the binary and the member, and says plainly that
833
+ * credentials were not touched.
834
+ * @param {string} member
835
+ * @param {'pull'|'push'} operation
836
+ * @param {{ error: string, missingTool?: string }} step
837
+ * @returns {DoltSyncError}
838
+ */
839
+ function missingToolSyncError(member, operation, step) {
840
+ const tool = step.missingTool || 'bd';
841
+ return new DoltSyncError(
842
+ `[Dolt] D-${operation} for member '${member}' failed: '${tool}' is not installed or not on PATH on member '${member}' -- ` +
843
+ `install it there (or fix that member's PATH) and retry. Not a credential problem; credentials were not re-provisioned. Raw: ${step.error}`,
844
+ { member, doltOutput: step.error, details: { kind: 'missing-tool', operation, tool } },
845
+ );
846
+ }
847
+
347
848
  /**
348
849
  * D-pull: bring `member`'s beads clone up to the shared remote before it reads
349
850
  * or is dispatched -- `bd dolt pull`. Transient (network / server / lock)
@@ -363,7 +864,14 @@ async function runDoltStep({ command, member, cmd, label, log, maxTransientRetri
363
864
  * is never suppressed. Override the check with
364
865
  * `opts.checkSyncRemoteConfigured` (same test hook doltPushAfter exposes).
365
866
  *
366
- * Two distinct benign no-op skips return `{ ok: true, skipped: true }` rather
867
+ * A further benign skip is the REMOTE-TIP FINGERPRINT: `reason:
868
+ * 'remote-unchanged'` means `git ls-remote <sync.remote> refs/dolt/data`
869
+ * returned the exact SHA this member last synchronized to, so the pull is a
870
+ * provable no-op and is not spawned. See the section comment above this
871
+ * function for the correctness argument and the fail-open rules; disable it
872
+ * with `opts.remoteTipFingerprint: false`.
873
+ *
874
+ * Two further benign no-op skips return `{ ok: true, skipped: true }` rather
367
875
  * than throwing: `reason: 'no-remote'` (no dolt remote configured -- nothing
368
876
  * to pull) and `reason: 'empty-remote'` (a configured remote that has never
369
877
  * had anything pushed into it, i.e. Dolt's "no branches found in remote"
@@ -378,7 +886,7 @@ async function runDoltStep({ command, member, cmd, label, log, maxTransientRetri
378
886
  *
379
887
  * @param {string} member
380
888
  * @param {{ command: Function, log?: Function, maxTransientRetries?: number, checkSyncRemoteConfigured?: Function, skipPull?: boolean, onAuthFailure?: Function }} opts
381
- * @returns {Promise<{ ok: true, member: string, skipped?: true, reason?: 'no-remote'|'empty-remote'|'already-fresh' }>}
889
+ * @returns {Promise<{ ok: true, member: string, skipped?: true, reason?: 'no-remote'|'empty-remote'|'already-fresh'|'remote-unchanged' }>}
382
890
  */
383
891
  /**
384
892
  * Invoke the injected settle callback at a divergence terminal, if one is
@@ -414,8 +922,518 @@ async function attemptSettle({ settle, member, operation, error, log }) {
414
922
  return null;
415
923
  }
416
924
 
925
+ // ---------------------------------------------------------------------------
926
+ // Remote-tip fingerprint: skip a D-pull only when the remote provably has not
927
+ // moved (dolt sync budget review, section B.1)
928
+ // ---------------------------------------------------------------------------
929
+ //
930
+ // THE CORRECTNESS ANCHOR. The shared remote's `refs/dolt/data` ref is the ONLY
931
+ // channel through which beads state moves between machines. A member's clone
932
+ // can therefore be stale in exactly one way: that ref advanced since the member
933
+ // last pulled or pushed. "Is a D-pull needed?" is then a question with a cheap,
934
+ // EXACT answer -- compare the remote SHA now against the SHA this member last
935
+ // synchronized to -- rather than a policy bet about who else might be writing.
936
+ // That is why this supersedes the role-based and time-based skip policies that
937
+ // were considered: those trade real staleness for speed (a reviewer reading
938
+ // acceptance criteria a remote doer just pushed is the exact false-FAILED-streak
939
+ // failure the post-streak verify pull exists to prevent), whereas a tip-equal
940
+ // skip removes only pulls that are provably no-ops.
941
+ //
942
+ // The probe is `git ls-remote <sync.remote> refs/dolt/data`: one network round
943
+ // trip, no Dolt engine startup, no 548MB chunk store to open (~0.35s measured,
944
+ // against multi-minute real pulls).
945
+ //
946
+ // THE RECORDED TIP is minted in exactly ONE place, and only ever from a value
947
+ // this member's clone is PROVABLY current with:
948
+ // * after a successful PULL, record the SHA observed IMMEDIATELY BEFORE the
949
+ // pull -- never one read afterwards. A push racing in during the pull then
950
+ // simply forces the NEXT pull to be real, which is the safe error.
951
+ // * after a successful PUSH by this member, FORGET the recorded tip. A push
952
+ // never records anything -- see the block below for why.
953
+ //
954
+ // WHY A PUSH CANNOT MINT A FINGERPRINT (dolt sync budget review round 3,
955
+ // item 1 -- the correct redesign of two earlier attempts):
956
+ //
957
+ // Attempt 1 recorded the remote SHA read AFTER the push, "still under the
958
+ // push mutex". Attempt 2 read it before AND after, and recorded the post-push
959
+ // SHA only when the ref had advanced ("it advanced, so I must have moved
960
+ // it"). Both are wrong for the same reason: the push mutex serializes THIS
961
+ // FLEET's pushes against each other and nothing else. Any unrelated machine
962
+ // can push to the same shared remote in the gap between this member's push
963
+ // completing and its post-push `git ls-remote` returning. The post-push read
964
+ // then observes a stranger's newer commit that this clone has never seen,
965
+ // records it as "my lastSyncedTip", and the very next D-pull is wrongly
966
+ // skipped -- exactly the staleness this feature exists to prevent. A network
967
+ // read of "the remote's current tip" is NEVER a proxy for "what my push
968
+ // published".
969
+ //
970
+ // The obvious local alternative -- record this clone's own commit SHA, the
971
+ // thing a fast-forward push makes the remote ref equal to -- does not exist
972
+ // for THIS transport. bd's git-backed remote (`git+https://...`) is Dolt's
973
+ // git blobstore: a push wraps the chunk-store manifest in a FRESH git commit,
974
+ // built inside the push on top of the remote head it just fetched, and
975
+ // publishes it with a lease. That commit (and so the remote's new
976
+ // refs/dolt/data SHA) is minted by the push itself, is not a function of
977
+ // local Dolt state, is not printed by `bd dolt push` ("Pushing to Dolt
978
+ // remote... / Push complete." either way), and lands locally only in a
979
+ // per-process UUID-named ref (refs/dolt/blobstore/<remote>/dolt/data/<uuid>)
980
+ // inside a sha256-named cache dir under .beads/ -- reachable only by a
981
+ // shell-dialect-specific filesystem scan on the member, which is exactly the
982
+ // kind of doubt this module refuses to turn into a skip. (Verified against a
983
+ // live clone: the cache repo's tracking refs and FETCH_HEAD already disagreed
984
+ // with the remote's live tip, and no stable local ref names the pushed SHA.)
985
+ //
986
+ // So a successful push FORGETS the fingerprint. The remote is now at a SHA
987
+ // this module cannot know; the pusher's next D-pull runs one real pull (after
988
+ // one ls-remote that re-arms the skip for the pulls after it). That is the
989
+ // conservative direction by construction: a redundant pull is the safe
990
+ // error, a skipped needed pull is not. A NO-OP push (nothing local to
991
+ // publish) is indistinguishable from a real one at this layer and is treated
992
+ // the same way -- it proves nothing about the clone's freshness, so it may
993
+ // not keep a fingerprint either. The D-push bracket does read the tip
994
+ // before and after the push, but only to decide whether the push LANDED
995
+ // (see "D-push landed check" below); that read is never recorded as a
996
+ // fingerprint, so the race above cannot reach a skip.
997
+ //
998
+ // FAIL-OPEN, ALWAYS. Every uncertainty -- no recorded tip yet, ls-remote failed
999
+ // or timed out, unparseable output, a sync.remote that could not be positively
1000
+ // read, a URL outside the strict safe charset -- falls through to a REAL pull.
1001
+ // The skip is only ever taken on a positive SHA match. There is deliberately no
1002
+ // path in which doubt produces a skip.
1003
+
1004
+ /** member -> { sha, url }: the remote refs/dolt/data SHA this member is known
1005
+ * to be current with, and the ls-remote URL it was observed at. Bound to the
1006
+ * URL so a fingerprint can never validate a skip against a remote other than
1007
+ * the one it was minted from (round 4 -- an agent-side `bd config set
1008
+ * sync.remote` is the one reset a surviving fingerprint would otherwise get
1009
+ * wrong; see noteMemberDispatchCompleted). Process-lifetime, same scope as
1010
+ * the sync.remote memo. */
1011
+ const lastSyncedTips = new Map();
1012
+
1013
+ /** Short timeout for the tip probe: it is one ls-remote round trip, and must
1014
+ * never inherit the 600s budget sized for a real Dolt sync -- a probe that
1015
+ * hangs has to fall through to the real pull quickly, not stall the bracket. */
1016
+ const DOLT_TIP_PROBE_TIMEOUT_S = 30;
1017
+
1018
+ /** The ref every `bd dolt push` advances on a git-transport Dolt remote. */
1019
+ const DOLT_DATA_REF = 'refs/dolt/data';
1020
+
1021
+ /** Never let the probe wait on a human (round-4 review, finding 2). The
1022
+ * probe URL carries no userinfo (see toGitLsRemoteUrl), so on a member
1023
+ * whose only credential for the host is the one embedded in sync.remote
1024
+ * git would otherwise try to PROMPT: on a Windows member Git Credential
1025
+ * Manager can block on a dialog until the 30s probe timeout, on every
1026
+ * bracket. `credential.interactive=never` is GCM's own no-UI switch;
1027
+ * `core.askPass=` (empty) disables any askpass program, so with no terminal
1028
+ * attached git fails immediately instead of waiting. Passed as `-c` config
1029
+ * because the command string must not rely on shell-level env assignment
1030
+ * (the member's shell may be PowerShell). */
1031
+ const GIT_NO_PROMPT_FLAGS = '-c credential.interactive=never -c core.askPass=';
1032
+
1033
+ /** After this many CONSECUTIVE failed probes a member's probe is disabled
1034
+ * for the process (cleared by the hard seams): a member that cannot
1035
+ * authenticate ls-remote, or whose sync.remote is a Dolt-native remote git
1036
+ * cannot list, would otherwise pay a failed round trip on every bracket.
1037
+ * Two, not one, so a single network blip does not cost the feature. */
1038
+ export const DOLT_TIP_PROBE_MAX_CONSECUTIVE_FAILURES = 2;
1039
+
1040
+ /** member -> consecutive probe failures (a success resets to 0). */
1041
+ const tipProbeFailures = new Map();
1042
+
1043
+ /**
1044
+ * Is `member`'s remote-tip probe currently disabled by the failure latch?
1045
+ * @param {string} member
1046
+ * @returns {boolean}
1047
+ */
1048
+ export function isTipProbeDisabled(member) {
1049
+ return (tipProbeFailures.get(member) || 0) >= DOLT_TIP_PROBE_MAX_CONSECUTIVE_FAILURES;
1050
+ }
1051
+
1052
+ /**
1053
+ * Reset the probe failure latch for `member` (or every member -- test
1054
+ * hygiene, alongside invalidateSyncRemoteCache() / clearLastSyncedTip()).
1055
+ * @param {string} [member]
1056
+ * @returns {number} how many entries were dropped
1057
+ */
1058
+ export function clearTipProbeFailures(member) {
1059
+ if (member === undefined) {
1060
+ const n = tipProbeFailures.size;
1061
+ tipProbeFailures.clear();
1062
+ return n;
1063
+ }
1064
+ return tipProbeFailures.delete(member) ? 1 : 0;
1065
+ }
1066
+
1067
+ /**
1068
+ * Strict safe-charset URL gate. The probe command string is handed to the
1069
+ * member's own shell, which may be PowerShell OR a POSIX shell, so rather than
1070
+ * trying to quote correctly for both this REFUSES any remote URL containing a
1071
+ * character outside a conservative set (no whitespace, no quote, no shell
1072
+ * metacharacter of either dialect). A rejected URL yields no fingerprint and a
1073
+ * real pull -- the safe direction.
1074
+ */
1075
+ const SAFE_REMOTE_URL_RE = /^[A-Za-z0-9._~:/@+-]+$/;
1076
+
1077
+ /** A URL with an explicit scheme (`https://`, `ssh://`, `file://`, ...). */
1078
+ const URL_SCHEME_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
1079
+
1080
+ /** The userinfo (`user@` or `user:password@`) of an http(s) URL. */
1081
+ const HTTP_USERINFO_RE = /^(https?:\/\/)[^/@]*@/i;
1082
+
1083
+ /**
1084
+ * Convert a bd `sync.remote` value into the URL `git ls-remote` should be
1085
+ * pointed at, or null when it cannot be used safely.
1086
+ *
1087
+ * bd spells a git-transport Dolt remote `git+https://host/org/repo.git`; the
1088
+ * `git+` scheme prefix is bd's own marker and is NOT part of the git URL, so it
1089
+ * is stripped. Anything failing the safe-charset gate returns null.
1090
+ *
1091
+ * NOTE: this deliberately derives the probe target from sync.remote and NEVER
1092
+ * from git's `origin`. The two can legitimately differ on a member, and probing
1093
+ * origin would compare this member's freshness against the wrong ref.
1094
+ *
1095
+ * SCHEME REQUIRED (round 4, fix A). sync.remote may legitimately hold a bare
1096
+ * Dolt remote NAME (`origin` -- the integration fixtures set exactly that),
1097
+ * which passes the charset gate but is not a URL at all: handed to
1098
+ * `git ls-remote origin` it silently resolves against GIT'S OWN origin, the
1099
+ * very thing the note above forbids. A scheme-less value -- a remote name,
1100
+ * or a bare filesystem path (a Dolt file remote, never a git repository) --
1101
+ * therefore yields null: no fingerprint, a real pull.
1102
+ *
1103
+ * USERINFO STRIPPED (round 4, fix B). The probe string is journaled VERBATIM
1104
+ * as a persisted, dashboard-visible command record (the workflow's command()
1105
+ * records the command text; `silent` only suppresses the console line). A
1106
+ * sync.remote of the shape `git+https://x-access-token:ghp_...@host/...`
1107
+ * would bake that token into the record, whereas before this feature it only
1108
+ * ever appeared as command OUTPUT. So an http(s) userinfo is removed before
1109
+ * the URL becomes part of any command. The stripped URL still authenticates:
1110
+ * every provisioned member carries a git credential helper for its VCS host
1111
+ * (provision_vcs_auth writes it; that is how `git push` works on members
1112
+ * today), and a member whose ONLY credential was the embedded userinfo gets
1113
+ * a failed probe, which is the fail-open real pull, not a wrong skip. ssh
1114
+ * URLs keep their userinfo: `git@` is the login name, not a secret.
1115
+ *
1116
+ * @param {string|null|undefined} syncRemote
1117
+ * @returns {string|null}
1118
+ */
1119
+ export function toGitLsRemoteUrl(syncRemote) {
1120
+ if (typeof syncRemote !== 'string') return null;
1121
+ const trimmed = syncRemote.trim();
1122
+ if (trimmed.length === 0) return null;
1123
+ let url = trimmed.startsWith('git+') ? trimmed.slice(4) : trimmed;
1124
+ if (url.length === 0) return null;
1125
+ if (!URL_SCHEME_RE.test(url)) return null;
1126
+ url = url.replace(HTTP_USERINFO_RE, '$1');
1127
+ if (!SAFE_REMOTE_URL_RE.test(url)) return null;
1128
+ return url;
1129
+ }
1130
+
1131
+ /**
1132
+ * Parse `git ls-remote` output for the refs/dolt/data SHA. Output lines are
1133
+ * `<sha>\t<ref>`. Returns null on anything unrecognized -- an empty result, a
1134
+ * malformed line, or a ref that is not exactly refs/dolt/data -- so the caller
1135
+ * falls through to a real pull.
1136
+ *
1137
+ * @param {string|null|undefined} output
1138
+ * @returns {string|null}
1139
+ */
1140
+ export function parseLsRemoteTip(output) {
1141
+ const text = String(output == null ? '' : output);
1142
+ for (const line of text.split(/\r?\n/)) {
1143
+ const m = line.match(/^([0-9a-f]{7,64})\s+(\S+)\s*$/i);
1144
+ if (m && m[2] === DOLT_DATA_REF) return m[1].toLowerCase();
1145
+ }
1146
+ return null;
1147
+ }
1148
+
1149
+ /**
1150
+ * Read the shared remote's current refs/dolt/data SHA for `member`, via one
1151
+ * `git ls-remote` on that member. Never throws: any failure returns null and
1152
+ * the caller treats that as "unknown", i.e. do the real thing.
1153
+ *
1154
+ * @param {string} member
1155
+ * @param {{ command: Function, log?: Function, url: string }} ctx
1156
+ * @returns {Promise<string|null>}
1157
+ */
1158
+ async function readRemoteDoltTip(member, { command, log = () => {}, url }) {
1159
+ const sha = await readRemoteDoltTipOnce(member, { command, log, url });
1160
+ if (sha) {
1161
+ tipProbeFailures.delete(member);
1162
+ return sha;
1163
+ }
1164
+ const failures = (tipProbeFailures.get(member) || 0) + 1;
1165
+ tipProbeFailures.set(member, failures);
1166
+ if (failures === DOLT_TIP_PROBE_MAX_CONSECUTIVE_FAILURES) {
1167
+ log(`[Dolt] remote-tip probe for member '${member}' failed ${failures} times in a row; disabling the probe for this member for the rest of the run (every D-pull is real, as before the fingerprint existed).`);
1168
+ }
1169
+ return null;
1170
+ }
1171
+
1172
+ async function readRemoteDoltTipOnce(member, { command, log, url }) {
1173
+ let res;
1174
+ try {
1175
+ res = await command(`git ${GIT_NO_PROMPT_FLAGS} ls-remote ${url} ${DOLT_DATA_REF}`, {
1176
+ member_name: member,
1177
+ silent: true,
1178
+ failSoft: true,
1179
+ label: `Dolt remote-tip probe for '${member}'`,
1180
+ timeout_s: DOLT_TIP_PROBE_TIMEOUT_S,
1181
+ });
1182
+ } catch (err) {
1183
+ log(`[Dolt] remote-tip probe for member '${member}' threw (falling through to a real pull): ${(err && err.message) || err}`);
1184
+ return null;
1185
+ }
1186
+ if (!res || res.ok === false) {
1187
+ log(`[Dolt] remote-tip probe for member '${member}' failed (falling through to a real pull): ${res ? res.error : 'no result'}`);
1188
+ return null;
1189
+ }
1190
+ const sha = parseLsRemoteTip(typeof res === 'object' ? res.output : res);
1191
+ if (!sha) {
1192
+ log(`[Dolt] remote-tip probe for member '${member}' returned no parseable ${DOLT_DATA_REF} SHA (falling through to a real pull).`);
1193
+ return null;
1194
+ }
1195
+ return sha;
1196
+ }
1197
+
1198
+ /**
1199
+ * Resolve the ls-remote URL for `member` from the MEMOIZED sync.remote probe,
1200
+ * or null when it cannot be positively read / is not safely usable. Returns
1201
+ * null without probing when `command` is missing.
1202
+ *
1203
+ * @param {string} member
1204
+ * @param {{ command: Function, log?: Function }} ctx
1205
+ * @returns {Promise<string|null>}
1206
+ */
1207
+ async function resolveTipProbeUrl(member, { command, log }) {
1208
+ if (typeof command !== 'function') return null;
1209
+ if (isTipProbeDisabled(member)) return null;
1210
+ const { url } = await readMemberSyncRemote(member, { command, log });
1211
+ return toGitLsRemoteUrl(url);
1212
+ }
1213
+
1214
+ /**
1215
+ * The SHA `member` is currently known to be synchronized with, or undefined.
1216
+ * @param {string} member
1217
+ * @returns {string|undefined}
1218
+ */
1219
+ export function getLastSyncedTip(member) {
1220
+ const entry = lastSyncedTips.get(member);
1221
+ return entry ? entry.sha : undefined;
1222
+ }
1223
+
1224
+ /**
1225
+ * Record the SHA `member` is now synchronized with, observed at ls-remote
1226
+ * URL `url`. Both are required: a tip with no URL to bind it to is doubt,
1227
+ * and doubt never produces a skip, so it is not recorded at all. Exported for
1228
+ * the tests and for any future call site that learns the tip out of band.
1229
+ * @param {string} member
1230
+ * @param {string} sha
1231
+ * @param {string} url - the exact `git ls-remote` target the SHA was read at
1232
+ */
1233
+ export function setLastSyncedTip(member, sha, url) {
1234
+ if (typeof sha !== 'string' || sha.length === 0) return;
1235
+ if (typeof url !== 'string' || url.length === 0) return;
1236
+ lastSyncedTips.set(member, { sha, url });
1237
+ }
1238
+
1239
+ /**
1240
+ * Decide whether `member`'s D-pull may be skipped: the observed remote tip
1241
+ * must equal the recorded one, at the same URL -- and if the member has been
1242
+ * dispatched to since its sync.remote memo was last positively read, that
1243
+ * memo is re-read FIRST and must still name the same URL. See
1244
+ * noteMemberDispatchCompleted for the reasoning.
1245
+ *
1246
+ * @param {string} member
1247
+ * @param {{ observedTip: string, probeUrl: string, command: Function, log: Function }} ctx
1248
+ * @returns {Promise<{ skip: boolean, reason?: 'remote-unchanged'|'no-remote', recordable: boolean }>}
1249
+ * `recordable` is false when the probe turned out to target the wrong
1250
+ * remote, so the caller must not mint a fingerprint from `observedTip`
1251
+ * after its pull. `reason: 'no-remote'` means the re-read found sync.remote
1252
+ * positively ABSENT: the pre-gate's own contract then applies (no `bd dolt`
1253
+ * command may be issued against a neutralized clone), so the caller takes
1254
+ * the no-remote exit rather than a real pull.
1255
+ */
1256
+ async function confirmSkipAfterDispatch(member, { observedTip, probeUrl, command, log }) {
1257
+ const recorded = lastSyncedTips.get(member);
1258
+ if (!recorded || recorded.sha !== observedTip || recorded.url !== probeUrl) {
1259
+ return { skip: false, recordable: true };
1260
+ }
1261
+ if (!dispatchedSinceVerified.has(member)) return { skip: true, reason: 'remote-unchanged', recordable: true };
1262
+ const fresh = await readMemberSyncRemote(member, { command, log, verify: true });
1263
+ if (!fresh.positive) {
1264
+ log(`[Dolt] D-pull for member '${member}': remote tip matches the recorded fingerprint, but sync.remote could not be re-read after a dispatch to this member -- pulling for real rather than skipping on an unconfirmed remote.`);
1265
+ return { skip: false, recordable: true };
1266
+ }
1267
+ if (!fresh.configured) {
1268
+ log(`[Dolt] D-pull for member '${member}': sync.remote was neutralized under a dispatch; forgetting the fingerprint -- no pull command issued`);
1269
+ clearLastSyncedTip(member);
1270
+ return { skip: true, reason: 'no-remote', recordable: false };
1271
+ }
1272
+ const freshUrl = toGitLsRemoteUrl(fresh.url);
1273
+ if (freshUrl === probeUrl) return { skip: true, reason: 'remote-unchanged', recordable: true };
1274
+ log(`[Dolt] D-pull for member '${member}': sync.remote changed under a dispatch (fingerprint was minted against a different remote); forgetting the fingerprint and pulling for real.`);
1275
+ clearLastSyncedTip(member);
1276
+ return { skip: false, recordable: false };
1277
+ }
1278
+
1279
+ /**
1280
+ * Forget `member`'s recorded tip (or every member's -- test hygiene). A
1281
+ * forgotten tip means the next D-pull is real, never skipped.
1282
+ * @param {string} [member]
1283
+ * @returns {number} how many entries were dropped
1284
+ */
1285
+ export function clearLastSyncedTip(member) {
1286
+ if (member === undefined) {
1287
+ const n = lastSyncedTips.size;
1288
+ lastSyncedTips.clear();
1289
+ return n;
1290
+ }
1291
+ return lastSyncedTips.delete(member) ? 1 : 0;
1292
+ }
1293
+
1294
+ // ---------------------------------------------------------------------------
1295
+ // D-push landed check: a push is only logged as landed when refs/dolt/data
1296
+ // actually moved
1297
+ // ---------------------------------------------------------------------------
1298
+ //
1299
+ // `bd dolt push` exiting 0 is not proof the remote moved: a push that timed
1300
+ // out at the transport used to be read as success and logged "landed" while
1301
+ // refs/dolt/data proved otherwise. So the D-push bracket reads refs/dolt/data
1302
+ // immediately before the first push and again after a push reports success:
1303
+ // * the tip CHANGED -> the push landed. It may also carry another machine's
1304
+ // later push on top of ours; that is still a landed push (Dolt's git
1305
+ // blobstore publishes with a lease on the head it fetched, so a push that
1306
+ // did not land fails instead of exiting 0). Bookkeeping is unchanged: the
1307
+ // fingerprint is FORGOTTEN, never minted from the post-push read -- see
1308
+ // "WHY A PUSH CANNOT MINT A FINGERPRINT" above. These reads only ever
1309
+ // decide landed/not-landed; neither is ever recorded.
1310
+ // * the tip did NOT change -> either a legitimate no-op push (nothing local
1311
+ // to publish; verified live: refs/dolt/data stays put and bd still prints
1312
+ // "Push complete.") or a push that did not land. `bd diff
1313
+ // remotes/origin/<branch> <branch>` tells them apart: no changes means
1314
+ // the remote already had everything (up-to-date), changes mean the
1315
+ // clone still holds work the remote lacks (NOT landed -> failure).
1316
+ // * anything inconclusive -- no git-transport (`git+`) sync.remote URL to
1317
+ // read (a bare remote name, a Dolt-native file:// or cloud remote), a
1318
+ // failed or unparseable read
1319
+ // -- keeps the pre-check behavior and logs that the landing could not be
1320
+ // verified. Only positive evidence of a non-landed push fails it.
1321
+
1322
+ /** Read refs/dolt/data at `url` for the D-push landed check. Never throws.
1323
+ * `empty` is true when ls-remote succeeded but the remote has no
1324
+ * refs/dolt/data yet (a first push). */
1325
+ async function readTipForPushCheck(member, { command, url, when }) {
1326
+ let res;
1327
+ try {
1328
+ res = await command(`git ${GIT_NO_PROMPT_FLAGS} ls-remote ${url} ${DOLT_DATA_REF}`, {
1329
+ member_name: member,
1330
+ silent: true,
1331
+ failSoft: true,
1332
+ label: `D-push ${when}-push remote-tip read for '${member}'`,
1333
+ timeout_s: DOLT_TIP_PROBE_TIMEOUT_S,
1334
+ });
1335
+ } catch (err) {
1336
+ return { sha: null, why: `ls-remote threw: ${(err && err.message) || err}` };
1337
+ }
1338
+ if (!res || res.ok === false) return { sha: null, why: `ls-remote failed: ${res ? res.error : 'no result'}` };
1339
+ const output = typeof res === 'object' ? res.output : res;
1340
+ const sha = parseLsRemoteTip(output);
1341
+ if (sha) return { sha };
1342
+ if (String(output == null ? '' : output).trim() === '') return { sha: null, empty: true, why: `the remote has no ${DOLT_DATA_REF}` };
1343
+ return { sha: null, why: `ls-remote returned no parseable ${DOLT_DATA_REF} SHA` };
1344
+ }
1345
+
1346
+ /**
1347
+ * Parse `bd diff <from> <to> --json`: does the clone hold changes the
1348
+ * remote-tracking branch lacks?
1349
+ * @param {string|null|undefined} output
1350
+ * @returns {boolean|null} true = unpushed changes, false = none, null = unknown
1351
+ */
1352
+ export function parseBdDiffPending(output) {
1353
+ const text = String(output == null ? '' : output).trim();
1354
+ if (/^No changes between /m.test(text)) return false;
1355
+ try {
1356
+ const parsed = JSON.parse(text);
1357
+ if (Array.isArray(parsed)) return parsed.length > 0;
1358
+ } catch { /* not JSON */ }
1359
+ return null;
1360
+ }
1361
+
1362
+ /** Branch names bd may report that are safe to put in a command string on
1363
+ * any member shell (no whitespace, quotes or shell metacharacters). */
1364
+ const SAFE_DOLT_BRANCH_RE = /^[A-Za-z0-9._/-]+$/;
1365
+
1366
+ /**
1367
+ * Does `member`'s clone still hold changes its Dolt remote-tracking branch
1368
+ * lacks? Reads the current branch from `bd vc status --json`, then diffs
1369
+ * remotes/origin/<branch> against it. Never throws.
1370
+ * @returns {Promise<{ pending: boolean|null, why?: string }>}
1371
+ */
1372
+ async function readUnpushedDoltChanges(member, { command }) {
1373
+ let branch = null;
1374
+ try {
1375
+ const res = await command('bd vc status --json', { member_name: member, silent: true, failSoft: true, label: `D-push landed check: branch read for '${member}'`, timeout_s: DOLT_TIP_PROBE_TIMEOUT_S });
1376
+ if (res && res.ok !== false) {
1377
+ const parsed = JSON.parse(String((typeof res === 'object' ? res.output : res) || ''));
1378
+ if (parsed && typeof parsed.branch === 'string') branch = parsed.branch;
1379
+ }
1380
+ } catch { /* unknown branch -> inconclusive below */ }
1381
+ if (!branch || !SAFE_DOLT_BRANCH_RE.test(branch)) return { pending: null, why: 'could not read the clone\'s Dolt branch' };
1382
+ let res;
1383
+ try {
1384
+ res = await command(`bd diff remotes/origin/${branch} ${branch} --json`, { member_name: member, silent: true, failSoft: true, label: `D-push landed check: unpushed-change read for '${member}'`, timeout_s: DOLT_TIP_PROBE_TIMEOUT_S });
1385
+ } catch (err) {
1386
+ return { pending: null, why: `bd diff threw: ${(err && err.message) || err}` };
1387
+ }
1388
+ if (!res || res.ok === false) return { pending: null, why: `bd diff failed: ${res ? res.error : 'no result'}` };
1389
+ const pending = parseBdDiffPending(typeof res === 'object' ? res.output : res);
1390
+ return pending === null ? { pending: null, why: 'bd diff output was not recognized' } : { pending };
1391
+ }
1392
+
1393
+ /**
1394
+ * Start the D-push landed check: resolve the ls-remote URL from the memoized
1395
+ * sync.remote and read refs/dolt/data before the push.
1396
+ * @returns {Promise<{ url: string|null, preTip: string|null, preEmpty: boolean, why?: string }>}
1397
+ */
1398
+ async function beginDoltPushLandedCheck(member, { command, log }) {
1399
+ let url = null;
1400
+ try {
1401
+ const raw = (await readMemberSyncRemote(member, { command, log })).url;
1402
+ // Only a git-transport Dolt remote (bd spells it `git+<url>`) publishes
1403
+ // refs/dolt/data. A Dolt-native remote (file://, DoltHub, cloud
1404
+ // storage) keeps its own chunk store; a directory that merely also
1405
+ // happens to be a git repo would answer ls-remote with no refs both
1406
+ // before and after a push that did land.
1407
+ url = typeof raw === 'string' && raw.trim().startsWith('git+') ? toGitLsRemoteUrl(raw) : null;
1408
+ } catch { url = null; }
1409
+ if (!url) return { url: null, preTip: null, preEmpty: false, why: 'sync.remote is not a git-transport (git+) URL whose refs/dolt/data can be read' };
1410
+ const pre = await readTipForPushCheck(member, { command, url, when: 'pre' });
1411
+ return { url, preTip: pre.sha, preEmpty: !!pre.empty, why: pre.why };
1412
+ }
1413
+
1414
+ /**
1415
+ * Finish the D-push landed check after a push reported success.
1416
+ * @returns {Promise<{ status: 'moved'|'up-to-date'|'not-landed'|'unverified', tip?: string, why?: string }>}
1417
+ */
1418
+ async function checkDoltPushLanded(member, { command, check }) {
1419
+ if (!check.url || (!check.preTip && !check.preEmpty)) return { status: 'unverified', why: check.why };
1420
+ const post = await readTipForPushCheck(member, { command, url: check.url, when: 'post' });
1421
+ if (!post.sha) {
1422
+ if (post.empty) return { status: 'not-landed', why: `the remote still has no ${DOLT_DATA_REF} after the push` };
1423
+ return { status: 'unverified', why: post.why };
1424
+ }
1425
+ if (post.sha !== check.preTip) return { status: 'moved', tip: post.sha };
1426
+ const unpushed = await readUnpushedDoltChanges(member, { command });
1427
+ if (unpushed.pending === false) return { status: 'up-to-date', tip: post.sha };
1428
+ if (unpushed.pending === true) return { status: 'not-landed', tip: post.sha, why: `${DOLT_DATA_REF} is still ${post.sha} and the clone still holds changes the remote lacks` };
1429
+ return { status: 'unverified', tip: post.sha, why: `${DOLT_DATA_REF} did not move (${post.sha}) and whether the clone had anything to publish could not be read: ${unpushed.why}` };
1430
+ }
1431
+
417
1432
  export async function doltPullBefore(member, opts = {}) {
418
- const { command, log = () => {}, maxTransientRetries = 8, checkSyncRemoteConfigured, skipPull = false, onAuthFailure, sleep, backoffBaseMs, timeoutS, settle } = opts;
1433
+ // `maxTransientRetries` is deliberately NOT defaulted here: runDoltStep()
1434
+ // must see whether the caller passed it (an explicit value caps both
1435
+ // retry ladders; undefined selects each ladder's own default).
1436
+ const { command, log = () => {}, maxTransientRetries, checkSyncRemoteConfigured, skipPull = false, onAuthFailure, sleep, backoffBaseMs, timeoutS, settle, remoteTipFingerprint = true, spawnOutageBudgetMs, now } = opts;
419
1437
  if (typeof command !== 'function') {
420
1438
  throw new Error("doltPullBefore requires an injected command() in opts");
421
1439
  }
@@ -436,9 +1454,32 @@ export async function doltPullBefore(member, opts = {}) {
436
1454
  return { ok: true, member, skipped: true, reason: 'already-fresh' };
437
1455
  }
438
1456
 
1457
+ // Remote-tip fingerprint (see the section comment above doltPullBefore).
1458
+ // `observedTip` is the SHA read BEFORE the pull; it is only committed to
1459
+ // lastSyncedTips once the pull below actually succeeds.
1460
+ let observedTip = null;
1461
+ let probeUrl = null;
1462
+ if (remoteTipFingerprint) {
1463
+ probeUrl = await resolveTipProbeUrl(member, { command, log });
1464
+ if (probeUrl) {
1465
+ observedTip = await readRemoteDoltTip(member, { command, log, url: probeUrl });
1466
+ if (observedTip) {
1467
+ const verdict = await confirmSkipAfterDispatch(member, { observedTip, probeUrl, command, log });
1468
+ if (verdict.skip && verdict.reason === 'no-remote') {
1469
+ return { ok: true, member, skipped: true, reason: 'no-remote' };
1470
+ }
1471
+ if (verdict.skip) {
1472
+ log(`[Dolt] D-pull for member '${member}' skipped: remote ${DOLT_DATA_REF} is unchanged at ${observedTip} since this member last synchronized -- the shared remote is the only cross-machine channel, so the clone is provably current.`);
1473
+ return { ok: true, member, skipped: true, reason: 'remote-unchanged', remoteTip: observedTip };
1474
+ }
1475
+ if (!verdict.recordable) observedTip = null;
1476
+ }
1477
+ }
1478
+ }
1479
+
439
1480
  const pull = await runDoltStep({
440
1481
  command, member, cmd: 'bd dolt pull',
441
- label: `D-pull for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS,
1482
+ label: `D-pull for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
442
1483
  });
443
1484
  if (!pull.ok) {
444
1485
  if (pull.kind === 'no-remote') {
@@ -462,6 +1503,11 @@ export async function doltPullBefore(member, opts = {}) {
462
1503
  `[Dolt] D-pull for member '${member}' hit an unmergeable beads conflict and must not be auto-resolved by judgment: ${pull.error}`,
463
1504
  { member, doltOutput: pull.error, operation: 'pull' },
464
1505
  );
1506
+ // A divergence (and any settle that republishes to resolve it)
1507
+ // leaves this clone at a tip we did not observe -- forget the
1508
+ // recorded fingerprint so the next D-pull is unconditionally real
1509
+ // rather than skipped against a stale SHA.
1510
+ clearLastSyncedTip(member);
465
1511
  const settled = await attemptSettle({ settle, member, operation: 'D-pull', error: diverged, log });
466
1512
  if (settled) {
467
1513
  // settle ends with its own `bd dolt pull` + `bd dolt push`, so
@@ -481,6 +1527,9 @@ export async function doltPullBefore(member, opts = {}) {
481
1527
  { member, doltOutput: pull.error, details: { kind: 'auth', operation: 'pull' } },
482
1528
  );
483
1529
  }
1530
+ if (pull.kind === 'missing-tool') {
1531
+ throw missingToolSyncError(member, 'pull', pull);
1532
+ }
484
1533
  if (pull.kind === 'remote-unreachable') {
485
1534
  const url = extractDoltRemoteUrl(pull.error);
486
1535
  throw new DoltSyncError(
@@ -494,6 +1543,13 @@ export async function doltPullBefore(member, opts = {}) {
494
1543
  );
495
1544
  }
496
1545
 
1546
+ // The pull landed, so this clone is current with the remote AS OF the SHA
1547
+ // read BEFORE it. Deliberately not a post-pull read: a push that raced in
1548
+ // during the pull is not included in what we just fetched, and recording
1549
+ // the later SHA would claim freshness this clone does not have. Recording
1550
+ // the earlier one can only cost one redundant future pull.
1551
+ if (observedTip && probeUrl) setLastSyncedTip(member, observedTip, probeUrl);
1552
+
497
1553
  return { ok: true, member };
498
1554
  }
499
1555
 
@@ -527,6 +1583,42 @@ export function extractConflictingTables(doltOutput) {
527
1583
  return [...tables];
528
1584
  }
529
1585
 
1586
+ /**
1587
+ * True when a failed D-pull carries the signature of a clone whose bd
1588
+ * auto-applied schema migrations were never published: dolt refuses the merge
1589
+ * because uncommitted local changes (the migrated `events` table) would be
1590
+ * stomped. Only a DoltSyncError (not a divergence/auth classification, which
1591
+ * keep their own handling) can match.
1592
+ */
1593
+ export function isUnpublishedMigrationPullFailure(err) {
1594
+ if (!(err instanceof DoltSyncError) || err instanceof DoltDivergedError) return false;
1595
+ if (err.details && err.details.kind === 'auth') return false;
1596
+ return /local changes would be stomped by merge/i.test(String(err.doltOutput || err.message || ''));
1597
+ }
1598
+
1599
+ /**
1600
+ * Heal for the signature above: publish the migrations with `bd dolt push`
1601
+ * (through doltPushAfter, so it takes the global push mutex when one is
1602
+ * supplied) and retry the pull exactly once. Any failure becomes an
1603
+ * UnpublishedSchemaMigrationsError naming the cause and the fix commands.
1604
+ */
1605
+ async function publishMigrationsAndRetryPull(member, opts, firstErr) {
1606
+ const { log = () => {} } = opts;
1607
+ log(`[Dolt] D-pull for member '${member}' failed because its beads clone holds unpublished local schema migrations (bd auto-applied them); publishing with 'bd dolt push' and retrying the pull once.`);
1608
+ try {
1609
+ await doltPushAfter(member, { ...opts, pushBeads: true });
1610
+ // The pull must really run: a fingerprint skip would claim freshness.
1611
+ clearLastSyncedTip(member);
1612
+ return await doltPullBefore(member, opts);
1613
+ } catch (healErr) {
1614
+ throw new UnpublishedSchemaMigrationsError(
1615
+ `[Dolt] member '${member}' beads clone has unpublished local schema migrations (bd auto-applied them), so the D-pull fails with "local changes would be stomped by merge" -- and publishing them failed: ${healErr.message}. ` +
1616
+ `Fix: give '${member}' a valid VCS credential (provision_vcs_auth), then run 'bd dolt push' in its beads workspace to publish the migration, then 'bd dolt pull', and relaunch.`,
1617
+ { member, doltOutput: firstErr.doltOutput, cause: healErr },
1618
+ );
1619
+ }
1620
+ }
1621
+
530
1622
  /**
531
1623
  * Pre-flight beads-health gate: the same D-pull probe as doltPullBefore(),
532
1624
  * run before a sprint issues any mutating git or PR command, so a diverged
@@ -546,12 +1638,17 @@ export function extractConflictingTables(doltOutput) {
546
1638
  *
547
1639
  * @param {string} member
548
1640
  * @param {{ command: Function, log?: Function, maxTransientRetries?: number, checkSyncRemoteConfigured?: Function }} opts
549
- * @returns {Promise<{ ok: true, member: string, skipped?: true, reason?: 'no-remote'|'empty-remote'|'already-fresh' }>}
1641
+ * @returns {Promise<{ ok: true, member: string, skipped?: true, reason?: 'no-remote'|'empty-remote'|'already-fresh'|'remote-unchanged' }>}
550
1642
  */
551
1643
  export async function preflightBeadsHealthGate(member, opts = {}) {
552
1644
  const { command, log = () => {} } = opts;
553
1645
  try {
554
- return await doltPullBefore(member, opts);
1646
+ try {
1647
+ return await doltPullBefore(member, opts);
1648
+ } catch (firstErr) {
1649
+ if (!isUnpublishedMigrationPullFailure(firstErr)) throw firstErr;
1650
+ return await publishMigrationsAndRetryPull(member, opts, firstErr);
1651
+ }
555
1652
  } catch (err) {
556
1653
  if (!(err instanceof DoltDivergedError)) {
557
1654
  throw err;
@@ -618,6 +1715,11 @@ export async function preflightBeadsHealthGate(member, opts = {}) {
618
1715
  * (including the reconcile/re-push) -- see runDoltStep's AUTH SELF-HEAL
619
1716
  * CONTRACT.
620
1717
  *
1718
+ * REMOTE-TIP FINGERPRINT: a successful push (first attempt or the re-push
1719
+ * after the one reconcile) FORGETS this member's recorded tip and issues no
1720
+ * `git ls-remote` at all -- see "WHY A PUSH CANNOT MINT A FINGERPRINT" above
1721
+ * doltPullBefore. The pusher's next D-pull is therefore always real.
1722
+ *
621
1723
  * `opts.settle` is the optional deterministic conflict-settlement callback
622
1724
  * (buildSettleCallback, dolt-settle.mjs). When present, a divergence that
623
1725
  * outlives the bounded reconcile runs settle before the DoltDivergedError is
@@ -629,7 +1731,11 @@ export async function preflightBeadsHealthGate(member, opts = {}) {
629
1731
  * @returns {Promise<{ ok: true, member: string, pushed: boolean, reconciled: boolean, skipped?: true, reason?: 'no-remote', recovered?: true, settledTables?: string[] }>}
630
1732
  */
631
1733
  export async function doltPushAfter(member, opts = {}) {
632
- const { command, pushBeads = true, log = () => {}, maxTransientRetries = 8, mutex, sprintId, checkSyncRemoteConfigured, onAuthFailure, sleep, backoffBaseMs, timeoutS, settle, renewIntervalMs = DOLT_MUTEX_RENEW_INTERVAL_MS } = opts;
1734
+ // `maxTransientRetries` is deliberately NOT defaulted here -- see
1735
+ // doltPullBefore. `remoteTipFingerprint` is accepted for call-site parity
1736
+ // with doltPullBefore but has nothing to switch off on the push side any
1737
+ // more: a push never probes and never records (it only forgets).
1738
+ const { command, pushBeads = true, log = () => {}, maxTransientRetries, mutex, sprintId, checkSyncRemoteConfigured, onAuthFailure, sleep, backoffBaseMs, timeoutS, settle, renewIntervalMs = DOLT_MUTEX_RENEW_INTERVAL_MS, spawnOutageBudgetMs, now } = opts;
633
1739
  if (typeof command !== 'function') {
634
1740
  throw new Error("doltPushAfter requires an injected command() in opts");
635
1741
  }
@@ -669,6 +1775,8 @@ export async function doltPushAfter(member, opts = {}) {
669
1775
  // exclusion mid-operation. Renew on an interval well under the lease while
670
1776
  // we hold it, and stop renewing in the same `finally` that releases.
671
1777
  let grant = null;
1778
+ /** The pre-push refs/dolt/data read; set inside the mutex below. */
1779
+ let landedCheck = { url: null, preTip: null, preEmpty: false, why: 'not read' };
672
1780
  if (mutex && typeof mutex.acquire === 'function') {
673
1781
  grant = await mutex.acquire(sprintId || member, { pid: process.pid });
674
1782
  }
@@ -689,6 +1797,11 @@ export async function doltPushAfter(member, opts = {}) {
689
1797
  if (typeof renewTimer.unref === 'function') renewTimer.unref();
690
1798
  }
691
1799
  try {
1800
+ // Read refs/dolt/data before the first push so a push that reports
1801
+ // success can be checked against it (see "D-push landed check" above).
1802
+ // Inside the mutex: no other push from this fleet can move the tip
1803
+ // between this read and our push.
1804
+ landedCheck = await beginDoltPushLandedCheck(member, { command, log });
692
1805
  return await doltPushGuarded();
693
1806
  } finally {
694
1807
  if (renewTimer) clearInterval(renewTimer);
@@ -713,6 +1826,10 @@ export async function doltPushAfter(member, opts = {}) {
713
1826
  // before returning. With no settle callback wired the behavior is
714
1827
  // unchanged: the DoltDivergedError propagates immediately.
715
1828
  async function surfaceDivergence(divergedError, operation) {
1829
+ // Either terminal leaves the remote at a SHA this member never
1830
+ // observed (settle republishes; an unrecovered divergence leaves the
1831
+ // clone wedged), so drop the fingerprint and force a real next pull.
1832
+ clearLastSyncedTip(member);
716
1833
  const settled = await attemptSettle({ settle, member, operation: `D-push (${operation})`, error: divergedError, log });
717
1834
  if (settled) {
718
1835
  return { ok: true, member, pushed: true, reconciled: true, recovered: true, settledTables: settled.resolvedTables || [] };
@@ -720,13 +1837,67 @@ export async function doltPushAfter(member, opts = {}) {
720
1837
  throw divergedError;
721
1838
  }
722
1839
 
1840
+ /**
1841
+ * A push landed. The remote's refs/dolt/data is now a SHA minted inside
1842
+ * the push that this module has no local, network-free way to learn (see
1843
+ * "WHY A PUSH CANNOT MINT A FINGERPRINT" above doltPullBefore), and any
1844
+ * post-push network read could observe an unrelated machine's later push
1845
+ * instead of ours. So the only correct bookkeeping is to FORGET whatever
1846
+ * fingerprint this member carried: the next D-pull is real. Local-only,
1847
+ * no command is issued.
1848
+ */
1849
+ function forgetTipAfterPush() {
1850
+ if (clearLastSyncedTip(member) > 0) {
1851
+ log(`[Dolt] D-push for member '${member}' landed; forgetting its remote-tip fingerprint (the remote is now at a SHA only the push knows) so the next D-pull is real.`);
1852
+ }
1853
+ }
1854
+
1855
+ /**
1856
+ * A push step reported success. Decide whether it actually landed (see
1857
+ * "D-push landed check" above) before logging it as landed or returning
1858
+ * success. A push that provably did not land is retried once; if it still
1859
+ * did not land, a DoltSyncError with details.kind 'push-not-landed' is
1860
+ * thrown for the caller's degrade/fatal policy (DoltSync.syncAfter).
1861
+ */
1862
+ async function confirmPushLanded(result, label) {
1863
+ let verdict = await checkDoltPushLanded(member, { command, check: landedCheck });
1864
+ if (verdict.status === 'not-landed') {
1865
+ log(`[Dolt] ${label} reported success but the push did NOT land: ${verdict.why}. Retrying the push once.`);
1866
+ const retry = await runDoltStep({
1867
+ command, member, cmd: 'bd dolt push',
1868
+ label: `D-push retry after an unlanded push for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
1869
+ });
1870
+ const firstWhy = verdict.why;
1871
+ verdict = retry.ok
1872
+ ? await checkDoltPushLanded(member, { command, check: landedCheck })
1873
+ : { status: 'not-landed', why: `${firstWhy}; the retry push failed: ${retry.error}` };
1874
+ if (verdict.status === 'not-landed') {
1875
+ clearLastSyncedTip(member);
1876
+ throw new DoltSyncError(
1877
+ `[Dolt] D-push for member '${member}' did not land on the remote: \`bd dolt push\` reported success but ${verdict.why}. The member's beads changes have NOT reached the shared remote.`,
1878
+ { member, doltOutput: verdict.why, details: { kind: 'push-not-landed', operation: 'push' } },
1879
+ );
1880
+ }
1881
+ }
1882
+ if (verdict.status === 'up-to-date') {
1883
+ clearLastSyncedTip(member);
1884
+ log(`[Dolt] D-push for member '${member}': nothing to publish (${DOLT_DATA_REF} unchanged and the clone holds no changes the remote lacks).`);
1885
+ return { ...result, upToDate: true };
1886
+ }
1887
+ if (verdict.status === 'unverified' && landedCheck.url) {
1888
+ log(`[Dolt] D-push for member '${member}' reported success, but whether it landed could not be verified: ${verdict.why}`);
1889
+ }
1890
+ forgetTipAfterPush();
1891
+ return result;
1892
+ }
1893
+
723
1894
  async function doltPushGuarded() {
724
1895
  let push = await runDoltStep({
725
1896
  command, member, cmd: 'bd dolt push',
726
- label: `D-push for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS,
1897
+ label: `D-push for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
727
1898
  });
728
1899
  if (push.ok) {
729
- return { ok: true, member, pushed: true, reconciled: false };
1900
+ return await confirmPushLanded({ ok: true, member, pushed: true, reconciled: false }, `D-push for member '${member}'`);
730
1901
  }
731
1902
 
732
1903
  if (push.kind === 'no-remote') {
@@ -762,6 +1933,9 @@ export async function doltPushAfter(member, opts = {}) {
762
1933
  { member, doltOutput: push.error, details: { kind: 'auth', operation: 'push' } },
763
1934
  );
764
1935
  }
1936
+ if (push.kind === 'missing-tool') {
1937
+ throw missingToolSyncError(member, 'push', push);
1938
+ }
765
1939
  if (push.kind === 'remote-unreachable') {
766
1940
  const url = extractDoltRemoteUrl(push.error);
767
1941
  throw new DoltSyncError(
@@ -781,7 +1955,7 @@ export async function doltPushAfter(member, opts = {}) {
781
1955
  log(`[Dolt] D-push for member '${member}' was rejected (another writer pushed first); reconciling with a single D-pull then one re-push (first-successful-pusher-wins).`);
782
1956
  const reconcile = await runDoltStep({
783
1957
  command, member, cmd: 'bd dolt pull',
784
- label: `D-push reconcile pull for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS,
1958
+ label: `D-push reconcile pull for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
785
1959
  });
786
1960
  if (!reconcile.ok) {
787
1961
  if (reconcile.kind === 'diverged') {
@@ -799,25 +1973,110 @@ export async function doltPushAfter(member, opts = {}) {
799
1973
  );
800
1974
  }
801
1975
 
1976
+ // The remote moved under the rejected first push (that is why it was
1977
+ // rejected), so the landed check's pre-push tip is re-read now: compared
1978
+ // against the stale one, another writer's push would read as ours landing.
1979
+ landedCheck = await beginDoltPushLandedCheck(member, { command, log });
802
1980
  push = await runDoltStep({
803
1981
  command, member, cmd: 'bd dolt push',
804
- label: `D-push re-push after reconcile for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS,
1982
+ label: `D-push re-push after reconcile for '${member}'`, log, maxTransientRetries, onAuthFailure, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
805
1983
  });
806
1984
  if (push.ok) {
807
- return { ok: true, member, pushed: true, reconciled: true };
1985
+ return await confirmPushLanded({ ok: true, member, pushed: true, reconciled: true }, `D-push re-push after reconcile for member '${member}'`);
808
1986
  }
809
1987
 
810
- if (push.kind === 'auth') {
1988
+ if (push.kind === 'auth' && !push.selfHealed) {
811
1989
  // apra-fleet-spp.3: same mislabel class as the first-push/pull paths,
812
1990
  // just reached via the post-reconcile re-push -- a credential that
813
1991
  // lapsed mid-reconcile is not a data divergence, so it must not be
814
1992
  // folded into DoltDivergedError below.
1993
+ //
1994
+ // Reached only when the bounded self-heal did NOT re-provision (no
1995
+ // onAuthFailure wired, or the self-heal itself threw). With no
1996
+ // evidence that the credentials were refreshed, a stale credential is
1997
+ // still the best explanation and this stays an auth terminal.
815
1998
  throw new DoltSyncError(
816
1999
  `[Dolt] D-push re-push after reconcile for member '${member}' failed on VCS CREDENTIALS, not a data divergence -- re-provision the member's VCS auth (provision_vcs_auth) and retry. Raw: ${push.error}`,
817
2000
  { member, doltOutput: push.error, details: { kind: 'auth', operation: 'push-reconcile-repush' } },
818
2001
  );
819
2002
  }
820
2003
 
2004
+ if (push.kind === 'auth') {
2005
+ // AUTH-SHAPED BUT PROVABLY NOT AUTH (live 2026-09-11, fleet-lin-dev1).
2006
+ //
2007
+ // Reaching this line means ALL THREE of the following already
2008
+ // happened, in this order, against this same remote:
2009
+ // 1. the FIRST push was rejected non-fast-forward ('diverged') --
2010
+ // which is itself PROOF the remote authenticated this clone:
2011
+ // a remote cannot compare refs and reject a push it never let in;
2012
+ // 2. the bounded reconcile D-pull SUCCEEDED;
2013
+ // 3. the re-push failed auth-shaped, runDoltStep's one-shot
2014
+ // self-heal re-provisioned the credentials (`selfHealed`), and
2015
+ // the retry with the FRESH credentials failed identically.
2016
+ //
2017
+ // So the credentials are demonstrably fine and re-minting them again
2018
+ // cannot help. Dolt's chunk-upload phase ('addTableFiles,
2019
+ // updateManifestAddFiles') reports a stale/unfinished-reconcile push
2020
+ // with git's credential-prompt text ("could not read Username"),
2021
+ // which classifyDoltFailure -- correctly, in isolation -- reads as
2022
+ // auth. Treating it as auth here is what produced the observed
2023
+ // production pathology: the engine looped provision_vcs_auth (51
2024
+ // repeated failures across one run's logs, each reporting
2025
+ // "provision_vcs_auth succeeded" and then failing identically) and
2026
+ // terminated with the misleading "failed on VCS CREDENTIALS, not a
2027
+ // data divergence" reason, when the actual cause was a local Dolt
2028
+ // clone behind the remote that a plain pull-then-push cleared.
2029
+ //
2030
+ // Do NOT fix this by loosening the 'auth' patterns: each message
2031
+ // classifies correctly on its own, and widening them would regress
2032
+ // apra-fleet-spp (a real credential failure being read as
2033
+ // divergence). The signal is the SEQUENCE, so it is judged here.
2034
+ //
2035
+ // Remedy = the reconcile that did not finish: ONE more bounded
2036
+ // D-pull + re-push cycle, deliberately WITHOUT `onAuthFailure`, so
2037
+ // this path can never re-enter the credential-reprovision loop it
2038
+ // exists to break. Still bounded (two cycles total, never a loop),
2039
+ // keeping apra-fleet-417.3's first-successful-pusher-wins contract.
2040
+ log(`[Dolt] D-push re-push after reconcile for member '${member}' failed with auth-shaped text, but VCS credentials are provably NOT the cause: the first push's non-fast-forward rejection proves the remote authenticated this clone moments earlier, and the credentials have since been re-provisioned and still fail identically. Treating it as an unfinished reconcile (a local clone behind the remote) and running ONE more bounded D-pull + re-push, with credential self-heal disabled. Raw: ${push.error}`);
2041
+
2042
+ const secondReconcile = await runDoltStep({
2043
+ command, member, cmd: 'bd dolt pull',
2044
+ label: `D-push second reconcile pull for '${member}'`, log, maxTransientRetries, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
2045
+ });
2046
+ if (!secondReconcile.ok) {
2047
+ if (secondReconcile.kind === 'diverged') {
2048
+ return await surfaceDivergence(
2049
+ new DoltDivergedError(
2050
+ `[Dolt] D-push second reconcile pull for member '${member}' hit an unmergeable beads conflict -- must not be retried blindly: ${secondReconcile.error}`,
2051
+ { member, doltOutput: secondReconcile.error, operation: 'push-reconcile' },
2052
+ ),
2053
+ 'push-reconcile',
2054
+ );
2055
+ }
2056
+ throw new DoltSyncError(
2057
+ `[Dolt] D-push second reconcile pull for member '${member}' failed: ${secondReconcile.error}`,
2058
+ { member, doltOutput: secondReconcile.error },
2059
+ );
2060
+ }
2061
+
2062
+ landedCheck = await beginDoltPushLandedCheck(member, { command, log });
2063
+ push = await runDoltStep({
2064
+ command, member, cmd: 'bd dolt push',
2065
+ label: `D-push second re-push after reconcile for '${member}'`, log, maxTransientRetries, sleep, backoffBaseMs, timeoutS, spawnOutageBudgetMs, now,
2066
+ });
2067
+ if (push.ok) {
2068
+ return await confirmPushLanded({ ok: true, member, pushed: true, reconciled: true }, `D-push second re-push after reconcile for member '${member}'`);
2069
+ }
2070
+
2071
+ return await surfaceDivergence(
2072
+ new DoltDivergedError(
2073
+ `[Dolt] D-push for member '${member}' still rejected after TWO bounded reconcile pulls -- refusing to retry further. The failure text names VCS credentials, but they were re-provisioned mid-ladder and the remote authenticated this clone earlier in the same ladder, so this is a stale/unmergeable clone, not a credential problem: ${push.error}`,
2074
+ { member, doltOutput: push.error, operation: 'push' },
2075
+ ),
2076
+ 'push',
2077
+ );
2078
+ }
2079
+
821
2080
  // Still rejected after the one bounded reconcile, and not an auth failure.
822
2081
  return await surfaceDivergence(
823
2082
  new DoltDivergedError(
@@ -852,8 +2111,8 @@ export async function doltPushAfter(member, opts = {}) {
852
2111
  //
853
2112
  // ok -- did the sync do what it was asked to do (a benign skip is ok)
854
2113
  // kind -- 'synced' | 'no-remote' | 'empty-remote' | 'already-fresh'
855
- // | 'diverged' | 'auth' | 'transient' | 'remote-unreachable'
856
- // | 'unknown'
2114
+ // | 'remote-unchanged' | 'diverged' | 'auth' | 'transient'
2115
+ // | 'remote-unreachable' | 'unknown'
857
2116
  // degraded -- true when the sync FAILED and the sprint is continuing anyway
858
2117
  // detail -- one human-readable line (the underlying error's message)
859
2118
  // error -- the underlying typed error, retained for later escalation
@@ -961,16 +2220,20 @@ export function classifySyncError(err) {
961
2220
  // doltPushAfter), so it always maps to 'conflict-unresolvable' here, never
962
2221
  // 'conflict-resolvable' (that state exists only transiently, mid-reconcile,
963
2222
  // and is never itself reported as a degraded terminal outcome).
964
- const NEUTRAL_KIND_MAP = {
2223
+ export const NEUTRAL_KIND_MAP = Object.freeze({
965
2224
  diverged: 'conflict-unresolvable',
966
2225
  auth: 'auth',
967
2226
  transient: 'transient',
968
2227
  'no-remote': 'no-store',
969
2228
  'empty-remote': 'no-store',
970
2229
  'remote-unreachable': 'store-unreachable',
2230
+ // A missing bd/dolt binary on the member (GitHub #616). The ADR taxonomy
2231
+ // has no environment-fault kind, and 'store-unreachable' would misreport a
2232
+ // reachable store, so it maps to 'unknown' -- explicitly, not by fallback.
2233
+ 'missing-tool': 'unknown',
971
2234
  unknown: 'unknown',
972
2235
  error: 'unknown',
973
- };
2236
+ });
974
2237
 
975
2238
  /**
976
2239
  * Map an adapter-flavored outcome `kind` (classifySyncError's return value) to
@@ -1137,16 +2400,19 @@ async function runDegradable(run, ctx) {
1137
2400
  */
1138
2401
  export async function syncBefore(member, opts = {}) {
1139
2402
  const { readinessGate = false, skipRefresh, fatal, onDegraded, healthGate, skipPull, ...rest } = opts;
2403
+ // Both renames (healthGate -> readinessGate, skipPull -> skipRefresh) came
2404
+ // from apra-fleet-417.5 (ADR Decision 2). The tracker id lives here, in a
2405
+ // comment, because the thrown messages below are runtime strings.
1140
2406
  if (healthGate !== undefined) {
1141
2407
  throw new Error(
1142
2408
  "DoltSync.syncBefore: opts.healthGate is retired -- pass opts.readinessGate instead " +
1143
- "(docs/adr-taskdb-backend-neutral-interface.md Decision 2, apra-fleet-417.5).",
2409
+ "(docs/adr-taskdb-backend-neutral-interface.md Decision 2).",
1144
2410
  );
1145
2411
  }
1146
2412
  if (skipPull !== undefined) {
1147
2413
  throw new Error(
1148
2414
  "DoltSync.syncBefore: opts.skipPull is retired -- pass opts.skipRefresh instead " +
1149
- "(docs/adr-taskdb-backend-neutral-interface.md Decision 2, apra-fleet-417.5).",
2415
+ "(docs/adr-taskdb-backend-neutral-interface.md Decision 2).",
1150
2416
  );
1151
2417
  }
1152
2418
  const adapterOpts = { ...rest, skipPull: skipRefresh };
@@ -1327,6 +2593,10 @@ export async function repair(member, opts = {}) {
1327
2593
  if (typeof command !== 'function') {
1328
2594
  return { repaired: false, escalation: 'not-configured: repair() requires an injected command() to run settle' };
1329
2595
  }
2596
+ // An operator/tool remediation can rewire this clone's remote and always
2597
+ // moves it off whatever tip we last observed, so drop both memos up front
2598
+ // (a repair must never be decided against, or leave behind, cached state).
2599
+ forgetMemberSyncState(member);
1330
2600
  const settle = typeof opts.settle === 'function'
1331
2601
  ? opts.settle
1332
2602
  : buildSettleCallback(member, { command, log, platform, arch, shell });
@@ -1356,6 +2626,19 @@ export const DoltSync = {
1356
2626
  capabilities,
1357
2627
  getDegradedSyncRecords,
1358
2628
  clearDegradedSyncRecords,
2629
+ // sync.remote memo (apra-fleet-akuv) -- noteMemberCommand() is the seam the
2630
+ // runner's central command() wrapper calls on every member-bound command;
2631
+ // noteMemberDispatchCompleted() is the soft seam its central agent()
2632
+ // wrapper calls once per settled dispatch (agent-side bd commands never
2633
+ // pass through command(), so this is how a member gets marked for the
2634
+ // lazy sync.remote re-check before any fingerprint skip).
2635
+ noteMemberCommand,
2636
+ noteMemberDispatchCompleted,
2637
+ invalidateSyncRemoteCache,
2638
+ // Remote-tip fingerprint state, exposed for tests and operator tooling.
2639
+ getLastSyncedTip,
2640
+ setLastSyncedTip,
2641
+ clearLastSyncedTip,
1359
2642
  };
1360
2643
 
1361
2644
  export default DoltSync;