@adhdev/daemon-core 0.9.82-rc.36 → 0.9.82-rc.361

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 (335) hide show
  1. package/dist/boot/daemon-lifecycle.d.ts +8 -0
  2. package/dist/boot/process-hardening.d.ts +50 -0
  3. package/dist/build-info.d.ts +37 -0
  4. package/dist/chat/source-machine.d.ts +166 -0
  5. package/dist/chat/source-resolver.d.ts +104 -0
  6. package/dist/chat/subscription-updates.d.ts +1 -0
  7. package/dist/cli-adapter-types.d.ts +55 -2
  8. package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
  9. package/dist/cli-adapters/cli-state-engine.d.ts +198 -0
  10. package/dist/cli-adapters/provider-cli-adapter.d.ts +116 -64
  11. package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
  12. package/dist/cli-adapters/provider-cli-runtime.d.ts +34 -0
  13. package/dist/cli-adapters/provider-cli-shared.d.ts +53 -0
  14. package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
  15. package/dist/cli-adapters/resolve-executable.d.ts +14 -0
  16. package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +6 -3
  17. package/dist/cli-adapters/terminal-backends/types.d.ts +10 -2
  18. package/dist/cli-adapters/terminal-screen.d.ts +4 -11
  19. package/dist/commands/cli-manager.d.ts +15 -1
  20. package/dist/commands/handler.d.ts +125 -0
  21. package/dist/commands/low-family/index.d.ts +3 -0
  22. package/dist/commands/low-family/refine-config.d.ts +2 -0
  23. package/dist/commands/low-family/session-host.d.ts +2 -0
  24. package/dist/commands/low-family/spec-providerdev.d.ts +11 -0
  25. package/dist/commands/low-family/types.d.ts +16 -0
  26. package/dist/commands/mesh-coordinator.d.ts +85 -1
  27. package/dist/commands/router.d.ts +336 -2
  28. package/dist/commands/upgrade-helper.d.ts +41 -1
  29. package/dist/config/chat-history.d.ts +9 -0
  30. package/dist/config/config.d.ts +5 -0
  31. package/dist/config/mesh-config.d.ts +77 -1
  32. package/dist/detection/ide-detector.d.ts +13 -0
  33. package/dist/detection/win32-ide-version.d.ts +37 -0
  34. package/dist/git/change-impact-config.d.ts +159 -0
  35. package/dist/git/git-commands.d.ts +11 -1
  36. package/dist/git/git-diff.d.ts +6 -0
  37. package/dist/git/git-executor.d.ts +11 -0
  38. package/dist/git/git-status.d.ts +23 -0
  39. package/dist/git/git-types.d.ts +2 -50
  40. package/dist/git/index.d.ts +2 -0
  41. package/dist/index.d.ts +54 -13
  42. package/dist/index.js +41337 -14723
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +44100 -17614
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/installer.d.ts +1 -4
  47. package/dist/ipc/local-ipc-server.d.ts +91 -0
  48. package/dist/launch.d.ts +1 -1
  49. package/dist/logging/async-batch-writer.d.ts +10 -0
  50. package/dist/logging/log-redactor.d.ts +24 -0
  51. package/dist/logging/log-tail-reader.d.ts +46 -0
  52. package/dist/logging/logger.d.ts +1 -1
  53. package/dist/mesh/contracts.d.ts +164 -0
  54. package/dist/mesh/coordinator-prompt.d.ts +36 -0
  55. package/dist/mesh/coordinator-registry.d.ts +59 -0
  56. package/dist/mesh/mesh-active-work.d.ts +174 -0
  57. package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
  58. package/dist/mesh/mesh-event-trace.d.ts +21 -0
  59. package/dist/mesh/mesh-events-coordinator.d.ts +170 -0
  60. package/dist/mesh/mesh-events-pending.d.ts +55 -0
  61. package/dist/mesh/mesh-events-stale.d.ts +40 -0
  62. package/dist/mesh/mesh-events-utils.d.ts +60 -0
  63. package/dist/mesh/mesh-events.d.ts +6 -49
  64. package/dist/mesh/mesh-fast-forward.d.ts +81 -0
  65. package/dist/mesh/mesh-host-ownership.d.ts +9 -0
  66. package/dist/mesh/mesh-init.d.ts +86 -0
  67. package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -3
  68. package/dist/mesh/mesh-ledger.d.ts +77 -1
  69. package/dist/mesh/mesh-missions.d.ts +164 -0
  70. package/dist/mesh/mesh-reconcile-loop.d.ts +7 -0
  71. package/dist/mesh/mesh-refine-batch.d.ts +68 -0
  72. package/dist/mesh/mesh-refine-status.d.ts +62 -0
  73. package/dist/mesh/mesh-review-inbox.d.ts +90 -0
  74. package/dist/mesh/mesh-routing.d.ts +70 -0
  75. package/dist/mesh/mesh-runtime-store.d.ts +429 -0
  76. package/dist/mesh/mesh-task-stats.d.ts +49 -0
  77. package/dist/mesh/mesh-unresolved-forward-outbox.d.ts +30 -0
  78. package/dist/mesh/mesh-work-queue.d.ts +246 -5
  79. package/dist/mesh/preview-freshness.d.ts +18 -0
  80. package/dist/mesh/refine-config.d.ts +216 -0
  81. package/dist/mesh/worktree-bootstrap-config.d.ts +135 -0
  82. package/dist/providers/acp-provider-instance.d.ts +5 -0
  83. package/dist/providers/approval-utils.d.ts +20 -0
  84. package/dist/providers/chat-message-normalization.d.ts +12 -0
  85. package/dist/providers/cli-provider-instance.d.ts +106 -3
  86. package/dist/providers/contracts.d.ts +139 -6
  87. package/dist/providers/external-sources.d.ts +71 -0
  88. package/dist/providers/manual-attendance.d.ts +63 -0
  89. package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
  90. package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
  91. package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
  92. package/dist/providers/native-history/dispatcher.d.ts +27 -0
  93. package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
  94. package/dist/providers/native-history/index.d.ts +13 -0
  95. package/dist/providers/provider-instance-manager.d.ts +14 -0
  96. package/dist/providers/provider-instance.d.ts +23 -1
  97. package/dist/providers/provider-loader.d.ts +26 -4
  98. package/dist/providers/provider-trust.d.ts +31 -0
  99. package/dist/providers/read-chat-contract.d.ts +29 -0
  100. package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
  101. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +86 -0
  102. package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
  103. package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
  104. package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
  105. package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
  106. package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
  107. package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
  108. package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
  109. package/dist/providers/sdk/v1/index.d.ts +30 -0
  110. package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
  111. package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
  112. package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
  113. package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
  114. package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
  115. package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
  116. package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
  117. package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
  118. package/dist/providers/spec/adapter.d.ts +91 -0
  119. package/dist/providers/spec/cli-adapter.d.ts +223 -0
  120. package/dist/providers/spec/evaluator.d.ts +45 -0
  121. package/dist/providers/spec/fsm-driver.d.ts +368 -0
  122. package/dist/providers/spec/fsm-evaluator.d.ts +76 -0
  123. package/dist/providers/spec/fsm-loader.d.ts +14 -0
  124. package/dist/providers/spec/fsm-types.d.ts +174 -0
  125. package/dist/providers/spec/native-history-executor.d.ts +41 -0
  126. package/dist/providers/spec/pre-launch-trust.d.ts +16 -0
  127. package/dist/providers/spec/route.d.ts +4 -0
  128. package/dist/providers/spec/types.d.ts +222 -0
  129. package/dist/providers/status-monitor.d.ts +7 -7
  130. package/dist/providers/transcript-v2.d.ts +176 -0
  131. package/dist/providers/types/interactive-prompt.d.ts +84 -0
  132. package/dist/providers/working-dir.d.ts +17 -0
  133. package/dist/repo-mesh-types.d.ts +295 -13
  134. package/dist/sessions/registry.d.ts +6 -0
  135. package/dist/shared-types-extra.d.ts +2 -4
  136. package/dist/shared-types.d.ts +59 -2
  137. package/dist/status/normalize.d.ts +1 -1
  138. package/dist/status/normalize.js +1 -0
  139. package/dist/status/normalize.js.map +1 -1
  140. package/dist/status/normalize.mjs +1 -0
  141. package/dist/status/normalize.mjs.map +1 -1
  142. package/dist/status/reporter.d.ts +2 -0
  143. package/dist/status/snapshot.d.ts +26 -0
  144. package/dist/system/load-better-sqlite3.d.ts +21 -0
  145. package/dist/types.d.ts +5 -0
  146. package/package.json +7 -3
  147. package/src/agent-stream/poller.ts +2 -3
  148. package/src/agent-stream/provider-adapter.ts +1 -1
  149. package/src/boot/daemon-lifecycle.ts +55 -12
  150. package/src/boot/process-hardening.ts +89 -0
  151. package/src/build-info.ts +73 -0
  152. package/src/chat/source-machine.ts +534 -0
  153. package/src/chat/source-resolver.ts +0 -0
  154. package/src/chat/subscription-updates.ts +20 -1
  155. package/src/cli-adapter-types.d.ts +1 -0
  156. package/src/cli-adapter-types.ts +56 -2
  157. package/src/cli-adapters/cli-script-runner.ts +421 -0
  158. package/src/cli-adapters/cli-state-engine.ts +1215 -0
  159. package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
  160. package/src/cli-adapters/provider-cli-adapter.ts +774 -1141
  161. package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
  162. package/src/cli-adapters/provider-cli-parse.ts +13 -0
  163. package/src/cli-adapters/provider-cli-runtime.ts +56 -7
  164. package/src/cli-adapters/provider-cli-shared.d.ts +4 -0
  165. package/src/cli-adapters/provider-cli-shared.ts +100 -11
  166. package/src/cli-adapters/pty-transport.ts +2 -1
  167. package/src/cli-adapters/raw-terminal-io.ts +252 -0
  168. package/src/cli-adapters/resolve-executable.ts +90 -0
  169. package/src/cli-adapters/session-host-transport.ts +2 -1
  170. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +53 -29
  171. package/src/cli-adapters/terminal-backends/types.ts +10 -3
  172. package/src/cli-adapters/terminal-screen.ts +16 -81
  173. package/src/commands/WINDOWS-UPGRADE-LOCK-FAILURE.md +198 -0
  174. package/src/commands/chat-commands.ts +1823 -62
  175. package/src/commands/cli-manager.ts +405 -23
  176. package/src/commands/handler.ts +841 -2
  177. package/src/commands/low-family/index.ts +23 -0
  178. package/src/commands/low-family/refine-config.ts +106 -0
  179. package/src/commands/low-family/session-host.ts +274 -0
  180. package/src/commands/low-family/spec-providerdev.ts +217 -0
  181. package/src/commands/low-family/types.ts +19 -0
  182. package/src/commands/mesh-coordinator.ts +332 -122
  183. package/src/commands/router.ts +7195 -1423
  184. package/src/commands/stream-commands.ts +8 -0
  185. package/src/commands/upgrade-helper.ts +310 -45
  186. package/src/config/chat-history.ts +483 -24
  187. package/src/config/config.ts +12 -0
  188. package/src/config/mesh-config.ts +388 -6
  189. package/src/config/recent-activity.ts +8 -2
  190. package/src/daemon/dev-auto-implement.ts +3 -2
  191. package/src/daemon/dev-cli-debug.ts +10 -1
  192. package/src/detection/cli-detector.ts +28 -9
  193. package/src/detection/ide-detector.ts +55 -16
  194. package/src/detection/win32-ide-version.ts +106 -0
  195. package/src/git/change-impact-config.ts +354 -0
  196. package/src/git/git-commands.ts +55 -14
  197. package/src/git/git-diff.ts +81 -11
  198. package/src/git/git-executor.ts +12 -0
  199. package/src/git/git-status.ts +574 -43
  200. package/src/git/git-types.ts +14 -62
  201. package/src/git/git-worktree.ts +8 -1
  202. package/src/git/index.ts +16 -0
  203. package/src/index.ts +156 -12
  204. package/src/installer.d.ts +1 -1
  205. package/src/installer.ts +8 -6
  206. package/src/ipc/local-ipc-server.ts +278 -0
  207. package/src/launch.d.ts +1 -1
  208. package/src/launch.ts +37 -28
  209. package/src/logging/async-batch-writer.ts +55 -0
  210. package/src/logging/command-log.ts +7 -5
  211. package/src/logging/log-redactor.ts +100 -0
  212. package/src/logging/log-tail-reader.ts +220 -0
  213. package/src/logging/logger.ts +14 -7
  214. package/src/mesh/contracts.ts +338 -0
  215. package/src/mesh/coordinator-prompt.ts +234 -31
  216. package/src/mesh/coordinator-registry.ts +121 -0
  217. package/src/mesh/mesh-active-work.ts +667 -0
  218. package/src/mesh/mesh-delivery-policy.ts +315 -0
  219. package/src/mesh/mesh-event-trace.ts +67 -0
  220. package/src/mesh/mesh-events-coordinator.ts +2572 -0
  221. package/src/mesh/mesh-events-pending.ts +599 -0
  222. package/src/mesh/mesh-events-stale.ts +309 -0
  223. package/src/mesh/mesh-events-utils.ts +361 -0
  224. package/src/mesh/mesh-events.ts +30 -1035
  225. package/src/mesh/mesh-fast-forward.ts +839 -0
  226. package/src/mesh/mesh-host-ownership.ts +73 -0
  227. package/src/mesh/mesh-init.ts +260 -0
  228. package/src/mesh/mesh-ledger-reconciliation.ts +12 -5
  229. package/src/mesh/mesh-ledger.ts +591 -102
  230. package/src/mesh/mesh-missions.ts +322 -0
  231. package/src/mesh/mesh-reconcile-loop.ts +1096 -0
  232. package/src/mesh/mesh-refine-batch.ts +197 -0
  233. package/src/mesh/mesh-refine-status.ts +231 -0
  234. package/src/mesh/mesh-review-inbox.ts +307 -0
  235. package/src/mesh/mesh-routing.ts +291 -0
  236. package/src/mesh/mesh-runtime-store.ts +1697 -0
  237. package/src/mesh/mesh-task-stats.ts +161 -0
  238. package/src/mesh/mesh-unresolved-forward-outbox.ts +185 -0
  239. package/src/mesh/mesh-work-queue.ts +997 -141
  240. package/src/mesh/preview-freshness.ts +118 -0
  241. package/src/mesh/refine-config.ts +423 -0
  242. package/src/mesh/worktree-bootstrap-config.ts +331 -0
  243. package/src/providers/acp-provider-instance.ts +43 -10
  244. package/src/providers/approval-utils.d.ts +5 -0
  245. package/src/providers/approval-utils.ts +57 -5
  246. package/src/providers/chat-message-normalization.ts +45 -5
  247. package/src/providers/cli-provider-instance.ts +1267 -101
  248. package/src/providers/contracts.d.ts +55 -0
  249. package/src/providers/contracts.ts +150 -6
  250. package/src/providers/extension-provider-instance.ts +12 -7
  251. package/src/providers/external-sources.ts +218 -0
  252. package/src/providers/ide-provider-instance.ts +35 -12
  253. package/src/providers/manual-attendance.ts +85 -0
  254. package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
  255. package/src/providers/native-history/claude-cli-transcript.ts +396 -0
  256. package/src/providers/native-history/codex-cli-transcript.ts +479 -0
  257. package/src/providers/native-history/dispatcher.ts +340 -0
  258. package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
  259. package/src/providers/native-history/index.ts +30 -0
  260. package/src/providers/provider-instance-manager.ts +30 -0
  261. package/src/providers/provider-instance.ts +19 -1
  262. package/src/providers/provider-loader.ts +670 -50
  263. package/src/providers/provider-schema.ts +87 -14
  264. package/src/providers/provider-trust.ts +114 -0
  265. package/src/providers/read-chat-contract.ts +76 -16
  266. package/src/providers/sdk/README.md +49 -0
  267. package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
  268. package/src/providers/sdk/v1/builders/cli/detect-status.ts +313 -0
  269. package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
  270. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +250 -0
  271. package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
  272. package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
  273. package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
  274. package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
  275. package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
  276. package/src/providers/sdk/v1/index.ts +152 -0
  277. package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
  278. package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
  279. package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
  280. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +504 -0
  281. package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
  282. package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
  283. package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
  284. package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
  285. package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
  286. package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
  287. package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
  288. package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
  289. package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
  290. package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
  291. package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
  292. package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
  293. package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
  294. package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
  295. package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
  296. package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
  297. package/src/providers/sdk/v1/types/cli/index.ts +365 -0
  298. package/src/providers/sdk/v1/types/common/index.ts +229 -0
  299. package/src/providers/sdk/v1/validators/index.ts +19 -0
  300. package/src/providers/sdk/v1/validators/manifest.ts +110 -0
  301. package/src/providers/sdk/v1/validators/taint.ts +309 -0
  302. package/src/providers/spec/adapter.ts +235 -0
  303. package/src/providers/spec/cli-adapter.ts +1051 -0
  304. package/src/providers/spec/evaluator.ts +407 -0
  305. package/src/providers/spec/fsm-driver.ts +1251 -0
  306. package/src/providers/spec/fsm-evaluator.ts +272 -0
  307. package/src/providers/spec/fsm-loader.ts +120 -0
  308. package/src/providers/spec/fsm-types.ts +273 -0
  309. package/src/providers/spec/native-history-executor.ts +1136 -0
  310. package/src/providers/spec/pre-launch-trust.ts +104 -0
  311. package/src/providers/spec/route.ts +51 -0
  312. package/src/providers/spec/types.ts +262 -0
  313. package/src/providers/status-monitor.d.ts +7 -7
  314. package/src/providers/status-monitor.ts +37 -22
  315. package/src/providers/transcript-v2.ts +567 -0
  316. package/src/providers/types/interactive-prompt.ts +536 -0
  317. package/src/providers/version-archive.ts +64 -24
  318. package/src/providers/working-dir.ts +23 -0
  319. package/src/repo-mesh-types.ts +378 -14
  320. package/src/sessions/registry.ts +6 -0
  321. package/src/shared-types-extra.ts +2 -4
  322. package/src/shared-types.d.ts +8 -0
  323. package/src/shared-types.ts +64 -1
  324. package/src/status/builders.ts +26 -6
  325. package/src/status/normalize.ts +2 -0
  326. package/src/status/reporter.ts +19 -1
  327. package/src/status/snapshot.ts +95 -26
  328. package/src/system/host-memory.ts +29 -12
  329. package/src/system/load-better-sqlite3.ts +68 -0
  330. package/src/types.ts +5 -0
  331. package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
  332. package/dist/mesh/mesh-sync.d.ts +0 -53
  333. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
  334. package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
  335. package/src/mesh/mesh-sync.ts +0 -111
