@drisp/protocol 0.6.0 → 0.8.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.
package/package.json CHANGED
@@ -1,53 +1,58 @@
1
1
  {
2
- "name": "@drisp/protocol",
3
- "version": "0.6.0",
4
- "description": "Wire contract between a drisp runner and the hub: zod schemas, inferred types, and JSON Schema for the instance-socket frames, Run, Turn, Interruption, and the event stream",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/drisplabs/cli.git",
8
- "directory": "packages/protocol"
9
- },
10
- "homepage": "https://github.com/drisplabs/cli/tree/main/packages/protocol#readme",
11
- "bugs": {
12
- "url": "https://github.com/drisplabs/cli/issues"
13
- },
14
- "keywords": [
15
- "drisp",
16
- "protocol",
17
- "zod",
18
- "json-schema"
19
- ],
20
- "license": "MIT",
21
- "type": "module",
22
- "engines": {
23
- "node": ">=20"
24
- },
25
- "publishConfig": {
26
- "access": "public"
27
- },
28
- "exports": {
29
- ".": {
30
- "source": "./src/index.ts",
31
- "types": "./dist/index.d.ts",
32
- "import": "./dist/index.js"
33
- },
34
- "./schema/*.json": "./schema/*.json",
35
- "./package.json": "./package.json"
36
- },
37
- "main": "./dist/index.js",
38
- "types": "./dist/index.d.ts",
39
- "files": [
40
- "dist",
41
- "!dist/**/*.js.map",
42
- "schema"
43
- ],
44
- "scripts": {
45
- "build": "tsup",
46
- "typecheck": "tsc --noEmit",
47
- "schema:generate": "vite-node scripts/generate-schema.ts",
48
- "prepublishOnly": "npm run build"
49
- },
50
- "dependencies": {
51
- "zod": "^4.3.6"
52
- }
2
+ "name": "@drisp/protocol",
3
+ "version": "0.8.0",
4
+ "description": "Wire contract between a drisp runner and the hub: zod schemas, inferred types, and JSON Schema for the instance-socket frames, Run, Turn, Interruption, and the event stream",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/drisplabs/cli.git",
8
+ "directory": "packages/protocol"
9
+ },
10
+ "homepage": "https://github.com/drisplabs/cli/tree/main/packages/protocol#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/drisplabs/cli/issues"
13
+ },
14
+ "keywords": [
15
+ "drisp",
16
+ "protocol",
17
+ "zod",
18
+ "json-schema"
19
+ ],
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=22"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "source": "./src/index.ts",
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ },
34
+ "./schema/*.json": "./schema/*.json",
35
+ "./package.json": "./package.json",
36
+ "./v2": {
37
+ "source": "./src/v2.ts",
38
+ "types": "./dist/v2.d.ts",
39
+ "import": "./dist/v2.js"
40
+ }
41
+ },
42
+ "main": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
44
+ "files": [
45
+ "dist",
46
+ "!dist/**/*.js.map",
47
+ "schema"
48
+ ],
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "typecheck": "tsc --noEmit",
52
+ "schema:generate": "vite-node scripts/generate-schema.ts",
53
+ "prepublishOnly": "npm run build"
54
+ },
55
+ "dependencies": {
56
+ "zod": "^4.3.6"
57
+ }
53
58
  }
