@adhdev/daemon-core 0.9.82-rc.209 → 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 (64) hide show
  1. package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +2 -0
  2. package/dist/commands/router.d.ts +6 -0
  3. package/dist/git/git-commands.d.ts +2 -0
  4. package/dist/git/git-diff.d.ts +6 -0
  5. package/dist/index.d.ts +11 -5
  6. package/dist/index.js +5699 -3486
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +5679 -3483
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/mesh/coordinator-prompt.d.ts +6 -0
  11. package/dist/mesh/mesh-delivery-policy.d.ts +5 -0
  12. package/dist/mesh/mesh-events-coordinator.d.ts +151 -0
  13. package/dist/mesh/mesh-events-pending.d.ts +33 -0
  14. package/dist/mesh/mesh-events-stale.d.ts +40 -0
  15. package/dist/mesh/mesh-events-utils.d.ts +14 -0
  16. package/dist/mesh/mesh-events.d.ts +5 -198
  17. package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -3
  18. package/dist/mesh/mesh-ledger.d.ts +19 -0
  19. package/dist/mesh/mesh-missions.d.ts +58 -0
  20. package/dist/mesh/mesh-review-inbox.d.ts +90 -0
  21. package/dist/mesh/mesh-runtime-store.d.ts +175 -0
  22. package/dist/mesh/mesh-task-stats.d.ts +49 -0
  23. package/dist/mesh/mesh-work-queue.d.ts +82 -0
  24. package/dist/mesh/refine-config.d.ts +24 -2
  25. package/dist/mesh/worktree-bootstrap-config.d.ts +22 -0
  26. package/dist/providers/acp-provider-instance.d.ts +2 -0
  27. package/dist/providers/spec/driver.d.ts +8 -0
  28. package/dist/providers/spec/evaluator.d.ts +4 -5
  29. package/dist/providers/spec/loader.d.ts +1 -0
  30. package/dist/providers/spec/schema.gen.d.ts +1409 -6
  31. package/dist/providers/spec/types.d.ts +188 -175
  32. package/dist/repo-mesh-types.d.ts +1 -0
  33. package/package.json +1 -1
  34. package/src/boot/daemon-lifecycle.ts +3 -0
  35. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +20 -7
  36. package/src/commands/router.ts +594 -66
  37. package/src/git/git-commands.ts +5 -5
  38. package/src/git/git-diff.ts +53 -0
  39. package/src/index.ts +11 -5
  40. package/src/mesh/coordinator-prompt.ts +14 -1
  41. package/src/mesh/mesh-delivery-policy.ts +17 -0
  42. package/src/mesh/mesh-events-coordinator.ts +1404 -0
  43. package/src/mesh/mesh-events-pending.ts +371 -0
  44. package/src/mesh/mesh-events-stale.ts +283 -0
  45. package/src/mesh/mesh-events-utils.ts +161 -0
  46. package/src/mesh/mesh-events.ts +27 -2143
  47. package/src/mesh/mesh-ledger-reconciliation.ts +12 -5
  48. package/src/mesh/mesh-ledger.ts +134 -2
  49. package/src/mesh/mesh-missions.ts +151 -0
  50. package/src/mesh/mesh-review-inbox.ts +307 -0
  51. package/src/mesh/mesh-runtime-store.ts +539 -3
  52. package/src/mesh/mesh-task-stats.ts +154 -0
  53. package/src/mesh/mesh-work-queue.ts +233 -17
  54. package/src/mesh/refine-config.ts +42 -5
  55. package/src/mesh/worktree-bootstrap-config.ts +79 -0
  56. package/src/providers/acp-provider-instance.ts +15 -1
  57. package/src/providers/cli-provider-instance.ts +34 -13
  58. package/src/providers/spec/driver.ts +57 -29
  59. package/src/providers/spec/evaluator.ts +302 -112
  60. package/src/providers/spec/loader.ts +226 -37
  61. package/src/providers/spec/schema.gen.ts +450 -334
  62. package/src/providers/spec/schema.json +162 -75
  63. package/src/providers/spec/types.ts +234 -183
  64. package/src/repo-mesh-types.ts +1 -0
