@adhdev/daemon-core 0.9.82-rc.21 → 0.9.82-rc.211

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 (269) hide show
  1. package/dist/boot/daemon-lifecycle.d.ts +1 -0
  2. package/dist/boot/process-hardening.d.ts +50 -0
  3. package/dist/chat/source-machine.d.ts +166 -0
  4. package/dist/chat/source-resolver.d.ts +104 -0
  5. package/dist/chat/subscription-updates.d.ts +1 -0
  6. package/dist/cli-adapter-types.d.ts +23 -2
  7. package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
  8. package/dist/cli-adapters/cli-state-engine.d.ts +178 -0
  9. package/dist/cli-adapters/provider-cli-adapter.d.ts +106 -63
  10. package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
  11. package/dist/cli-adapters/provider-cli-shared.d.ts +29 -0
  12. package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
  13. package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +3 -3
  14. package/dist/cli-adapters/terminal-backends/types.d.ts +1 -2
  15. package/dist/cli-adapters/terminal-screen.d.ts +2 -11
  16. package/dist/commands/cli-manager.d.ts +2 -1
  17. package/dist/commands/handler.d.ts +110 -0
  18. package/dist/commands/mesh-coordinator.d.ts +85 -1
  19. package/dist/commands/router.d.ts +32 -1
  20. package/dist/config/chat-history.d.ts +9 -0
  21. package/dist/config/config.d.ts +5 -0
  22. package/dist/config/mesh-config.d.ts +72 -1
  23. package/dist/git/git-commands.d.ts +9 -1
  24. package/dist/git/git-diff.d.ts +6 -0
  25. package/dist/git/git-types.d.ts +2 -0
  26. package/dist/index.d.ts +46 -11
  27. package/dist/index.js +35173 -15756
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +34880 -15556
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/installer.d.ts +1 -4
  32. package/dist/ipc/local-ipc-server.d.ts +91 -0
  33. package/dist/launch.d.ts +1 -1
  34. package/dist/logging/async-batch-writer.d.ts +10 -0
  35. package/dist/mesh/contracts.d.ts +164 -0
  36. package/dist/mesh/coordinator-prompt.d.ts +36 -0
  37. package/dist/mesh/coordinator-registry.d.ts +59 -0
  38. package/dist/mesh/mesh-active-work.d.ts +90 -0
  39. package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
  40. package/dist/mesh/mesh-events-coordinator.d.ts +151 -0
  41. package/dist/mesh/mesh-events-pending.d.ts +33 -0
  42. package/dist/mesh/mesh-events-stale.d.ts +40 -0
  43. package/dist/mesh/mesh-events-utils.d.ts +14 -0
  44. package/dist/mesh/mesh-events.d.ts +5 -40
  45. package/dist/mesh/mesh-fast-forward.d.ts +41 -0
  46. package/dist/mesh/mesh-host-ownership.d.ts +9 -0
  47. package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -3
  48. package/dist/mesh/mesh-ledger.d.ts +77 -1
  49. package/dist/mesh/mesh-missions.d.ts +58 -0
  50. package/dist/mesh/mesh-refine-status.d.ts +26 -0
  51. package/dist/mesh/mesh-review-inbox.d.ts +90 -0
  52. package/dist/mesh/mesh-runtime-store.d.ts +324 -0
  53. package/dist/mesh/mesh-task-stats.d.ts +49 -0
  54. package/dist/mesh/mesh-work-queue.d.ts +137 -6
  55. package/dist/mesh/preview-freshness.d.ts +18 -0
  56. package/dist/mesh/refine-config.d.ts +215 -0
  57. package/dist/mesh/worktree-bootstrap-config.d.ts +135 -0
  58. package/dist/providers/acp-provider-instance.d.ts +2 -0
  59. package/dist/providers/approval-utils.d.ts +13 -0
  60. package/dist/providers/cli-provider-instance.d.ts +39 -3
  61. package/dist/providers/contracts.d.ts +130 -6
  62. package/dist/providers/external-sources.d.ts +71 -0
  63. package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
  64. package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
  65. package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
  66. package/dist/providers/native-history/dispatcher.d.ts +27 -0
  67. package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
  68. package/dist/providers/native-history/index.d.ts +13 -0
  69. package/dist/providers/provider-instance-manager.d.ts +12 -0
  70. package/dist/providers/provider-instance.d.ts +13 -1
  71. package/dist/providers/provider-loader.d.ts +26 -4
  72. package/dist/providers/provider-trust.d.ts +31 -0
  73. package/dist/providers/read-chat-contract.d.ts +29 -0
  74. package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
  75. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
  76. package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
  77. package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
  78. package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
  79. package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
  80. package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
  81. package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
  82. package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
  83. package/dist/providers/sdk/v1/index.d.ts +30 -0
  84. package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
  85. package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
  86. package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
  87. package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
  88. package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
  89. package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
  90. package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
  91. package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
  92. package/dist/providers/spec/adapter.d.ts +52 -0
  93. package/dist/providers/spec/cli-adapter.d.ts +101 -0
  94. package/dist/providers/spec/driver.d.ts +225 -0
  95. package/dist/providers/spec/evaluator.d.ts +54 -0
  96. package/dist/providers/spec/loader.d.ts +15 -0
  97. package/dist/providers/spec/native-history-executor.d.ts +41 -0
  98. package/dist/providers/spec/route.d.ts +4 -0
  99. package/dist/providers/spec/schema.gen.d.ts +2025 -0
  100. package/dist/providers/spec/types.d.ts +302 -0
  101. package/dist/providers/transcript-v2.d.ts +176 -0
  102. package/dist/providers/types/interactive-prompt.d.ts +48 -0
  103. package/dist/repo-mesh-types.d.ts +109 -1
  104. package/dist/sessions/registry.d.ts +3 -0
  105. package/dist/shared-types-extra.d.ts +2 -4
  106. package/dist/shared-types.d.ts +42 -1
  107. package/dist/status/normalize.d.ts +1 -1
  108. package/dist/status/normalize.js +1 -0
  109. package/dist/status/normalize.js.map +1 -1
  110. package/dist/status/normalize.mjs +1 -0
  111. package/dist/status/normalize.mjs.map +1 -1
  112. package/dist/status/reporter.d.ts +2 -0
  113. package/dist/status/snapshot.d.ts +1 -0
  114. package/dist/types.d.ts +5 -0
  115. package/package.json +6 -3
  116. package/src/agent-stream/poller.ts +2 -3
  117. package/src/boot/daemon-lifecycle.ts +22 -10
  118. package/src/boot/process-hardening.ts +89 -0
  119. package/src/chat/source-machine.ts +534 -0
  120. package/src/chat/source-resolver.ts +0 -0
  121. package/src/chat/subscription-updates.ts +20 -1
  122. package/src/cli-adapter-types.d.ts +1 -0
  123. package/src/cli-adapter-types.ts +22 -2
  124. package/src/cli-adapters/cli-script-runner.ts +421 -0
  125. package/src/cli-adapters/cli-state-engine.ts +1138 -0
  126. package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
  127. package/src/cli-adapters/provider-cli-adapter.ts +673 -1139
  128. package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
  129. package/src/cli-adapters/provider-cli-parse.ts +13 -0
  130. package/src/cli-adapters/provider-cli-runtime.ts +3 -1
  131. package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
  132. package/src/cli-adapters/provider-cli-shared.ts +59 -11
  133. package/src/cli-adapters/raw-terminal-io.ts +252 -0
  134. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +35 -29
  135. package/src/cli-adapters/terminal-backends/types.ts +1 -3
  136. package/src/cli-adapters/terminal-screen.ts +11 -81
  137. package/src/commands/chat-commands.ts +1787 -60
  138. package/src/commands/cli-manager.ts +283 -14
  139. package/src/commands/handler.ts +809 -2
  140. package/src/commands/mesh-coordinator.ts +332 -122
  141. package/src/commands/router.ts +4198 -557
  142. package/src/config/chat-history.ts +95 -24
  143. package/src/config/config.ts +12 -0
  144. package/src/config/mesh-config.ts +280 -2
  145. package/src/config/recent-activity.ts +8 -2
  146. package/src/daemon/dev-auto-implement.ts +3 -2
  147. package/src/daemon/dev-cli-debug.ts +10 -1
  148. package/src/detection/ide-detector.ts +26 -16
  149. package/src/git/git-commands.ts +42 -12
  150. package/src/git/git-diff.ts +53 -0
  151. package/src/git/git-status.ts +35 -6
  152. package/src/git/git-types.ts +2 -0
  153. package/src/git/git-worktree.ts +8 -1
  154. package/src/index.ts +126 -10
  155. package/src/installer.d.ts +1 -1
  156. package/src/installer.ts +8 -6
  157. package/src/ipc/local-ipc-server.ts +278 -0
  158. package/src/launch.d.ts +1 -1
  159. package/src/launch.ts +37 -28
  160. package/src/logging/async-batch-writer.ts +55 -0
  161. package/src/logging/logger.ts +2 -1
  162. package/src/mesh/contracts.ts +329 -0
  163. package/src/mesh/coordinator-prompt.ts +218 -31
  164. package/src/mesh/coordinator-registry.ts +121 -0
  165. package/src/mesh/mesh-active-work.ts +437 -0
  166. package/src/mesh/mesh-delivery-policy.ts +315 -0
  167. package/src/mesh/mesh-events-coordinator.ts +1404 -0
  168. package/src/mesh/mesh-events-pending.ts +371 -0
  169. package/src/mesh/mesh-events-stale.ts +283 -0
  170. package/src/mesh/mesh-events-utils.ts +161 -0
  171. package/src/mesh/mesh-events.ts +24 -908
  172. package/src/mesh/mesh-fast-forward.ts +438 -0
  173. package/src/mesh/mesh-host-ownership.ts +73 -0
  174. package/src/mesh/mesh-ledger-reconciliation.ts +12 -5
  175. package/src/mesh/mesh-ledger.ts +587 -102
  176. package/src/mesh/mesh-missions.ts +151 -0
  177. package/src/mesh/mesh-refine-status.ts +144 -0
  178. package/src/mesh/mesh-review-inbox.ts +307 -0
  179. package/src/mesh/mesh-runtime-store.ts +1305 -0
  180. package/src/mesh/mesh-task-stats.ts +154 -0
  181. package/src/mesh/mesh-work-queue.ts +490 -166
  182. package/src/mesh/preview-freshness.ts +118 -0
  183. package/src/mesh/refine-config.ts +403 -0
  184. package/src/mesh/worktree-bootstrap-config.ts +326 -0
  185. package/src/providers/acp-provider-instance.ts +15 -1
  186. package/src/providers/approval-utils.d.ts +4 -0
  187. package/src/providers/approval-utils.ts +47 -5
  188. package/src/providers/chat-message-normalization.ts +4 -11
  189. package/src/providers/cli-provider-instance.ts +833 -64
  190. package/src/providers/contracts.d.ts +55 -0
  191. package/src/providers/contracts.ts +141 -6
  192. package/src/providers/external-sources.ts +218 -0
  193. package/src/providers/ide-provider-instance.ts +19 -5
  194. package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
  195. package/src/providers/native-history/claude-cli-transcript.ts +396 -0
  196. package/src/providers/native-history/codex-cli-transcript.ts +419 -0
  197. package/src/providers/native-history/dispatcher.ts +340 -0
  198. package/src/providers/native-history/hermes-cli-transcript.ts +230 -0
  199. package/src/providers/native-history/index.ts +30 -0
  200. package/src/providers/provider-instance-manager.ts +30 -0
  201. package/src/providers/provider-instance.ts +10 -1
  202. package/src/providers/provider-loader.ts +582 -50
  203. package/src/providers/provider-schema.ts +87 -14
  204. package/src/providers/provider-trust.ts +114 -0
  205. package/src/providers/read-chat-contract.ts +76 -16
  206. package/src/providers/sdk/README.md +49 -0
  207. package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
  208. package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
  209. package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
  210. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +250 -0
  211. package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
  212. package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
  213. package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
  214. package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
  215. package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
  216. package/src/providers/sdk/v1/index.ts +152 -0
  217. package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
  218. package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
  219. package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
  220. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +504 -0
  221. package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
  222. package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
  223. package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
  224. package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
  225. package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
  226. package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
  227. package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
  228. package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
  229. package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
  230. package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
  231. package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
  232. package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
  233. package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
  234. package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
  235. package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
  236. package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
  237. package/src/providers/sdk/v1/types/cli/index.ts +365 -0
  238. package/src/providers/sdk/v1/types/common/index.ts +229 -0
  239. package/src/providers/sdk/v1/validators/index.ts +19 -0
  240. package/src/providers/sdk/v1/validators/manifest.ts +110 -0
  241. package/src/providers/sdk/v1/validators/taint.ts +309 -0
  242. package/src/providers/spec/adapter.ts +138 -0
  243. package/src/providers/spec/cli-adapter.ts +626 -0
  244. package/src/providers/spec/driver.ts +922 -0
  245. package/src/providers/spec/evaluator.ts +597 -0
  246. package/src/providers/spec/loader.ts +324 -0
  247. package/src/providers/spec/native-history-executor.ts +939 -0
  248. package/src/providers/spec/route.ts +51 -0
  249. package/src/providers/spec/schema.gen.ts +691 -0
  250. package/src/providers/spec/schema.json +341 -0
  251. package/src/providers/spec/types.ts +356 -0
  252. package/src/providers/transcript-v2.ts +567 -0
  253. package/src/providers/types/interactive-prompt.ts +425 -0
  254. package/src/providers/version-archive.ts +38 -20
  255. package/src/repo-mesh-types.ts +119 -1
  256. package/src/sessions/registry.ts +3 -0
  257. package/src/shared-types-extra.ts +2 -4
  258. package/src/shared-types.ts +45 -1
  259. package/src/status/builders.ts +24 -6
  260. package/src/status/normalize.ts +2 -0
  261. package/src/status/reporter.ts +15 -0
  262. package/src/status/snapshot.ts +84 -25
  263. package/src/system/host-memory.ts +29 -12
  264. package/src/types.ts +5 -0
  265. package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
  266. package/dist/mesh/mesh-sync.d.ts +0 -53
  267. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
  268. package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
  269. package/src/mesh/mesh-sync.ts +0 -111