@@ -0,0 +1,591 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "version": {
6
+ "type": "number",
7
+ "const": 1
8
+ },
9
+ "checkpointId": {
10
+ "type": "string",
11
+ "minLength": 1
12
+ },
13
+ "orgId": {
14
+ "type": "string",
15
+ "minLength": 1
16
+ },
17
+ "phase": {
18
+ "type": "string",
19
+ "enum": [
20
+ "parked",
21
+ "terminal"
22
+ ]
23
+ },
24
+ "runId": {
25
+ "type": "string",
26
+ "minLength": 1
27
+ },
28
+ "sessionId": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "sourceAttemptId": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "executionRevision": {
37
+ "type": "integer",
38
+ "exclusiveMinimum": 0,
39
+ "maximum": 9007199254740991
40
+ },
41
+ "historyProduced": {
42
+ "type": "integer",
43
+ "minimum": 0,
44
+ "maximum": 9007199254740991
45
+ },
46
+ "historyAck": {
47
+ "type": "integer",
48
+ "minimum": 0,
49
+ "maximum": 9007199254740991
50
+ },
51
+ "grant": {
52
+ "type": "object",
53
+ "properties": {
54
+ "commandId": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "maxLength": 160
58
+ },
59
+ "hubEpoch": {
60
+ "type": "string",
61
+ "minLength": 1,
62
+ "maxLength": 160
63
+ },
64
+ "runId": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "maxLength": 160
68
+ },
69
+ "sessionId": {
70
+ "type": "string",
71
+ "minLength": 1,
72
+ "maxLength": 160
73
+ },
74
+ "runnerId": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "maxLength": 160
78
+ },
79
+ "installationId": {
80
+ "type": "string",
81
+ "minLength": 1,
82
+ "maxLength": 160
83
+ },
84
+ "attemptId": {
85
+ "type": "string",
86
+ "minLength": 1,
87
+ "maxLength": 160
88
+ },
89
+ "generation": {
90
+ "type": "integer",
91
+ "minimum": 0,
92
+ "maximum": 9007199254740991
93
+ },
94
+ "baseExecutionRevision": {
95
+ "type": "integer",
96
+ "minimum": 0,
97
+ "maximum": 9007199254740991
98
+ },
99
+ "baseHistorySeq": {
100
+ "type": "integer",
101
+ "minimum": 0,
102
+ "maximum": 9007199254740991
103
+ },
104
+ "cloudHistoryThrough": {
105
+ "type": "integer",
106
+ "minimum": 0,
107
+ "maximum": 9007199254740991
108
+ },
109
+ "purpose": {
110
+ "type": "string",
111
+ "enum": [
112
+ "start",
113
+ "resume"
114
+ ]
115
+ },
116
+ "spec": {
117
+ "type": "object",
118
+ "properties": {
119
+ "prompt": {
120
+ "type": "string",
121
+ "minLength": 1,
122
+ "maxLength": 131072
123
+ },
124
+ "projectDir": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "maxLength": 4096
128
+ },
129
+ "harness": {
130
+ "type": "string",
131
+ "enum": [
132
+ "claude-code",
133
+ "codex"
134
+ ]
135
+ },
136
+ "workflow": {
137
+ "anyOf": [
138
+ {
139
+ "type": "string",
140
+ "maxLength": 512
141
+ },
142
+ {
143
+ "type": "object",
144
+ "properties": {
145
+ "name": {
146
+ "type": "string",
147
+ "minLength": 1,
148
+ "maxLength": 128,
149
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
150
+ },
151
+ "source": {
152
+ "type": "string",
153
+ "maxLength": 201,
154
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*\\/[A-Za-z0-9][A-Za-z0-9_.-]*$"
155
+ },
156
+ "ref": {
157
+ "type": "string",
158
+ "minLength": 1,
159
+ "maxLength": 512
160
+ },
161
+ "version": {
162
+ "type": "string",
163
+ "minLength": 1,
164
+ "maxLength": 128,
165
+ "pattern": "^\\d[A-Za-z0-9_.+-]*$"
166
+ }
167
+ },
168
+ "required": [
169
+ "name"
170
+ ],
171
+ "additionalProperties": false
172
+ }
173
+ ]
174
+ },
175
+ "repository": {
176
+ "type": "object",
177
+ "properties": {
178
+ "bindingId": {
179
+ "type": "string",
180
+ "minLength": 1,
181
+ "maxLength": 160
182
+ },
183
+ "repositoryId": {
184
+ "type": "integer",
185
+ "exclusiveMinimum": 0,
186
+ "maximum": 9007199254740991
187
+ },
188
+ "installationId": {
189
+ "type": "integer",
190
+ "exclusiveMinimum": 0,
191
+ "maximum": 9007199254740991
192
+ },
193
+ "owner": {
194
+ "type": "string",
195
+ "minLength": 1,
196
+ "maxLength": 100,
197
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]*$"
198
+ },
199
+ "name": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "maxLength": 100,
203
+ "pattern": "^(?!\\.{1,2}$)[a-zA-Z0-9_.-]+$"
204
+ },
205
+ "ref": {
206
+ "type": "string",
207
+ "minLength": 1,
208
+ "maxLength": 512,
209
+ "pattern": "^(?![-/])(?!.*\\.\\.)(?!.*@\\{)(?!.*(?:^|\\/)\\.)(?!.*\\.lock(?:\\/|$))(?!.*\\/\\/)[^\\x00-\\x20\\x7f~^:?*\\[\\\\]+(?<![/.])$"
210
+ },
211
+ "commitSha": {
212
+ "type": "string",
213
+ "pattern": "^[0-9a-f]{40}$"
214
+ },
215
+ "branch": {
216
+ "type": "string",
217
+ "minLength": 1,
218
+ "maxLength": 512,
219
+ "pattern": "^(?![-/])(?!.*\\.\\.)(?!.*@\\{)(?!.*(?:^|\\/)\\.)(?!.*\\.lock(?:\\/|$))(?!.*\\/\\/)[^\\x00-\\x20\\x7f~^:?*\\[\\\\]+(?<![/.])$"
220
+ },
221
+ "workingDirectory": {
222
+ "type": "string",
223
+ "minLength": 1,
224
+ "maxLength": 1024,
225
+ "pattern": "^(?:\\.|(?!\\/)(?!.*(?:^|\\/)\\.\\.?(?:\\/|$))(?!.*(?:^|\\/)\\.git(?:\\/|$))[^\\x00-\\x1f\\x7f\\\\:]+(?<!\\/))$"
226
+ },
227
+ "setupCommands": {
228
+ "maxItems": 16,
229
+ "type": "array",
230
+ "items": {
231
+ "type": "string",
232
+ "minLength": 1,
233
+ "maxLength": 8192
234
+ }
235
+ },
236
+ "configRevision": {
237
+ "type": "integer",
238
+ "minimum": 0,
239
+ "maximum": 9007199254740991
240
+ }
241
+ },
242
+ "required": [
243
+ "bindingId",
244
+ "repositoryId",
245
+ "installationId",
246
+ "owner",
247
+ "name",
248
+ "ref",
249
+ "commitSha",
250
+ "branch",
251
+ "workingDirectory",
252
+ "setupCommands",
253
+ "configRevision"
254
+ ],
255
+ "additionalProperties": false
256
+ }
257
+ },
258
+ "required": [
259
+ "prompt",
260
+ "projectDir",
261
+ "harness"
262
+ ],
263
+ "additionalProperties": false
264
+ },
265
+ "continuation": {
266
+ "$ref": "#/$defs/__schema0"
267
+ },
268
+ "previousRun": {
269
+ "type": "object",
270
+ "properties": {
271
+ "runId": {
272
+ "type": "string",
273
+ "minLength": 1,
274
+ "maxLength": 160
275
+ },
276
+ "executionRevision": {
277
+ "type": "integer",
278
+ "minimum": 0,
279
+ "maximum": 9007199254740991
280
+ },
281
+ "historyProduced": {
282
+ "type": "integer",
283
+ "minimum": 0,
284
+ "maximum": 9007199254740991
285
+ },
286
+ "closeReason": {
287
+ "type": "string",
288
+ "const": "abandoned"
289
+ },
290
+ "checkpoint": {
291
+ "type": "object",
292
+ "properties": {
293
+ "checkpointId": {
294
+ "type": "string",
295
+ "minLength": 1,
296
+ "maxLength": 160
297
+ },
298
+ "checksum": {
299
+ "type": "string",
300
+ "pattern": "^[a-f0-9]{64}$"
301
+ }
302
+ },
303
+ "required": [
304
+ "checkpointId",
305
+ "checksum"
306
+ ],
307
+ "additionalProperties": false
308
+ }
309
+ },
310
+ "required": [
311
+ "runId",
312
+ "executionRevision",
313
+ "historyProduced"
314
+ ],
315
+ "additionalProperties": false
316
+ },
317
+ "checkpoint": {
318
+ "type": "object",
319
+ "properties": {
320
+ "checkpointId": {
321
+ "type": "string",
322
+ "minLength": 1,
323
+ "maxLength": 160
324
+ },
325
+ "checksum": {
326
+ "type": "string",
327
+ "pattern": "^[a-f0-9]{64}$"
328
+ }
329
+ },
330
+ "required": [
331
+ "checkpointId",
332
+ "checksum"
333
+ ],
334
+ "additionalProperties": false
335
+ },
336
+ "delegationToken": {
337
+ "type": "string",
338
+ "minLength": 32,
339
+ "maxLength": 256
340
+ },
341
+ "parent": {
342
+ "type": "object",
343
+ "properties": {
344
+ "runId": {
345
+ "type": "string",
346
+ "minLength": 1,
347
+ "maxLength": 160
348
+ },
349
+ "tokenCap": {
350
+ "type": "integer",
351
+ "exclusiveMinimum": 0,
352
+ "maximum": 9007199254740991
353
+ }
354
+ },
355
+ "required": [
356
+ "runId",
357
+ "tokenCap"
358
+ ],
359
+ "additionalProperties": false
360
+ }
361
+ },
362
+ "required": [
363
+ "commandId",
364
+ "hubEpoch",
365
+ "runId",
366
+ "sessionId",
367
+ "runnerId",
368
+ "installationId",
369
+ "attemptId",
370
+ "generation",
371
+ "baseExecutionRevision",
372
+ "baseHistorySeq",
373
+ "cloudHistoryThrough",
374
+ "purpose",
375
+ "spec"
376
+ ],
377
+ "additionalProperties": false
378
+ },
379
+ "gitHead": {
380
+ "type": "string",
381
+ "pattern": "^[0-9a-f]{40,64}$"
382
+ },
383
+ "gitBase": {
384
+ "type": "string",
385
+ "pattern": "^[0-9a-f]{40,64}$"
386
+ },
387
+ "gitBundle": {
388
+ "type": "string"
389
+ },
390
+ "indexPatch": {
391
+ "type": "string"
392
+ },
393
+ "files": {
394
+ "maxItems": 100000,
395
+ "type": "array",
396
+ "items": {
397
+ "type": "object",
398
+ "properties": {
399
+ "path": {
400
+ "type": "string",
401
+ "minLength": 1,
402
+ "maxLength": 4096
403
+ },
404
+ "content": {
405
+ "type": "string"
406
+ },
407
+ "executable": {
408
+ "type": "boolean"
409
+ }
410
+ },
411
+ "required": [
412
+ "path",
413
+ "content",
414
+ "executable"
415
+ ],
416
+ "additionalProperties": false
417
+ }
418
+ },
419
+ "deleted": {
420
+ "maxItems": 100000,
421
+ "type": "array",
422
+ "items": {
423
+ "type": "string",
424
+ "minLength": 1,
425
+ "maxLength": 4096
426
+ }
427
+ },
428
+ "sessionRows": {
429
+ "type": "array",
430
+ "items": {
431
+ "type": "object",
432
+ "properties": {
433
+ "kind": {
434
+ "type": "string"
435
+ },
436
+ "id": {
437
+ "type": "string"
438
+ },
439
+ "payload": {
440
+ "type": "string"
441
+ }
442
+ },
443
+ "required": [
444
+ "kind",
445
+ "id",
446
+ "payload"
447
+ ],
448
+ "additionalProperties": false
449
+ }
450
+ },
451
+ "history": {
452
+ "type": "array",
453
+ "items": {
454
+ "type": "object",
455
+ "properties": {
456
+ "seq": {
457
+ "type": "integer",
458
+ "exclusiveMinimum": 0,
459
+ "maximum": 9007199254740991
460
+ },
461
+ "record": {
462
+ "type": "object",
463
+ "properties": {
464
+ "eventId": {
465
+ "type": "string",
466
+ "minLength": 1,
467
+ "maxLength": 160
468
+ },
469
+ "attemptId": {
470
+ "type": "string",
471
+ "minLength": 1,
472
+ "maxLength": 160
473
+ },
474
+ "emittedAt": {
475
+ "type": "string",
476
+ "format": "date-time",
477
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
478
+ },
479
+ "kind": {
480
+ "type": "string",
481
+ "minLength": 1,
482
+ "maxLength": 128
483
+ },
484
+ "data": {
485
+ "$ref": "#/$defs/__schema1"
486
+ }
487
+ },
488
+ "required": [
489
+ "eventId",
490
+ "attemptId",
491
+ "emittedAt",
492
+ "kind",
493
+ "data"
494
+ ],
495
+ "additionalProperties": false
496
+ }
497
+ },
498
+ "required": [
499
+ "seq",
500
+ "record"
501
+ ],
502
+ "additionalProperties": false
503
+ }
504
+ }
505
+ },
506
+ "required": [
507
+ "version",
508
+ "checkpointId",
509
+ "orgId",
510
+ "phase",
511
+ "runId",
512
+ "sessionId",
513
+ "sourceAttemptId",
514
+ "executionRevision",
515
+ "historyProduced",
516
+ "historyAck",
517
+ "grant",
518
+ "gitHead",
519
+ "gitBundle",
520
+ "indexPatch",
521
+ "files",
522
+ "deleted",
523
+ "sessionRows",
524
+ "history"
525
+ ],
526
+ "additionalProperties": false,
527
+ "$defs": {
528
+ "__schema0": {
529
+ "anyOf": [
530
+ {
531
+ "type": "string"
532
+ },
533
+ {
534
+ "type": "number"
535
+ },
536
+ {
537
+ "type": "boolean"
538
+ },
539
+ {
540
+ "type": "null"
541
+ },
542
+ {
543
+ "type": "array",
544
+ "items": {
545
+ "$ref": "#/$defs/__schema0"
546
+ }
547
+ },
548
+ {
549
+ "type": "object",
550
+ "propertyNames": {
551
+ "type": "string"
552
+ },
553
+ "additionalProperties": {
554
+ "$ref": "#/$defs/__schema0"
555
+ }
556
+ }
557
+ ]
558
+ },
559
+ "__schema1": {
560
+ "anyOf": [
561
+ {
562
+ "type": "string"
563
+ },
564
+ {
565
+ "type": "number"
566
+ },
567
+ {
568
+ "type": "boolean"
569
+ },
570
+ {
571
+ "type": "null"
572
+ },
573
+ {
574
+ "type": "array",
575
+ "items": {
576
+ "$ref": "#/$defs/__schema1"
577
+ }
578
+ },
579
+ {
580
+ "type": "object",
581
+ "propertyNames": {
582
+ "type": "string"
583
+ },
584
+ "additionalProperties": {
585
+ "$ref": "#/$defs/__schema1"
586
+ }
587
+ }
588
+ ]
589
+ }
590
+ }
591
+ }