@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
@@ -0,0 +1,18 @@
1
+ export type PreviewFreshnessStatus = 'fresh' | 'stale' | 'unknown' | 'not_configured';
2
+ export interface PreviewFreshness {
3
+ status: PreviewFreshnessStatus;
4
+ lastPreviewCommit: string | null;
5
+ currentMainCommit: string | null;
6
+ currentMainCommitSource: 'origin/main' | 'HEAD' | 'unknown';
7
+ recordPath: string;
8
+ lastDeployedAt?: string;
9
+ lastTarget?: string;
10
+ previewVersion?: string;
11
+ targets: Record<'npm' | 'server' | 'web', {
12
+ commit: string | null;
13
+ deployedAt?: string;
14
+ status: PreviewFreshnessStatus;
15
+ }>;
16
+ nextAction: string;
17
+ }
18
+ export declare function buildPreviewFreshness(repoRoot: string): PreviewFreshness;
@@ -0,0 +1,215 @@
1
+ export declare const MESH_REFINE_VALIDATION_CATEGORIES: readonly ["typecheck", "test", "lint", "build"];
2
+ export type MeshRefineValidationCategory = typeof MESH_REFINE_VALIDATION_CATEGORIES[number];
3
+ export interface RepoMeshRefineValidationCommandConfig {
4
+ /** Executable name or a whitespace-tokenized command string. Never executed through a shell. */
5
+ command: string;
6
+ /** Optional explicit argv. Prefer this over shell-like command strings. */
7
+ args?: string[];
8
+ category?: MeshRefineValidationCategory;
9
+ cwd?: string;
10
+ timeoutMs?: number;
11
+ outputLimitBytes?: number;
12
+ env?: Record<string, string>;
13
+ }
14
+ export interface RepoMeshRefineConfig {
15
+ version: 1;
16
+ /**
17
+ * Narrow Refinery opt-in for monorepos with submodule gitlinks.
18
+ * When true, Refinery may non-force publish unreachable submodule gitlink
19
+ * commits to the submodule remote main branch after validation and
20
+ * patch-equivalence pass, then verify remote-main reachability.
21
+ */
22
+ allowAutoPublishSubmoduleMainCommits?: boolean;
23
+ validation?: {
24
+ required?: boolean;
25
+ /**
26
+ * M2-2 (v2): how Refinery sources its bootstrap stage.
27
+ * 'inherit' (default) — consume the worktree_bootstrap config/state:
28
+ * skip when the node's bootstrap is 'ready' (staleInputs unchanged),
29
+ * run the worktree_bootstrap definition when stale/never-ran.
30
+ * 'skip' — no bootstrap stage at all (validation commands run as-is).
31
+ */
32
+ bootstrap?: 'inherit' | 'skip';
33
+ /**
34
+ * DEPRECATED (M2-2): define bootstrap once in
35
+ * .adhdev/worktree_bootstrap.json instead. Still honored when no
36
+ * worktree_bootstrap config exists, with a deprecation warning; when
37
+ * both exist the worktree_bootstrap config wins.
38
+ */
39
+ bootstrapCommands?: RepoMeshRefineValidationCommandConfig[];
40
+ commands?: RepoMeshRefineValidationCommandConfig[];
41
+ };
42
+ }
43
+ export interface MeshRefineValidationCommandPlan {
44
+ command: string;
45
+ args: string[];
46
+ displayCommand: string;
47
+ category: MeshRefineValidationCategory | 'custom';
48
+ source: string;
49
+ cwd?: string;
50
+ timeoutMs?: number;
51
+ outputLimitBytes?: number;
52
+ env?: Record<string, string>;
53
+ }
54
+ export interface MeshRefineConfigLoadResult {
55
+ config?: RepoMeshRefineConfig;
56
+ source: string;
57
+ sourceType: 'mesh_policy' | 'repo_file' | 'unavailable' | 'invalid';
58
+ path?: string;
59
+ error?: string;
60
+ }
61
+ export interface MeshRefineValidationPlan {
62
+ source: string;
63
+ sourceType: MeshRefineConfigLoadResult['sourceType'];
64
+ /** M2-2: how the bootstrap stage is sourced ('inherit' consumes worktree_bootstrap; 'skip' disables it). */
65
+ bootstrapMode: 'inherit' | 'skip';
66
+ bootstrapCommands: MeshRefineValidationCommandPlan[];
67
+ commands: MeshRefineValidationCommandPlan[];
68
+ rejectedCommands: Array<Record<string, unknown>>;
69
+ /** M2-2: deprecation notices (e.g. validation.bootstrapCommands present). */
70
+ deprecationWarnings: string[];
71
+ suggestions: RepoMeshRefineValidationCommandConfig[];
72
+ suggestedConfig?: RepoMeshRefineConfig;
73
+ unavailableReason?: string;
74
+ }
75
+ export declare const MESH_REFINE_CONFIG_LOCATIONS: string[];
76
+ export declare const MESH_REFINE_CONFIG_SCHEMA: {
77
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
78
+ readonly title: "ADHDev Repo Mesh Refinery Config";
79
+ readonly type: "object";
80
+ readonly additionalProperties: false;
81
+ readonly required: readonly ["version"];
82
+ readonly properties: {
83
+ readonly version: {
84
+ readonly const: 1;
85
+ };
86
+ readonly allowAutoPublishSubmoduleMainCommits: {
87
+ readonly type: "boolean";
88
+ readonly default: false;
89
+ readonly description: "When true, Refinery may non-force publish submodule gitlink commits referenced by the refined root tree to each submodule origin/main after validation and patch-equivalence pass, then verify reachability.";
90
+ };
91
+ readonly validation: {
92
+ readonly type: "object";
93
+ readonly additionalProperties: false;
94
+ readonly properties: {
95
+ readonly required: {
96
+ readonly type: "boolean";
97
+ readonly default: true;
98
+ };
99
+ readonly bootstrap: {
100
+ readonly enum: readonly ["inherit", "skip"];
101
+ readonly default: "inherit";
102
+ readonly description: "M2-2 (v2): 'inherit' consumes the worktree_bootstrap config/state (skip when ready, rerun when stale); 'skip' disables the bootstrap stage entirely.";
103
+ };
104
+ readonly commands: {
105
+ readonly type: "array";
106
+ readonly minItems: 1;
107
+ readonly maxItems: 8;
108
+ readonly items: {
109
+ readonly type: "object";
110
+ readonly additionalProperties: false;
111
+ readonly required: readonly ["command"];
112
+ readonly properties: {
113
+ readonly command: {
114
+ readonly type: "string";
115
+ readonly minLength: 1;
116
+ };
117
+ readonly args: {
118
+ readonly type: "array";
119
+ readonly items: {
120
+ readonly type: "string";
121
+ };
122
+ };
123
+ readonly category: {
124
+ readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
125
+ };
126
+ readonly cwd: {
127
+ readonly type: "string";
128
+ };
129
+ readonly timeoutMs: {
130
+ readonly type: "number";
131
+ readonly minimum: 1000;
132
+ readonly maximum: 600000;
133
+ };
134
+ readonly outputLimitBytes: {
135
+ readonly type: "number";
136
+ readonly minimum: 1024;
137
+ readonly maximum: 1048576;
138
+ };
139
+ readonly env: {
140
+ readonly type: "object";
141
+ readonly additionalProperties: {
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ };
146
+ };
147
+ };
148
+ readonly bootstrapCommands: {
149
+ readonly type: "array";
150
+ readonly maxItems: 4;
151
+ readonly description: "DEPRECATED: define bootstrap once in .adhdev/worktree_bootstrap.json. Honored only when no worktree_bootstrap config exists (with a deprecation warning); worktree_bootstrap wins when both exist.";
152
+ readonly items: {
153
+ readonly type: "object";
154
+ readonly additionalProperties: false;
155
+ readonly required: readonly ["command"];
156
+ readonly properties: {
157
+ readonly command: {
158
+ readonly type: "string";
159
+ readonly minLength: 1;
160
+ };
161
+ readonly args: {
162
+ readonly type: "array";
163
+ readonly items: {
164
+ readonly type: "string";
165
+ };
166
+ };
167
+ readonly category: {
168
+ readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
169
+ };
170
+ readonly cwd: {
171
+ readonly type: "string";
172
+ };
173
+ readonly timeoutMs: {
174
+ readonly type: "number";
175
+ readonly minimum: 1000;
176
+ readonly maximum: 600000;
177
+ };
178
+ readonly outputLimitBytes: {
179
+ readonly type: "number";
180
+ readonly minimum: 1024;
181
+ readonly maximum: 1048576;
182
+ };
183
+ readonly env: {
184
+ readonly type: "object";
185
+ readonly additionalProperties: {
186
+ readonly type: "string";
187
+ };
188
+ };
189
+ };
190
+ };
191
+ };
192
+ };
193
+ };
194
+ };
195
+ };
196
+ export declare function isMeshConfigRecord(value: unknown): value is Record<string, unknown>;
197
+ export declare function normalizeMeshCommandConfig(entry: unknown, source: string): {
198
+ command?: MeshRefineValidationCommandPlan;
199
+ rejected?: Record<string, unknown>;
200
+ };
201
+ export declare function validateMeshRefineConfig(config: unknown, source?: string): {
202
+ valid: boolean;
203
+ errors: string[];
204
+ bootstrapCommands: MeshRefineValidationCommandPlan[];
205
+ commands: MeshRefineValidationCommandPlan[];
206
+ rejectedCommands: Array<Record<string, unknown>>;
207
+ bootstrapMode: 'inherit' | 'skip';
208
+ deprecationWarnings: string[];
209
+ };
210
+ export declare function loadMeshRefineConfig(mesh: any, workspace: string): MeshRefineConfigLoadResult;
211
+ export declare function suggestMeshRefineConfig(mesh: any, workspace: string): {
212
+ suggestions: RepoMeshRefineValidationCommandConfig[];
213
+ suggestedConfig?: RepoMeshRefineConfig;
214
+ };
215
+ export declare function resolveMeshRefineValidationPlan(mesh: any, workspace: string): MeshRefineValidationPlan;
@@ -0,0 +1,135 @@
1
+ import { type MeshRefineValidationCommandPlan, type RepoMeshRefineValidationCommandConfig } from './refine-config.js';
2
+ import type { MeshAsyncJobLifecycle } from '../repo-mesh-types.js';
3
+ export type WorktreeBootstrapStatus = 'ready' | 'running' | 'failed' | 'not_configured' | 'disabled' | 'stale';
4
+ export interface RepoMeshWorktreeBootstrapConfig {
5
+ version: 1;
6
+ enabled?: boolean;
7
+ runOnClone?: boolean;
8
+ required?: boolean;
9
+ commands?: RepoMeshRefineValidationCommandConfig[];
10
+ staleInputs?: string[];
11
+ }
12
+ export interface WorktreeBootstrapState extends MeshAsyncJobLifecycle {
13
+ status: WorktreeBootstrapStatus;
14
+ required: boolean;
15
+ configSource?: string;
16
+ configSourceType?: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
17
+ lastCommand?: string;
18
+ exitCode?: number | null;
19
+ commandsRun?: Array<Record<string, unknown>>;
20
+ staleInputs?: string[];
21
+ /**
22
+ * M2-1: sha256 per staleInputs path recorded when the bootstrap reached
23
+ * 'ready'. evaluateWorktreeBootstrapState compares current file hashes
24
+ * against this to detect staleness (e.g. base merge changed a lockfile).
25
+ * Missing files hash to the literal 'absent'.
26
+ */
27
+ staleInputsDigest?: Record<string, string>;
28
+ /** M2-1: why an evaluated state resolved to stale (digest_mismatch | never_ran). */
29
+ staleReason?: string;
30
+ }
31
+ export interface WorktreeBootstrapConfigLoadResult {
32
+ config?: RepoMeshWorktreeBootstrapConfig;
33
+ source: string;
34
+ sourceType: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
35
+ path?: string;
36
+ error?: string;
37
+ }
38
+ export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS: string[];
39
+ export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA: {
40
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
41
+ readonly title: "ADHDev Repo Mesh Worktree Bootstrap Config";
42
+ readonly type: "object";
43
+ readonly additionalProperties: false;
44
+ readonly required: readonly ["version"];
45
+ readonly properties: {
46
+ readonly version: {
47
+ readonly const: 1;
48
+ };
49
+ readonly enabled: {
50
+ readonly type: "boolean";
51
+ readonly default: true;
52
+ };
53
+ readonly runOnClone: {
54
+ readonly type: "boolean";
55
+ readonly default: true;
56
+ };
57
+ readonly required: {
58
+ readonly type: "boolean";
59
+ readonly default: true;
60
+ };
61
+ readonly staleInputs: {
62
+ readonly type: "array";
63
+ readonly maxItems: 16;
64
+ readonly items: {
65
+ readonly type: "string";
66
+ readonly minLength: 1;
67
+ };
68
+ };
69
+ readonly commands: {
70
+ readonly type: "array";
71
+ readonly minItems: 1;
72
+ readonly maxItems: 4;
73
+ readonly items: {
74
+ readonly type: "object";
75
+ readonly additionalProperties: false;
76
+ readonly required: readonly ["command"];
77
+ readonly properties: {
78
+ readonly command: {
79
+ readonly type: "string";
80
+ readonly minLength: 1;
81
+ };
82
+ readonly args: {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "string";
86
+ };
87
+ };
88
+ readonly category: {
89
+ readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
90
+ };
91
+ readonly cwd: {
92
+ readonly type: "string";
93
+ };
94
+ readonly timeoutMs: {
95
+ readonly type: "number";
96
+ readonly minimum: 1000;
97
+ readonly maximum: 600000;
98
+ };
99
+ readonly outputLimitBytes: {
100
+ readonly type: "number";
101
+ readonly minimum: 1024;
102
+ readonly maximum: 1048576;
103
+ };
104
+ readonly env: {
105
+ readonly type: "object";
106
+ readonly additionalProperties: {
107
+ readonly type: "string";
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ export declare function validateMeshWorktreeBootstrapConfig(config: unknown, source?: string): {
116
+ valid: boolean;
117
+ errors: string[];
118
+ commands: MeshRefineValidationCommandPlan[];
119
+ rejectedCommands: Array<Record<string, unknown>>;
120
+ };
121
+ export declare function loadMeshWorktreeBootstrapConfig(mesh: any, workspace: string): WorktreeBootstrapConfigLoadResult;
122
+ /** M2-1: hash staleInputs files so 'ready' can be invalidated when they change. */
123
+ export declare function computeStaleInputsDigest(workspace: string, staleInputs: string[] | undefined): Record<string, string>;
124
+ /**
125
+ * M2-1: the official bootstrap state contract. Resolves the effective state
126
+ * for a node workspace from config presence + the persisted last-run state +
127
+ * a staleInputs digest comparison. Read-only — never runs commands.
128
+ *
129
+ * ready — last run succeeded and staleInputs are unchanged
130
+ * stale — never ran, or a staleInputs file changed since 'ready'
131
+ * running/failed — persisted lifecycle state passes through
132
+ * not_configured / disabled / (invalid → failed) — from config resolution
133
+ */
134
+ export declare function evaluateWorktreeBootstrapState(mesh: any, workspace: string, persisted?: WorktreeBootstrapState | null): WorktreeBootstrapState;
135
+ export declare function runMeshWorktreeBootstrap(mesh: any, workspace: string): Promise<WorktreeBootstrapState>;
@@ -44,6 +44,8 @@ export declare class AcpProviderInstance implements ProviderInstance {
44
44
  private partialBlocks;
45
45
  /** Tool calls collected during current turn */
46
46
  private turnToolCalls;
47
+ /** Guard: prevent concurrent sendPrompt calls from racing on shared state */
48
+ private _sendPromptInFlight;
47
49
  private errorMessage;
48
50
  private errorReason;
49
51
  private stderrBuffer;
@@ -4,4 +4,17 @@ export declare function pickApprovalButton(buttons: string[] | null | undefined,
4
4
  index: number;
5
5
  label: string;
6
6
  };
7
+ export declare function pickAutoApprovalButton(buttons: string[] | null | undefined): {
8
+ index: number;
9
+ label: string;
10
+ };
7
11
  export declare function formatAutoApprovalMessage(modalMessage?: string, buttonLabel?: string): string;
12
+ /**
13
+ * Returns true when the given text (e.g. last assistant message content, or
14
+ * the tail of the PTY screen) looks like an active approval/input prompt
15
+ * rather than a completed assistant response. Used to prevent false
16
+ * idle/completion events when Claude Code surfaces a "Do you want to proceed?"
17
+ * style prompt that the PTY parser captures as an assistant turn while the
18
+ * session is still awaiting user input.
19
+ */
20
+ export declare function looksLikeActiveApprovalPromptText(content: string): boolean;
@@ -45,15 +45,18 @@ export declare class CliProviderInstance implements ProviderInstance {
45
45
  private monitor;
46
46
  private generatingDebounceTimer;
47
47
  private generatingDebouncePending;
48
- private lastApprovalEventAt;
48
+ private lastApprovalEventFingerprint;
49
49
  private autoApproveBusy;
50
50
  private autoApproveBusyTimer;
51
+ private lastAutoApprovalSignature;
51
52
  private controlValues;
52
53
  private summaryMetadata;
53
54
  private appliedEffectKeys;
54
55
  private historyWriter;
55
56
  private runtimeMessages;
56
57
  private lastPersistedHistoryMessages;
58
+ private lastAcknowledgedUserInputAt;
59
+ private externalBusyIdleFingerprint;
57
60
  private lastNativeSourceCanonicalCheckAt;
58
61
  private lastNativeSourceCanonicalCacheKey;
59
62
  private cachedSqliteDb;
@@ -63,6 +66,7 @@ export declare class CliProviderInstance implements ProviderInstance {
63
66
  private suppressIdleHistoryReplay;
64
67
  private errorMessage;
65
68
  private errorReason;
69
+ private activeInteractivePrompt;
66
70
  private presentationMode;
67
71
  private providerSessionId?;
68
72
  private launchMode;
@@ -93,17 +97,47 @@ export declare class CliProviderInstance implements ProviderInstance {
93
97
  setPresentationMode(mode: 'terminal' | 'chat'): void;
94
98
  getPresentationMode(): 'terminal' | 'chat';
95
99
  getHotChatSessionState(): HotChatSessionState;
96
- getSessionModalState(): SessionModalState;
100
+ getSessionModalState(sessionId?: string): SessionModalState;
97
101
  updateSettings(newSettings: Record<string, any>): void;
102
+ /**
103
+ * Stamp a direct-dispatch mesh assignment on this instance.
104
+ * setupMeshEventForwarding reads settings.meshNodeFor + meshActiveTaskId to
105
+ * route generating_completed back to the originating coordinator. Without
106
+ * this stamp, mesh_send_task --direct targets a plain CLI session whose
107
+ * completion events silently drop because the forwarder has nothing to
108
+ * match against.
109
+ */
110
+ attachMeshAssignment(assignment: {
111
+ meshId: string;
112
+ nodeId?: string;
113
+ taskId?: string;
114
+ }): void;
115
+ /**
116
+ * Clear a previously-attached mesh assignment after the task reaches a
117
+ * terminal state. Leaving meshNodeFor pinned would route this session's
118
+ * subsequent unrelated turns (e.g. ad-hoc dashboard chats) to the
119
+ * coordinator as if they were task completions.
120
+ */
121
+ detachMeshAssignment(): void;
98
122
  onEvent(event: string, data?: any): void;
123
+ recordAcknowledgedUserInput(input: InputEnvelope | string): void;
99
124
  dispose(): void;
100
125
  private completedDebounceTimer;
101
126
  private completedDebouncePending;
127
+ private lastExternalCompletionProbe;
102
128
  private enforceFreshSessionLaunchIfNeeded;
103
129
  private completionHasFinalAssistantMessage;
130
+ private buildExternalTranscriptProbe;
131
+ private recordPendingTranscriptProbe;
132
+ private readExternalCompletionMessages;
133
+ private completionFinalAssistantEvidence;
134
+ private completionFinalSummary;
135
+ private externalNativeFinalFingerprint;
136
+ private getExternalNativeFinalReconciliation;
137
+ private buildCompletedFinalizationDiagnostic;
104
138
  private hasAdapterPendingResponse;
105
139
  private shouldSuppressStaleParsedBusyStatus;
106
- private getCompletedFinalizationBlockReason;
140
+ private getCompletedFinalizationBlock;
107
141
  private scheduleCompletedDebounceFlush;
108
142
  private flushCompletedDebounceIfFinalized;
109
143
  private maybeAutoApproveStatus;
@@ -127,6 +161,8 @@ export declare class CliProviderInstance implements ProviderInstance {
127
161
  private mergeConversationMessages;
128
162
  private formatApprovalRequestMessage;
129
163
  private promoteProviderSessionId;
164
+ private shouldHydrateExistingProviderHistory;
165
+ private shouldSuppressFreshLaunchStartupReplay;
130
166
  private syncCanonicalSavedHistoryIfNeeded;
131
167
  private restorePersistedHistoryFromCurrentSession;
132
168
  private getProbeDirectories;
@@ -10,6 +10,14 @@ import type { ProviderSummaryMetadata } from '../shared-types.js';
10
10
  import type { ChatMessageKind } from './chat-message-normalization.js';
11
11
  export type ReadChatTurnStatus = 'open' | 'waiting_approval' | 'complete' | 'error';
12
12
  export interface ReadChatResult {
13
+ /**
14
+ * Declared chat contract version. Absent or `'1.0'` → legacy v1 payload
15
+ * (current shape). `'2.0'` → v2 payload conforming to transcript-v2.ts
16
+ * (ReadChatResultV2). Validators in read-chat-contract.ts route on this
17
+ * field. A1 only adds the field; A2 will make v2 the daemon-internal
18
+ * canonical form and reject unrecognised versions at provider load time.
19
+ */
20
+ contractVersion?: import('./transcript-v2.js').ChatContractVersion;
13
21
  messages: ChatMessage[];
14
22
  status: AgentStatus;
15
23
  activeModal?: ModalInfo | null;
@@ -294,10 +302,89 @@ export interface ProviderMeshCoordinatorConfig {
294
302
  requiresRestart?: boolean;
295
303
  /** User-facing setup explanation for manual modes. */
296
304
  instructions?: string;
297
- /** Copyable setup template. Supports {{meshId}}, {{adhdevMcpCommand}}, {{workspace}}, {{serverName}}. */
305
+ /** Copyable setup template. Supports {{meshId}}, {{adhdevMcpCommand}}, {{adhdevMcpArgs}}, {{workspace}}, {{serverName}}. */
298
306
  template?: string;
299
307
  };
308
+ /**
309
+ * How the coordinator system prompt reaches the launched CLI. Replaces the
310
+ * old hard-coded `if (cliType === 'claude-cli') push --append-system-prompt`
311
+ * branches in router.ts: a new CLI now ships its injection rule in its
312
+ * provider.v1.json, no daemon code change needed. Users can override the
313
+ * rendered prompt or the injection mechanism per-provider; if omitted, no
314
+ * system prompt is injected (safe default — won't crash spawn with a flag
315
+ * the CLI doesn't recognize).
316
+ */
317
+ systemPromptInjection?: MeshCoordinatorSystemPromptInjection;
318
+ /**
319
+ * How coordinator-launched worker sessions are isolated from coordinator-only
320
+ * MCP/tools/config. Provider-specific CLI quirks belong here, not in daemon
321
+ * launch code.
322
+ */
323
+ delegatedWorkerIsolation?: MeshCoordinatorDelegatedWorkerIsolation;
300
324
  }
325
+ export interface MeshCoordinatorDelegatedWorkerIsolation {
326
+ /** Environment variables to unset for delegated worker sessions. */
327
+ env?: {
328
+ unset?: string[];
329
+ };
330
+ /** Spawn-argument rules applied before launching a delegated worker. */
331
+ args?: MeshCoordinatorDelegatedWorkerArgRule[];
332
+ }
333
+ export type MeshCoordinatorDelegatedWorkerArgRule = {
334
+ mode: 'empty_mcp_config';
335
+ /** CLI flag that points at an MCP config file, e.g. '--mcp-config'. */
336
+ flag: string;
337
+ /** Optional CLI flag that forces only the provided MCP config to be used. */
338
+ strictFlag?: string;
339
+ } | {
340
+ mode: 'config_override';
341
+ /** CLI config flag, e.g. '-c' or '--config'. */
342
+ flag: string;
343
+ /** Config key to set for worker isolation. */
344
+ key: string;
345
+ /** Config value to set. */
346
+ value: string;
347
+ /** Optional broader key prefix used for duplicate detection. */
348
+ dedupeKey?: string;
349
+ };
350
+ /**
351
+ * Declarative description of how a CLI accepts a session-scoped system prompt.
352
+ *
353
+ * Modes:
354
+ * - cli_arg → push `flag` + prompt onto spawn args (Claude)
355
+ * - config_override → push `flag` + a templated key=value config override (Codex)
356
+ * - context_file → write prompt into a workspace markdown the CLI
357
+ * auto-loads as project context (Gemini, Antigravity)
358
+ * - env_var → expose prompt to the spawned process as $name (Hermes)
359
+ *
360
+ * The prompt text is templated with `{prompt}` (raw) or `{prompt_json}`
361
+ * (JSON-encoded for embedding inside config-override strings).
362
+ */
363
+ export type MeshCoordinatorSystemPromptInjection = {
364
+ mode: 'cli_arg';
365
+ /** Spawn-args flag, e.g. '--append-system-prompt'. The prompt becomes the next argv. */
366
+ flag: string;
367
+ } | {
368
+ mode: 'config_override';
369
+ /** Spawn-args flag, e.g. '-c'. Followed by `template` with placeholders rendered. */
370
+ flag: string;
371
+ /** Template using {prompt} or {prompt_json}, e.g. 'developer_instructions={prompt_json}'. */
372
+ template: string;
373
+ } | {
374
+ mode: 'context_file';
375
+ /** Workspace-relative file path the CLI auto-loads, e.g. 'AGENTS.md' or 'GEMINI.md'. */
376
+ path: string;
377
+ /**
378
+ * Optional wrapper around the prompt. Use `{prompt}` placeholder. Existing
379
+ * wrapper-delimited blocks are replaced rather than duplicated, so re-launching
380
+ * a coordinator doesn't pile up copies. If omitted, the prompt is appended raw.
381
+ */
382
+ wrapper?: string;
383
+ } | {
384
+ mode: 'env_var';
385
+ /** Env-var name, e.g. 'HERMES_EPHEMERAL_SYSTEM_PROMPT'. */
386
+ name: string;
387
+ };
301
388
  export interface ProviderCompatibilityEntry {
302
389
  ideVersion: string;
303
390
  scriptDir: string;
@@ -378,6 +465,14 @@ export interface ProviderModule {
378
465
  extensionIdPattern_flags?: string;
379
466
  compatibility?: ProviderCompatibilityEntry[];
380
467
  defaultScriptDir?: string;
468
+ /**
469
+ * v1 declarative tui block (spinner/settledPrompt/modal/dispatchOrder/etc).
470
+ * When present, the daemon's CliScriptRunner builds canonical
471
+ * (input → verdict) functions from this and injects them into provider
472
+ * scripts as `sdk.declarativeDetectStatus` and `sdk.declarativeParseApproval`.
473
+ * v0 / verified-tier providers can omit this entirely.
474
+ */
475
+ tui?: Record<string, unknown>;
381
476
  /**
382
477
  * Scripts that can run at the IDE main-page level (not just inside the extension webview session frame).
383
478
  * Default: ['listModes', 'setMode', 'listModels', 'setModel'].
@@ -429,8 +524,16 @@ export interface ProviderModule {
429
524
  /** History behavior config — controls message filtering and collapse during replay */
430
525
  historyBehavior?: ProviderHistoryBehavior;
431
526
  /**
432
- * Canonical history sync config — for providers that maintain native history files.
433
- * When set, daemon syncs from native format into ADHDev JSONL store on each tick.
527
+ * Native history config — for providers that maintain native history files.
528
+ * When set, daemon reads/lists provider-native transcripts directly. This is
529
+ * the canonical v1 field name; the legacy `canonicalHistory` field name is
530
+ * still accepted by the loader and aliased onto this field at load time.
531
+ */
532
+ nativeHistory?: NativeHistoryConfig;
533
+ /**
534
+ * @deprecated Legacy v0 alias for {@link ProviderModule.nativeHistory}.
535
+ * Loader populates this from `nativeHistory` so existing internal readers
536
+ * keep working during the transition. Remove after one release.
434
537
  */
435
538
  canonicalHistory?: ProviderCanonicalHistoryConfig;
436
539
  /**
@@ -561,20 +664,25 @@ export interface ProviderHistoryBehavior {
561
664
  * daemon-core. They let each provider own native transcript file discovery and
562
665
  * parsing while daemon-core only validates/pages the normalized result.
563
666
  */
564
- export interface ProviderCanonicalHistoryScriptsConfig {
667
+ export interface NativeHistoryScriptsConfig {
565
668
  /** Reads one native session. Default: 'readNativeHistory'. */
566
669
  readSession?: string;
567
670
  /** Lists native sessions with summary metadata. Default: 'listNativeHistory'. */
568
671
  listSessions?: string;
569
672
  }
570
673
  /**
571
- * Canonical history sync config for providers that maintain their own native history files.
674
+ * @deprecated Use {@link NativeHistoryScriptsConfig}. Retained as an alias for
675
+ * one release so external consumers that referenced the old name keep compiling.
676
+ */
677
+ export type ProviderCanonicalHistoryScriptsConfig = NativeHistoryScriptsConfig;
678
+ /**
679
+ * Native history config — for providers that maintain their own native history files.
572
680
  *
573
681
  * Preferred mode is provider-owned scripts via `scripts`. `format` is now an
574
682
  * opaque provider label retained for diagnostics/backward compatibility; daemon
575
683
  * live paths must not branch on provider-specific format values.
576
684
  */
577
- export interface ProviderCanonicalHistoryConfig {
685
+ export interface NativeHistoryConfig {
578
686
  /** Opaque provider-owned history format label. */
579
687
  format?: string;
580
688
  /** Optional native history glob/template for diagnostics only. */
@@ -590,7 +698,23 @@ export interface ProviderCanonicalHistoryConfig {
590
698
  * Omitted mode defaults to 'native-source'.
591
699
  */
592
700
  mode?: 'native-source' | 'materialized-mirror' | 'disabled';
701
+ /**
702
+ * Chat transcript contract version this provider's read_chat output
703
+ * conforms to. See transcript-v2.ts for the v2 invariants. Absent or `'1.0'`
704
+ * → legacy v1 payload (current behaviour). `'2.0'` → strict v2 payload
705
+ * (stable providerUnitKey/bubbleId/sequence, strict enums, honest coverage).
706
+ *
707
+ * A1 only surfaces this field; validators in read-chat-contract.ts route
708
+ * on it. A2 makes v2 the daemon-internal canonical form and rejects
709
+ * unrecognised values at provider load time.
710
+ */
711
+ contractVersion?: import('./transcript-v2.js').ChatContractVersion;
593
712
  }
713
+ /**
714
+ * @deprecated Use {@link NativeHistoryConfig}. Retained as an alias for one
715
+ * release so external consumers that referenced the old name keep compiling.
716
+ */
717
+ export type ProviderCanonicalHistoryConfig = NativeHistoryConfig;
594
718
  /**
595
719
  * Auto-implement spawn config — controls how the provider is spawned for autonomous AI-driven
596
720
  * provider script implementation (dev-auto-implement.ts).