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

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 +35171 -15756
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +34878 -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 +912 -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,691 @@
1
+ /**
2
+ * Auto-generated. Mirrors schema.json — regenerate after editing.
3
+ *
4
+ * SCHEMA_V1: validates adhdev:cli/spec@1 (legacy). Used for migration.
5
+ * SCHEMA_V3: validates adhdev:cli/spec@3 (current). Used after migration.
6
+ * SCHEMA: alias for SCHEMA_V3 (default export for loader.ts).
7
+ */
8
+
9
+ export const SCHEMA_V1 = {
10
+ "$schema": "http://json-schema.org/draft-07/schema#",
11
+ "$id": "adhdev:cli/spec@1",
12
+ "title": "ADHDev CLI provider spec v1",
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": [
16
+ "$schema",
17
+ "id",
18
+ "name",
19
+ "binary",
20
+ "send_message",
21
+ "layout",
22
+ "states",
23
+ "default_state"
24
+ ],
25
+ "properties": {
26
+ "$schema": {
27
+ "type": "string",
28
+ "const": "adhdev:cli/spec@1"
29
+ },
30
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9-]*$" },
31
+ "name": { "type": "string", "minLength": 1 },
32
+ "binary": { "type": "string", "minLength": 1 },
33
+ "spawn_args": { "type": "array", "items": { "type": "string" }, "default": [] },
34
+ "env": { "type": "object", "additionalProperties": { "type": "string" }, "default": {} },
35
+ "send_message": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["submit_key"],
39
+ "properties": {
40
+ "submit_key": { "type": "string", "minLength": 1 },
41
+ "delay_ms_before_submit": { "type": "integer", "minimum": 0 },
42
+ "delay_ms_per_char": { "type": "integer", "minimum": 0 }
43
+ }
44
+ },
45
+ "layout": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["sections"],
49
+ "properties": {
50
+ "sections": {
51
+ "type": "array",
52
+ "minItems": 1,
53
+ "items": { "$ref": "#/definitions/sectionV1" }
54
+ }
55
+ }
56
+ },
57
+ "states": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "items": { "$ref": "#/definitions/stateV1" }
61
+ },
62
+ "default_state": { "type": "string", "minLength": 1 },
63
+ "control_bar": { "type": "array", "default": [], "items": { "$ref": "#/definitions/control" } },
64
+ "notifications": { "type": "array", "default": [], "items": { "$ref": "#/definitions/notification" } },
65
+ "delegate": { "type": "array", "default": [], "items": { "$ref": "#/definitions/delegateTrigger" } },
66
+ "native_history": { "$ref": "#/definitions/nativeHistory" },
67
+ "cli_version_range": { "type": "string", "minLength": 1 },
68
+ "requiresFinalAssistantBeforeIdle": { "type": "boolean" },
69
+ "debounce": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "busy_hold_ms": { "type": "integer", "minimum": 0 },
74
+ "idle_hold_ms": { "type": "integer", "minimum": 0 },
75
+ "startup_grace_ms": { "type": "integer", "minimum": 0 },
76
+ "completion_idle_after": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["regex", "hold_ms"],
80
+ "properties": {
81
+ "section": { "type": "string", "minLength": 1 },
82
+ "regex": { "type": "string", "minLength": 1 },
83
+ "flags": { "type": "string" },
84
+ "hold_ms": { "type": "integer", "minimum": 0 },
85
+ "force_after_ms": { "type": "integer", "minimum": 0 }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "definitions": {
92
+ "size": {
93
+ "oneOf": [
94
+ { "type": "integer", "minimum": 0 },
95
+ { "type": "string", "pattern": "^\\d+(\\.\\d+)?%$" }
96
+ ]
97
+ },
98
+ "sectionV1": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["id"],
102
+ "properties": {
103
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
104
+ "from_top": { "$ref": "#/definitions/size" },
105
+ "from_bottom": { "$ref": "#/definitions/size" },
106
+ "until": {
107
+ "type": "object",
108
+ "additionalProperties": false,
109
+ "required": ["section"],
110
+ "properties": { "section": { "type": "string" } }
111
+ },
112
+ "anchor_regex": { "type": "string", "minLength": 1 },
113
+ "anchor_flags": { "type": "string" },
114
+ "anchor_last": { "type": "boolean" },
115
+ "anchor_context": {
116
+ "type": "object",
117
+ "additionalProperties": false,
118
+ "properties": {
119
+ "prev": { "type": "string" },
120
+ "prev_flags": { "type": "string" },
121
+ "next": { "type": "string" },
122
+ "next_flags": { "type": "string" }
123
+ }
124
+ },
125
+ "lines": { "type": "integer", "minimum": 1 },
126
+ "until_regex": { "type": "string", "minLength": 1 },
127
+ "until_regex_flags": { "type": "string" }
128
+ }
129
+ },
130
+ "sectionRegex": {
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "required": ["regex"],
134
+ "properties": {
135
+ "section": { "type": "string" },
136
+ "regex": { "type": "string", "minLength": 1 },
137
+ "flags": { "type": "string", "default": "i" },
138
+ "cursor_row_min": { "type": "integer", "minimum": 0 },
139
+ "cursor_row_max": { "type": "integer", "minimum": 0 },
140
+ "cursor_col_min": { "type": "integer", "minimum": 0 },
141
+ "cursor_col_max": { "type": "integer", "minimum": 0 },
142
+ "cursor_above_lines": { "type": "integer", "minimum": 1 },
143
+ "changed": { "type": "boolean", "const": true }
144
+ }
145
+ },
146
+ "sectionPattern": {
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "required": ["pattern"],
150
+ "properties": {
151
+ "section": { "type": "string" },
152
+ "pattern": { "type": "string", "minLength": 1 },
153
+ "flags": { "type": "string", "default": "" }
154
+ }
155
+ },
156
+ "stateV1": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "required": ["id", "label", "when"],
160
+ "properties": {
161
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
162
+ "label": { "type": "string", "minLength": 1 },
163
+ "when": { "$ref": "#/definitions/sectionRegex" },
164
+ "extract_title": { "$ref": "#/definitions/sectionRegex" },
165
+ "modal_buttons": {
166
+ "type": "object",
167
+ "additionalProperties": false,
168
+ "required": ["key_for_index"],
169
+ "oneOf": [
170
+ { "required": ["pattern"] },
171
+ { "required": ["patterns"] }
172
+ ],
173
+ "properties": {
174
+ "section": { "type": "string" },
175
+ "pattern": { "type": "string", "minLength": 1 },
176
+ "flags": { "type": "string" },
177
+ "patterns": {
178
+ "type": "array",
179
+ "minItems": 1,
180
+ "items": {
181
+ "type": "object",
182
+ "additionalProperties": false,
183
+ "required": ["pattern"],
184
+ "properties": {
185
+ "pattern": { "type": "string", "minLength": 1 },
186
+ "flags": { "type": "string" }
187
+ }
188
+ }
189
+ },
190
+ "key_for_index": { "type": "string", "minLength": 1 },
191
+ "min_count": { "type": "integer", "minimum": 1, "default": 2 },
192
+ "continuation_lines": { "type": "boolean", "default": false }
193
+ }
194
+ }
195
+ }
196
+ },
197
+ "control": {
198
+ "type": "object",
199
+ "additionalProperties": false,
200
+ "required": ["id", "label", "action"],
201
+ "properties": {
202
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
203
+ "label": { "type": "string", "minLength": 1 },
204
+ "visible_when_state": { "type": "array", "items": { "type": "string" } },
205
+ "action": { "$ref": "#/definitions/controlAction" }
206
+ }
207
+ },
208
+ "controlAction": {
209
+ "oneOf": [
210
+ {
211
+ "type": "object",
212
+ "additionalProperties": false,
213
+ "required": ["type", "keys"],
214
+ "properties": {
215
+ "type": { "const": "send_keys" },
216
+ "keys": { "type": "string", "minLength": 1 }
217
+ }
218
+ },
219
+ {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": ["type", "trigger_keys", "wait_for", "extract_choices", "submit_key"],
223
+ "properties": {
224
+ "type": { "const": "open_picker" },
225
+ "trigger_keys": { "type": "string", "minLength": 1 },
226
+ "wait_for": { "$ref": "#/definitions/sectionRegex" },
227
+ "extract_choices": { "$ref": "#/definitions/sectionPattern" },
228
+ "submit_key": { "type": "string", "minLength": 1 }
229
+ }
230
+ },
231
+ {
232
+ "type": "object",
233
+ "additionalProperties": false,
234
+ "required": ["type", "method", "keys_template"],
235
+ "properties": {
236
+ "type": { "const": "attach_image" },
237
+ "method": { "const": "tempfile_then_keys" },
238
+ "keys_template": { "type": "string", "minLength": 1 }
239
+ }
240
+ }
241
+ ]
242
+ },
243
+ "notification": {
244
+ "type": "object",
245
+ "additionalProperties": false,
246
+ "required": ["id", "when_state", "title"],
247
+ "properties": {
248
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
249
+ "when_state": { "type": "string", "minLength": 1 },
250
+ "title": { "type": "string", "minLength": 1 },
251
+ "body": { "type": "string" }
252
+ }
253
+ },
254
+ "nativeHistory": {
255
+ "type": "object",
256
+ "additionalProperties": false,
257
+ "properties": {
258
+ "reader": {
259
+ "type": "string",
260
+ "enum": ["claude-cli", "codex-cli", "antigravity-cli", "hermes-cli"]
261
+ },
262
+ "source": {
263
+ "oneOf": [
264
+ { "$ref": "#/definitions/nativeHistoryJsonlSource" },
265
+ { "$ref": "#/definitions/nativeHistorySqliteSource" }
266
+ ]
267
+ },
268
+ "override_path": { "type": "string", "minLength": 1 }
269
+ }
270
+ },
271
+ "nativeHistoryMessageMap": {
272
+ "type": "object",
273
+ "additionalProperties": false,
274
+ "required": ["role", "content"],
275
+ "properties": {
276
+ "role": { "type": "string", "minLength": 1 },
277
+ "content": { "type": "string", "minLength": 1 },
278
+ "content_strip": { "type": "array", "items": { "type": "string", "minLength": 1 } },
279
+ "content_unwrap": { "type": "array", "items": { "type": "string", "minLength": 1 } },
280
+ "timestamp_ms": { "type": "string", "minLength": 1 },
281
+ "kind": { "type": "string", "minLength": 1 }
282
+ }
283
+ },
284
+ "nativeHistoryJsonlSource": {
285
+ "type": "object",
286
+ "additionalProperties": false,
287
+ "required": ["kind", "path", "message_map"],
288
+ "properties": {
289
+ "kind": { "const": "jsonl" },
290
+ "path": { "type": "string", "minLength": 1 },
291
+ "file_pattern": { "type": "string", "minLength": 1 },
292
+ "recent_window_ms": { "type": "integer", "minimum": 0 },
293
+ "session_id_from": { "type": "string", "enum": ["filename_uuid", "first_record"] },
294
+ "session_id_path": { "type": "string", "minLength": 1 },
295
+ "message_filter": {
296
+ "type": "object",
297
+ "additionalProperties": false,
298
+ "required": ["where"],
299
+ "properties": { "where": { "type": "string", "minLength": 1 } }
300
+ },
301
+ "message_map": { "$ref": "#/definitions/nativeHistoryMessageMap" }
302
+ }
303
+ },
304
+ "nativeHistorySqliteSource": {
305
+ "type": "object",
306
+ "additionalProperties": false,
307
+ "required": ["kind", "path", "session_query", "message_query", "message_map"],
308
+ "properties": {
309
+ "kind": { "const": "sqlite" },
310
+ "path": { "type": "string", "minLength": 1 },
311
+ "session_query": { "type": "string", "minLength": 1 },
312
+ "message_query": { "type": "string", "minLength": 1 },
313
+ "message_map": { "$ref": "#/definitions/nativeHistoryMessageMap" }
314
+ }
315
+ },
316
+ "delegateTrigger": {
317
+ "type": "object",
318
+ "additionalProperties": false,
319
+ "required": ["id", "when_state", "task_template"],
320
+ "properties": {
321
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
322
+ "when_state": { "type": "string", "minLength": 1 },
323
+ "after_duration_ms": { "type": "integer", "minimum": 0 },
324
+ "task_template": { "type": "string", "minLength": 1 }
325
+ }
326
+ }
327
+ }
328
+ } as const;
329
+
330
+ export const SCHEMA_V3 = {
331
+ "$schema": "http://json-schema.org/draft-07/schema#",
332
+ "$id": "adhdev:cli/spec@3",
333
+ "title": "ADHDev CLI provider spec v3",
334
+ "type": "object",
335
+ "additionalProperties": false,
336
+ "required": [
337
+ "$schema",
338
+ "id",
339
+ "name",
340
+ "binary",
341
+ "send_message",
342
+ "sections",
343
+ "states",
344
+ "default_state"
345
+ ],
346
+ "properties": {
347
+ "$schema": { "type": "string", "const": "adhdev:cli/spec@3" },
348
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9-]*$" },
349
+ "name": { "type": "string", "minLength": 1 },
350
+ "binary": { "type": "string", "minLength": 1 },
351
+ "spawn_args": { "type": "array", "items": { "type": "string" }, "default": [] },
352
+ "env": { "type": "object", "additionalProperties": { "type": "string" }, "default": {} },
353
+ "cli_version_range": { "type": "string", "minLength": 1 },
354
+ "send_message": {
355
+ "type": "object",
356
+ "additionalProperties": false,
357
+ "required": ["submit_key"],
358
+ "properties": {
359
+ "submit_key": { "type": "string", "minLength": 1 },
360
+ "delay_ms_before_submit": { "type": "integer", "minimum": 0 },
361
+ "delay_ms_per_char": { "type": "integer", "minimum": 0 }
362
+ }
363
+ },
364
+ "sections": {
365
+ "type": "object",
366
+ "minProperties": 1,
367
+ "additionalProperties": { "$ref": "#/definitions/sectionDef" }
368
+ },
369
+ "states": {
370
+ "type": "array",
371
+ "minItems": 1,
372
+ "items": { "$ref": "#/definitions/stateV3" }
373
+ },
374
+ "default_state": { "type": "string", "minLength": 1 },
375
+ "control_bar": { "type": "array", "default": [], "items": { "$ref": "#/definitions/control" } },
376
+ "notifications": { "type": "array", "default": [], "items": { "$ref": "#/definitions/notification" } },
377
+ "delegate": { "type": "array", "default": [], "items": { "$ref": "#/definitions/delegateTrigger" } },
378
+ "native_history": { "$ref": "#/definitions/nativeHistory" },
379
+ "requiresFinalAssistantBeforeIdle": { "type": "boolean" },
380
+ "timing": {
381
+ "type": "object",
382
+ "additionalProperties": false,
383
+ "properties": {
384
+ "busy_hold_ms": { "type": "integer", "minimum": 0 },
385
+ "idle_hold_ms": { "type": "integer", "minimum": 0 },
386
+ "startup_grace_ms": { "type": "integer", "minimum": 0 },
387
+ "completion_marker": {
388
+ "type": "object",
389
+ "additionalProperties": false,
390
+ "required": ["matches", "hold_ms"],
391
+ "properties": {
392
+ "section": { "type": "string", "minLength": 1 },
393
+ "matches": { "type": "string", "minLength": 1 },
394
+ "flags": { "type": "string" },
395
+ "hold_ms": { "type": "integer", "minimum": 0 },
396
+ "force_after_ms": { "type": "integer", "minimum": 0 }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ },
402
+ "definitions": {
403
+ "size": {
404
+ "oneOf": [
405
+ { "type": "integer", "minimum": 0 },
406
+ { "type": "string", "pattern": "^\\d+(\\.\\d+)?%$" }
407
+ ]
408
+ },
409
+ "sectionDef": {
410
+ "type": "object",
411
+ "additionalProperties": false,
412
+ "properties": {
413
+ "from_top": { "$ref": "#/definitions/size" },
414
+ "from_bottom": { "$ref": "#/definitions/size" },
415
+ "until": { "type": "string", "minLength": 1 },
416
+ "anchor": { "type": "string", "minLength": 1 },
417
+ "anchor_flags": { "type": "string" },
418
+ "anchor_last": { "type": "boolean" },
419
+ "anchor_context": {
420
+ "type": "object",
421
+ "additionalProperties": false,
422
+ "properties": {
423
+ "prev": { "type": "string" },
424
+ "prev_flags": { "type": "string" },
425
+ "next": { "type": "string" },
426
+ "next_flags": { "type": "string" }
427
+ }
428
+ },
429
+ "lines": { "type": "integer", "minimum": 1 },
430
+ "until_regex": { "type": "string", "minLength": 1 },
431
+ "until_regex_flags": { "type": "string" }
432
+ }
433
+ },
434
+ "condition": {
435
+ "oneOf": [
436
+ { "$ref": "#/definitions/regexCondition" },
437
+ { "$ref": "#/definitions/changedCondition" },
438
+ { "$ref": "#/definitions/allCondition" },
439
+ { "$ref": "#/definitions/anyCondition" }
440
+ ]
441
+ },
442
+ "regexCondition": {
443
+ "type": "object",
444
+ "additionalProperties": false,
445
+ "required": ["matches"],
446
+ "properties": {
447
+ "section": { "type": "string" },
448
+ "matches": { "type": "string", "minLength": 1 },
449
+ "flags": { "type": "string" },
450
+ "cursor_row_min": { "type": "integer", "minimum": 0 },
451
+ "cursor_row_max": { "type": "integer", "minimum": 0 },
452
+ "cursor_col_min": { "type": "integer", "minimum": 0 },
453
+ "cursor_col_max": { "type": "integer", "minimum": 0 }
454
+ }
455
+ },
456
+ "changedCondition": {
457
+ "type": "object",
458
+ "additionalProperties": false,
459
+ "required": ["cursor_above", "changed"],
460
+ "properties": {
461
+ "cursor_above": { "type": "integer", "minimum": 1 },
462
+ "changed": { "type": "boolean", "const": true }
463
+ }
464
+ },
465
+ "allCondition": {
466
+ "type": "object",
467
+ "additionalProperties": false,
468
+ "required": ["all"],
469
+ "properties": {
470
+ "all": {
471
+ "type": "array",
472
+ "items": { "$ref": "#/definitions/condition" }
473
+ }
474
+ }
475
+ },
476
+ "anyCondition": {
477
+ "type": "object",
478
+ "additionalProperties": false,
479
+ "required": ["any"],
480
+ "properties": {
481
+ "any": {
482
+ "type": "array",
483
+ "items": { "$ref": "#/definitions/condition" }
484
+ }
485
+ }
486
+ },
487
+ "extractTitle": {
488
+ "type": "object",
489
+ "additionalProperties": false,
490
+ "properties": {
491
+ "section": { "type": "string" },
492
+ "regex": { "type": "string", "minLength": 1 },
493
+ "flags": { "type": "string" },
494
+ "first_line": { "type": "boolean", "const": true }
495
+ }
496
+ },
497
+ "extractButtons": {
498
+ "type": "object",
499
+ "additionalProperties": false,
500
+ "required": ["pattern", "key_for_index"],
501
+ "properties": {
502
+ "section": { "type": "string" },
503
+ "pattern": { "type": "string", "minLength": 1 },
504
+ "flags": { "type": "string" },
505
+ "key_for_index": { "type": "string", "minLength": 1 },
506
+ "min_count": { "type": "integer", "minimum": 1, "default": 2 },
507
+ "continuation_lines": { "type": "boolean", "default": false }
508
+ }
509
+ },
510
+ "stateV3": {
511
+ "type": "object",
512
+ "additionalProperties": false,
513
+ "required": ["id", "label", "when"],
514
+ "properties": {
515
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
516
+ "label": { "type": "string", "minLength": 1 },
517
+ "when": {
518
+ "oneOf": [
519
+ { "$ref": "#/definitions/allCondition" },
520
+ { "$ref": "#/definitions/anyCondition" }
521
+ ]
522
+ },
523
+ "extract": {
524
+ "type": "object",
525
+ "additionalProperties": false,
526
+ "properties": {
527
+ "title": { "$ref": "#/definitions/extractTitle" },
528
+ "buttons": { "$ref": "#/definitions/extractButtons" }
529
+ }
530
+ }
531
+ }
532
+ },
533
+ "sectionRegex": {
534
+ "type": "object",
535
+ "additionalProperties": false,
536
+ "required": ["regex"],
537
+ "properties": {
538
+ "section": { "type": "string" },
539
+ "regex": { "type": "string", "minLength": 1 },
540
+ "flags": { "type": "string", "default": "i" },
541
+ "cursor_row_min": { "type": "integer", "minimum": 0 },
542
+ "cursor_row_max": { "type": "integer", "minimum": 0 },
543
+ "cursor_col_min": { "type": "integer", "minimum": 0 },
544
+ "cursor_col_max": { "type": "integer", "minimum": 0 }
545
+ }
546
+ },
547
+ "sectionPattern": {
548
+ "type": "object",
549
+ "additionalProperties": false,
550
+ "required": ["pattern"],
551
+ "properties": {
552
+ "section": { "type": "string" },
553
+ "pattern": { "type": "string", "minLength": 1 },
554
+ "flags": { "type": "string", "default": "" }
555
+ }
556
+ },
557
+ "control": {
558
+ "type": "object",
559
+ "additionalProperties": false,
560
+ "required": ["id", "label", "action"],
561
+ "properties": {
562
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
563
+ "label": { "type": "string", "minLength": 1 },
564
+ "visible_when_state": { "type": "array", "items": { "type": "string" } },
565
+ "action": { "$ref": "#/definitions/controlAction" }
566
+ }
567
+ },
568
+ "controlAction": {
569
+ "oneOf": [
570
+ {
571
+ "type": "object",
572
+ "additionalProperties": false,
573
+ "required": ["type", "keys"],
574
+ "properties": {
575
+ "type": { "const": "send_keys" },
576
+ "keys": { "type": "string", "minLength": 1 }
577
+ }
578
+ },
579
+ {
580
+ "type": "object",
581
+ "additionalProperties": false,
582
+ "required": ["type", "trigger_keys", "wait_for", "extract_choices", "submit_key"],
583
+ "properties": {
584
+ "type": { "const": "open_picker" },
585
+ "trigger_keys": { "type": "string", "minLength": 1 },
586
+ "wait_for": { "$ref": "#/definitions/sectionRegex" },
587
+ "extract_choices": { "$ref": "#/definitions/sectionPattern" },
588
+ "submit_key": { "type": "string", "minLength": 1 }
589
+ }
590
+ },
591
+ {
592
+ "type": "object",
593
+ "additionalProperties": false,
594
+ "required": ["type", "method", "keys_template"],
595
+ "properties": {
596
+ "type": { "const": "attach_image" },
597
+ "method": { "const": "tempfile_then_keys" },
598
+ "keys_template": { "type": "string", "minLength": 1 }
599
+ }
600
+ }
601
+ ]
602
+ },
603
+ "notification": {
604
+ "type": "object",
605
+ "additionalProperties": false,
606
+ "required": ["id", "when_state", "title"],
607
+ "properties": {
608
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
609
+ "when_state": { "type": "string", "minLength": 1 },
610
+ "title": { "type": "string", "minLength": 1 },
611
+ "body": { "type": "string" }
612
+ }
613
+ },
614
+ "nativeHistory": {
615
+ "type": "object",
616
+ "additionalProperties": false,
617
+ "properties": {
618
+ "reader": {
619
+ "type": "string",
620
+ "enum": ["claude-cli", "codex-cli", "antigravity-cli", "hermes-cli"]
621
+ },
622
+ "source": {
623
+ "oneOf": [
624
+ { "$ref": "#/definitions/nativeHistoryJsonlSource" },
625
+ { "$ref": "#/definitions/nativeHistorySqliteSource" }
626
+ ]
627
+ },
628
+ "override_path": { "type": "string", "minLength": 1 }
629
+ }
630
+ },
631
+ "nativeHistoryMessageMap": {
632
+ "type": "object",
633
+ "additionalProperties": false,
634
+ "required": ["role", "content"],
635
+ "properties": {
636
+ "role": { "type": "string", "minLength": 1 },
637
+ "content": { "type": "string", "minLength": 1 },
638
+ "content_strip": { "type": "array", "items": { "type": "string", "minLength": 1 } },
639
+ "content_unwrap": { "type": "array", "items": { "type": "string", "minLength": 1 } },
640
+ "timestamp_ms": { "type": "string", "minLength": 1 },
641
+ "kind": { "type": "string", "minLength": 1 }
642
+ }
643
+ },
644
+ "nativeHistoryJsonlSource": {
645
+ "type": "object",
646
+ "additionalProperties": false,
647
+ "required": ["kind", "path", "message_map"],
648
+ "properties": {
649
+ "kind": { "const": "jsonl" },
650
+ "path": { "type": "string", "minLength": 1 },
651
+ "file_pattern": { "type": "string", "minLength": 1 },
652
+ "recent_window_ms": { "type": "integer", "minimum": 0 },
653
+ "session_id_from": { "type": "string", "enum": ["filename_uuid", "first_record"] },
654
+ "session_id_path": { "type": "string", "minLength": 1 },
655
+ "message_filter": {
656
+ "type": "object",
657
+ "additionalProperties": false,
658
+ "required": ["where"],
659
+ "properties": { "where": { "type": "string", "minLength": 1 } }
660
+ },
661
+ "message_map": { "$ref": "#/definitions/nativeHistoryMessageMap" }
662
+ }
663
+ },
664
+ "nativeHistorySqliteSource": {
665
+ "type": "object",
666
+ "additionalProperties": false,
667
+ "required": ["kind", "path", "session_query", "message_query", "message_map"],
668
+ "properties": {
669
+ "kind": { "const": "sqlite" },
670
+ "path": { "type": "string", "minLength": 1 },
671
+ "session_query": { "type": "string", "minLength": 1 },
672
+ "message_query": { "type": "string", "minLength": 1 },
673
+ "message_map": { "$ref": "#/definitions/nativeHistoryMessageMap" }
674
+ }
675
+ },
676
+ "delegateTrigger": {
677
+ "type": "object",
678
+ "additionalProperties": false,
679
+ "required": ["id", "when_state", "task_template"],
680
+ "properties": {
681
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
682
+ "when_state": { "type": "string", "minLength": 1 },
683
+ "after_duration_ms": { "type": "integer", "minimum": 0 },
684
+ "task_template": { "type": "string", "minLength": 1 }
685
+ }
686
+ }
687
+ }
688
+ } as const;
689
+
690
+ /** Default schema export — v3 (current). */
691
+ export const SCHEMA = SCHEMA_V3;