@@ -14,6 +14,198 @@ import { DaemonCliManager } from './cli-manager.js';
14
14
  import type { ProviderLoader } from '../providers/provider-loader.js';
15
15
  import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
16
16
  import { SessionRegistry } from '../sessions/registry.js';
17
+ export declare function buildMeshNodeDisplayLabel(node: Record<string, unknown>, nodeId: string, providerPriority: string[]): string;
18
+ /**
19
+ * Resolve the owning-node attribution for a mesh node record so a coordinator can
20
+ * stamp the TRUE owner onto a synthetic session entry instead of letting the
21
+ * dashboard fall back to the coordinator's own daemonId. Returns whichever of the
22
+ * owning node's `daemonId` / display machine name could be read from the node's
23
+ * (possibly multi-serialization-path) shape; both may be undefined for a node that
24
+ * never carried machine identity.
25
+ */
26
+ export declare function resolveMeshNodeAttribution(node: unknown): {
27
+ daemonId?: string;
28
+ machineName?: string;
29
+ };
30
+ export declare function readCachedInlineMeshActiveSessionDetails(node: any): Array<Record<string, unknown>>;
31
+ type MeshRefineStageStatus = 'passed' | 'failed' | 'skipped';
32
+ type MeshRefinePatchEquivalenceSummary = {
33
+ status: MeshRefineStageStatus;
34
+ equivalent: boolean;
35
+ baseHead: string;
36
+ branchHead: string;
37
+ mergeBase?: string;
38
+ mergedTree?: string;
39
+ expectedPatchId?: string;
40
+ actualPatchId?: string;
41
+ durationMs: number;
42
+ error?: string;
43
+ stdout?: string;
44
+ stderr?: string;
45
+ actionableHint?: MeshRefineSubmoduleConflictHint;
46
+ /**
47
+ * Set when a `merge-tree` submodule conflict was reclassified as a trivial
48
+ * gitlink fast-forward and the gate passed via a synthesized merge tree.
49
+ */
50
+ gitlinkTrivialFastForward?: {
51
+ resolved: boolean;
52
+ gitlinks: Array<{
53
+ path: string;
54
+ baseCommit?: string;
55
+ branchCommit?: string;
56
+ fastForward: boolean;
57
+ }>;
58
+ reason?: string;
59
+ };
60
+ };
61
+ type MeshRefineEffectiveDiffSummary = {
62
+ status: MeshRefineStageStatus;
63
+ /** True when there is at least one root-tree change between base and branch (incl. gitlink bumps). */
64
+ hasEffectiveDiff: boolean;
65
+ baseHead: string;
66
+ branchHead: string;
67
+ /** Root-level paths that differ between base and branch (capped). */
68
+ changedPaths?: string[];
69
+ /** Submodule paths with uncommitted/divergent commits but NO committed gitlink bump in the root tree. */
70
+ submoduleHints?: Array<{
71
+ path: string;
72
+ reason: string;
73
+ }>;
74
+ durationMs: number;
75
+ error?: string;
76
+ stdout?: string;
77
+ stderr?: string;
78
+ };
79
+ type MeshRefineSubmoduleConflictHint = {
80
+ kind: 'submodule_conflict';
81
+ message: string;
82
+ conflicts: Array<{
83
+ path: string;
84
+ baseCommit?: string;
85
+ branchCommit?: string;
86
+ }>;
87
+ nextSteps: string[];
88
+ };
89
+ /**
90
+ * A spawn-resolution failure is when the executable itself could not be found by
91
+ * the OS spawn boundary — `spawn <cmd> ENOENT` — as opposed to the command
92
+ * running and exiting non-zero. On win32 this is the .cmd-shim case: libuv's
93
+ * spawn search appends only .com/.exe, so a bare `npm`/`npx`/`tsc` (which are
94
+ * .cmd shims) ENOENTs even though it is installed. It carries no stderr, so it
95
+ * must be detected by error.code/syscall, not by string-matching output.
96
+ */
97
+ export declare function isSpawnResolutionError(error: any): boolean;
98
+ export declare function describeSpawnError(error: any, command: string, spawnResolutionFailed: boolean): string;
99
+ export declare function runMeshRefinePatchEquivalenceGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefinePatchEquivalenceSummary>;
100
+ export type MeshWorktreePatchContainmentSummary = {
101
+ /** True only when merging worktreeHead into ref introduces no new patch. */
102
+ contained: boolean;
103
+ ref: string;
104
+ worktreeHead: string;
105
+ mergeBase?: string;
106
+ mergedTree?: string;
107
+ /** patch-id of (ref -> synthesized merge tree); empty string when nothing new is added. */
108
+ residualPatchId?: string;
109
+ durationMs: number;
110
+ /** Set when the check could not run (treated conservatively as NOT contained). */
111
+ error?: string;
112
+ };
113
+ /**
114
+ * Patch-equivalence containment check for the worktree force-cleanup convergence
115
+ * guard. Answers a narrower question than {@link runMeshRefinePatchEquivalenceGate}:
116
+ * "are the worktree branch's changes ALREADY present in `ref` (e.g. origin/main),
117
+ * even though the worktree HEAD's commit SHA is not an ancestor of ref?"
118
+ *
119
+ * This is the cherry-pick / squash / rebase case: the same content landed on the
120
+ * default ref under a different commit SHA, so `merge-base --is-ancestor` (the
121
+ * primary cleanup guard) reports the worktree as un-converged and refuses to
122
+ * remove it. Refinery already accepts patch-equivalent landings via merge-tree +
123
+ * patch-id; this brings the same notion of "convergence" to the cleanup guard.
124
+ *
125
+ * Mechanism: synthesize the merge of `worktreeHead` into `ref` (reusing the same
126
+ * trivial-gitlink-fast-forward handling as the refine gate) and compute the
127
+ * patch-id of (ref -> mergedTree). If that residual diff is EMPTY, merging the
128
+ * worktree adds nothing new on top of ref — its changes are already present there
129
+ * and the worktree is safe to remove. A non-empty residual means the worktree
130
+ * still carries content not in ref, so it is NOT contained and must stay blocked.
131
+ *
132
+ * Conservative by construction: any merge-tree / patch-id failure, a genuine
133
+ * (non-trivial) submodule conflict, or any thrown error yields `contained: false`
134
+ * so an exception can never widen the cleanup allow-list.
135
+ */
136
+ export declare function checkWorktreeChangesPatchEquivalentInRef(repoRoot: string, ref: string, worktreeHead: string): Promise<MeshWorktreePatchContainmentSummary>;
137
+ /**
138
+ * No-op guard: detect a "silent no-op" merge before the Refinery merge runs.
139
+ *
140
+ * A silent no-op occurs when the refine target branch's ROOT tree is byte-identical
141
+ * to the merge base (origin/main). This is the trap where a submodule (e.g. oss) has
142
+ * real commits but the root branch never committed the gitlink (oss-pointer) bump, so
143
+ * the root diff Refinery would merge is empty. Merging that produces a merge commit with
144
+ * no content change — reported as "success" while the actual work never reaches main.
145
+ *
146
+ * A committed gitlink bump (the legitimate oss-pointer bump) DOES show up in the root
147
+ * tree diff (as a 160000-mode entry), so this guard does NOT block legitimate refines —
148
+ * it only fires when the root tree diff vs base is COMPLETELY empty.
149
+ *
150
+ * Runs after the patch-equivalence gate; the "already merged via other path" case
151
+ * (branch has real changes already present in base) is handled upstream and never
152
+ * reaches here, so an empty root diff at this point is genuinely a no-op.
153
+ */
154
+ export declare function runMeshRefineEffectiveDiffGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefineEffectiveDiffSummary>;
155
+ /**
156
+ * Result of evaluating whether a `git merge-tree --write-tree` submodule
157
+ * conflict is in fact a trivial gitlink fast-forward that should pass the
158
+ * patch-equivalence gate.
159
+ *
160
+ * `git merge-tree` (and `git merge` with the default recursive strategy)
161
+ * refuses to 3-way merge gitlinks unless the case is "trivial" — and it
162
+ * treats *any* gitlink that differs across merge-base/base/branch as
163
+ * non-trivial, even when the branch-side commit is a strict descendant of the
164
+ * base-side commit (i.e. a real fast-forward). Refinery only ever wants to
165
+ * accept the branch's recorded gitlink, so a fast-forwardable bump is safe to
166
+ * resolve to the branch side without any conflict.
167
+ */
168
+ type GitlinkTrivialFastForwardEvaluation = {
169
+ /** True only when the merge-tree conflict is *fully* explained by trivial-ff gitlinks. */
170
+ trivial: boolean;
171
+ /** Why the evaluation declined to treat the conflict as trivial (set when trivial=false). */
172
+ reason?: string;
173
+ /** Per-path detail for the changed gitlinks that were inspected. */
174
+ gitlinks: Array<{
175
+ path: string;
176
+ baseCommit?: string;
177
+ branchCommit?: string;
178
+ fastForward: boolean;
179
+ }>;
180
+ };
181
+ /**
182
+ * Return the changed gitlink paths between base and branch whose advance is a
183
+ * strict fast-forward (the base-side commit is an ancestor of the branch-side
184
+ * commit inside that submodule's repo). These are the paths whose patch-id hunk
185
+ * may legitimately differ when base has advanced the same submodule, so they
186
+ * are safe to exclude from the patch-equivalence comparison. A non-ff (genuinely
187
+ * diverged) gitlink is deliberately excluded from this set so it still fails the
188
+ * gate.
189
+ */
190
+ export declare function collectFastForwardGitlinkPaths(repoRoot: string, baseHead: string, branchHead: string): string[];
191
+ /**
192
+ * Decide whether a merge-tree submodule conflict between base and branch is a
193
+ * trivial gitlink fast-forward (and nothing else).
194
+ *
195
+ * The conflict is treated as trivial ONLY when:
196
+ * 1. at least one changed gitlink exists,
197
+ * 2. every changed gitlink fast-forwards (base-commit is an ancestor of the
198
+ * branch-commit inside that submodule's repo), and
199
+ * 3. the *only* paths that changed on both sides of the merge (i.e. the paths
200
+ * that could possibly produce a 3-way conflict — the intersection of
201
+ * mergeBase→base and mergeBase→branch changes) are gitlinks. Any
202
+ * overlapping non-gitlink path means a genuine content conflict could be
203
+ * hiding behind the submodule failure, so we keep the block.
204
+ *
205
+ * If any of these fail, the conflict is left as a genuine block. This never
206
+ * passes a regular-file conflict or a diverged (non-ff) gitlink.
207
+ */
208
+ export declare function evaluateGitlinkTrivialFastForward(repoRoot: string, baseHead: string, branchHead: string): GitlinkTrivialFastForwardEvaluation;
17
209
  export interface SessionHostControlPlane {
18
210
  getDiagnostics(payload?: {
19
211
  includeSessions?: boolean;
@@ -55,12 +247,14 @@ export interface CommandRouterDeps {
55
247
  value: any[];
56
248
  };
57
249
  sessionRegistry: SessionRegistry;
58
- /** Callback for CDP manager creation after launch_ide */
250
+ /** Callback after CDP manager created (transport-specific extras) */
59
251
  onCdpManagerCreated?: (ideType: string, manager: DaemonCdpManager) => void;
60
252
  /** Callback after IDE connected (e.g., startAgentStreamPolling) */
61
253
  onIdeConnected?: () => void;
62
254
  /** Callback after status change (stop_ide, restart) */
63
255
  onStatusChange?: () => void;
256
+ /** Callback when a mesh state is invalidated */
257
+ onMeshStateChange?: (meshId: string) => void;
64
258
  /** Callback after chat-related commands */
65
259
  onPostChatCommand?: () => void;
66
260
  /** Get a connected CDP manager (for agent stream reset check) */
@@ -87,20 +281,102 @@ export declare class DaemonCommandRouter {
87
281
  * Allows the MCP server to query mesh data via get_mesh even when
88
282
  * the mesh doesn't exist in the local meshes.json file. */
89
283
  private inlineMeshCache;
284
+ /** Tombstones for inline mesh nodes removed via remove_mesh_node, keyed by
285
+ * meshId → set of removed nodeIds. The dashboard keeps echoing the removed
286
+ * node in the inlineMesh it attaches to every command; without a tombstone,
287
+ * reconcileInlineMeshCache MERGEs it straight back (resurrection). A
288
+ * tombstoned node is skipped during reconcile only while its workspace is
289
+ * absent from disk — a genuine re-registration (same nodeId, workspace back
290
+ * on disk) clears the tombstone and merges normally, preserving clone
291
+ * worktree visibility and legitimate node re-creation. */
292
+ private removedInlineMeshNodeIds;
293
+ /** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
294
+ private aggregateMeshStatusCache;
295
+ /** Shared per-peer git_status probe dedup + recently-probed reuse gate.
296
+ * Spans separate mesh_status/get_mesh calls so the dashboard auto-retry
297
+ * loop cannot storm a slow peer with back-to-back refreshUpstream probes. */
298
+ private meshGitProbeCache;
299
+ /** In-memory async Refinery jobs keyed by meshId:nodeId to reject/return duplicate in-flight requests. */
300
+ private runningRefineJobs;
301
+ /** Terminal async Refinery jobs preserve a clear answer after the worktree node has been removed. */
302
+ private terminalRefineJobs;
303
+ /** In-memory async batch Refinery jobs keyed by meshId (one batch convergence per mesh at a time). */
304
+ private runningRefineBatchJobs;
305
+ /** Terminal async batch Refinery jobs preserve the last batch outcome for late readers. */
306
+ private terminalRefineBatchJobs;
90
307
  constructor(deps: CommandRouterDeps);
308
+ private cloneJsonValue;
309
+ private hydrateCachedAggregateMeshStatusFromInline;
310
+ private getCachedAggregateMeshStatus;
311
+ private rememberAggregateMeshStatus;
312
+ getCachedInlineMeshNodes(): any[];
313
+ /**
314
+ * Resolve the REMOTE worker daemonId that owns a given session, when the session
315
+ * belongs to a mesh node hosted on a DIFFERENT daemon than this coordinator.
316
+ *
317
+ * The coordinator does not host remote-worker session instances in its own
318
+ * instanceManager/sessionRegistry — only their cached mesh-node metadata. A
319
+ * dashboard-issued session-scoped command (invoke_provider_script / resolve_action /
320
+ * set_mode / …) lands on the coordinator with a targetSessionId the coordinator can't
321
+ * find locally, and without forwarding it dies as "Live session not found". send_chat
322
+ * happens to survive (its target resolves to the worker by another route), but the
323
+ * controlbar commands do not — so the controlbar buttons appear to do nothing.
324
+ *
325
+ * Mirror the existing node-level remote-forward pattern (fast_forward_mesh_node etc.):
326
+ * scan the candidate mesh nodes for the one hosting the targetSessionId, and return its
327
+ * daemonId when that daemonId is a remote daemon (i.e. not this coordinator's own
328
+ * statusInstanceId). Returns undefined for a locally-hosted session (no forward — execute
329
+ * locally as before) or when ownership can't be resolved.
330
+ *
331
+ * The candidate set spans BOTH the cached inline-mesh nodes and the live aggregate
332
+ * mesh-status snapshots. The inline cache reliably carries only each node's single primary
333
+ * session (cachedStatus.activeSession), so a worker hosting more than one session exposes its
334
+ * non-primary sessions only on the aggregate snapshot nodes (status.activeSessions /
335
+ * activeSessionDetails, built from live session records). collectMeshNodeHostedSessionIds does
336
+ * the wider plural-shape scan so a controlbar/modal command targeting a non-primary remote
337
+ * session still resolves its owner — the singular readCachedInlineMeshActiveSessions semantics
338
+ * other consumers depend on stay untouched.
339
+ */
340
+ resolveRemoteMeshSessionOwnerDaemonId(sessionId: string): string | undefined;
341
+ /**
342
+ * Candidate nodes for remote-session owner resolution: the cached inline-mesh nodes (which
343
+ * carry each node's primary session) plus the nodes from every cached aggregate mesh-status
344
+ * snapshot (which carry each node's full live session list). getCachedInlineMeshNodes()
345
+ * returns a fresh array, so appending the aggregate nodes never mutates cached state.
346
+ */
347
+ private collectMeshSessionOwnerCandidateNodes;
91
348
  getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
92
349
  private warmInlineMeshCache;
93
350
  private getMeshForCommand;
351
+ private invalidateAggregateMeshStatus;
352
+ private requireMeshHostMutationOwner;
94
353
  private updateInlineMeshNode;
95
354
  private removeInlineMeshNode;
355
+ private tombstoneRemovedInlineMeshNode;
356
+ /** Filter an incoming inline mesh against this mesh's tombstones before it is
357
+ * reconciled into the cache. A tombstoned node is dropped only while its
358
+ * workspace is still absent from disk; if the workspace is back (genuine
359
+ * re-registration), the tombstone is cleared and the node merges normally. */
360
+ private applyInlineMeshNodeTombstones;
96
361
  private normalizeMeshSessionCleanupMode;
97
362
  private sessionMatchesMeshNode;
363
+ /**
364
+ * Best-effort recursive removal of a managed worktree directory.
365
+ *
366
+ * The git-registry de-registration is the safety-critical step of worktree
367
+ * teardown; a leftover directory must never gate dropping the node from the
368
+ * mesh. On Windows, `fs.rmSync` can throw EINVAL/EPERM/EBUSY on submodule
369
+ * gitlink (`.git`) files, long paths, junctions, or while a just-stopped
370
+ * delegate session is still releasing a handle/cwd on the directory. This
371
+ * helper absorbs those errors (never throws), with bounded retries + backoff
372
+ * to give handles time to release, and reports whether residue remains.
373
+ */
374
+ private bestEffortRemoveWorktreeDir;
98
375
  private cleanupLocalWorktreeNode;
99
376
  private getWorktreeForceCleanupConvergence;
100
377
  private isCompletedHostedSession;
101
378
  private recordIntentionalMeshSessionStop;
102
379
  private cleanupMeshSessions;
103
- private traceSessionHostAction;
104
380
  /**
105
381
  * Unified command routing.
106
382
  * Returns result for all commands:
@@ -113,6 +389,63 @@ export declare class DaemonCommandRouter {
113
389
  * @param source Log source ('ws' | 'p2p' | 'standalone' | etc.)
114
390
  */
115
391
  execute(cmd: string, args: any, source?: string): Promise<CommandRouterResult>;
392
+ private buildRefineJobKey;
393
+ private buildRefineJobHandle;
394
+ private queueRefineJobEvent;
395
+ private appendRefineJobLedger;
396
+ /**
397
+ * On daemon restart, scan all mesh ledgers for refine jobs that were dispatched
398
+ * but never completed/failed (i.e. the daemon died mid-job). Re-queue each one
399
+ * so the job runs to completion automatically without coordinator intervention.
400
+ */
401
+ resumePendingRefineJobsOnStartup(): Promise<void>;
402
+ private executeMeshRefineNodeSynchronously;
403
+ /**
404
+ * Batch refinery: converge multiple sibling worktree nodes onto the base branch
405
+ * in one sequential pipeline, absorbing the rebase + patch-equivalence churn that
406
+ * arises when several siblings touch the same submodule.
407
+ *
408
+ * Reuses executeMeshRefineNodeSynchronously per node — every node goes through the
409
+ * exact same validation / patch-equivalence / submodule-reachability / merge / cleanup
410
+ * gates, including its built-in auto-rebase onto fresh origin/<base>. Because each
411
+ * node fetches origin/<base> at the start of its own refine, a node merged earlier in
412
+ * the batch advances the base, and the next node's refine auto-rebases onto it before
413
+ * re-running patch-equivalence. No force-push, no reset — conflicting nodes are
414
+ * isolated as blocked_review while the rest of the batch proceeds.
415
+ */
416
+ private batchRefineMeshNodes;
417
+ /**
418
+ * Convergence core shared by the synchronous batch entry and the async batch job.
419
+ * Refines each node in order: the per-node refine pipeline fetches origin/<base>
420
+ * fresh, so each merged sibling advances the base before the next node's auto-rebase
421
+ * + patch-equivalence re-check. A blocked/failed node is isolated; the batch
422
+ * continues with the remaining nodes. Does NOT touch the per-node merge logic — it
423
+ * only sequences calls to executeMeshRefineNodeSynchronously and aggregates outcomes.
424
+ */
425
+ private runMeshRefineBatchConvergence;
426
+ private buildRefineBatchJobKey;
427
+ private buildRefineBatchJobHandle;
428
+ /**
429
+ * Emit a batch Refinery terminal/accepted event through the SAME pending-event +
430
+ * forward mechanism single-node refine uses (queueRefineJobEvent), so the
431
+ * coordinator's existing refine:accepted/completed/failed handling and message
432
+ * renderer apply unchanged. The aggregate per-node results ride along in `result`.
433
+ */
434
+ private queueRefineBatchJobEvent;
435
+ private appendRefineBatchJobLedger;
436
+ private finishMeshRefineBatchJob;
437
+ /**
438
+ * Async entry for the batch Refinery execute path. Mirrors startMeshRefineJob:
439
+ * resolves the plan synchronously (so target/ordering errors and the dry-run shape
440
+ * stay synchronous), then for execute=true registers an in-flight batch job, returns
441
+ * {async:true, status:'accepted', batch:true, ...plan} immediately, and runs the
442
+ * convergence loop in the background — emitting the same terminal refine event.
443
+ * Idempotent: a batch already in flight for this mesh returns the running handle
444
+ * with duplicate:true rather than spawning a second background job.
445
+ */
446
+ private startMeshRefineBatchJob;
447
+ private finishMeshRefineJob;
448
+ private startMeshRefineJob;
116
449
  /**
117
450
  * Daemon-level command execution (IDE start/stop/restart, CLI, detect, logs).
118
451
  * Returns null if not handled at this level → caller delegates to CommandHandler.
@@ -123,3 +456,4 @@ export declare class DaemonCommandRouter {
123
456
  */
124
457
  private stopIde;
125
458
  }
459
+ export {};
@@ -39,6 +39,46 @@ export declare function buildPinnedGlobalInstallCommand(options: {
39
39
  }): PinnedGlobalInstallCommand;
40
40
  export declare function getNpmExecOptions(platform?: NodeJS.Platform): NpmExecOptions;
41
41
  export declare function execNpmCommandSync(args: string[], options?: ExecFileSyncOptions, surface?: Pick<CurrentGlobalInstallSurface, 'npmExecutable' | 'npmArgsPrefix' | 'execOptions'>): Buffer | string;
42
- export declare function stopSessionHostProcesses(appName: string): void;
42
+ export declare function stopSessionHostProcesses(appName: string): Promise<void>;
43
+ /**
44
+ * Enumerate processes that have a locked native addon (conpty.node /
45
+ * ghostty-vt.dll) of *this* install memory-mapped.
46
+ *
47
+ * `stopSessionHostProcesses()` only knows the single managed session-host pid, so
48
+ * any *foreign* holder — e.g. an orphaned `pty_*probe*.cjs` left in `%TEMP%` — is
49
+ * invisible to it and keeps the addon locked through every install retry, dooming
50
+ * the upgrade with EBUSY. This scans by the module's full path so we only ever
51
+ * target a holder of the exact `packageRoot` being replaced (never an unrelated
52
+ * install's copy). Windows-only — these locks don't exist on POSIX.
53
+ */
54
+ export declare function listForeignNativeAddonHolders(packageRoot: string | null | undefined): Array<{
55
+ pid: number;
56
+ commandLine: string | null;
57
+ }>;
58
+ /**
59
+ * Terminate every foreign process holding this install's native addon mapped,
60
+ * then wait for each to actually exit so the mapping is released before npm
61
+ * copies the file into its staging dir. Returns what it found/killed so the
62
+ * caller can surface an actionable recovery message on failure.
63
+ */
64
+ export declare function stopForeignNativeAddonHolders(packageRoot: string | null | undefined, options?: {
65
+ parentPid?: number;
66
+ }): Promise<Array<{
67
+ pid: number;
68
+ commandLine: string | null;
69
+ killed: boolean;
70
+ }>>;
71
+ /**
72
+ * Best-effort removal of a leftover npm staging entry.
73
+ *
74
+ * A stale staging dir can hold a locked native binary — e.g. `ghostty-vt.dll`
75
+ * from `@adhdev/ghostty-vt-node` still mapped by a lingering session-host
76
+ * process — which makes `rmSync` throw `EPERM` on Windows. Staging cleanup is
77
+ * only housekeeping: the leftover is inert and npm creates its own fresh
78
+ * staging dir for the real install, so a lock on an old leftover must NOT abort
79
+ * the upgrade. Log and continue instead of letting the error propagate.
80
+ */
81
+ export declare function safeRemoveStaleEntry(target: string, label: string): void;
82
+ export declare function cleanupStaleGlobalInstallDirs(pkgName: string, surface: CurrentGlobalInstallSurface): void;
43
83
  export declare function spawnDetachedDaemonUpgradeHelper(payload: DaemonUpgradeHelperPayload): void;
44
84
  export declare function maybeRunDaemonUpgradeHelperFromEnv(): Promise<boolean>;
@@ -110,12 +110,21 @@ export declare function readProviderChatHistory(agentType: string, options?: {
110
110
  excludeRecentCount?: number;
111
111
  historyBehavior?: ProviderHistoryBehavior;
112
112
  scripts?: ProviderNativeHistoryScripts;
113
+ excludeInProgressTurn?: boolean;
114
+ sessionStartedAtMs?: number;
115
+ envOverrides?: Record<string, string>;
116
+ forceRefresh?: boolean;
113
117
  }): {
114
118
  messages: HistoryMessage[];
115
119
  hasMore: boolean;
116
120
  source: 'provider-native' | 'adhdev-mirror' | 'native-unavailable';
117
121
  sourcePath?: string;
118
122
  sourceMtimeMs?: number;
123
+ providerSessionId?: string;
124
+ workspace?: string;
125
+ nativeHistoryCoverage?: string;
126
+ partialReason?: string;
127
+ unavailableReason?: string;
119
128
  };
120
129
  export declare function listProviderHistorySessions(agentType: string, options?: {
121
130
  canonicalHistory?: ProviderCanonicalHistoryConfig;
@@ -86,6 +86,11 @@ export declare function isStableMachineId(machineId?: string | null): boolean;
86
86
  * Get the config directory path
87
87
  */
88
88
  export declare function getConfigDir(): string;
89
+ /**
90
+ * Get the daemon runtime data directory (~/.adhdev/daemon/).
91
+ * Distinct from the user-config dir so runtime state can be cleared independently.
92
+ */
93
+ export declare function getDaemonDataDir(): string;
89
94
  /**
90
95
  * Load configuration from disk
91
96
  */
@@ -5,7 +5,7 @@
5
5
  * Cloud mode syncs these to D1 via server routes; standalone mode
6
6
  * uses this file as the single source of truth.
7
7
  */
8
- import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig } from '../repo-mesh-types.js';
8
+ import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig, RepoMeshHostMetadata, RepoMeshDaemonRole } from '../repo-mesh-types.js';
9
9
  /**
10
10
  * Normalize a Git remote URL into a stable identity string.
11
11
  * e.g. "git@github.com:user/repo.git" → "github.com/user/repo"
@@ -22,6 +22,7 @@ export interface CreateMeshOptions {
22
22
  defaultBranch?: string;
23
23
  policy?: Partial<RepoMeshPolicy>;
24
24
  coordinator?: RepoMeshCoordinatorConfig;
25
+ meshHost?: RepoMeshHostMetadata;
25
26
  }
26
27
  export declare function createMesh(opts: CreateMeshOptions): LocalMeshEntry;
27
28
  export interface UpdateMeshOptions {
@@ -29,23 +30,98 @@ export interface UpdateMeshOptions {
29
30
  defaultBranch?: string;
30
31
  policy?: Partial<RepoMeshPolicy>;
31
32
  coordinator?: RepoMeshCoordinatorConfig;
33
+ meshHost?: RepoMeshHostMetadata;
32
34
  }
33
35
  export declare function updateMesh(meshId: string, opts: UpdateMeshOptions): LocalMeshEntry | undefined;
34
36
  export declare function deleteMesh(meshId: string): boolean;
37
+ export declare function tokenIdForManualPairing(token: string): string;
38
+ export interface ConfigureMeshHostPairingOptions {
39
+ hostAddress: string;
40
+ token: string;
41
+ now?: string;
42
+ }
43
+ export declare function configureMeshHostPairing(meshId: string, opts: ConfigureMeshHostPairingOptions): {
44
+ mesh: LocalMeshEntry;
45
+ meshHost: RepoMeshHostMetadata;
46
+ hostAddress: string;
47
+ } | undefined;
48
+ export interface CreateMeshHostPairingTokenOptions {
49
+ token?: string;
50
+ expiresAt?: string;
51
+ now?: string;
52
+ }
53
+ export declare function createMeshHostPairingToken(meshId: string, opts?: CreateMeshHostPairingTokenOptions): {
54
+ mesh: LocalMeshEntry;
55
+ meshHost: RepoMeshHostMetadata;
56
+ token: string;
57
+ tokenId: string;
58
+ expiresAt?: string;
59
+ } | undefined;
60
+ export interface MeshHostJoinMemberNodeInput {
61
+ id?: string;
62
+ workspace: string;
63
+ repoRoot?: string;
64
+ daemonId?: string;
65
+ machineId?: string;
66
+ userOverrides?: Partial<RepoMeshNodeCapabilities>;
67
+ policy?: RepoMeshNodePolicy;
68
+ role?: RepoMeshDaemonRole;
69
+ }
70
+ export interface ApplyMeshHostJoinOptions {
71
+ token: string;
72
+ memberNode: MeshHostJoinMemberNodeInput;
73
+ memberMeshId?: string;
74
+ now?: string;
75
+ }
76
+ export declare function applyMeshHostJoinRequest(meshId: string, opts: ApplyMeshHostJoinOptions): {
77
+ accepted: true;
78
+ mesh: LocalMeshEntry;
79
+ meshHost: RepoMeshHostMetadata;
80
+ node: LocalMeshNodeEntry;
81
+ tokenId: string;
82
+ } | {
83
+ accepted: false;
84
+ mesh?: LocalMeshEntry;
85
+ meshHost?: RepoMeshHostMetadata;
86
+ tokenId?: string;
87
+ reason: string;
88
+ } | undefined;
89
+ export declare function markMeshHostPairingJoined(meshId: string, opts: {
90
+ hostDaemonId?: string;
91
+ hostNodeId?: string;
92
+ joinedAt?: string;
93
+ token?: string;
94
+ tokenId?: string;
95
+ }): {
96
+ mesh: LocalMeshEntry;
97
+ meshHost: RepoMeshHostMetadata;
98
+ } | undefined;
35
99
  export interface AddNodeOptions {
36
100
  workspace: string;
37
101
  repoRoot?: string;
38
102
  daemonId?: string;
39
103
  machineId?: string;
104
+ capabilities?: string[];
40
105
  userOverrides?: Partial<RepoMeshNodeCapabilities>;
41
106
  policy?: RepoMeshNodePolicy;
42
107
  isLocalWorktree?: boolean;
43
108
  worktreeBranch?: string;
44
109
  clonedFromNodeId?: string;
110
+ worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
111
+ role?: RepoMeshDaemonRole;
45
112
  }
46
113
  export declare function addNode(meshId: string, opts: AddNodeOptions): LocalMeshNodeEntry | undefined;
47
114
  export declare function removeNode(meshId: string, nodeId: string): boolean;
48
115
  export declare function updateNode(meshId: string, nodeId: string, opts: {
49
116
  userOverrides?: Partial<RepoMeshNodeCapabilities>;
50
117
  policy?: RepoMeshNodePolicy;
118
+ worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
119
+ /** Per-node instruction surfaced in the coordinator prompt. Pass an
120
+ * empty string or undefined to clear it. */
121
+ systemPrompt?: string;
122
+ /** Live self-reported platform/arch from the owning daemon's git_status
123
+ * envelope. Persisted distinctly from userOverrides (auto-detected, not
124
+ * operator intent) so capability-tag os=/arch= self-heals across loads. */
125
+ reportedPlatform?: string;
126
+ reportedArch?: string;
51
127
  }): LocalMeshNodeEntry | undefined;
@@ -32,4 +32,17 @@ export interface IDEDefinition {
32
32
  };
33
33
  }
