@adhdev/daemon-core 0.9.82-rc.32 → 0.9.82-rc.321

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 (306) 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 +46 -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 +115 -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 +38 -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 +2 -1
  20. package/dist/commands/handler.d.ts +110 -0
  21. package/dist/commands/mesh-coordinator.d.ts +85 -1
  22. package/dist/commands/router.d.ts +229 -1
  23. package/dist/commands/upgrade-helper.d.ts +12 -0
  24. package/dist/config/chat-history.d.ts +9 -0
  25. package/dist/config/config.d.ts +5 -0
  26. package/dist/config/mesh-config.d.ts +72 -1
  27. package/dist/detection/ide-detector.d.ts +13 -0
  28. package/dist/detection/win32-ide-version.d.ts +37 -0
  29. package/dist/git/git-commands.d.ts +9 -1
  30. package/dist/git/git-diff.d.ts +6 -0
  31. package/dist/git/git-executor.d.ts +11 -0
  32. package/dist/git/git-status.d.ts +9 -0
  33. package/dist/git/git-types.d.ts +2 -50
  34. package/dist/index.d.ts +51 -12
  35. package/dist/index.js +35378 -11873
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +38854 -15461
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/installer.d.ts +1 -4
  40. package/dist/ipc/local-ipc-server.d.ts +91 -0
  41. package/dist/launch.d.ts +1 -1
  42. package/dist/logging/async-batch-writer.d.ts +10 -0
  43. package/dist/logging/log-redactor.d.ts +24 -0
  44. package/dist/logging/log-tail-reader.d.ts +46 -0
  45. package/dist/mesh/contracts.d.ts +164 -0
  46. package/dist/mesh/coordinator-prompt.d.ts +36 -0
  47. package/dist/mesh/coordinator-registry.d.ts +59 -0
  48. package/dist/mesh/mesh-active-work.d.ts +108 -0
  49. package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
  50. package/dist/mesh/mesh-events-coordinator.d.ts +169 -0
  51. package/dist/mesh/mesh-events-pending.d.ts +45 -0
  52. package/dist/mesh/mesh-events-stale.d.ts +40 -0
  53. package/dist/mesh/mesh-events-utils.d.ts +47 -0
  54. package/dist/mesh/mesh-events.d.ts +6 -49
  55. package/dist/mesh/mesh-fast-forward.d.ts +81 -0
  56. package/dist/mesh/mesh-host-ownership.d.ts +9 -0
  57. package/dist/mesh/mesh-init.d.ts +86 -0
  58. package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -3
  59. package/dist/mesh/mesh-ledger.d.ts +77 -1
  60. package/dist/mesh/mesh-missions.d.ts +116 -0
  61. package/dist/mesh/mesh-reconcile-loop.d.ts +7 -0
  62. package/dist/mesh/mesh-refine-batch.d.ts +68 -0
  63. package/dist/mesh/mesh-refine-status.d.ts +62 -0
  64. package/dist/mesh/mesh-review-inbox.d.ts +90 -0
  65. package/dist/mesh/mesh-routing.d.ts +70 -0
  66. package/dist/mesh/mesh-runtime-store.d.ts +401 -0
  67. package/dist/mesh/mesh-task-stats.d.ts +49 -0
  68. package/dist/mesh/mesh-unresolved-forward-outbox.d.ts +30 -0
  69. package/dist/mesh/mesh-work-queue.d.ts +204 -5
  70. package/dist/mesh/preview-freshness.d.ts +18 -0
  71. package/dist/mesh/refine-config.d.ts +215 -0
  72. package/dist/mesh/worktree-bootstrap-config.d.ts +135 -0
  73. package/dist/providers/acp-provider-instance.d.ts +2 -0
  74. package/dist/providers/approval-utils.d.ts +13 -0
  75. package/dist/providers/cli-provider-instance.d.ts +61 -3
  76. package/dist/providers/contracts.d.ts +130 -6
  77. package/dist/providers/external-sources.d.ts +71 -0
  78. package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
  79. package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
  80. package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
  81. package/dist/providers/native-history/dispatcher.d.ts +27 -0
  82. package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
  83. package/dist/providers/native-history/index.d.ts +13 -0
  84. package/dist/providers/provider-instance-manager.d.ts +13 -0
  85. package/dist/providers/provider-instance.d.ts +13 -1
  86. package/dist/providers/provider-loader.d.ts +26 -4
  87. package/dist/providers/provider-trust.d.ts +31 -0
  88. package/dist/providers/read-chat-contract.d.ts +29 -0
  89. package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
  90. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
  91. package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
  92. package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
  93. package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
  94. package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
  95. package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
  96. package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
  97. package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
  98. package/dist/providers/sdk/v1/index.d.ts +30 -0
  99. package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
  100. package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
  101. package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
  102. package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
  103. package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
  104. package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
  105. package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
  106. package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
  107. package/dist/providers/spec/adapter.d.ts +69 -0
  108. package/dist/providers/spec/cli-adapter.d.ts +217 -0
  109. package/dist/providers/spec/evaluator.d.ts +23 -0
  110. package/dist/providers/spec/fsm-driver.d.ts +278 -0
  111. package/dist/providers/spec/fsm-evaluator.d.ts +72 -0
  112. package/dist/providers/spec/fsm-loader.d.ts +14 -0
  113. package/dist/providers/spec/fsm-types.d.ts +128 -0
  114. package/dist/providers/spec/native-history-executor.d.ts +41 -0
  115. package/dist/providers/spec/pre-launch-trust.d.ts +16 -0
  116. package/dist/providers/spec/route.d.ts +4 -0
  117. package/dist/providers/spec/types.d.ts +180 -0
  118. package/dist/providers/transcript-v2.d.ts +176 -0
  119. package/dist/providers/types/interactive-prompt.d.ts +84 -0
  120. package/dist/providers/working-dir.d.ts +17 -0
  121. package/dist/repo-mesh-types.d.ts +277 -13
  122. package/dist/sessions/registry.d.ts +6 -0
  123. package/dist/shared-types-extra.d.ts +2 -4
  124. package/dist/shared-types.d.ts +42 -1
  125. package/dist/status/normalize.d.ts +1 -1
  126. package/dist/status/normalize.js +1 -0
  127. package/dist/status/normalize.js.map +1 -1
  128. package/dist/status/normalize.mjs +1 -0
  129. package/dist/status/normalize.mjs.map +1 -1
  130. package/dist/status/reporter.d.ts +2 -0
  131. package/dist/status/snapshot.d.ts +1 -0
  132. package/dist/types.d.ts +5 -0
  133. package/package.json +7 -3
  134. package/src/agent-stream/poller.ts +2 -3
  135. package/src/boot/daemon-lifecycle.ts +55 -12
  136. package/src/boot/process-hardening.ts +89 -0
  137. package/src/build-info.ts +73 -0
  138. package/src/chat/source-machine.ts +534 -0
  139. package/src/chat/source-resolver.ts +0 -0
  140. package/src/chat/subscription-updates.ts +20 -1
  141. package/src/cli-adapter-types.d.ts +1 -0
  142. package/src/cli-adapter-types.ts +47 -2
  143. package/src/cli-adapters/cli-script-runner.ts +421 -0
  144. package/src/cli-adapters/cli-state-engine.ts +1215 -0
  145. package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
  146. package/src/cli-adapters/provider-cli-adapter.ts +710 -1140
  147. package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
  148. package/src/cli-adapters/provider-cli-parse.ts +13 -0
  149. package/src/cli-adapters/provider-cli-runtime.ts +56 -7
  150. package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
  151. package/src/cli-adapters/provider-cli-shared.ts +85 -11
  152. package/src/cli-adapters/pty-transport.ts +2 -1
  153. package/src/cli-adapters/raw-terminal-io.ts +252 -0
  154. package/src/cli-adapters/resolve-executable.ts +90 -0
  155. package/src/cli-adapters/session-host-transport.ts +2 -1
  156. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +53 -29
  157. package/src/cli-adapters/terminal-backends/types.ts +10 -3
  158. package/src/cli-adapters/terminal-screen.ts +16 -81
  159. package/src/commands/chat-commands.ts +1822 -61
  160. package/src/commands/cli-manager.ts +286 -14
  161. package/src/commands/handler.ts +809 -2
  162. package/src/commands/mesh-coordinator.ts +332 -122
  163. package/src/commands/router.ts +6369 -704
  164. package/src/commands/stream-commands.ts +8 -0
  165. package/src/commands/upgrade-helper.ts +81 -30
  166. package/src/config/chat-history.ts +483 -24
  167. package/src/config/config.ts +12 -0
  168. package/src/config/mesh-config.ts +320 -4
  169. package/src/config/recent-activity.ts +8 -2
  170. package/src/daemon/dev-auto-implement.ts +3 -2
  171. package/src/daemon/dev-cli-debug.ts +10 -1
  172. package/src/detection/cli-detector.ts +28 -9
  173. package/src/detection/ide-detector.ts +55 -16
  174. package/src/detection/win32-ide-version.ts +106 -0
  175. package/src/git/git-commands.ts +42 -12
  176. package/src/git/git-diff.ts +53 -0
  177. package/src/git/git-executor.ts +12 -0
  178. package/src/git/git-status.ts +408 -43
  179. package/src/git/git-types.ts +14 -62
  180. package/src/git/git-worktree.ts +8 -1
  181. package/src/index.ts +145 -11
  182. package/src/installer.d.ts +1 -1
  183. package/src/installer.ts +8 -6
  184. package/src/ipc/local-ipc-server.ts +278 -0
  185. package/src/launch.d.ts +1 -1
  186. package/src/launch.ts +37 -28
  187. package/src/logging/async-batch-writer.ts +55 -0
  188. package/src/logging/log-redactor.ts +100 -0
  189. package/src/logging/log-tail-reader.ts +220 -0
  190. package/src/logging/logger.ts +2 -1
  191. package/src/mesh/contracts.ts +329 -0
  192. package/src/mesh/coordinator-prompt.ts +234 -31
  193. package/src/mesh/coordinator-registry.ts +121 -0
  194. package/src/mesh/mesh-active-work.ts +469 -0
  195. package/src/mesh/mesh-delivery-policy.ts +315 -0
  196. package/src/mesh/mesh-events-coordinator.ts +2102 -0
  197. package/src/mesh/mesh-events-pending.ts +508 -0
  198. package/src/mesh/mesh-events-stale.ts +290 -0
  199. package/src/mesh/mesh-events-utils.ts +254 -0
  200. package/src/mesh/mesh-events.ts +30 -1035
  201. package/src/mesh/mesh-fast-forward.ts +839 -0
  202. package/src/mesh/mesh-host-ownership.ts +73 -0
  203. package/src/mesh/mesh-init.ts +260 -0
  204. package/src/mesh/mesh-ledger-reconciliation.ts +12 -5
  205. package/src/mesh/mesh-ledger.ts +589 -102
  206. package/src/mesh/mesh-missions.ts +248 -0
  207. package/src/mesh/mesh-reconcile-loop.ts +496 -0
  208. package/src/mesh/mesh-refine-batch.ts +197 -0
  209. package/src/mesh/mesh-refine-status.ts +231 -0
  210. package/src/mesh/mesh-review-inbox.ts +307 -0
  211. package/src/mesh/mesh-routing.ts +291 -0
  212. package/src/mesh/mesh-runtime-store.ts +1578 -0
  213. package/src/mesh/mesh-task-stats.ts +154 -0
  214. package/src/mesh/mesh-unresolved-forward-outbox.ts +185 -0
  215. package/src/mesh/mesh-work-queue.ts +663 -142
  216. package/src/mesh/preview-freshness.ts +118 -0
  217. package/src/mesh/refine-config.ts +403 -0
  218. package/src/mesh/worktree-bootstrap-config.ts +326 -0
  219. package/src/providers/acp-provider-instance.ts +19 -4
  220. package/src/providers/approval-utils.d.ts +4 -0
  221. package/src/providers/approval-utils.ts +47 -5
  222. package/src/providers/chat-message-normalization.ts +4 -11
  223. package/src/providers/cli-provider-instance.ts +958 -91
  224. package/src/providers/contracts.d.ts +55 -0
  225. package/src/providers/contracts.ts +141 -6
  226. package/src/providers/extension-provider-instance.ts +5 -1
  227. package/src/providers/external-sources.ts +218 -0
  228. package/src/providers/ide-provider-instance.ts +25 -6
  229. package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
  230. package/src/providers/native-history/claude-cli-transcript.ts +396 -0
  231. package/src/providers/native-history/codex-cli-transcript.ts +479 -0
  232. package/src/providers/native-history/dispatcher.ts +340 -0
  233. package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
  234. package/src/providers/native-history/index.ts +30 -0
  235. package/src/providers/provider-instance-manager.ts +30 -0
  236. package/src/providers/provider-instance.ts +10 -1
  237. package/src/providers/provider-loader.ts +662 -50
  238. package/src/providers/provider-schema.ts +87 -14
  239. package/src/providers/provider-trust.ts +114 -0
  240. package/src/providers/read-chat-contract.ts +76 -16
  241. package/src/providers/sdk/README.md +49 -0
  242. package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
  243. package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
  244. package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
  245. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +250 -0
  246. package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
  247. package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
  248. package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
  249. package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
  250. package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
  251. package/src/providers/sdk/v1/index.ts +152 -0
  252. package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
  253. package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
  254. package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
  255. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +504 -0
  256. package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
  257. package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
  258. package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
  259. package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
  260. package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
  261. package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
  262. package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
  263. package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
  264. package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
  265. package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
  266. package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
  267. package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
  268. package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
  269. package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
  270. package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
  271. package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
  272. package/src/providers/sdk/v1/types/cli/index.ts +365 -0
  273. package/src/providers/sdk/v1/types/common/index.ts +229 -0
  274. package/src/providers/sdk/v1/validators/index.ts +19 -0
  275. package/src/providers/sdk/v1/validators/manifest.ts +110 -0
  276. package/src/providers/sdk/v1/validators/taint.ts +309 -0
  277. package/src/providers/spec/adapter.ts +168 -0
  278. package/src/providers/spec/cli-adapter.ts +986 -0
  279. package/src/providers/spec/evaluator.ts +345 -0
  280. package/src/providers/spec/fsm-driver.ts +909 -0
  281. package/src/providers/spec/fsm-evaluator.ts +255 -0
  282. package/src/providers/spec/fsm-loader.ts +112 -0
  283. package/src/providers/spec/fsm-types.ts +222 -0
  284. package/src/providers/spec/native-history-executor.ts +1136 -0
  285. package/src/providers/spec/pre-launch-trust.ts +104 -0
  286. package/src/providers/spec/route.ts +51 -0
  287. package/src/providers/spec/types.ts +226 -0
  288. package/src/providers/transcript-v2.ts +567 -0
  289. package/src/providers/types/interactive-prompt.ts +536 -0
  290. package/src/providers/version-archive.ts +64 -24
  291. package/src/providers/working-dir.ts +23 -0
  292. package/src/repo-mesh-types.ts +356 -13
  293. package/src/sessions/registry.ts +6 -0
  294. package/src/shared-types-extra.ts +2 -4
  295. package/src/shared-types.ts +45 -1
  296. package/src/status/builders.ts +26 -6
  297. package/src/status/normalize.ts +2 -0
  298. package/src/status/reporter.ts +15 -0
  299. package/src/status/snapshot.ts +84 -25
  300. package/src/system/host-memory.ts +29 -12
  301. package/src/types.ts +5 -0
  302. package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
  303. package/dist/mesh/mesh-sync.d.ts +0 -53
  304. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
  305. package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
  306. package/src/mesh/mesh-sync.ts +0 -111