@@ -7,8 +7,10 @@
7
7
  * Migrated from @adhdev/core — this is now the single source of truth.
8
8
  */
9
9
 
10
- import { execSync } from 'child_process';
11
- import { existsSync } from 'fs';
10
+ import { exec } from 'child_process';
11
+ import { promisify } from 'util';
12
+ const execAsync = promisify(exec);
13
+ import { existsSync, statSync } from 'fs';
12
14
  import { platform, homedir } from 'os';
13
15
  import * as path from 'path';
14
16
  import type { ProviderLoader } from '../providers/provider-loader.js';
@@ -73,25 +75,33 @@ function findCliCommand(command: string): string | null {
73
75
  const resolved = path.isAbsolute(candidate) ? candidate : path.resolve(candidate);
74
76
  return existsSync(resolved) ? resolved : null;
75
77
  }
76
- try {
77
- const result = execSync(
78
- platform() === 'win32' ? `where ${trimmed}` : `which ${trimmed}`,
79
- { encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }
80
- ).trim();
81
- return result.split('\n')[0] || null;
82
- } catch {
83
- return null;
78
+ const isWin = platform() === 'win32';
79
+ const paths = (process.env.PATH || '').split(isWin ? ';' : ':');
80
+ const exes = isWin ? ['.exe', '.cmd', '.bat', ''] : [''];
81
+ for (const p of paths) {
82
+ if (!p) continue;
83
+ for (const ext of exes) {
84
+ const fullPath = path.join(p, trimmed + ext);
85
+ try {
86
+ if (existsSync(fullPath)) {
87
+ const stat = statSync(fullPath);
88
+ if (stat.isFile() && (isWin || (stat.mode & 0o111))) {
89
+ return fullPath;
90
+ }
91
+ }
92
+ } catch { }
93
+ }
84
94
  }
95
+ return null;
85
96
  }
