dsh-plugin-dshm 0.0.0-stage → 0.1.0

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 (80) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +228 -2
  4. package/README.zh-CN.md +190 -0
  5. package/cordis.patch.yml +7 -0
  6. package/lib/auth/signature.d.ts +4 -0
  7. package/lib/auth/signature.js +24 -0
  8. package/lib/cli/index.d.ts +4 -0
  9. package/lib/cli/index.js +41 -0
  10. package/lib/client.js +419 -0
  11. package/lib/config.d.ts +10 -0
  12. package/lib/config.js +27 -0
  13. package/lib/discovery/advertiser.d.ts +45 -0
  14. package/lib/discovery/advertiser.js +141 -0
  15. package/lib/discovery/interfaces.d.ts +5 -0
  16. package/lib/discovery/interfaces.js +24 -0
  17. package/lib/errors.d.ts +5 -0
  18. package/lib/errors.js +10 -0
  19. package/lib/host/local.d.ts +5 -0
  20. package/lib/host/local.js +122 -0
  21. package/lib/host/tailscale.d.ts +43 -0
  22. package/lib/host/tailscale.js +137 -0
  23. package/lib/host/types.d.ts +40 -0
  24. package/lib/host/types.js +1 -0
  25. package/lib/index.d.ts +30 -0
  26. package/lib/index.js +98 -0
  27. package/lib/methods/index.d.ts +9 -0
  28. package/lib/methods/index.js +206 -0
  29. package/lib/pairing/state.d.ts +26 -0
  30. package/lib/pairing/state.js +89 -0
  31. package/lib/pairing/window.d.ts +18 -0
  32. package/lib/pairing/window.js +57 -0
  33. package/lib/projection/client.d.mts +2 -0
  34. package/lib/projection/client.mjs +11 -0
  35. package/lib/projection/files.d.ts +33 -0
  36. package/lib/projection/files.js +278 -0
  37. package/lib/projection/fold-recording.d.mts +50 -0
  38. package/lib/projection/fold-recording.mjs +440 -0
  39. package/lib/projection/host.d.ts +6 -0
  40. package/lib/projection/host.js +86 -0
  41. package/lib/projection/ids.d.mts +1 -0
  42. package/lib/projection/ids.mjs +1 -0
  43. package/lib/projection/index.d.ts +2 -0
  44. package/lib/projection/index.js +2 -0
  45. package/lib/projection/interactions.d.ts +10 -0
  46. package/lib/projection/interactions.js +73 -0
  47. package/lib/projection/native.d.ts +114 -0
  48. package/lib/projection/native.js +903 -0
  49. package/lib/protocol/THIRD_PARTY_LICENSES.txt +135 -0
  50. package/lib/protocol/dmp.d.ts +402 -0
  51. package/lib/protocol/dmp.js +1 -0
  52. package/lib/protocol/schema/dmp-v1/common.schema.json +88 -0
  53. package/lib/protocol/schema/dmp-v1/events.schema.json +107 -0
  54. package/lib/protocol/schema/dmp-v1/frames.schema.json +280 -0
  55. package/lib/protocol/schema/dmp-v1/methods.schema.json +584 -0
  56. package/lib/protocol/schema/dmp-v1/models.schema.json +674 -0
  57. package/lib/protocol/scripts/contract.mjs +8106 -0
  58. package/lib/push/controller.d.ts +64 -0
  59. package/lib/push/controller.js +290 -0
  60. package/lib/push/observer.d.ts +51 -0
  61. package/lib/push/observer.js +266 -0
  62. package/lib/push/payload.d.ts +15 -0
  63. package/lib/push/payload.js +18 -0
  64. package/lib/push/store.d.ts +17 -0
  65. package/lib/push/store.js +75 -0
  66. package/lib/server/index.d.ts +30 -0
  67. package/lib/server/index.js +500 -0
  68. package/lib/server/rate-limit.d.ts +7 -0
  69. package/lib/server/rate-limit.js +19 -0
  70. package/lib/server/uploads.d.ts +21 -0
  71. package/lib/server/uploads.js +74 -0
  72. package/lib/types.d.ts +92 -0
  73. package/lib/types.js +1 -0
  74. package/lib/ui/card.d.mts +3 -0
  75. package/lib/ui/card.mjs +59 -0
  76. package/lib/ui/copy.d.mts +146 -0
  77. package/lib/ui/copy.mjs +106 -0
  78. package/lib/ui/remote-setup.d.mts +81 -0
  79. package/lib/ui/remote-setup.mjs +75 -0
  80. package/package.json +67 -4