@@ -1,10 +1,15 @@
1
1
  /**
2
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).
3
7
  */
4
- export const SCHEMA = {
8
+
9
+ export const SCHEMA_V1 = {
5
10
  "$schema": "http://json-schema.org/draft-07/schema#",
6
11
  "$id": "adhdev:cli/spec@1",
7
- "title": "ADHDev CLI provider spec",
12
+ "title": "ADHDev CLI provider spec v1",
8
13
  "type": "object",
9
14
  "additionalProperties": false,
10
15
  "required": [
@@ -22,112 +27,45 @@ export const SCHEMA = {
22
27
  "type": "string",
23
28
  "const": "adhdev:cli/spec@1"
24
29
  },
25
- "id": {
26
- "type": "string",
27
- "minLength": 1,
28
- "pattern": "^[a-z][a-z0-9-]*$"
29
- },
30
- "name": {
31
- "type": "string",
32
- "minLength": 1
33
- },
34
- "binary": {
35
- "type": "string",
36
- "minLength": 1
37
- },
38
- "spawn_args": {
39
- "type": "array",
40
- "items": {
41
- "type": "string"
42
- },
43
- "default": []
44
- },
45
- "env": {
46
- "type": "object",
47
- "additionalProperties": {
48
- "type": "string"
49
- },
50
- "default": {}
51
- },
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": {} },
52
35
  "send_message": {
53
36
  "type": "object",
54
37
  "additionalProperties": false,
55
- "required": [
56
- "submit_key"
57
- ],
38
+ "required": ["submit_key"],
58
39
  "properties": {
59
- "submit_key": {
60
- "type": "string",
61
- "minLength": 1
62
- },
63
- "delay_ms_before_submit": {
64
- "type": "integer",
65
- "minimum": 0
66
- },
67
- "delay_ms_per_char": {
68
- "type": "integer",
69
- "minimum": 0
70
- }
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 }
71
43
  }
72
44
  },
73
45
  "layout": {
74
46
  "type": "object",
75
47
  "additionalProperties": false,
76
- "required": [
77
- "sections"
78
- ],
48
+ "required": ["sections"],
79
49
  "properties": {
80
50
  "sections": {
81
51
  "type": "array",
82
52
  "minItems": 1,
83
- "items": {
84
- "$ref": "#/definitions/section"
85
- }
53
+ "items": { "$ref": "#/definitions/sectionV1" }
86
54
  }
87
55
  }
88
56
  },
89
57
  "states": {
90
58
  "type": "array",
91
59
  "minItems": 1,
92
- "items": {
93
- "$ref": "#/definitions/state"
94
- }
95
- },
96
- "default_state": {
97
- "type": "string",
98
- "minLength": 1
99
- },
100
- "control_bar": {
101
- "type": "array",
102
- "default": [],
103
- "items": {
104
- "$ref": "#/definitions/control"
105
- }
106
- },
107
- "notifications": {
108
- "type": "array",
109
- "default": [],
110
- "items": {
111
- "$ref": "#/definitions/notification"
112
- }
113
- },
114
- "delegate": {
115
- "type": "array",
116
- "default": [],
117
- "items": {
118
- "$ref": "#/definitions/delegateTrigger"
119
- }
120
- },
121
- "native_history": {
122
- "$ref": "#/definitions/nativeHistory"
123
- },
124
- "cli_version_range": {
125
- "type": "string",
126
- "minLength": 1
127
- },
128
- "requiresFinalAssistantBeforeIdle": {
129
- "type": "boolean"
60
+ "items": { "$ref": "#/definitions/stateV1" }
130
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" },
131
69
  "debounce": {
132
70
  "type": "object",
133
71
  "additionalProperties": false,
@@ -153,45 +91,23 @@ export const SCHEMA = {
153
91
  "definitions": {
154
92
  "size": {
155
93
  "oneOf": [
156
- {
157
- "type": "integer",
158
- "minimum": 0
159
- },
160
- {
161
- "type": "string",
162
- "pattern": "^\\d+(\\.\\d+)?%$"
163
- }
94
+ { "type": "integer", "minimum": 0 },
95
+ { "type": "string", "pattern": "^\\d+(\\.\\d+)?%$" }
164
96
  ]
165
97
  },
166
- "section": {
98
+ "sectionV1": {
167
99
  "type": "object",
168
100
  "additionalProperties": false,
169
- "required": [
170
- "id"
171
- ],
101
+ "required": ["id"],
172
102
  "properties": {
173
- "id": {
174
- "type": "string",
175
- "minLength": 1,
176
- "pattern": "^[a-z][a-z0-9_]*$"
177
- },
178
- "from_top": {
179
- "$ref": "#/definitions/size"
180
- },
181
- "from_bottom": {
182
- "$ref": "#/definitions/size"
183
- },
103
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z][a-z0-9_]*$" },
104
+ "from_top": { "$ref": "#/definitions/size" },
105
+ "from_bottom": { "$ref": "#/definitions/size" },
184
106
  "until": {
185
107
  "type": "object",
186
108
  "additionalProperties": false,
187
- "required": [
188
- "section"
189
- ],
190
- "properties": {
191
- "section": {
192
- "type": "string"
193
- }
194
- }
109
+ "required": ["section"],
110
+ "properties": { "section": { "type": "string" } }
195
111
  },
196
112
  "anchor_regex": { "type": "string", "minLength": 1 },
197
113
  "anchor_flags": { "type": "string" },
@@ -214,104 +130,50 @@ export const SCHEMA = {
214
130
  "sectionRegex": {
215
131
  "type": "object",
216
132
  "additionalProperties": false,
217
- "required": [
218
- "regex"
219
- ],
133
+ "required": ["regex"],
220
134
  "properties": {
221
- "section": {
222
- "type": "string"
223
- },
224
- "regex": {
225
- "type": "string",
226
- "minLength": 1
227
- },
228
- "flags": {
229
- "type": "string",
230
- "default": "i"
231
- },
232
- "cursor_row_min": {
233
- "type": "integer",
234
- "minimum": 0
235
- },
236
- "cursor_row_max": {
237
- "type": "integer",
238
- "minimum": 0
239
- },
240
- "cursor_col_min": {
241
- "type": "integer",
242
- "minimum": 0
243
- },
244
- "cursor_col_max": {
245
- "type": "integer",
246
- "minimum": 0
247
- }
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 }
248
144
  }
249
145
  },
250
146
  "sectionPattern": {
251
147
  "type": "object",
252
148
  "additionalProperties": false,
253
- "required": [
254
- "pattern"
255
- ],
149
+ "required": ["pattern"],
256
150
  "properties": {
257
- "section": {
258
- "type": "string"
259
- },
260
- "pattern": {
261
- "type": "string",
262
- "minLength": 1
263
- },
264
- "flags": {
265
- "type": "string",
266
- "default": ""
267
- }
151
+ "section": { "type": "string" },
152
+ "pattern": { "type": "string", "minLength": 1 },
153
+ "flags": { "type": "string", "default": "" }
268
154
  }
269
155
  },
270
- "state": {
156
+ "stateV1": {
271
157
  "type": "object",
272
158
  "additionalProperties": false,
273
- "required": [
274
- "id",
275
- "label",
276
- "when"
277
- ],
159
+ "required": ["id", "label", "when"],
278
160
  "properties": {
279
- "id": {
280
- "type": "string",
281
- "minLength": 1,
282
- "pattern": "^[a-z][a-z0-9_]*$"
283
- },
284
- "label": {
285
- "type": "string",
286
- "minLength": 1
287
- },
288
- "when": {
289
- "$ref": "#/definitions/sectionRegex"
290
- },
291
- "extract_title": {
292
- "$ref": "#/definitions/sectionRegex"
293
- },
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" },
294
165
  "modal_buttons": {
295
166
  "type": "object",
296
167
  "additionalProperties": false,
297
- "required": [
298
- "key_for_index"
299
- ],
168
+ "required": ["key_for_index"],
300
169
  "oneOf": [
301
170
  { "required": ["pattern"] },
302
171
  { "required": ["patterns"] }
303
172
  ],
304
173
  "properties": {
305
- "section": {
306
- "type": "string"
307
- },
308
- "pattern": {
309
- "type": "string",
310
- "minLength": 1
311
- },
312
- "flags": {
313
- "type": "string"
314
- },
174
+ "section": { "type": "string" },
175
+ "pattern": { "type": "string", "minLength": 1 },
176
+ "flags": { "type": "string" },
315
177
  "patterns": {
316
178
  "type": "array",
317
179
  "minItems": 1,
@@ -325,19 +187,9 @@ export const SCHEMA = {
325
187
  }
326
188
  }
327
189
  },
328
- "key_for_index": {
329
- "type": "string",
330
- "minLength": 1
331
- },
332
- "min_count": {
333
- "type": "integer",
334
- "minimum": 1,
335
- "default": 2
336
- },
337
- "continuation_lines": {
338
- "type": "boolean",
339
- "default": false
340
- }
190
+ "key_for_index": { "type": "string", "minLength": 1 },
191
+ "min_count": { "type": "integer", "minimum": 1, "default": 2 },
192
+ "continuation_lines": { "type": "boolean", "default": false }
341
193
  }
342
194
  }
343
195
  }
@@ -345,100 +197,405 @@ export const SCHEMA = {
345
197
  "control": {
346
198
  "type": "object",
347
199
  "additionalProperties": false,
348
- "required": [
349
- "id",
350
- "label",
351
- "action"
352
- ],
200
+ "required": ["id", "label", "action"],
353
201
  "properties": {
354
- "id": {
355
- "type": "string",
356
- "minLength": 1,
357
- "pattern": "^[a-z][a-z0-9_]*$"
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
+ }
358
230
  },
359
- "label": {
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": {
360
259
  "type": "string",
361
- "minLength": 1
260
+ "enum": ["claude-cli", "codex-cli", "antigravity-cli", "hermes-cli"]
362
261
  },
363
- "visible_when_state": {
364
- "type": "array",
365
- "items": {
366
- "type": "string"
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 }
367
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
+ ]
368
522
  },
369
- "action": {
370
- "$ref": "#/definitions/controlAction"
523
+ "extract": {
524
+ "type": "object",
525
+ "additionalProperties": false,
526
+ "properties": {
527
+ "title": { "$ref": "#/definitions/extractTitle" },
528
+ "buttons": { "$ref": "#/definitions/extractButtons" }
529
+ }
371
530
  }
372
531
  }
373
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
+ },
374
568
  "controlAction": {
375
569
  "oneOf": [
376
570
  {
377
571
  "type": "object",
378
572
  "additionalProperties": false,
379
- "required": [
380
- "type",
381
- "keys"
382
- ],
573
+ "required": ["type", "keys"],
383
574
  "properties": {
384
- "type": {
385
- "const": "send_keys"
386
- },
387
- "keys": {
388
- "type": "string",
389
- "minLength": 1
390
- }
575
+ "type": { "const": "send_keys" },
576
+ "keys": { "type": "string", "minLength": 1 }
391
577
  }
392
578
  },
393
579
  {
394
580
  "type": "object",
395
581
  "additionalProperties": false,
396
- "required": [
397
- "type",
398
- "trigger_keys",
399
- "wait_for",
400
- "extract_choices",
401
- "submit_key"
402
- ],
582
+ "required": ["type", "trigger_keys", "wait_for", "extract_choices", "submit_key"],
403
583
  "properties": {
404
- "type": {
405
- "const": "open_picker"
406
- },
407
- "trigger_keys": {
408
- "type": "string",
409
- "minLength": 1
410
- },
411
- "wait_for": {
412
- "$ref": "#/definitions/sectionRegex"
413
- },
414
- "extract_choices": {
415
- "$ref": "#/definitions/sectionPattern"
416
- },
417
- "submit_key": {
418
- "type": "string",
419
- "minLength": 1
420
- }
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 }
421
589
  }
422
590
  },
423
591
  {
424
592
  "type": "object",
425
593
  "additionalProperties": false,
426
- "required": [
427
- "type",
428
- "method",
429
- "keys_template"
430
- ],
594
+ "required": ["type", "method", "keys_template"],
431
595
  "properties": {
432
- "type": {
433
- "const": "attach_image"
434
- },
435
- "method": {
436
- "const": "tempfile_then_keys"
437
- },
438
- "keys_template": {
439
- "type": "string",
440
- "minLength": 1
441
- }
596
+ "type": { "const": "attach_image" },
597
+ "method": { "const": "tempfile_then_keys" },
598
+ "keys_template": { "type": "string", "minLength": 1 }
442
599
  }
443
600
  }
444
601
  ]
@@ -446,28 +603,12 @@ export const SCHEMA = {
446
603
  "notification": {
447
604
  "type": "object",
448
605
  "additionalProperties": false,
449
- "required": [
450
- "id",
451
- "when_state",
452
- "title"
453
- ],
606
+ "required": ["id", "when_state", "title"],
454
607
  "properties": {
455
- "id": {
456
- "type": "string",
457
- "minLength": 1,
458
- "pattern": "^[a-z][a-z0-9_]*$"
459
- },
460
- "when_state": {
461
- "type": "string",
462
- "minLength": 1
463
- },
464
- "title": {
465
- "type": "string",
466
- "minLength": 1
467
- },
468
- "body": {
469
- "type": "string"
470
- }
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" }
471
612
  }
472
613
  },
473
614
  "nativeHistory": {
@@ -476,12 +617,7 @@ export const SCHEMA = {
476
617
  "properties": {
477
618
  "reader": {
478
619
  "type": "string",
479
- "enum": [
480
- "claude-cli",
481
- "codex-cli",
482
- "antigravity-cli",
483
- "hermes-cli"
484
- ]
620
+ "enum": ["claude-cli", "codex-cli", "antigravity-cli", "hermes-cli"]
485
621
  },
486
622
  "source": {
487
623
  "oneOf": [
@@ -499,14 +635,8 @@ export const SCHEMA = {
499
635
  "properties": {
500
636
  "role": { "type": "string", "minLength": 1 },
501
637
  "content": { "type": "string", "minLength": 1 },
502
- "content_strip": {
503
- "type": "array",
504
- "items": { "type": "string", "minLength": 1 }
505
- },
506
- "content_unwrap": {
507
- "type": "array",
508
- "items": { "type": "string", "minLength": 1 }
509
- },
638
+ "content_strip": { "type": "array", "items": { "type": "string", "minLength": 1 } },
639
+ "content_unwrap": { "type": "array", "items": { "type": "string", "minLength": 1 } },
510
640
  "timestamp_ms": { "type": "string", "minLength": 1 },
511
641
  "kind": { "type": "string", "minLength": 1 }
512
642
  }
@@ -546,30 +676,16 @@ export const SCHEMA = {
546
676
  "delegateTrigger": {
547
677
  "type": "object",
548
678
  "additionalProperties": false,
549
- "required": [
550
- "id",
551
- "when_state",
552
- "task_template"
553
- ],
679
+ "required": ["id", "when_state", "task_template"],
554
680
  "properties": {
555
- "id": {
556
- "type": "string",
557
- "minLength": 1,
558
- "pattern": "^[a-z][a-z0-9_]*$"
559
- },
560
- "when_state": {
561
- "type": "string",
562
- "minLength": 1
563
- },
564
- "after_duration_ms": {
565
- "type": "integer",
566
- "minimum": 0
567
- },
568
- "task_template": {
569
- "type": "string",
570
- "minLength": 1
571
- }
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 }
572
685
  }
573
686
  }
574
687
  }
575
688
  } as const;
689
+
690
+ /** Default schema export — v3 (current). */
691
+ export const SCHEMA = SCHEMA_V3;