@@ -1,13 +1,16 @@
1
- import type { TerminalViewportBackend, TerminalViewportBackendOptions, TerminalViewportBackendPreference } from './types.js';
2
- export declare function resolveTerminalBackendPreference(): TerminalViewportBackendPreference;
3
- export declare function isGhosttyVtBackendAvailable(): boolean;
1
+ import type { TerminalViewportBackend, TerminalViewportBackendOptions } from './types.js';
4
2
  export declare class GhosttyVtTerminalBackend implements TerminalViewportBackend {
5
3
  readonly kind: "ghostty-vt";
6
4
  private terminal;
5
+ private rows;
6
+ private disposed;
7
7
  constructor(options: TerminalViewportBackendOptions);
8
8
  resize(rows: number, cols: number): void;
9
9
  write(data: string): void;
10
+ private formatLines;
11
+ private static trimBlankEnds;
10
12
  getText(): string;
13
+ getTextWithScrollback(): string;
11
14
  getCursorPosition(): {
12
15
  col: number;
13
16
  row: number;
@@ -1,5 +1,4 @@
1
- export type TerminalViewportBackendKind = 'xterm' | 'ghostty-vt';
2
- export type TerminalViewportBackendPreference = TerminalViewportBackendKind | 'auto';
1
+ export type TerminalViewportBackendKind = 'ghostty-vt';
3
2
  export type TerminalViewportBackendOptions = {
4
3
  rows: number;
5
4
  cols: number;
@@ -10,6 +9,15 @@ export interface TerminalViewportBackend {
10
9
  resize(rows: number, cols: number): void;
11
10
  write(data: string): void;
12
11
  getText(): string;
12
+ /**
13
+ * Like getText() but includes scrollback history (the lines that have
14
+ * scrolled above the visible viewport). Used by content-pattern matching
15
+ * (e.g. approval/modal button extraction) that must stay correct when a
16
+ * tall prompt — a big diff or long explanation — pushes part of the
17
+ * prompt box above the viewport. NOT for cursor-relative / stable_ms
18
+ * conditions, whose row indices are viewport-relative.
19
+ */
20
+ getTextWithScrollback(): string;
13
21
  getCursorPosition(): {
14
22
  col: number;
15
23
  row: number;
@@ -1,29 +1,22 @@
1
1
  /**
2
- * PTY screen snapshot abstraction.
3
- *
4
- * Terminal viewport backend selection.
5
- *
6
- * Runtime preference is backend-agnostic:
7
- * - prefer ghostty-vt when available (or when explicitly requested)
8
- * - fall back to xterm when ghostty-vt is unavailable
2
+ * PTY screen snapshot abstraction — ghostty-vt backend.
9
3
  */
10
- import type { TerminalViewportBackendKind, TerminalViewportBackendPreference } from './terminal-backends/types.js';
4
+ import type { TerminalViewportBackendKind } from './terminal-backends/types.js';
11
5
  export declare function getTerminalBackendRuntimeStatus(): {
12
6
  backend: TerminalViewportBackendKind;
13
- preference: TerminalViewportBackendPreference;
14
- ghosttyAvailable: boolean;
15
7
  };
16
8
  export declare class TerminalScreen {
17
9
  readonly backendKind: TerminalViewportBackendKind;
18
10
  private rows;
19
11
  private cols;
20
- private readonly preference;
21
12
  private terminal;
22
13
  constructor(rows?: number, cols?: number);
23
14
  reset(rows?: number, cols?: number): void;
24
15
  resize(rows: number, cols: number): void;
25
16
  write(data: string): void;
26
17
  getText(): string;
18
+ /** Full buffer including scrollback history (see backend doc). */
19
+ getTextWithScrollback(): string;
27
20
  getCursorPosition(): {
28
21
  col: number;
29
22
  row: number;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
8
8
  import { ProviderLoader } from '../providers/provider-loader.js';
9
- import { type ProviderModule, type ProviderResumeCapability } from '../providers/contracts.js';
9
+ import { type MeshCoordinatorDelegatedWorkerIsolation, type ProviderModule, type ProviderResumeCapability } from '../providers/contracts.js';
10
10
  import type { CliAdapter } from '../cli-adapter-types.js';
11
11
  import type { PtyTransportFactory } from '../cli-adapters/pty-transport.js';
12
12
  import type { SessionRegistry } from '../sessions/registry.js';
@@ -68,6 +68,7 @@ export interface CoordinatorDelegatedCliLaunchOptionsInput {
68
68
  workspace: string;
69
69
  cliArgs?: string[];
70
70
  env?: Record<string, string>;
71
+ isolation?: MeshCoordinatorDelegatedWorkerIsolation;
71
72
  }
72
73
  export interface CoordinatorDelegatedCliLaunchOptions {
73
74
  cliArgs: string[];
@@ -104,7 +104,117 @@ export declare class DaemonCommandHandler implements CommandHelpers {
104
104
  setAgentStreamManager(manager: DaemonAgentStreamManager): void;
105
105
  handle(cmd: string, args: any): Promise<CommandResult>;
106
106
  private dispatch;
107
+ /**
108
+ * Reload providers from disk. Does NOT pull from the registry — the user
109
+ * controls installs explicitly via install_provider_manifest. To upgrade
110
+ * an installed provider, call install_provider_manifest again with the
111
+ * desired version (or with no version to pick up the latest from
112
+ * registry), or use check_provider_updates to see what is out of date.
113
+ */
107
114
  private handleRefreshScripts;
115
+ /**
116
+ * Return per-provider availability so the dashboard's provider catalog
117
+ * can show "Installed" badges. Reuses the existing detection state from
118
+ * ProviderLoader.getMachineProviderStatus() — no probing is triggered.
119
+ */
120
+ private handleListProviderAvailability;
121
+ /**
122
+ * Compute the *upstream cache root*. install_provider_manifest writes
123
+ * official-registry manifests here so the daemon's standard upstream
124
+ * layer picks them up — no special handling needed at load time, and
125
+ * the manifests inherit the official-trust badge instead of the
126
+ * untrusted-external one.
127
+ *
128
+ * Path matches ProviderLoader.upstreamDir but we recompute it from
129
+ * homedir() so this method stays usable in dev where userDir can
130
+ * point at a sibling git checkout.
131
+ */
132
+ private getUpstreamInstallRoot;
133
+ /**
134
+ * Download a single provider manifest from the registry and write it to
135
+ * ~/.adhdev/providers/.upstream/{category}/{type}/provider.json.
136
+ *
137
+ * Used by standalone onboarding to seed the upstream cache with the
138
+ * default provider set on first launch. Verifies SHA-256 checksum
139
+ * against the registry meta before persisting. Refuses to write
140
+ * outside the upstream root.
141
+ *
142
+ * Args: { type: string, category?: string, version?: string }
143
+ * If category/version are omitted, looks up the latest from the registry.
144
+ */
145
+ private handleInstallProviderManifest;
146
+ /**
147
+ * If `manifest.source = { type:'github', repo, ref, subdir? }` is set,
148
+ * walk each script directory the manifest references and download every
149
+ * file from the public GitHub raw endpoint. Returns a small summary so
150
+ * the caller can report what was fetched.
151
+ *
152
+ * Best-effort: failures don't reject the install — the manifest itself is
153
+ * usable for declarative-only providers, and the user still gets a clear
154
+ * error string back if a needed script is missing.
155
+ */
156
+ private fetchProviderSources;
157
+ /**
158
+ * Remove a provider manifest from the upstream cache root
159
+ * (~/.adhdev/providers/.upstream/{category}/{type}/). Refuses to touch
160
+ * anything outside that root. Used by onboarding to opt out of a
161
+ * provider the user doesn't want; the dashboard no longer exposes a
162
+ * per-provider uninstall button (external sources are removed as a
163
+ * whole via remove_provider_source).
164
+ */
165
+ private handleUninstallProviderManifest;
166
+ /**
167
+ * Return everything currently installed in the upstream cache with its
168
+ * version. This is the "what does this daemon have" answer used both by
169
+ * the UI and by the update checker.
170
+ */
171
+ private handleListInstalledProviders;
172
+ /**
173
+ * For each installed provider, ask the registry for its current latest
174
+ * version and report whether an update is available. The user can then
175
+ * call install_provider_manifest to upgrade (it overwrites the file).
176
+ *
177
+ * Returns { providers: [{ type, category, installedVersion, latestVersion,
178
+ * updateAvailable, error? }] }
179
+ */
180
+ private handleCheckProviderUpdates;
181
+ /**
182
+ * Register a new external provider source. The daemon clones the repo
183
+ * to ~/.adhdev/external/<name>/, walks it once to detect provided
184
+ * types, and surfaces any conflicts with already-installed types so
185
+ * the dashboard can ask the user how to resolve them.
186
+ *
187
+ * Args: { url: string, ref?: string, name?: string }
188
+ * - url: https://, git@, or any git-cloneable URL
189
+ * - ref: branch/tag/commit (default "main")
190
+ * - name: short identifier (default derived from URL)
191
+ *
192
+ * Returns: { source, providers, conflicts }
193
+ * - conflicts: list of types this new source provides that another
194
+ * source already exposes. UI uses this to prompt for active-source
195
+ * selection before the load takes effect.
196
+ */
197
+ private handleAddProviderSource;
198
+ /**
199
+ * Remove a registered external source. Deletes the clone directory and
200
+ * any active-source entry pointing to it.
201
+ *
202
+ * Args: { name: string }
203
+ */
204
+ private handleRemoveProviderSource;
205
+ /**
206
+ * List registered external sources + each source's currently installed
207
+ * providers + the active selection for any conflicting types. Used by
208
+ * the dashboard's "Sources" tab.
209
+ */
210
+ private handleListProviderSources;
211
+ /**
212
+ * Pick which source's copy of a conflicting provider type is active.
213
+ * Other sources' copies stay on disk but the loader ignores them.
214
+ *
215
+ * Args: { type: string, sourceName: string }
216
+ */
217
+ private handleSetActiveProviderSource;
108
218
  private proxyDevServerPost;
109
219
  private proxyDevServerGet;
110
220
  private proxyDevServerScaffold;
@@ -1,4 +1,4 @@
1
- import type { ProviderModule, MeshCoordinatorMcpConfigFormat } from '../providers/contracts.js';
1
+ import type { MeshCoordinatorMcpConfigFormat, MeshCoordinatorSystemPromptInjection, ProviderModule } from '../providers/contracts.js';
2
2
  export interface MeshCoordinatorMcpServerLaunch {
3
3
  command: string;
4
4
  args: string[];
@@ -25,6 +25,7 @@ export type MeshCoordinatorSetup = {
25
25
  command: string;
26
26
  requiresRestart: boolean;
27
27
  instructions: string;
28
+ mcpServer: MeshCoordinatorMcpServerLaunch;
28
29
  } | {
29
30
  kind: 'unsupported';
30
31
  reason: string;
@@ -42,3 +43,86 @@ export interface ResolveMeshCoordinatorSetupOptions {
42
43
  }
43
44
  export declare function createHermesManualMeshCoordinatorSetup(meshId: string, workspace: string): MeshCoordinatorSetup;
44
45
  export declare function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupOptions): MeshCoordinatorSetup;
46
+ /**
47
+ * Apply a provider's declared system-prompt injection rule, mutating `cliArgs`
48
+ * and `launchEnv` in place and writing any required workspace context file.
49
+ *
50
+ * Replaces the previous hard-coded `if (cliType === 'claude-cli') ... else if
51
+ * (cliType === 'hermes-cli') ...` branches in router.ts. Adding a new CLI is
52
+ * now provider.v1.json data, not a router edit.
53
+ *
54
+ * Failures are non-fatal: log and continue with whatever was applied so the
55
+ * coordinator session still launches, just without the prompt for that
56
+ * provider. A missing/unknown rule means "skip injection" — safe by default
57
+ * (the previous fallback unconditionally pushed --append-system-prompt onto
58
+ * every non-Claude CLI, which crashed agy on launch).
59
+ */
60
+ export interface CoordinatorInjectionEffect {
61
+ /** Absolute path the daemon wrote a wrapper-blocked file to. Only set for
62
+ * context_file injection. R48 schedules a strip after launch so workers
63
+ * don't see the wrapper on disk; R47's unregister cleanup uses it as a
64
+ * fallback if the timer never fires (process crash, etc). */
65
+ contextFilePath?: string;
66
+ }
67
+ export declare function applyMeshCoordinatorSystemPromptInjection(systemPrompt: string, injection: MeshCoordinatorSystemPromptInjection | undefined, ctx: {
68
+ cliArgs: string[];
69
+ launchEnv: Record<string, string>;
70
+ workspace: string;
71
+ cliType: string;
72
+ }): CoordinatorInjectionEffect;
73
+ /**
74
+ * Strip the daemon's wrapper block from a context_file we previously wrote.
75
+ *
76
+ * Used in two places:
77
+ * 1. R48 inject-then-remove: ~5s after spawn, after agy/gemini have read
78
+ * the file into their in-memory system-prompt cache. Removing it from
79
+ * disk at that point doesn't affect the running coordinator but keeps
80
+ * worker sessions (or fresh non-coordinator launches) in the same
81
+ * workspace from picking up our wrapper.
82
+ * 2. R47 unregister fallback: if the timer never fires (process crash,
83
+ * kill -9), coordinator-registry.unregisterMeshCoordinator runs the
84
+ * same logic when its entry is dropped.
85
+ *
86
+ * Idempotent: missing file is fine, missing sentinels are fine, returns
87
+ * silently. Leaves user-authored content outside the sentinels intact.
88
+ * Deletes the file outright if our wrapper was the only content.
89
+ */
90
+ export declare function stripCoordinatorWrapperFile(filePath: string): void;
91
+ export interface PtyExecResult {
92
+ exitCode: number | null;
93
+ signal: number | null;
94
+ output: string;
95
+ timedOut: boolean;
96
+ }
97
+ export interface MeshCoordinatorRegistrationStep {
98
+ command: string;
99
+ args: string[];
100
+ required: boolean;
101
+ label: 'remove_existing' | 'register';
102
+ }
103
+ /**
104
+ * Codex rejects `mcp add` when a server with the same name already exists.
105
+ * Replace that entry before registering so transport/mesh changes do not leave
106
+ * a fresh coordinator attached to stale MCP launch arguments.
107
+ */
108
+ export declare function buildMeshCoordinatorRegistrationPlan(cliType: string, serverName: string, registrationCommand: string): MeshCoordinatorRegistrationStep[];
109
+ /**
110
+ * Run a one-shot CLI command under a real PTY and collect its output.
111
+ *
112
+ * Some provider mcp-registration commands (`agy mcp add`, future bubbletea
113
+ * TUIs) refuse to run without `/dev/tty`. Daemon-side `execFileSync` runs
114
+ * pipe-only, so those commands fail with errors like
115
+ * `bubbletea: error opening TTY: open /dev/tty: device not configured`
116
+ * and silently skip the registration, leaving the launched session
117
+ * without the adhdev-mesh MCP tools — which is exactly what we saw with
118
+ * agy coordinators.
119
+ *
120
+ * Wrapping the registration through node-pty gives the child a real PTY,
121
+ * so the bubbletea check passes. We close stdin immediately and just
122
+ * collect stdout until the process exits or the timeout fires.
123
+ */
124
+ export declare function execUnderPty(command: string, args: string[], options?: {
125
+ cwd?: string;
126
+ env?: Record<string, string>;
127
+ timeoutMs?: number;
128
+ }): Promise<PtyExecResult>;
@@ -14,6 +14,138 @@ 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 readCachedInlineMeshActiveSessionDetails(node: any): Array<Record<string, unknown>>;
18
+ type MeshRefineStageStatus = 'passed' | 'failed' | 'skipped';
19
+ type MeshRefinePatchEquivalenceSummary = {
20
+ status: MeshRefineStageStatus;
21
+ equivalent: boolean;
22
+ baseHead: string;
23
+ branchHead: string;
24
+ mergeBase?: string;
25
+ mergedTree?: string;
26
+ expectedPatchId?: string;
27
+ actualPatchId?: string;
28
+ durationMs: number;
29
+ error?: string;
30
+ stdout?: string;
31
+ stderr?: string;
32
+ actionableHint?: MeshRefineSubmoduleConflictHint;
33
+ /**
34
+ * Set when a `merge-tree` submodule conflict was reclassified as a trivial
35
+ * gitlink fast-forward and the gate passed via a synthesized merge tree.
36
+ */
37
+ gitlinkTrivialFastForward?: {
38
+ resolved: boolean;
39
+ gitlinks: Array<{
40
+ path: string;
41
+ baseCommit?: string;
42
+ branchCommit?: string;
43
+ fastForward: boolean;
44
+ }>;
45
+ reason?: string;
46
+ };
47
+ };
48
+ type MeshRefineEffectiveDiffSummary = {
49
+ status: MeshRefineStageStatus;
50
+ /** True when there is at least one root-tree change between base and branch (incl. gitlink bumps). */
51
+ hasEffectiveDiff: boolean;
52
+ baseHead: string;
53
+ branchHead: string;
54
+ /** Root-level paths that differ between base and branch (capped). */
55
+ changedPaths?: string[];
56
+ /** Submodule paths with uncommitted/divergent commits but NO committed gitlink bump in the root tree. */
57
+ submoduleHints?: Array<{
58
+ path: string;
59
+ reason: string;
60
+ }>;
61
+ durationMs: number;
62
+ error?: string;
63
+ stdout?: string;
64
+ stderr?: string;
65
+ };
66
+ type MeshRefineSubmoduleConflictHint = {
67
+ kind: 'submodule_conflict';
68
+ message: string;
69
+ conflicts: Array<{
70
+ path: string;
71
+ baseCommit?: string;
72
+ branchCommit?: string;
73
+ }>;
74
+ nextSteps: string[];
75
+ };
76
+ export declare function runMeshRefinePatchEquivalenceGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefinePatchEquivalenceSummary>;
77
+ /**
78
+ * No-op guard: detect a "silent no-op" merge before the Refinery merge runs.
79
+ *
80
+ * A silent no-op occurs when the refine target branch's ROOT tree is byte-identical
81
+ * to the merge base (origin/main). This is the trap where a submodule (e.g. oss) has
82
+ * real commits but the root branch never committed the gitlink (oss-pointer) bump, so
83
+ * the root diff Refinery would merge is empty. Merging that produces a merge commit with
84
+ * no content change — reported as "success" while the actual work never reaches main.
85
+ *
86
+ * A committed gitlink bump (the legitimate oss-pointer bump) DOES show up in the root
87
+ * tree diff (as a 160000-mode entry), so this guard does NOT block legitimate refines —
88
+ * it only fires when the root tree diff vs base is COMPLETELY empty.
89
+ *
90
+ * Runs after the patch-equivalence gate; the "already merged via other path" case
91
+ * (branch has real changes already present in base) is handled upstream and never
92
+ * reaches here, so an empty root diff at this point is genuinely a no-op.
93
+ */
94
+ export declare function runMeshRefineEffectiveDiffGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefineEffectiveDiffSummary>;
95
+ /**
96
+ * Result of evaluating whether a `git merge-tree --write-tree` submodule
97
+ * conflict is in fact a trivial gitlink fast-forward that should pass the
98
+ * patch-equivalence gate.
99
+ *
100
+ * `git merge-tree` (and `git merge` with the default recursive strategy)
101
+ * refuses to 3-way merge gitlinks unless the case is "trivial" — and it
102
+ * treats *any* gitlink that differs across merge-base/base/branch as
103
+ * non-trivial, even when the branch-side commit is a strict descendant of the
104
+ * base-side commit (i.e. a real fast-forward). Refinery only ever wants to
105
+ * accept the branch's recorded gitlink, so a fast-forwardable bump is safe to
106
+ * resolve to the branch side without any conflict.
107
+ */
108
+ type GitlinkTrivialFastForwardEvaluation = {
109
+ /** True only when the merge-tree conflict is *fully* explained by trivial-ff gitlinks. */
110
+ trivial: boolean;
111
+ /** Why the evaluation declined to treat the conflict as trivial (set when trivial=false). */
112
+ reason?: string;
113
+ /** Per-path detail for the changed gitlinks that were inspected. */
114
+ gitlinks: Array<{
115
+ path: string;
116
+ baseCommit?: string;
117
+ branchCommit?: string;
118
+ fastForward: boolean;
119
+ }>;
120
+ };
121
+ /**
122
+ * Return the changed gitlink paths between base and branch whose advance is a
123
+ * strict fast-forward (the base-side commit is an ancestor of the branch-side
124
+ * commit inside that submodule's repo). These are the paths whose patch-id hunk
125
+ * may legitimately differ when base has advanced the same submodule, so they
126
+ * are safe to exclude from the patch-equivalence comparison. A non-ff (genuinely
127
+ * diverged) gitlink is deliberately excluded from this set so it still fails the
128
+ * gate.
129
+ */
130
+ export declare function collectFastForwardGitlinkPaths(repoRoot: string, baseHead: string, branchHead: string): string[];
131
+ /**
132
+ * Decide whether a merge-tree submodule conflict between base and branch is a
133
+ * trivial gitlink fast-forward (and nothing else).
134
+ *
135
+ * The conflict is treated as trivial ONLY when:
136
+ * 1. at least one changed gitlink exists,
137
+ * 2. every changed gitlink fast-forwards (base-commit is an ancestor of the
138
+ * branch-commit inside that submodule's repo), and
139
+ * 3. the *only* paths that changed on both sides of the merge (i.e. the paths
140
+ * that could possibly produce a 3-way conflict — the intersection of
141
+ * mergeBase→base and mergeBase→branch changes) are gitlinks. Any
142
+ * overlapping non-gitlink path means a genuine content conflict could be
143
+ * hiding behind the submodule failure, so we keep the block.
144
+ *
145
+ * If any of these fail, the conflict is left as a genuine block. This never
146
+ * passes a regular-file conflict or a diverged (non-ff) gitlink.
147
+ */
148
+ export declare function evaluateGitlinkTrivialFastForward(repoRoot: string, baseHead: string, branchHead: string): GitlinkTrivialFastForwardEvaluation;
17
149
  export interface SessionHostControlPlane {
18
150
  getDiagnostics(payload?: {
19
151
  includeSessions?: boolean;
@@ -55,12 +187,14 @@ export interface CommandRouterDeps {
55
187
  value: any[];
56
188
  };
57
189
  sessionRegistry: SessionRegistry;
58
- /** Callback for CDP manager creation after launch_ide */
190
+ /** Callback after CDP manager created (transport-specific extras) */
59
191
  onCdpManagerCreated?: (ideType: string, manager: DaemonCdpManager) => void;
60
192
  /** Callback after IDE connected (e.g., startAgentStreamPolling) */
61
193
  onIdeConnected?: () => void;
62
194
  /** Callback after status change (stop_ide, restart) */
63
195
  onStatusChange?: () => void;
196
+ /** Callback when a mesh state is invalidated */
197
+ onMeshStateChange?: (meshId: string) => void;
64
198
  /** Callback after chat-related commands */
65
199
  onPostChatCommand?: () => void;
66
200
  /** Get a connected CDP manager (for agent stream reset check) */
@@ -87,12 +221,48 @@ export declare class DaemonCommandRouter {
87
221
  * Allows the MCP server to query mesh data via get_mesh even when
88
222
  * the mesh doesn't exist in the local meshes.json file. */
89
223
  private inlineMeshCache;
224
+ /** Tombstones for inline mesh nodes removed via remove_mesh_node, keyed by
225
+ * meshId → set of removed nodeIds. The dashboard keeps echoing the removed
226
+ * node in the inlineMesh it attaches to every command; without a tombstone,
227
+ * reconcileInlineMeshCache MERGEs it straight back (resurrection). A
228
+ * tombstoned node is skipped during reconcile only while its workspace is
229
+ * absent from disk — a genuine re-registration (same nodeId, workspace back
230
+ * on disk) clears the tombstone and merges normally, preserving clone
231
+ * worktree visibility and legitimate node re-creation. */
232
+ private removedInlineMeshNodeIds;
233
+ /** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
234
+ private aggregateMeshStatusCache;
235
+ /** Shared per-peer git_status probe dedup + recently-probed reuse gate.
236
+ * Spans separate mesh_status/get_mesh calls so the dashboard auto-retry
237
+ * loop cannot storm a slow peer with back-to-back refreshUpstream probes. */
238
+ private meshGitProbeCache;
239
+ /** In-memory async Refinery jobs keyed by meshId:nodeId to reject/return duplicate in-flight requests. */
240
+ private runningRefineJobs;
241
+ /** Terminal async Refinery jobs preserve a clear answer after the worktree node has been removed. */
242
+ private terminalRefineJobs;
243
+ /** In-memory async batch Refinery jobs keyed by meshId (one batch convergence per mesh at a time). */
244
+ private runningRefineBatchJobs;
245
+ /** Terminal async batch Refinery jobs preserve the last batch outcome for late readers. */
246
+ private terminalRefineBatchJobs;
90
247
  constructor(deps: CommandRouterDeps);
248
+ private cloneJsonValue;
249
+ private hydrateCachedAggregateMeshStatusFromInline;
250
+ private getCachedAggregateMeshStatus;
251
+ private rememberAggregateMeshStatus;
252
+ getCachedInlineMeshNodes(): any[];
91
253
  getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
92
254
  private warmInlineMeshCache;
93
255
  private getMeshForCommand;
256
+ private invalidateAggregateMeshStatus;
257
+ private requireMeshHostMutationOwner;
94
258
  private updateInlineMeshNode;
95
259
  private removeInlineMeshNode;
260
+ private tombstoneRemovedInlineMeshNode;
261
+ /** Filter an incoming inline mesh against this mesh's tombstones before it is
262
+ * reconciled into the cache. A tombstoned node is dropped only while its
263
+ * workspace is still absent from disk; if the workspace is back (genuine
264
+ * re-registration), the tombstone is cleared and the node merges normally. */
265
+ private applyInlineMeshNodeTombstones;
96
266
  private normalizeMeshSessionCleanupMode;
97
267
  private sessionMatchesMeshNode;
98
268
  private cleanupLocalWorktreeNode;
@@ -113,6 +283,63 @@ export declare class DaemonCommandRouter {
113
283
  * @param source Log source ('ws' | 'p2p' | 'standalone' | etc.)
114
284
  */
115
285
  execute(cmd: string, args: any, source?: string): Promise<CommandRouterResult>;
286
+ private buildRefineJobKey;
287
+ private buildRefineJobHandle;
288
+ private queueRefineJobEvent;
289
+ private appendRefineJobLedger;
290
+ /**
291
+ * On daemon restart, scan all mesh ledgers for refine jobs that were dispatched
292
+ * but never completed/failed (i.e. the daemon died mid-job). Re-queue each one
293
+ * so the job runs to completion automatically without coordinator intervention.
294
+ */
295
+ resumePendingRefineJobsOnStartup(): Promise<void>;
296
+ private executeMeshRefineNodeSynchronously;
297
+ /**
298
+ * Batch refinery: converge multiple sibling worktree nodes onto the base branch
299
+ * in one sequential pipeline, absorbing the rebase + patch-equivalence churn that
300
+ * arises when several siblings touch the same submodule.
301
+ *
302
+ * Reuses executeMeshRefineNodeSynchronously per node — every node goes through the
303
+ * exact same validation / patch-equivalence / submodule-reachability / merge / cleanup
304
+ * gates, including its built-in auto-rebase onto fresh origin/<base>. Because each
305
+ * node fetches origin/<base> at the start of its own refine, a node merged earlier in
306
+ * the batch advances the base, and the next node's refine auto-rebases onto it before
307
+ * re-running patch-equivalence. No force-push, no reset — conflicting nodes are
308
+ * isolated as blocked_review while the rest of the batch proceeds.
309
+ */
310
+ private batchRefineMeshNodes;
311
+ /**
312
+ * Convergence core shared by the synchronous batch entry and the async batch job.
313
+ * Refines each node in order: the per-node refine pipeline fetches origin/<base>
314
+ * fresh, so each merged sibling advances the base before the next node's auto-rebase
315
+ * + patch-equivalence re-check. A blocked/failed node is isolated; the batch
316
+ * continues with the remaining nodes. Does NOT touch the per-node merge logic — it
317
+ * only sequences calls to executeMeshRefineNodeSynchronously and aggregates outcomes.
318
+ */
319
+ private runMeshRefineBatchConvergence;
320
+ private buildRefineBatchJobKey;
321
+ private buildRefineBatchJobHandle;
322
+ /**
323
+ * Emit a batch Refinery terminal/accepted event through the SAME pending-event +
324
+ * forward mechanism single-node refine uses (queueRefineJobEvent), so the
325
+ * coordinator's existing refine:accepted/completed/failed handling and message
326
+ * renderer apply unchanged. The aggregate per-node results ride along in `result`.
327
+ */
328
+ private queueRefineBatchJobEvent;
329
+ private appendRefineBatchJobLedger;
330
+ private finishMeshRefineBatchJob;
331
+ /**
332
+ * Async entry for the batch Refinery execute path. Mirrors startMeshRefineJob:
333
+ * resolves the plan synchronously (so target/ordering errors and the dry-run shape
334
+ * stay synchronous), then for execute=true registers an in-flight batch job, returns
335
+ * {async:true, status:'accepted', batch:true, ...plan} immediately, and runs the
336
+ * convergence loop in the background — emitting the same terminal refine event.
337
+ * Idempotent: a batch already in flight for this mesh returns the running handle
338
+ * with duplicate:true rather than spawning a second background job.
339
+ */
340
+ private startMeshRefineBatchJob;
341
+ private finishMeshRefineJob;
342
+ private startMeshRefineJob;
116
343
  /**
117
344
  * Daemon-level command execution (IDE start/stop/restart, CLI, detect, logs).
118
345
  * Returns null if not handled at this level → caller delegates to CommandHandler.
@@ -123,3 +350,4 @@ export declare class DaemonCommandRouter {
123
350
  */
124
351
  private stopIde;
125
352
  }
353
+ export {};
@@ -40,5 +40,17 @@ export declare function buildPinnedGlobalInstallCommand(options: {
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
42
  export declare function stopSessionHostProcesses(appName: string): void;
43
+ /**
44
+ * Best-effort removal of a leftover npm staging entry.
45
+ *
46
+ * A stale staging dir can hold a locked native binary — e.g. `ghostty-vt.dll`
47
+ * from `@adhdev/ghostty-vt-node` still mapped by a lingering session-host
48
+ * process — which makes `rmSync` throw `EPERM` on Windows. Staging cleanup is
49
+ * only housekeeping: the leftover is inert and npm creates its own fresh
50
+ * staging dir for the real install, so a lock on an old leftover must NOT abort
51
+ * the upgrade. Log and continue instead of letting the error propagate.
52
+ */
53
+ export declare function safeRemoveStaleEntry(target: string, label: string): void;
54
+ export declare function cleanupStaleGlobalInstallDirs(pkgName: string, surface: CurrentGlobalInstallSurface): void;
43
55
  export declare function spawnDetachedDaemonUpgradeHelper(payload: DaemonUpgradeHelperPayload): void;
44
56
  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
  */