@@ -0,0 +1,674 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "dmp://v1/models.schema.json",
4
+ "title": "DMP v1 domain models",
5
+ "$defs": {
6
+ "HostInfo": {
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": ["hostId", "name", "platform"],
10
+ "properties": {
11
+ "hostId": { "$ref": "common.schema.json#/$defs/Id" },
12
+ "name": { "type": "string" },
13
+ "platform": { "enum": ["macos", "windows", "linux"] }
14
+ }
15
+ },
16
+
17
+ "Workspace": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": ["workspaceId", "title", "path", "updatedAt"],
21
+ "properties": {
22
+ "workspaceId": { "$ref": "common.schema.json#/$defs/Id" },
23
+ "title": { "type": "string" },
24
+ "path": { "description": "Absolute path on the PC, for display only.", "type": "string" },
25
+ "updatedAt": { "$ref": "common.schema.json#/$defs/Timestamp" }
26
+ }
27
+ },
28
+
29
+ "SessionStatus": {
30
+ "x-dmp-open-enum": true,
31
+ "enum": ["idle", "running", "needs-input", "error"]
32
+ },
33
+
34
+ "SessionSummary": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["sessionId", "title", "status", "pendingInteractions", "updatedAt", "archived", "pinned"],
38
+ "properties": {
39
+ "sessionId": { "$ref": "common.schema.json#/$defs/Id" },
40
+ "workspaceId": { "$ref": "common.schema.json#/$defs/Id" },
41
+ "parentSessionId": { "$ref": "common.schema.json#/$defs/Id" },
42
+ "title": { "type": ["string", "null"] },
43
+ "preview": { "description": "First user message or latest assistant text, at most 200 characters.", "type": "string", "maxLength": 200 },
44
+ "status": { "$ref": "#/$defs/SessionStatus" },
45
+ "pendingInteractions": { "description": "All answerable interactions, including continued questions that no longer block the agent.", "type": "integer", "minimum": 0 },
46
+ "updatedAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
47
+ "lastActivityAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
48
+ "archived": { "type": "boolean" },
49
+ "pinned": { "type": "boolean" },
50
+ "model": { "$ref": "common.schema.json#/$defs/ModelSelection" }
51
+ }
52
+ },
53
+
54
+ "SessionDetail": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["summary"],
58
+ "properties": {
59
+ "summary": { "$ref": "#/$defs/SessionSummary" },
60
+ "cwd": { "type": "string" },
61
+ "permission": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["current"],
65
+ "properties": { "current": { "type": "string" } }
66
+ }
67
+ }
68
+ },
69
+
70
+ "Attachment": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "required": ["name"],
74
+ "properties": {
75
+ "name": { "type": "string" },
76
+ "mime": { "type": "string" },
77
+ "size": { "type": "integer", "minimum": 0 }
78
+ }
79
+ },
80
+
81
+ "ItemState": { "enum": ["streaming", "complete", "failed", "cancelled"] },
82
+
83
+ "ToolKind": {
84
+ "x-dmp-open-enum": true,
85
+ "enum": ["shell", "edit", "read", "search", "web", "mcp", "subagent", "question", "present", "plan", "other"]
86
+ },
87
+
88
+ "ToolStatus": {
89
+ "x-dmp-open-enum": true,
90
+ "enum": ["pending", "awaiting-approval", "running", "succeeded", "failed", "denied", "cancelled"]
91
+ },
92
+
93
+ "DiffHunk": {
94
+ "type": "object",
95
+ "additionalProperties": false,
96
+ "required": ["oldStart", "oldLines", "newStart", "newLines", "lines"],
97
+ "properties": {
98
+ "oldStart": { "type": "integer", "minimum": 0 },
99
+ "oldLines": { "type": "integer", "minimum": 0 },
100
+ "newStart": { "type": "integer", "minimum": 0 },
101
+ "newLines": { "type": "integer", "minimum": 0 },
102
+ "lines": {
103
+ "description": "Unified-diff lines, each starting with ' ', '+' or '-'.",
104
+ "type": "array",
105
+ "items": { "type": "string", "pattern": "^[ +-]" }
106
+ }
107
+ }
108
+ },
109
+
110
+ "Diff": {
111
+ "oneOf": [
112
+ {
113
+ "type": "object",
114
+ "additionalProperties": false,
115
+ "required": ["kind", "path", "hunks", "coarse"],
116
+ "properties": {
117
+ "kind": { "const": "text" },
118
+ "path": { "type": "string" },
119
+ "hunks": { "type": "array", "items": { "$ref": "#/$defs/DiffHunk" } },
120
+ "coarse": { "description": "True when the comparison timed out and the diff is a whole-file replacement.", "type": "boolean" }
121
+ }
122
+ },
123
+ {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": ["kind", "path"],
127
+ "properties": { "kind": { "const": "binary" }, "path": { "type": "string" } }
128
+ },
129
+ {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "required": ["kind", "path"],
133
+ "properties": { "kind": { "const": "oversized" }, "path": { "type": "string" } }
134
+ }
135
+ ]
136
+ },
137
+
138
+ "ToolOutput": {
139
+ "type": "object",
140
+ "additionalProperties": false,
141
+ "required": ["text", "truncated", "isError"],
142
+ "properties": {
143
+ "text": { "type": "string", "maxLength": 65536 },
144
+ "truncated": { "type": "boolean" },
145
+ "totalBytes": { "type": "integer", "minimum": 0 },
146
+ "isError": { "type": "boolean" }
147
+ }
148
+ },
149
+
150
+ "Todo": {
151
+ "type": "object",
152
+ "additionalProperties": false,
153
+ "required": ["text", "status"],
154
+ "properties": {
155
+ "text": { "type": "string" },
156
+ "status": { "enum": ["pending", "in_progress", "completed"] }
157
+ }
158
+ },
159
+
160
+ "DeliverableRef": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "required": ["deliverableId", "name", "path"],
164
+ "properties": {
165
+ "deliverableId": { "$ref": "common.schema.json#/$defs/Id" },
166
+ "name": { "type": "string" },
167
+ "path": { "type": "string" },
168
+ "description": { "type": "string" }
169
+ }
170
+ },
171
+
172
+ "Deliverable": {
173
+ "type": "object",
174
+ "additionalProperties": false,
175
+ "required": ["deliverableId", "name", "path", "turn", "presentedAt"],
176
+ "properties": {
177
+ "deliverableId": { "$ref": "common.schema.json#/$defs/Id" },
178
+ "name": { "type": "string" },
179
+ "path": { "type": "string" },
180
+ "description": { "type": "string" },
181
+ "turn": { "type": "integer", "minimum": 0 },
182
+ "presentedAt": { "$ref": "common.schema.json#/$defs/Timestamp" }
183
+ }
184
+ },
185
+
186
+ "ItemOrder": {
187
+ "description": "Stable display position, fixed when the item is first created and never changed by later updates. Sort by seq, then index.",
188
+ "type": "object",
189
+ "additionalProperties": false,
190
+ "required": ["seq", "index"],
191
+ "properties": {
192
+ "seq": { "description": "Native sequence of the event that created the item.", "$ref": "common.schema.json#/$defs/Seq" },
193
+ "index": { "description": "Position among items created by that same native event, from 0.", "type": "integer", "minimum": 0 }
194
+ }
195
+ },
196
+
197
+ "TextTruncation": {
198
+ "description": "Present when the inline text was cut at 256 KiB. Fetch the full text with timeline.text.",
199
+ "type": "object",
200
+ "additionalProperties": false,
201
+ "required": ["totalBytes"],
202
+ "properties": { "totalBytes": { "type": "integer", "minimum": 0 } }
203
+ },
204
+
205
+ "ItemBase": {
206
+ "type": "object",
207
+ "required": ["itemId", "seq", "order", "time", "kind"],
208
+ "properties": {
209
+ "itemId": { "$ref": "common.schema.json#/$defs/Id" },
210
+ "seq": { "description": "Highest native sequence that has affected this item (changes on update). Used for resume, not for display order.", "$ref": "common.schema.json#/$defs/Seq" },
211
+ "order": { "$ref": "#/$defs/ItemOrder" },
212
+ "turn": { "type": "integer", "minimum": 0 },
213
+ "time": { "$ref": "common.schema.json#/$defs/Timestamp" },
214
+ "kind": { "type": "string" }
215
+ }
216
+ },
217
+
218
+ "TimelineItem": {
219
+ "description": "One renderable unit of a session timeline. Replace by itemId on upsert.",
220
+ "type": "object",
221
+ "required": ["kind"],
222
+ "properties": { "kind": { "type": "string" } },
223
+ "discriminator": { "propertyName": "kind" },
224
+ "oneOf": [
225
+ { "$ref": "#/$defs/UserMessageItem" },
226
+ { "$ref": "#/$defs/AssistantMessageItem" },
227
+ { "$ref": "#/$defs/ReasoningItem" },
228
+ { "$ref": "#/$defs/ToolCallItem" },
229
+ { "$ref": "#/$defs/InteractionItem" },
230
+ { "$ref": "#/$defs/PlanItem" },
231
+ { "$ref": "#/$defs/GoalItem" },
232
+ { "$ref": "#/$defs/ChangesItem" },
233
+ { "$ref": "#/$defs/DeliverablesItem" },
234
+ { "$ref": "#/$defs/TurnEndItem" },
235
+ { "$ref": "#/$defs/NoticeItem" }
236
+ ]
237
+ },
238
+
239
+ "UserMessageItem": {
240
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
241
+ "type": "object",
242
+ "unevaluatedProperties": false,
243
+ "required": ["text", "attachments"],
244
+ "properties": {
245
+ "kind": { "const": "user_message" },
246
+ "text": { "type": "string", "maxLength": 262144 },
247
+ "truncated": { "$ref": "#/$defs/TextTruncation" },
248
+ "attachments": { "type": "array", "items": { "$ref": "#/$defs/Attachment" } }
249
+ }
250
+ },
251
+
252
+ "AssistantMessageItem": {
253
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
254
+ "type": "object",
255
+ "unevaluatedProperties": false,
256
+ "required": ["text", "state"],
257
+ "properties": {
258
+ "kind": { "const": "assistant_message" },
259
+ "text": { "description": "Markdown.", "type": "string", "maxLength": 262144 },
260
+ "truncated": { "$ref": "#/$defs/TextTruncation" },
261
+ "state": { "$ref": "#/$defs/ItemState" },
262
+ "model": { "$ref": "common.schema.json#/$defs/ModelSelection" }
263
+ }
264
+ },
265
+
266
+ "ReasoningItem": {
267
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
268
+ "type": "object",
269
+ "unevaluatedProperties": false,
270
+ "required": ["text", "state"],
271
+ "properties": {
272
+ "kind": { "const": "reasoning" },
273
+ "text": { "type": "string", "maxLength": 262144 },
274
+ "truncated": { "$ref": "#/$defs/TextTruncation" },
275
+ "state": { "$ref": "#/$defs/ItemState" },
276
+ "durationMs": { "type": "integer", "minimum": 0 }
277
+ }
278
+ },
279
+
280
+ "ToolCallItem": {
281
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
282
+ "type": "object",
283
+ "unevaluatedProperties": false,
284
+ "required": ["callId", "tool", "title", "input", "status"],
285
+ "properties": {
286
+ "kind": { "const": "tool_call" },
287
+ "callId": { "$ref": "common.schema.json#/$defs/Id" },
288
+ "tool": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "required": ["name", "kind"],
292
+ "properties": {
293
+ "name": { "type": "string" },
294
+ "kind": { "$ref": "#/$defs/ToolKind" }
295
+ }
296
+ },
297
+ "title": { "description": "Short human summary, e.g. 'Run npm test' or 'Edit src/app.ts'.", "type": "string" },
298
+ "input": {
299
+ "type": "object",
300
+ "additionalProperties": false,
301
+ "properties": {
302
+ "command": { "type": "string" },
303
+ "path": { "type": "string" },
304
+ "query": { "type": "string" },
305
+ "url": { "type": "string" },
306
+ "raw": { "description": "Tool arguments as JSON text, cut off at 8 KiB.", "type": "string", "maxLength": 8192 }
307
+ }
308
+ },
309
+ "status": { "$ref": "#/$defs/ToolStatus" },
310
+ "output": { "$ref": "#/$defs/ToolOutput" },
311
+ "diff": { "$ref": "#/$defs/Diff" },
312
+ "jobId": { "$ref": "common.schema.json#/$defs/Id" },
313
+ "childSessionId": { "$ref": "common.schema.json#/$defs/Id" },
314
+ "durationMs": { "type": "integer", "minimum": 0 }
315
+ }
316
+ },
317
+
318
+ "InteractionItem": {
319
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
320
+ "type": "object",
321
+ "unevaluatedProperties": false,
322
+ "required": ["interactionKind", "state", "summary"],
323
+ "properties": {
324
+ "kind": { "const": "interaction" },
325
+ "interactionId": { "$ref": "common.schema.json#/$defs/Id" },
326
+ "interactionKind": { "enum": ["approval", "question"] },
327
+ "state": { "enum": ["pending", "answered", "cancelled", "expired"] },
328
+ "summary": { "type": "string" },
329
+ "outcome": { "description": "e.g. 'allow-once', 'deny', or the chosen option labels joined.", "type": "string" },
330
+ "toolCallId": { "$ref": "common.schema.json#/$defs/Id" }
331
+ }
332
+ },
333
+
334
+ "PlanItem": {
335
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
336
+ "type": "object",
337
+ "unevaluatedProperties": false,
338
+ "required": ["todos"],
339
+ "properties": {
340
+ "kind": { "const": "plan" },
341
+ "todos": { "type": "array", "items": { "$ref": "#/$defs/Todo" } }
342
+ }
343
+ },
344
+
345
+ "GoalItem": {
346
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
347
+ "type": "object",
348
+ "unevaluatedProperties": false,
349
+ "required": ["objective", "state"],
350
+ "properties": {
351
+ "kind": { "const": "goal" },
352
+ "objective": { "type": "string" },
353
+ "state": { "x-dmp-open-enum": true, "enum": ["active", "achieved", "abandoned"] }
354
+ }
355
+ },
356
+
357
+ "ChangesItem": {
358
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
359
+ "type": "object",
360
+ "unevaluatedProperties": false,
361
+ "required": ["changeId", "fileCount", "added", "deleted", "available"],
362
+ "properties": {
363
+ "kind": { "const": "changes" },
364
+ "changeId": { "$ref": "common.schema.json#/$defs/Id" },
365
+ "fileCount": { "type": "integer", "minimum": 0 },
366
+ "added": { "type": "integer", "minimum": 0 },
367
+ "deleted": { "type": "integer", "minimum": 0 },
368
+ "available": { "description": "False once DSH no longer holds the snapshot contents (e.g. after restart).", "type": "boolean" }
369
+ }
370
+ },
371
+
372
+ "DeliverablesItem": {
373
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
374
+ "type": "object",
375
+ "unevaluatedProperties": false,
376
+ "required": ["deliverables"],
377
+ "properties": {
378
+ "kind": { "const": "deliverables" },
379
+ "deliverables": { "type": "array", "items": { "$ref": "#/$defs/DeliverableRef" } }
380
+ }
381
+ },
382
+
383
+ "TurnEndItem": {
384
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
385
+ "type": "object",
386
+ "unevaluatedProperties": false,
387
+ "required": ["reason"],
388
+ "properties": {
389
+ "kind": { "const": "turn_end" },
390
+ "reason": { "enum": ["completed", "cancelled", "error"] },
391
+ "errorMessage": { "type": "string" }
392
+ }
393
+ },
394
+
395
+ "NoticeItem": {
396
+ "allOf": [{ "$ref": "#/$defs/ItemBase" }],
397
+ "type": "object",
398
+ "unevaluatedProperties": false,
399
+ "required": ["level", "text"],
400
+ "properties": {
401
+ "kind": { "const": "notice" },
402
+ "level": { "enum": ["info", "warning", "error"] },
403
+ "text": { "type": "string" },
404
+ "code": { "x-dmp-open-enum": true, "enum": ["model-changed", "permission-changed", "title-changed", "session-forked", "other"] }
405
+ }
406
+ },
407
+
408
+ "ApprovalRequest": {
409
+ "type": "object",
410
+ "additionalProperties": false,
411
+ "required": ["toolName", "toolKind", "title"],
412
+ "properties": {
413
+ "toolName": { "type": "string" },
414
+ "toolKind": { "$ref": "#/$defs/ToolKind" },
415
+ "title": { "type": "string" },
416
+ "command": { "type": "string" },
417
+ "path": { "type": "string" },
418
+ "reason": { "type": "string" },
419
+ "preview": {
420
+ "oneOf": [
421
+ { "type": "object", "additionalProperties": false, "required": ["kind", "diff"], "properties": { "kind": { "const": "diff" }, "diff": { "$ref": "#/$defs/Diff" } } },
422
+ { "type": "object", "additionalProperties": false, "required": ["kind", "text"], "properties": { "kind": { "const": "text" }, "text": { "type": "string", "maxLength": 65536 } } }
423
+ ]
424
+ }
425
+ }
426
+ },
427
+
428
+ "Question": {
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "required": ["questionId", "question", "options", "multiSelect"],
432
+ "properties": {
433
+ "questionId": { "$ref": "common.schema.json#/$defs/Id" },
434
+ "question": { "type": "string" },
435
+ "header": { "type": "string" },
436
+ "options": {
437
+ "type": "array",
438
+ "items": {
439
+ "type": "object",
440
+ "additionalProperties": false,
441
+ "required": ["label"],
442
+ "properties": { "label": { "type": "string" }, "description": { "type": "string" } }
443
+ }
444
+ },
445
+ "multiSelect": { "type": "boolean" }
446
+ }
447
+ },
448
+
449
+ "Interaction": {
450
+ "description": "An answerable human interaction. Only blocking interactions make the session needs-input; continued questions remain answerable without blocking.",
451
+ "type": "object",
452
+ "required": ["kind"],
453
+ "properties": { "kind": { "type": "string" } },
454
+ "discriminator": { "propertyName": "kind" },
455
+ "oneOf": [
456
+ {
457
+ "type": "object",
458
+ "additionalProperties": false,
459
+ "required": ["interactionId", "sessionId", "kind", "createdAt", "blocking", "approval"],
460
+ "properties": {
461
+ "interactionId": { "$ref": "common.schema.json#/$defs/Id" },
462
+ "sessionId": { "$ref": "common.schema.json#/$defs/Id" },
463
+ "kind": { "const": "approval" },
464
+ "blocking": { "const": true },
465
+ "createdAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
466
+ "toolCallId": { "$ref": "common.schema.json#/$defs/Id" },
467
+ "approval": { "$ref": "#/$defs/ApprovalRequest" }
468
+ }
469
+ },
470
+ {
471
+ "type": "object",
472
+ "additionalProperties": false,
473
+ "required": ["interactionId", "sessionId", "kind", "createdAt", "blocking", "questions"],
474
+ "properties": {
475
+ "interactionId": { "$ref": "common.schema.json#/$defs/Id" },
476
+ "sessionId": { "$ref": "common.schema.json#/$defs/Id" },
477
+ "kind": { "const": "question" },
478
+ "blocking": { "description": "True while the native question waits for a reply; false once a timed question has continued.", "type": "boolean" },
479
+ "createdAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
480
+ "toolCallId": { "$ref": "common.schema.json#/$defs/Id" },
481
+ "questions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/Question" } }
482
+ }
483
+ }
484
+ ]
485
+ },
486
+
487
+ "InteractionAnswer": {
488
+ "type": "object",
489
+ "required": ["kind"],
490
+ "properties": { "kind": { "type": "string" } },
491
+ "discriminator": { "propertyName": "kind" },
492
+ "oneOf": [
493
+ {
494
+ "type": "object",
495
+ "additionalProperties": false,
496
+ "required": ["kind", "decision"],
497
+ "properties": {
498
+ "kind": { "const": "approval" },
499
+ "decision": { "enum": ["allow-once", "deny"] }
500
+ }
501
+ },
502
+ {
503
+ "type": "object",
504
+ "additionalProperties": false,
505
+ "required": ["kind", "answers"],
506
+ "properties": {
507
+ "kind": { "const": "question" },
508
+ "answers": {
509
+ "type": "array",
510
+ "minItems": 1,
511
+ "items": {
512
+ "type": "object",
513
+ "additionalProperties": false,
514
+ "required": ["questionId", "selected"],
515
+ "properties": {
516
+ "questionId": { "$ref": "common.schema.json#/$defs/Id" },
517
+ "selected": { "type": "array", "items": { "type": "string" } },
518
+ "custom": { "type": "string" }
519
+ }
520
+ }
521
+ }
522
+ }
523
+ }
524
+ ]
525
+ },
526
+
527
+ "QueueItem": {
528
+ "type": "object",
529
+ "additionalProperties": false,
530
+ "required": ["queueItemId", "text", "mode"],
531
+ "properties": {
532
+ "queueItemId": { "$ref": "common.schema.json#/$defs/Id" },
533
+ "text": { "type": "string" },
534
+ "mode": { "enum": ["next-turn", "next-step"] },
535
+ "createdAt": { "$ref": "common.schema.json#/$defs/Timestamp" }
536
+ }
537
+ },
538
+
539
+ "Job": {
540
+ "type": "object",
541
+ "additionalProperties": false,
542
+ "required": ["jobId", "title", "status", "output"],
543
+ "properties": {
544
+ "jobId": { "$ref": "common.schema.json#/$defs/Id" },
545
+ "sessionId": { "$ref": "common.schema.json#/$defs/Id" },
546
+ "toolCallId": { "$ref": "common.schema.json#/$defs/Id" },
547
+ "title": { "type": "string" },
548
+ "status": { "x-dmp-open-enum": true, "enum": ["running", "completed", "failed", "killed"] },
549
+ "startedAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
550
+ "endedAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
551
+ "output": {
552
+ "type": "object",
553
+ "additionalProperties": false,
554
+ "required": ["earliest", "total"],
555
+ "properties": {
556
+ "earliest": { "description": "Oldest retained byte offset.", "type": "integer", "minimum": 0 },
557
+ "total": { "description": "Total bytes produced so far.", "type": "integer", "minimum": 0 }
558
+ }
559
+ }
560
+ }
561
+ },
562
+
563
+ "JobChunk": {
564
+ "type": "object",
565
+ "additionalProperties": false,
566
+ "required": ["at", "text", "channel"],
567
+ "properties": {
568
+ "at": { "description": "Byte offset of this chunk in the job output.", "type": "integer", "minimum": 0 },
569
+ "text": { "type": "string" },
570
+ "channel": { "enum": ["stdout", "stderr"] },
571
+ "gapBefore": { "type": "boolean" },
572
+ "lossy": { "type": "boolean" }
573
+ }
574
+ },
575
+
576
+ "Device": {
577
+ "type": "object",
578
+ "additionalProperties": false,
579
+ "required": ["deviceId", "name", "model", "pairedAt", "secureEnclave", "current"],
580
+ "properties": {
581
+ "deviceId": { "$ref": "common.schema.json#/$defs/Id" },
582
+ "name": { "type": "string" },
583
+ "model": { "type": "string" },
584
+ "pairedAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
585
+ "lastSeenAt": { "$ref": "common.schema.json#/$defs/Timestamp" },
586
+ "secureEnclave": { "type": "boolean" },
587
+ "current": { "description": "True for the device making this request.", "type": "boolean" }
588
+ }
589
+ },
590
+
591
+ "ModelCatalog": {
592
+ "type": "object",
593
+ "additionalProperties": false,
594
+ "required": ["providers"],
595
+ "properties": {
596
+ "providers": {
597
+ "type": "array",
598
+ "items": {
599
+ "type": "object",
600
+ "additionalProperties": false,
601
+ "required": ["provider", "label", "models"],
602
+ "properties": {
603
+ "provider": { "$ref": "common.schema.json#/$defs/Id" },
604
+ "label": { "type": "string" },
605
+ "error": { "description": "Present when this provider's model list failed to load.", "type": "string" },
606
+ "models": {
607
+ "type": "array",
608
+ "items": {
609
+ "type": "object",
610
+ "additionalProperties": false,
611
+ "required": ["model", "label", "efforts"],
612
+ "properties": {
613
+ "model": { "$ref": "common.schema.json#/$defs/Id" },
614
+ "label": { "type": "string" },
615
+ "efforts": { "type": "array", "items": { "type": "string" } }
616
+ }
617
+ }
618
+ }
619
+ }
620
+ }
621
+ },
622
+ "default": { "$ref": "common.schema.json#/$defs/ModelSelection" }
623
+ }
624
+ },
625
+
626
+ "PermissionCatalog": {
627
+ "type": "object",
628
+ "additionalProperties": false,
629
+ "required": ["options", "defaultPreset"],
630
+ "properties": {
631
+ "options": {
632
+ "type": "array",
633
+ "items": {
634
+ "type": "object",
635
+ "additionalProperties": false,
636
+ "required": ["preset", "label", "approval"],
637
+ "properties": {
638
+ "preset": { "type": "string" },
639
+ "label": { "type": "string" },
640
+ "description": { "type": "string" },
641
+ "approval": { "x-dmp-open-enum": true, "enum": ["ask", "never", "auto"] }
642
+ }
643
+ }
644
+ },
645
+ "defaultPreset": { "type": "string" }
646
+ }
647
+ },
648
+
649
+ "FileEntry": {
650
+ "type": "object",
651
+ "additionalProperties": false,
652
+ "required": ["name", "type"],
653
+ "properties": {
654
+ "name": { "type": "string" },
655
+ "type": { "enum": ["file", "dir", "symlink", "other"] },
656
+ "size": { "type": "integer", "minimum": 0 }
657
+ }
658
+ },
659
+
660
+ "ChangeFile": {
661
+ "type": "object",
662
+ "additionalProperties": false,
663
+ "required": ["index", "path", "display", "status", "added", "deleted"],
664
+ "properties": {
665
+ "index": { "type": "integer", "minimum": 0 },
666
+ "path": { "type": "string" },
667
+ "display": { "description": "Slash-separated display path.", "type": "string" },
668
+ "status": { "x-dmp-open-enum": true, "enum": ["added", "modified", "deleted", "renamed"] },
669
+ "added": { "type": "integer", "minimum": 0 },
670
+ "deleted": { "type": "integer", "minimum": 0 }
671
+ }
672
+ }
673
+ }
674
+ }