@roll-agent/relay-protocol 0.0.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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "type": "runtime.encrypted",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "envelopeId": "00000000-0000-4000-8000-000000000508",
5
+ "payloadKind": "request",
6
+ "requestId": "00000000-0000-4000-8000-000000000505",
7
+ "algorithm": "example-aead",
8
+ "nonce": "opaque-nonce",
9
+ "ciphertext": "opaque-ciphertext",
10
+ "plaintext": {
11
+ "secret": "must-not-be-visible"
12
+ }
13
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "runtime.ack",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "throughRelaySequence": 0,
5
+ "unexpected": true
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "runtime.gap",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "fromRelaySequence": 0,
5
+ "throughRelaySequence": 2,
6
+ "recovery": "event.replay"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "runtime.request",
3
+ "requestId": "not-a-uuid",
4
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
5
+ "method": "thread.list",
6
+ "params": {}
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "runtime.unknown",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507"
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "runtime.request",
3
+ "requestId": "00000000-0000-4000-8000-000000000505",
4
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
5
+ "method": "runtime.futureMethod",
6
+ "params": {}
7
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "device.connect",
3
+ "protocolVersion": "9.9",
4
+ "deviceId": "00000000-0000-4000-8000-000000000506",
5
+ "pairingToken": "pairing-token-with-sufficient-length"
6
+ }
@@ -0,0 +1,458 @@
1
+ {
2
+ "protocolVersion": "1.0",
3
+ "frames": [
4
+ {
5
+ "id": "device-connect",
6
+ "fixture": "valid-device-connect.json",
7
+ "valid": true
8
+ },
9
+ {
10
+ "id": "runtime-request",
11
+ "fixture": "valid-runtime-request.json",
12
+ "valid": true
13
+ },
14
+ {
15
+ "id": "runtime-response",
16
+ "fixture": "valid-runtime-response.json",
17
+ "valid": true
18
+ },
19
+ {
20
+ "id": "runtime-event",
21
+ "fixture": "valid-runtime-event.json",
22
+ "valid": true
23
+ },
24
+ {
25
+ "id": "runtime-ack",
26
+ "fixture": "valid-runtime-ack.json",
27
+ "valid": true
28
+ },
29
+ {
30
+ "id": "runtime-gap",
31
+ "fixture": "valid-runtime-gap.json",
32
+ "valid": true
33
+ },
34
+ {
35
+ "id": "runtime-encrypted",
36
+ "fixture": "valid-runtime-encrypted.json",
37
+ "valid": true
38
+ },
39
+ {
40
+ "id": "unknown-version",
41
+ "fixture": "invalid-unknown-version.json",
42
+ "valid": false
43
+ },
44
+ {
45
+ "id": "unknown-message",
46
+ "fixture": "invalid-unknown-message.json",
47
+ "valid": false
48
+ },
49
+ {
50
+ "id": "unknown-method",
51
+ "fixture": "invalid-unknown-method.json",
52
+ "valid": false
53
+ },
54
+ {
55
+ "id": "invalid-id",
56
+ "fixture": "invalid-request-id.json",
57
+ "valid": false
58
+ },
59
+ {
60
+ "id": "extra-field",
61
+ "fixture": "invalid-extra-field.json",
62
+ "valid": false
63
+ },
64
+ {
65
+ "id": "invalid-gap-recovery",
66
+ "fixture": "invalid-gap-recovery.json",
67
+ "valid": false
68
+ },
69
+ {
70
+ "id": "encrypted-metadata-leak",
71
+ "fixture": "invalid-encrypted-metadata-leak.json",
72
+ "valid": false
73
+ }
74
+ ],
75
+ "negotiation": [
76
+ {
77
+ "id": "same-version",
78
+ "peerVersions": ["1.0"],
79
+ "expected": "1.0"
80
+ },
81
+ {
82
+ "id": "unknown-before-supported",
83
+ "peerVersions": ["9.9", "1.0"],
84
+ "expected": "1.0"
85
+ },
86
+ {
87
+ "id": "unknown-only",
88
+ "peerVersions": ["9.9"],
89
+ "expected": null
90
+ }
91
+ ],
92
+ "methodRegistry": [
93
+ {
94
+ "id": "method-disposition-initialize",
95
+ "value": "initialize",
96
+ "expected": "local-only"
97
+ },
98
+ {
99
+ "id": "method-disposition-thread.list",
100
+ "value": "thread.list",
101
+ "expected": "query"
102
+ },
103
+ {
104
+ "id": "method-disposition-thread.create",
105
+ "value": "thread.create",
106
+ "expected": "mutation"
107
+ },
108
+ {
109
+ "id": "method-disposition-thread.open",
110
+ "value": "thread.open",
111
+ "expected": "query"
112
+ },
113
+ {
114
+ "id": "method-disposition-thread.snapshot",
115
+ "value": "thread.snapshot",
116
+ "expected": "query"
117
+ },
118
+ {
119
+ "id": "method-disposition-thread.rename",
120
+ "value": "thread.rename",
121
+ "expected": "mutation"
122
+ },
123
+ {
124
+ "id": "method-disposition-thread.delete",
125
+ "value": "thread.delete",
126
+ "expected": "mutation"
127
+ },
128
+ {
129
+ "id": "method-disposition-thread.detach",
130
+ "value": "thread.detach",
131
+ "expected": "mutation"
132
+ },
133
+ {
134
+ "id": "method-disposition-thread.capabilities",
135
+ "value": "thread.capabilities",
136
+ "expected": "query"
137
+ },
138
+ {
139
+ "id": "method-disposition-turn.start",
140
+ "value": "turn.start",
141
+ "expected": "mutation"
142
+ },
143
+ {
144
+ "id": "method-disposition-turn.cancel",
145
+ "value": "turn.cancel",
146
+ "expected": "mutation"
147
+ },
148
+ {
149
+ "id": "method-disposition-approval.respond",
150
+ "value": "approval.respond",
151
+ "expected": "mutation"
152
+ },
153
+ {
154
+ "id": "method-disposition-operation.get",
155
+ "value": "operation.get",
156
+ "expected": "query"
157
+ },
158
+ {
159
+ "id": "method-disposition-approval.candidate",
160
+ "value": "approval.candidate",
161
+ "expected": "mutation"
162
+ },
163
+ {
164
+ "id": "unknown-method-not-recognized",
165
+ "value": "runtime.futureMethod",
166
+ "expected": null
167
+ }
168
+ ],
169
+ "methods": [
170
+ {
171
+ "id": "approval-candidate-params",
172
+ "method": "approval.candidate",
173
+ "kind": "params",
174
+ "valid": true,
175
+ "value": {
176
+ "threadId": "00000000-0000-4000-8000-000000000502",
177
+ "turnId": "00000000-0000-4000-8000-000000000503",
178
+ "approvalId": "00000000-0000-4000-8000-000000000504",
179
+ "decision": "approve"
180
+ }
181
+ },
182
+ {
183
+ "id": "approval-candidate-empty-reason",
184
+ "method": "approval.candidate",
185
+ "kind": "params",
186
+ "valid": false,
187
+ "value": {
188
+ "threadId": "00000000-0000-4000-8000-000000000502",
189
+ "turnId": "00000000-0000-4000-8000-000000000503",
190
+ "approvalId": "00000000-0000-4000-8000-000000000504",
191
+ "decision": "reject",
192
+ "reason": ""
193
+ }
194
+ },
195
+ {
196
+ "id": "approval-candidate-result",
197
+ "method": "approval.candidate",
198
+ "kind": "result",
199
+ "valid": true,
200
+ "value": {
201
+ "accepted": true
202
+ }
203
+ }
204
+ ],
205
+ "replay": [
206
+ {
207
+ "id": "same-request-different-key-order",
208
+ "existing": {
209
+ "type": "runtime.request",
210
+ "requestId": "00000000-0000-4000-8000-000000000505",
211
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
212
+ "method": "thread.snapshot",
213
+ "params": {
214
+ "threadId": "00000000-0000-4000-8000-000000000502",
215
+ "limit": 100
216
+ }
217
+ },
218
+ "candidate": {
219
+ "type": "runtime.request",
220
+ "requestId": "00000000-0000-4000-8000-000000000505",
221
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
222
+ "method": "thread.snapshot",
223
+ "params": {
224
+ "limit": 100,
225
+ "threadId": "00000000-0000-4000-8000-000000000502"
226
+ }
227
+ },
228
+ "expected": {
229
+ "disposition": "replay"
230
+ }
231
+ },
232
+ {
233
+ "id": "same-id-different-payload",
234
+ "existing": {
235
+ "type": "runtime.request",
236
+ "requestId": "00000000-0000-4000-8000-000000000505",
237
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
238
+ "method": "thread.snapshot",
239
+ "params": {
240
+ "threadId": "00000000-0000-4000-8000-000000000502",
241
+ "limit": 100
242
+ }
243
+ },
244
+ "candidate": {
245
+ "type": "runtime.request",
246
+ "requestId": "00000000-0000-4000-8000-000000000505",
247
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
248
+ "method": "thread.snapshot",
249
+ "params": {
250
+ "threadId": "00000000-0000-4000-8000-000000000502",
251
+ "limit": 10
252
+ }
253
+ },
254
+ "expected": {
255
+ "disposition": "conflict",
256
+ "errorCode": "RELAY_REQUEST_ID_CONFLICT"
257
+ }
258
+ },
259
+ {
260
+ "id": "same-id-different-method",
261
+ "existing": {
262
+ "type": "runtime.request",
263
+ "requestId": "00000000-0000-4000-8000-000000000505",
264
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
265
+ "method": "thread.snapshot",
266
+ "params": {
267
+ "threadId": "00000000-0000-4000-8000-000000000502",
268
+ "limit": 100
269
+ }
270
+ },
271
+ "candidate": {
272
+ "type": "runtime.request",
273
+ "requestId": "00000000-0000-4000-8000-000000000505",
274
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
275
+ "method": "thread.open",
276
+ "params": {
277
+ "threadId": "00000000-0000-4000-8000-000000000502",
278
+ "limit": 100
279
+ }
280
+ },
281
+ "expected": {
282
+ "disposition": "conflict",
283
+ "errorCode": "RELAY_REQUEST_ID_CONFLICT"
284
+ }
285
+ },
286
+ {
287
+ "id": "different-request-id",
288
+ "existing": {
289
+ "type": "runtime.request",
290
+ "requestId": "00000000-0000-4000-8000-000000000505",
291
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
292
+ "method": "thread.snapshot",
293
+ "params": {
294
+ "threadId": "00000000-0000-4000-8000-000000000502",
295
+ "limit": 100
296
+ }
297
+ },
298
+ "candidate": {
299
+ "type": "runtime.request",
300
+ "requestId": "00000000-0000-4000-8000-000000000509",
301
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
302
+ "method": "thread.snapshot",
303
+ "params": {
304
+ "threadId": "00000000-0000-4000-8000-000000000502",
305
+ "limit": 100
306
+ }
307
+ },
308
+ "expected": {
309
+ "disposition": "new"
310
+ }
311
+ },
312
+ {
313
+ "id": "different-workspace-id",
314
+ "existing": {
315
+ "type": "runtime.request",
316
+ "requestId": "00000000-0000-4000-8000-000000000505",
317
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
318
+ "method": "thread.snapshot",
319
+ "params": {
320
+ "threadId": "00000000-0000-4000-8000-000000000502",
321
+ "limit": 100
322
+ }
323
+ },
324
+ "candidate": {
325
+ "type": "runtime.request",
326
+ "requestId": "00000000-0000-4000-8000-000000000505",
327
+ "workspaceId": "00000000-0000-4000-8000-000000000510",
328
+ "method": "thread.snapshot",
329
+ "params": {
330
+ "threadId": "00000000-0000-4000-8000-000000000502",
331
+ "limit": 100
332
+ }
333
+ },
334
+ "expected": {
335
+ "disposition": "new"
336
+ }
337
+ }
338
+ ],
339
+ "ack": [
340
+ {
341
+ "id": "initial-advance",
342
+ "acknowledgedThrough": -1,
343
+ "advertisedThrough": 0,
344
+ "incomingThrough": 0,
345
+ "expected": "advance"
346
+ },
347
+ {
348
+ "id": "advance-contiguous-prefix",
349
+ "acknowledgedThrough": 0,
350
+ "advertisedThrough": 2,
351
+ "incomingThrough": 2,
352
+ "expected": "advance"
353
+ },
354
+ {
355
+ "id": "equal-duplicate-ack",
356
+ "acknowledgedThrough": 2,
357
+ "advertisedThrough": 2,
358
+ "incomingThrough": 2,
359
+ "expected": "duplicate"
360
+ },
361
+ {
362
+ "id": "stale-duplicate-ack",
363
+ "acknowledgedThrough": 2,
364
+ "advertisedThrough": 2,
365
+ "incomingThrough": 1,
366
+ "expected": "duplicate"
367
+ },
368
+ {
369
+ "id": "ack-beyond-advertised",
370
+ "acknowledgedThrough": 0,
371
+ "advertisedThrough": 1,
372
+ "incomingThrough": 2,
373
+ "expected": "invalid"
374
+ },
375
+ {
376
+ "id": "fractional-ack",
377
+ "acknowledgedThrough": 0,
378
+ "advertisedThrough": 1,
379
+ "incomingThrough": 0.5,
380
+ "expected": "invalid"
381
+ },
382
+ {
383
+ "id": "ack-below-sentinel",
384
+ "acknowledgedThrough": -2,
385
+ "advertisedThrough": 0,
386
+ "incomingThrough": 0,
387
+ "expected": "invalid"
388
+ }
389
+ ],
390
+ "errors": [
391
+ {
392
+ "id": "error-retryability-RELAY_PROTOCOL_VERSION_UNSUPPORTED",
393
+ "code": "RELAY_PROTOCOL_VERSION_UNSUPPORTED",
394
+ "retryable": false
395
+ },
396
+ {
397
+ "id": "error-retryability-RELAY_INVALID_FRAME",
398
+ "code": "RELAY_INVALID_FRAME",
399
+ "retryable": false
400
+ },
401
+ {
402
+ "id": "error-retryability-INVALID_PARAMS",
403
+ "code": "INVALID_PARAMS",
404
+ "retryable": false
405
+ },
406
+ {
407
+ "id": "error-retryability-RELAY_REQUEST_ID_CONFLICT",
408
+ "code": "RELAY_REQUEST_ID_CONFLICT",
409
+ "retryable": false
410
+ },
411
+ {
412
+ "id": "error-retryability-WORKSPACE_NOT_FOUND",
413
+ "code": "WORKSPACE_NOT_FOUND",
414
+ "retryable": false
415
+ },
416
+ {
417
+ "id": "error-retryability-RELAY_ENCRYPTION_REQUIRED",
418
+ "code": "RELAY_ENCRYPTION_REQUIRED",
419
+ "retryable": false
420
+ },
421
+ {
422
+ "id": "error-retryability-ENCRYPTED_PAYLOAD_INVALID",
423
+ "code": "ENCRYPTED_PAYLOAD_INVALID",
424
+ "retryable": false
425
+ },
426
+ {
427
+ "id": "error-retryability-LocalApprovalDeniedError",
428
+ "code": "LocalApprovalDeniedError",
429
+ "retryable": false
430
+ },
431
+ {
432
+ "id": "error-retryability-LocalConfirmationRequiredError",
433
+ "code": "LocalConfirmationRequiredError",
434
+ "retryable": false
435
+ },
436
+ {
437
+ "id": "error-retryability-COMPANION_ERROR",
438
+ "code": "COMPANION_ERROR",
439
+ "retryable": false
440
+ }
441
+ ],
442
+ "encryptedVisibleMetadataFields": [
443
+ "type",
444
+ "workspaceId",
445
+ "envelopeId",
446
+ "payloadKind",
447
+ "requestId",
448
+ "relaySequence",
449
+ "algorithm",
450
+ "nonce",
451
+ "ciphertext"
452
+ ],
453
+ "deferredBreakingRules": [
454
+ "runtime.response-result-xor-error",
455
+ "encrypted-payload-kind-required-metadata",
456
+ "gap-from-not-after-through"
457
+ ]
458
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "device.connect",
3
+ "protocolVersion": "1.0",
4
+ "deviceId": "00000000-0000-4000-8000-000000000506",
5
+ "pairingToken": "pairing-token-with-sufficient-length"
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "runtime.ack",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "throughRelaySequence": 0
5
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "type": "runtime.encrypted",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "envelopeId": "00000000-0000-4000-8000-000000000508",
5
+ "payloadKind": "request",
6
+ "requestId": "00000000-0000-4000-8000-000000000505",
7
+ "algorithm": "example-aead",
8
+ "nonce": "opaque-nonce",
9
+ "ciphertext": "opaque-ciphertext"
10
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "type": "runtime.event",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "relaySequence": 0,
5
+ "event": {
6
+ "protocolVersion": "1.0",
7
+ "runtimeInstanceId": "00000000-0000-4000-8000-000000000501",
8
+ "sequence": 0,
9
+ "timestamp": "2026-07-30T00:00:00.000Z",
10
+ "threadId": "00000000-0000-4000-8000-000000000502",
11
+ "turnId": "00000000-0000-4000-8000-000000000503",
12
+ "event": {
13
+ "type": "turn.completed"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "runtime.gap",
3
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
4
+ "fromRelaySequence": 0,
5
+ "throughRelaySequence": 2,
6
+ "recovery": "thread.snapshot"
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "type": "runtime.request",
3
+ "requestId": "00000000-0000-4000-8000-000000000505",
4
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
5
+ "method": "thread.snapshot",
6
+ "params": {
7
+ "threadId": "00000000-0000-4000-8000-000000000502",
8
+ "limit": 100
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "runtime.response",
3
+ "requestId": "00000000-0000-4000-8000-000000000505",
4
+ "workspaceId": "00000000-0000-4000-8000-000000000507",
5
+ "result": {
6
+ "accepted": true
7
+ }
8
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@roll-agent/relay-protocol",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/steveoon/roll-agent"
8
+ },
9
+ "homepage": "https://github.com/steveoon/roll-agent",
10
+ "bugs": {
11
+ "url": "https://github.com/steveoon/roll-agent/issues"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./conformance": {
19
+ "types": "./dist/conformance.d.ts",
20
+ "default": "./dist/conformance.js"
21
+ },
22
+ "./schema": "./dist/schema/roll-relay-protocol-v1.schema.json",
23
+ "./fixtures/*": "./fixtures/*"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "fixtures"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22.6.0"
34
+ },
35
+ "dependencies": {
36
+ "zod": "3.25.76",
37
+ "@roll-agent/protocol": "0.1.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.0.0",
41
+ "ajv": "8.18.0",
42
+ "ajv-formats": "3.0.1",
43
+ "prettier": "3.8.1"
44
+ },
45
+ "scripts": {
46
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node --experimental-strip-types scripts/generate-schema.mjs",
47
+ "typecheck": "tsc --noEmit",
48
+ "test": "node --experimental-strip-types --test \"src/**/*.test.ts\"",
49
+ "clean": "rm -rf dist"
50
+ }
51
+ }