34
34
  export declare function registerIDEDefinition(def: IDEDefinition): void;
35
+ /**
36
+ * Resolve an IDE version on demand (NOT at boot).
37
+ *
38
+ * Order of preference, all spawn-free where possible:
39
+ * 1. win32: read the bundled product.json/package.json next to the exe.
40
+ * 2. Otherwise spawn `<cli> --version` — but ONLY when the binary is not a
41
+ * known GUI executable (the #4 guard), so we never boot an IDE window.
42
+ *
43
+ * `win32ProcessNames` is provider.json `processNames.win32` (type → exe names),
44
+ * used to recognise GUI executables. Callers that have a ProviderLoader can
45
+ * pass `providerLoader.getWinProcessNames()`.
46
+ */
47
+ export declare function getIdeVersion(cliCommand: string, win32ProcessNames?: Record<string, string[]>): Promise<string | null>;
35
48
  export declare function detectIDEs(providerLoader?: ProviderLoader): Promise<IDEInfo[]>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * ADHDev — Windows IDE version detection (execution-free)
3
+ *
4
+ * On Windows the resolved "CLI" for a VS Code fork (Cursor, Antigravity, …)
5
+ * frequently resolves to the GUI Electron executable itself, because the
6
+ * case-insensitive filesystem matches `...\cursor\cursor.exe` against the
7
+ * real `Cursor.exe`. Running `<that exe> --version` boots the GUI instead of
8
+ * printing a version (Electron ignores the unknown flag and opens a window).
9
+ *
10
+ * To learn the version WITHOUT spawning anything, we read the bundled
11
+ * `product.json` / `package.json` that ship next to the executable. VS Code
12
+ * forks embed their version there. This is a pure filesystem read.
13
+ *
14
+ * It also exposes a guard so any remaining `--version` exec path can refuse to
15
+ * spawn a binary that is a known GUI executable for an IDE provider.
16
+ */
17
+ /**
18
+ * Read an IDE version from disk (no process spawn).
19
+ *
20
+ * @param exePath Absolute path to the GUI executable (or any path inside the
21
+ * IDE install dir — we read the manifest relative to its directory).
22
+ * @returns The version string, or null if it could not be determined.
23
+ */
24
+ export declare function readWin32IdeVersionFromDisk(exePath: string): string | null;
25
+ /**
26
+ * True when `binPath` resolves to a known GUI executable for some IDE.
27
+ *
28
+ * Used as a safety net: any code path about to run `<bin> --version` must skip
29
+ * the spawn when the binary is actually the GUI Electron exe, since that would
30
+ * launch the IDE window. Comparison is case-insensitive on the basename
31
+ * (Windows filesystem semantics) against every provider's `processNames.win32`.
32
+ *
33
+ * @param binPath Resolved binary path that would be exec'd.
34
+ * @param win32ProcessNames Map of provider type → list of GUI exe names
35
+ * (from provider.json `processNames.win32`, e.g. `["Cursor.exe"]`).
36
+ */
37
+ export declare function isKnownWin32GuiExe(binPath: string | null | undefined, win32ProcessNames: Record<string, string[]>): boolean;