86
97
 
87
- function getIdeVersion(cliCommand: string): string | null {
98
+ async function getIdeVersion(cliCommand: string): Promise<string | null> {
88
99
  try {
89
- const result = execSync(`"${cliCommand}" --version`, {
100
+ const { stdout } = await execAsync(`"${cliCommand}" --version`, {
90
101
  encoding: 'utf-8',
91
102
  timeout: 10000,
92
- stdio: ['pipe', 'pipe', 'pipe'],
93
- }).trim();
94
- return result.split('\n')[0] || null;
103
+ });
104
+ return stdout.trim().split('\n')[0] || null;
95
105
  } catch {
96
106
  return null;
97
107
  }
@@ -152,7 +162,7 @@ export async function detectIDEs(providerLoader?: ProviderLoader): Promise<IDEIn
152
162
  const installed = os === 'darwin'
153
163
  ? !!(resolvedCli || appPath)
154
164
  : !!resolvedCli;
155
- const version = resolvedCli ? getIdeVersion(resolvedCli) : null;
165
+ const version = resolvedCli ? await getIdeVersion(resolvedCli) : null;
156
166
 
157
167
  results.push({
158
168
  id: def.id,
@@ -42,8 +42,12 @@ export interface GitLogResult extends GitRepoIdentity {
42
42
  }
43
43
 
44
44
  export interface GitCheckpointResult extends GitRepoIdentity {
45
- commit: string;
45
+ commit?: string;
46
46
  message: string;
47
+ status?: 'created' | 'skipped';
48
+ skipped?: boolean;
49
+ noop?: boolean;
50
+ reason?: 'nothing_to_commit';
47
51
  lastCheckedAt: number;
48
52
  }
49
53
 
@@ -62,9 +66,9 @@ export interface GitPushResult extends GitRepoIdentity {
62
66
  }
63
67
 
64
68
  export interface GitCommandServices {
65
- getStatus?: (params: { workspace: string; refreshUpstream?: boolean }) => Promise<GitRepoStatus> | GitRepoStatus;
66
- getDiffSummary?: (params: { workspace: string; staged?: boolean }) => Promise<GitDiffSummary> | GitDiffSummary;
67
- getDiffFile?: (params: { workspace: string; path: string; staged?: boolean }) => Promise<GitFileDiff> | GitFileDiff;
69
+ getStatus?: (params: { workspace: string; refreshUpstream?: boolean; includeSubmodules?: boolean; submoduleIgnorePaths?: string[] }) => Promise<GitRepoStatus> | GitRepoStatus;
70
+ getDiffSummary?: (params: { workspace: string; staged?: boolean; base?: string }) => Promise<GitDiffSummary> | GitDiffSummary;
71
+ getDiffFile?: (params: { workspace: string; path: string; staged?: boolean; base?: string }) => Promise<GitFileDiff> | GitFileDiff;
68
72
  createSnapshot?: (params: {
69
73
  workspace: string;
70
74
  reason: GitSnapshotReason;
@@ -172,8 +176,8 @@ const defaultSnapshotStore = createGitSnapshotStore({
172
176
  export function createDefaultGitCommandServices(): GitCommandServices {
173
177
  return {
174
178
  getStatus: ({ workspace, refreshUpstream }) => getGitRepoStatus(workspace, { refreshUpstream }),
175
- getDiffSummary: ({ workspace }) => getGitDiffSummary(workspace),
176
- getDiffFile: ({ workspace, path: filePath }) => getGitFileDiff(workspace, filePath),
179
+ getDiffSummary: ({ workspace, base }) => getGitDiffSummary(workspace, base ? { baseRef: base } : {}),
180
+ getDiffFile: ({ workspace, path: filePath, base }) => getGitFileDiff(workspace, filePath, base ? { baseRef: base } : {}),
177
181
  createSnapshot: ({ workspace, reason, sessionId, turnId }) => defaultSnapshotStore.create({
178
182
  workspace,
179
183
  reason,
@@ -290,13 +294,22 @@ export async function handleGitCommand(
290
294
  switch (command) {
291
295
  case 'git_status': {
292
296
  if (!services.getStatus) return serviceNotImplemented(command);
293
- const status = await runService(() => services.getStatus!({ workspace, refreshUpstream: optionalBoolean(args?.refreshUpstream) }));
297
+ const submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths)
298
+ ? args.submoduleIgnorePaths.filter((value: unknown): value is string => typeof value === 'string' && value.trim().length > 0)
299
+ : undefined;
300
+ const statusParams: { workspace: string; refreshUpstream?: boolean; includeSubmodules?: boolean; submoduleIgnorePaths?: string[] } = { workspace };
301
+ const refreshUpstream = optionalBoolean(args?.refreshUpstream);
302
+ const includeSubmodules = optionalBoolean(args?.includeSubmodules);
303
+ if (refreshUpstream !== undefined) statusParams.refreshUpstream = refreshUpstream;
304
+ if (includeSubmodules !== undefined) statusParams.includeSubmodules = includeSubmodules;
305
+ if (submoduleIgnorePaths && submoduleIgnorePaths.length > 0) statusParams.submoduleIgnorePaths = submoduleIgnorePaths;
306
+ const status = await runService(() => services.getStatus!(statusParams));
294
307
  return 'success' in status ? status : { success: true, status };
295
308
  }
296
309
 
297
310
  case 'git_diff_summary': {
298
311
  if (!services.getDiffSummary) return serviceNotImplemented(command);
299
- const diffSummary = await runService(() => services.getDiffSummary!({ workspace, staged: optionalBoolean(args?.staged) }));
312
+ const diffSummary = await runService(() => services.getDiffSummary!({ workspace, staged: optionalBoolean(args?.staged), base: optionalString(args?.base) }));
300
313
  return 'success' in diffSummary ? diffSummary : { success: true, diffSummary };
301
314
  }
302
315
 
@@ -442,6 +455,15 @@ async function gitCheckpoint(
442
455
  if (statusResult.hasConflicts) {
443
456
  throw new GitCommandError('conflict', 'Repository has conflicts — resolve before checkpointing');
444
457
  }
458
+ const dirtySubmodules = (statusResult.submodules || []).filter(submodule => submodule.dirty);
459
+ if (dirtySubmodules.length > 0) {
460
+ const paths = dirtySubmodules.map(submodule => submodule.path).join(', ');
461
+ throw new GitCommandError(
462
+ 'dirty_index_required',
463
+ `Repository has dirty submodules that must be checkpointed first: ${paths}. ` +
464
+ 'Checkpoint or commit each dirty submodule, then checkpoint this repository to record gitlink changes.',
465
+ );
466
+ }
445
467
 
446
468
  const addArgs = includeUntracked ? ['-A'] : ['-u'];
447
469
  await runGit(repo, ['add', ...addArgs], { cwd: repoRoot });
@@ -455,10 +477,17 @@ async function gitCheckpoint(
455
477
  } catch (err: any) {
456
478
  const output = (err?.stdout || '') + (err?.stderr || '');
457
479
  if (/nothing to commit/i.test(output)) {
458
- throw new GitCommandError('nothing_to_commit', 'Nothing to commit — working tree is clean.', {
459
- stdout: err?.stdout,
460
- stderr: err?.stderr,
461
- });
480
+ return {
481
+ workspace: repo.workspace,
482
+ repoRoot,
483
+ isGitRepo: true,
484
+ message: fullMsg,
485
+ status: 'skipped',
486
+ skipped: true,
487
+ noop: true,
488
+ reason: 'nothing_to_commit',
489
+ lastCheckedAt: Date.now(),
490
+ };
462
491
  }
463
492
  throw err;
464
493
  }
@@ -469,6 +498,7 @@ async function gitCheckpoint(
469
498
  isGitRepo: true,
470
499
  commit: commitSha,
471
500
  message: fullMsg,
501
+ status: 'created',
472
502
  lastCheckedAt: Date.now(),
473
503
  };
474
504
  }
@@ -10,6 +10,20 @@ export interface GitDiffOptions {
10
10
  timeoutMs?: number;
11
11
  maxFiles?: number;
12
12
  maxBytes?: number;
13
+ /**
14
+ * When set, diff `<baseRef>...HEAD` (merge-base range — "what this branch
15
+ * adds on top of base") instead of the working tree. Staged/untracked
16
+ * sections do not apply in this mode.
17
+ */
18
+ baseRef?: string;
19
+ }
20
+
21
+ function validateBaseRef(ref: string): string {
22
+ const trimmed = ref.trim();
23
+ if (!trimmed || trimmed.startsWith('-') || trimmed.includes('..') || !/^[A-Za-z0-9][A-Za-z0-9._/@-]*$/.test(trimmed)) {
24
+ throw new GitCommandError('invalid_args', `Invalid base ref: ${ref}`);
25
+ }
26
+ return trimmed;
13
27
  }
14
28
 
15
29
  export interface GitFileDiffResult {
@@ -44,6 +58,30 @@ export async function getGitDiffSummary(
44
58
  try {
45
59
  const repo = await resolveGitRepository(workspace, options);
46
60
  const repoRoot = repo.repoRoot!;
61
+
62
+ if (options.baseRef) {
63
+ const range = `${validateBaseRef(options.baseRef)}...HEAD`;
64
+ const [nameStatus, numstat] = await Promise.all([
65
+ runGit(repo, ['diff', '--no-ext-diff', '--name-status', range, '--'], { ...options, cwd: repoRoot }),
66
+ runGit(repo, ['diff', '--no-ext-diff', '--numstat', range, '--'], { ...options, cwd: repoRoot }),
67
+ ]);
68
+ const outputBytes = byteLength(nameStatus.stdout + numstat.stdout);
69
+ const changes = combineDiffEntries(nameStatus.stdout, numstat.stdout, false);
70
+ const maxFiles = normalizePositiveInteger(options.maxFiles, DEFAULT_MAX_FILES);
71
+ const maxBytes = normalizePositiveInteger(options.maxBytes, DEFAULT_MAX_BYTES);
72
+ const files = changes.slice(0, maxFiles);
73
+ return {
74
+ workspace: repo.workspace,
75
+ repoRoot,
76
+ isGitRepo: true,
77
+ files,
78
+ totalInsertions: files.reduce((sum, file) => sum + file.insertions, 0),
79
+ totalDeletions: files.reduce((sum, file) => sum + file.deletions, 0),
80
+ truncated: changes.length > files.length || outputBytes > maxBytes,
81
+ lastCheckedAt,
82
+ };
83
+ }
84
+
47
85
  const [unstagedNameStatus, unstagedNumstat, stagedNameStatus, stagedNumstat, untracked] = await Promise.all([
48
86
  runGit(repo, ['diff', '--no-ext-diff', '--name-status'], { ...options, cwd: repoRoot }),
49
87
  runGit(repo, ['diff', '--no-ext-diff', '--numstat'], { ...options, cwd: repoRoot }),
@@ -106,6 +144,21 @@ export async function getGitFileDiff(
106
144
  const selected = await resolveRepoFilePath(repoRoot, filePath);
107
145
  const maxBytes = normalizePositiveInteger(options.maxBytes, DEFAULT_MAX_BYTES);
108
146
 
147
+ if (options.baseRef) {
148
+ const range = `${validateBaseRef(options.baseRef)}...HEAD`;
149
+ const result = await runGit(repo, ['diff', '--no-ext-diff', range, '--', selected.relativePath], { ...options, cwd: repoRoot });
150
+ const bounded = truncateText(result.stdout, maxBytes);
151
+ return {
152
+ workspace: repo.workspace,
153
+ repoRoot,
154
+ isGitRepo: true,
155
+ path: selected.relativePath,
156
+ diff: bounded.text,
157
+ truncated: bounded.truncated,
158
+ lastCheckedAt,
159
+ };
160
+ }
161
+
109
162
  const [unstaged, staged] = await Promise.all([
110
163
  runGit(repo, ['diff', '--no-ext-diff', '--', selected.relativePath], { ...options, cwd: repoRoot }),
111
164
  runGit(repo, ['diff', '--cached', '--no-ext-diff', '--', selected.relativePath], { ...options, cwd: repoRoot }),
@@ -48,6 +48,11 @@ export async function getGitRepoStatus(
48
48
  if (includeSubmodules) {
49
49
  submodules = await getSubmoduleStatuses(repo, options);
50
50
  }
51
+ const submoduleDirty = (submodules || []).some(submodule => submodule.dirty || submodule.outOfSync || !!submodule.error);
52
+ const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0
53
+ || parsed.conflictFiles.length > 0
54
+ || stashCount > 0
55
+ || submoduleDirty;
51
56
 
52
57
  return {
53
58
  workspace: repo.workspace,
@@ -67,6 +72,7 @@ export async function getGitRepoStatus(
67
72
  untracked: parsed.untracked,
68
73
  deleted: parsed.deleted,
69
74
  renamed: parsed.renamed,
75
+ dirty,
70
76
  hasConflicts: parsed.conflictFiles.length > 0,
71
77
  conflictFiles: parsed.conflictFiles,
72
78
  stashCount,
@@ -285,6 +291,7 @@ function emptyStatus(workspace: string, lastCheckedAt: number, error: GitCommand
285
291
  untracked: 0,
286
292
  deleted: 0,
287
293
  renamed: 0,
294
+ dirty: false,
288
295
  hasConflicts: false,
289
296
  conflictFiles: [],
290
297
  stashCount: 0,
@@ -304,12 +311,34 @@ async function getSubmoduleStatuses(
304
311
 
305
312
  try {
306
313
  const result = await runGit(repo, ['submodule', 'status', '--recursive'], options);
307
- return parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
314
+ const submodules = parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
315
+ await Promise.all(submodules.map(submodule => enrichSubmoduleWorktreeStatus(repo, submodule, options)));
316
+ return submodules;
308
317
  } catch {
309
318
  return [];
310
319
  }
311
320
  }
312
321
 
322
+ async function enrichSubmoduleWorktreeStatus(
323
+ repo: ResolvedGitRepo,
324
+ submodule: GitSubmoduleStatus,
325
+ options: GitStatusOptions,
326
+ ): Promise<void> {
327
+ try {
328
+ const result = await runGit(repo, ['status', '--porcelain=v2', '--branch'], {
329
+ ...options,
330
+ cwd: submodule.repoPath,
331
+ });
332
+ const parsed = parsePorcelainV2Status(result.stdout);
333
+ const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0
334
+ || parsed.conflictFiles.length > 0;
335
+ submodule.dirty = submodule.dirty || dirty;
336
+ } catch (error) {
337
+ submodule.dirty = true;
338
+ submodule.error = formatGitError(error);
339
+ }
340
+ }
341
+
313
342
  function parseSubmoduleStatusOutput(
314
343
  output: string,
315
344
  repoRoot: string,
@@ -321,9 +350,9 @@ function parseSubmoduleStatusOutput(
321
350
  for (const line of output.split('\n')) {
322
351
  if (!line.trim()) continue;
323
352
 
324
- // Format: [+- ]<commit> <path> (<branch>)
325
- // - = out of sync, + = dirty, ' ' = clean
326
- const match = line.match(/^([\-+\s])([0-9a-f]{40})\s+(\S+)(?:\s+\(([^)]+)\))?/);
353
+ // Format: [+-U ]<commit> <path> (<branch>)
354
+ // - = not initialized, + = gitlink out of sync, U = conflict, ' ' = aligned.
355
+ const match = line.match(/^([\-+U\s])([0-9a-f]{40})\s+(\S+)(?:\s+\(([^)]+)\))?/);
327
356
  if (!match) continue;
328
357
 
329
358
  const prefix = match[1];
@@ -336,8 +365,8 @@ function parseSubmoduleStatusOutput(
336
365
  path,
337
366
  commit,
338
367
  repoPath: repoRoot + '/' + path,
339
- dirty: prefix === '+',
340
- outOfSync: prefix === '-',
368
+ dirty: prefix === 'U',
369
+ outOfSync: prefix === '-' || prefix === '+',
341
370
  lastCheckedAt: Date.now(),
342
371
  });
343
372
  }
@@ -60,6 +60,8 @@ export interface GitRepoStatus extends GitRepoIdentity {
60
60
  untracked: number;
61
61
  deleted: number;
62
62
  renamed: number;
63
+ /** Aggregate dirty flag including root worktree changes, conflicts, stash, and submodule drift. */
64
+ dirty: boolean;
63
65
  hasConflicts: boolean;
64
66
  conflictFiles: string[];
65
67
  stashCount: number;
@@ -116,8 +116,11 @@ export async function createWorktree(opts: WorktreeCreateOptions): Promise<Workt
116
116
  });
117
117
  } catch (error: any) {
118
118
  const stderr = typeof error.stderr === 'string' ? error.stderr : '';
119
- // Clean error messages for common failures
120
119
  if (/already exists/i.test(stderr)) {
120
+ // Distinguish directory-collision (TOCTOU race) from branch-already-exists
121
+ if (existsSync(targetDir)) {
122
+ throw new Error(`Worktree target directory was created concurrently: ${targetDir}`);
123
+ }
121
124
  throw new Error(`Branch '${branch}' already exists or is checked out in another worktree`);
122
125
  }
123
126
  throw new Error(`git worktree add failed: ${stderr.trim() || error.message}`);
@@ -170,6 +173,10 @@ export async function removeWorktree(repoRoot: string, worktreePath: string, opt
170
173
  const stdout = typeof error.stdout === 'string' ? error.stdout : '';
171
174
  const detail = `${stderr}\n${stdout}\n${error.message || ''}`;
172
175
  if (opts.allowSubmoduleForceFallback && SUBMODULE_WORKTREE_REMOVE_RE.test(detail)) {
176
+ process.stderr.write(
177
+ `[adhdev-mesh] WARNING: git worktree remove --force fallback for submodule worktree '${worktreePath}'. `
178
+ + `Any uncommitted changes inside submodules will be lost.\n`,
179
+ );
173
180
  try {
174
181
  await execFileAsync('git', ['worktree', 'remove', '--force', worktreePath], {
175
182
  cwd: repoRoot,
package/src/index.ts CHANGED
@@ -85,9 +85,28 @@ export type {
85
85
  InputMediaType,
86
86
  } from './shared-types.js';
87
87
 
88
+ export type {
89
+ InteractivePrompt,
90
+ InteractiveQuestion,
91
+ InteractiveOption,
92
+ InteractivePromptResponse,
93
+ InteractiveAnswer,
94
+ } from './providers/types/interactive-prompt.js';
95
+ export {
96
+ normalizeInteractivePrompt,
97
+ normalizeInteractivePromptResponse,
98
+ buildClaudeInteractiveToolResult,
99
+ interactivePromptFromClaudeAskUserQuestion,
100
+ detectClaudeAskUserQuestionPromptFromJson,
101
+ } from './providers/types/interactive-prompt.js';
102
+
88
103
  // ── Repo Mesh Types (cross-package) ──
89
104
  export type {
90
105
  RepoMesh,
106
+ RepoMeshDaemonRole,
107
+ RepoMeshHostMetadata,
108
+ RepoMeshHostPairingMetadata,
109
+ RepoMeshHostStatus,
91
110
  RepoMeshNode,
92
111
  RepoMeshNodeHealth,
93
112
  RepoMeshPolicy,
@@ -111,6 +130,7 @@ export type {
111
130
  RepoMeshLedgerEntryStatus,
112
131
  RepoMeshLedgerSummaryStatus,
113
132
  RepoMeshLedgerStatus,
133
+ MeshAsyncJobLifecycle,
114
134
  } from './repo-mesh-types.js';
115
135
  export { DEFAULT_MESH_POLICY } from './repo-mesh-types.js';
116
136
 
@@ -138,7 +158,7 @@ export type RecentSessionBucket = 'needs_attention' | 'working' | 'task_complete
138
158
  export type { IDaemonCore, DaemonCoreOptions } from './daemon-core.js';
139
159
 
140
160
  // ── Config ──
141
- export { loadConfig, saveConfig, resetConfig, isSetupComplete, markSetupComplete, updateConfig } from './config/config.js';
161
+ export { loadConfig, saveConfig, resetConfig, isSetupComplete, markSetupComplete, updateConfig, getDaemonDataDir } from './config/config.js';
142
162
  export { getWorkspaceState } from './config/workspaces.js';
143
163
  export { appendRecentActivity, getRecentActivity } from './config/recent-activity.js';
144
164
  export type { RecentActivityEntry } from './config/recent-activity.js';
@@ -154,19 +174,58 @@ export type { CreateMeshOptions, UpdateMeshOptions, AddNodeOptions } from './con
154
174
 
155
175
  // ── Mesh Coordinator ──
156
176
  export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
177
+ export { upsertMeshMission, getMeshMissions, getMeshMission, summarizeMissionTasks, summarizeMeshMission, getActiveMeshMissionSummaries, buildMissionPromptSection, MESH_MISSION_STATUSES } from './mesh/mesh-missions.js';
178
+ export type { MeshMissionRecord, MeshMissionStatus, MeshMissionSummary, MeshMissionTaskAggregate } from './mesh/mesh-missions.js';
179
+ export { computeMeshTaskStats, computeMeshMissionStats } from './mesh/mesh-task-stats.js';
180
+ export type { MeshTaskStats, MeshMissionStats } from './mesh/mesh-task-stats.js';
181
+ export { deriveMeshReviewInboxItems } from './mesh/mesh-review-inbox.js';
182
+ export type { MeshReviewInboxItem, MeshReviewInboxDerivation, MeshReviewInboxEvidence, MeshReviewInboxDiffSummary, MeshReviewInboxDiffFile, MeshReviewInboxReason, MeshReviewInboxConvergence } from './mesh/mesh-review-inbox.js';
157
183
  export type { CoordinatorPromptContext } from './mesh/coordinator-prompt.js';
158
- export { syncMeshes } from './mesh/mesh-sync.js';
159
- export type { MeshSyncTransport, MeshSyncResult, RemoteMeshRecord } from './mesh/mesh-sync.js';
184
+ export { loadMeshCoordinatorRegistry, registerMeshCoordinator, unregisterMeshCoordinator, getCoordinatorForSession, listCoordinatorsForWorkspace } from './mesh/coordinator-registry.js';
185
+ export type { CoordinatorRegistryEntry } from './mesh/coordinator-registry.js';
186
+ export {
187
+ MESH_REFINE_CONFIG_LOCATIONS,
188
+ MESH_REFINE_CONFIG_SCHEMA,
189
+ loadMeshRefineConfig,
190
+ resolveMeshRefineValidationPlan,
191
+ suggestMeshRefineConfig,
192
+ validateMeshRefineConfig,
193
+ } from './mesh/refine-config.js';
194
+ export {
195
+ MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS,
196
+ MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA,
197
+ loadMeshWorktreeBootstrapConfig,
198
+ runMeshWorktreeBootstrap,
199
+ validateMeshWorktreeBootstrapConfig,
200
+ type RepoMeshWorktreeBootstrapConfig,
201
+ type WorktreeBootstrapState,
202
+ } from './mesh/worktree-bootstrap-config.js';
203
+ export type {
204
+ MeshRefineValidationCategory,
205
+ MeshRefineValidationCommandPlan,
206
+ MeshRefineValidationPlan,
207
+ RepoMeshRefineConfig,
208
+ RepoMeshRefineValidationCommandConfig,
209
+ } from './mesh/refine-config.js';
160
210
 
161
211
  // ── Mesh Task Ledger ──
162
- export { appendLedgerEntry, appendRemoteLedgerEntries, readLedgerEntries, readLedgerSlice, getLedgerSummary, getLedgerDir, getSessionRecoveryContext, MAX_LEDGER_SLICE_LIMIT } from './mesh/mesh-ledger.js';
163
- export type { AppendRemoteLedgerResult, MeshLedgerEntry, MeshLedgerKind, MeshLedgerSlice, MeshLedgerSummary, ReadLedgerOptions, ReadLedgerSliceOptions, SessionRecoveryContext } from './mesh/mesh-ledger.js';
212
+ export { appendLedgerEntry, appendRemoteLedgerEntries, buildTaskCompletionEvidence, normalizeMeshWorkerResult, readLedgerEntries, readLedgerSlice, readLedgerSliceFromStore, getLedgerSummary, getLedgerDir, getSessionRecoveryContext, MAX_LEDGER_SLICE_LIMIT } from './mesh/mesh-ledger.js';
213
+ export type { AppendRemoteLedgerResult, MeshLedgerEntry, MeshLedgerKind, MeshLedgerSlice, MeshLedgerSummary, ReadLedgerOptions, ReadLedgerSliceOptions, SessionRecoveryContext, MeshTaskCompletionEvidence, MeshWorkerResultArtifact, MeshProcessArtifact, MeshValidationResultArtifact } from './mesh/mesh-ledger.js';
214
+ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
215
+ export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
164
216
  export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
165
- export type { MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
217
+ export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
166
218
 
167
219
  // ── Mesh Work Queue (GUPP) ──
168
- export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats } from './mesh/mesh-work-queue.js';
169
- export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
220
+ export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
221
+ export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
222
+ export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary } from './mesh/mesh-active-work.js';
223
+ export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
224
+ export { buildMeshAsyncRefineJobs } from './mesh/mesh-refine-status.js';
225
+ export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary } from './mesh/mesh-refine-status.js';
226
+
227
+ // ── Mesh Host Ownership ──
228
+ export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';
170
229
 
171
230
  // ── Mesh Visualization ──
172
231
  // buildMeshGraph and MeshGraph types moved to @adhdev/web-core to avoid
@@ -176,9 +235,13 @@ export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './m
176
235
  // export type { MeshGraph, MeshGraphNode, MeshGraphEdge, MeshGraphNodeType, MeshGraphEdgeType } from './mesh/mesh-visualization.js';
177
236
 
178
237
  // ── Mesh Events ──
179
- export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
238
+ export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent, reconcileDirectDispatchCompletionFromTranscript } from './mesh/mesh-events.js';
180
239
  export type { PendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
181
240
 
241
+ // ── Mesh Delivery Policy ──
242
+ export { resolveDeliveryDecision, createSessionDelivery, updateSessionDeliveryStatus, getActiveSessionDeliveries, markSessionDeliveriesTerminal, recordCompletionConflict, getRecentCompletionConflicts } from './mesh/mesh-delivery-policy.js';
243
+ export type { MeshSessionDeliveryStatus, MeshSessionDeliveryKind, MeshDeliveryDecision, MeshDeliveryPolicyResult, SessionDeliveryRecord } from './mesh/mesh-delivery-policy.js';
244
+
182
245
  // ── Mesh P2P Relay Failure Classification ──
183
246
  export {
184
247
  P2pRelayFailureError,
@@ -222,7 +285,7 @@ export type { CdpInitializerConfig } from './cdp/initializer.js';
222
285
  // ── Commands ──
223
286
  export { DaemonCommandHandler } from './commands/handler.js';
224
287
  export type { CommandResult, CommandContext } from './commands/handler.js';
225
- export { DaemonCommandRouter } from './commands/router.js';
288
+ export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails } from './commands/router.js';
226
289
  export type { CommandRouterDeps, CommandRouterResult } from './commands/router.js';
227
290
  export {
228
291
  maybeRunDaemonUpgradeHelperFromEnv,
@@ -388,6 +451,13 @@ export type { CliAdapter } from './cli-adapter-types.js';
388
451
  export { NodePtyTransportFactory } from './cli-adapters/pty-transport.js';
389
452
  export type { PtyRuntimeTransport, PtyTransportFactory, PtySpawnOptions } from './cli-adapters/pty-transport.js';
390
453
  export { SessionHostPtyTransportFactory } from './cli-adapters/session-host-transport.js';
454
+ export {
455
+ RawTerminalAttachment,
456
+ namedKeyToAnsi,
457
+ namedKeysToAnsi,
458
+ withRawTerminalAttachment,
459
+ } from './cli-adapters/raw-terminal-io.js';
460
+ export type { NamedKey, RawTerminalAttachmentOptions, RawTerminalSessionHostClient } from './cli-adapters/raw-terminal-io.js';
391
461
  export type { HostedCliRuntimeDescriptor, CliTransportFactoryParams } from './commands/cli-manager.js';
392
462
  export {
393
463
  DEFAULT_SESSION_HOST_APP_NAME,
@@ -415,3 +485,49 @@ export type { ExtensionInfo as InstallerExtensionInfo } from './installer.js';
415
485
  // ── Boot / Lifecycle ──
416
486
  export { initDaemonComponents, startDaemonDevSupport, shutdownDaemonComponents } from './boot/daemon-lifecycle.js';
417
487
  export type { DaemonInitConfig, DaemonComponents, DaemonDevSupportOptions } from './boot/daemon-lifecycle.js';
488
+
489
+ // ── Local IPC server (shared between cloud + standalone daemons) ──
490
+ export {
491
+ startLocalIpcServer,
492
+ buildIpcStatusHttpResponse,
493
+ type LocalIpcServerOptions,
494
+ type LocalIpcServerHandle,
495
+ type IpcCommandContext,
496
+ type IpcCommandResult,
497
+ type IpcStatusPayload,
498
+ } from './ipc/local-ipc-server.js';
499
+
500
+ // ── CLI Spec (adhdev:cli/spec@1) ──
501
+ export { evaluate as evaluateSpec, evaluate } from './providers/spec/evaluator.js';
502
+ export { loadSpec, resolveSpecPath } from './providers/spec/loader.js';
503
+ export { createNativeHistoryDispatcher } from './providers/native-history/index.js';
504
+ export type { ReaderId } from './providers/native-history/index.js';
505
+ export {
506
+ readClaudeCliSession, readCodexCliSession,
507
+ readAntigravityCliSession, readHermesCliSession,
508
+ } from './providers/native-history/index.js';
509
+ export type {
510
+ CliSpec, SpecState, ControlAction, Control,
511
+ NotificationRule, DelegateTrigger, Section,
512
+ } from './providers/spec/types.js';
513
+ export type { SpecEvaluation, TraceEntry } from './providers/spec/evaluator.js';
514
+ export { SpecDriver } from './providers/spec/driver.js';
515
+ export type { DashboardEvent, DashboardCommand, SpecDriverOpts } from './providers/spec/driver.js';
516
+ export { TerminalAdapter } from './providers/spec/adapter.js';
517
+ export type { TerminalAdapterOpts, TerminalAdapterHandlers } from './providers/spec/adapter.js';
518
+
519
+ // ── Provider SDK (v1) — selective re-exports for external tooling ──
520
+ // Tooling (registry publish, dashboard validators, the e2e harness) needs
521
+ // the manifest validator, the builder catalog, and the contract version.
522
+ // We don't re-export *everything* from the SDK to keep the public surface
523
+ // stable; consumers that need internal SDK types still import from the
524
+ // sdk/v1 subpath.
525
+ export {
526
+ validateCliProviderManifest,
527
+ formatManifestValidationIssues,
528
+ type ManifestValidationIssue,
529
+ type ManifestValidationResult,
530
+ V1_CONTRACT_VERSION,
531
+ V1_PRIMITIVE_CATALOG,
532
+ V1_ALL_PRIMITIVES,
533
+ } from './providers/sdk/v1/index.js';
@@ -31,7 +31,7 @@ export interface InstallResult {
31
31
  /**
32
32
  * Check if an extension is already installed
33
33
  */
34
- export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): boolean;
34
+ export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): Promise<boolean>;
35
35
  /**
36
36
  * Install a single extension
37
37
  */
package/src/installer.ts CHANGED
@@ -122,20 +122,22 @@ export interface InstallResult {
122
122
  /**
123
123
  * Check if an extension is already installed
124
124
  */
125
- export function isExtensionInstalled(
125
+ import { promisify } from 'util';
126
+ const execAsync = promisify(exec);
127
+
128
+ export async function isExtensionInstalled(
126
129
  ide: IDEInfo,
127
130
  marketplaceId: string
128
- ): boolean {
131
+ ): Promise<boolean> {
129
132
  if (!ide.cliCommand) return false;
130
133
 
131
134
  try {
132
- const result = execSync(`"${ide.cliCommand}" --list-extensions`, {
135
+ const { stdout } = await execAsync(`"${ide.cliCommand}" --list-extensions`, {
133
136
  encoding: 'utf-8',
134
137
  timeout: 15000,
135
- stdio: ['pipe', 'pipe', 'pipe'],
136
138
  });
137
139
 
138
- const installed = result
140
+ const installed = stdout
139
141
  .trim()
140
142
  .split('\n')
141
143
  .map((e) => e.trim().toLowerCase());
@@ -163,7 +165,7 @@ export async function installExtension(
163
165
  }
164
166
 
165
167
  // Check if already installed
166
- const alreadyInstalled = isExtensionInstalled(ide, extension.marketplaceId);
168
+ const alreadyInstalled = await isExtensionInstalled(ide, extension.marketplaceId);
167
169
  if (alreadyInstalled) {
168
170
  return {
169
171
  extensionId: extension.id,