@roll-agent/protocol 0.3.0 → 0.4.1

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 (35) hide show
  1. package/README.md +93 -14
  2. package/dist/index.d.ts +9482 -663
  3. package/dist/index.js +1257 -138
  4. package/dist/schema/roll-runtime-protocol-v1.0.schema.json +2657 -0
  5. package/dist/schema/roll-runtime-protocol-v1.1.schema.json +2824 -0
  6. package/dist/schema/roll-runtime-protocol-v1.2.schema.json +4112 -0
  7. package/dist/schema/roll-runtime-protocol-v1.3.schema.json +5695 -0
  8. package/dist/schema/roll-runtime-protocol-v1.schema.json +4061 -1223
  9. package/fixtures/v1.2/invalid-duplicate-client-capability-method.json +9 -0
  10. package/fixtures/v1.2/invalid-legacy-approval-request.json +15 -0
  11. package/fixtures/v1.2/invalid-legacy-server-request-cancel-notification.json +9 -0
  12. package/fixtures/v1.2/invalid-sensitive-approval-request.json +19 -0
  13. package/fixtures/v1.2/invalid-sensitive-user-input-request.json +20 -0
  14. package/fixtures/v1.2/invalid-thread-snapshot-interaction-payload.json +37 -0
  15. package/fixtures/v1.2/invalid-user-input-request-response.json +13 -0
  16. package/fixtures/v1.2/valid-approval-request.json +22 -0
  17. package/fixtures/v1.2/valid-client-capabilities-set-request.json +9 -0
  18. package/fixtures/v1.2/valid-client-capabilities-set-response.json +8 -0
  19. package/fixtures/v1.2/valid-server-request-cancel-notification.json +8 -0
  20. package/fixtures/v1.2/valid-thread-snapshot-response.json +42 -0
  21. package/fixtures/v1.2/valid-user-input-request-response.json +11 -0
  22. package/fixtures/v1.2/valid-user-input-request.json +35 -0
  23. package/fixtures/v1.3/invalid-durable-delta-event-notification.json +19 -0
  24. package/fixtures/v1.3/invalid-ephemeral-completed-event-notification.json +15 -0
  25. package/fixtures/v1.3/invalid-runtime-events-resume-cursor-request.json +9 -0
  26. package/fixtures/v1.3/invalid-thread-recovery-snapshot-response.json +31 -0
  27. package/fixtures/v1.3/invalid-thread-recovery-snapshot-timestamp-response.json +21 -0
  28. package/fixtures/v1.3/valid-runtime-durable-event-notification.json +20 -0
  29. package/fixtures/v1.3/valid-runtime-ephemeral-event-notification.json +18 -0
  30. package/fixtures/v1.3/valid-runtime-events-resume-request.json +9 -0
  31. package/fixtures/v1.3/valid-runtime-events-resume-response.json +8 -0
  32. package/fixtures/v1.3/valid-thread-recovery-snapshot-request.json +10 -0
  33. package/fixtures/v1.3/valid-thread-recovery-snapshot-response.json +21 -0
  34. package/fixtures/v1.3/valid-thread-snapshot-response.json +20 -0
  35. package/package.json +6 -1
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "capability-rpc-2",
4
+ "method": "client.capabilities.set",
5
+ "params": {
6
+ "revision": 2,
7
+ "serverRequestMethods": ["approval.request", "approval.request"]
8
+ }
9
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "approval-rpc-legacy",
4
+ "method": "approval.request",
5
+ "params": {
6
+ "threadId": "00000000-0000-4000-8000-000000000002",
7
+ "approval": {
8
+ "id": "00000000-0000-4000-8000-000000000005",
9
+ "turnId": "00000000-0000-4000-8000-000000000003",
10
+ "agentName": "browser-use-agent",
11
+ "toolName": "click",
12
+ "preview": {}
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.serverRequest.cancel",
4
+ "params": {
5
+ "serverRequestId": "approval-rpc-1",
6
+ "approvalId": "00000000-0000-4000-8000-000000000005",
7
+ "reason": "turn-cancelled"
8
+ }
9
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "approval-rpc-sensitive",
4
+ "method": "approval.request",
5
+ "params": {
6
+ "interactionId": "00000000-0000-4000-8000-000000000006",
7
+ "threadId": "00000000-0000-4000-8000-000000000002",
8
+ "turnId": "00000000-0000-4000-8000-000000000003",
9
+ "expiresAt": "2026-07-29T12:10:00.000Z",
10
+ "sensitivity": "secret",
11
+ "approval": {
12
+ "id": "00000000-0000-4000-8000-000000000005",
13
+ "turnId": "00000000-0000-4000-8000-000000000003",
14
+ "agentName": "browser-use-agent",
15
+ "toolName": "click",
16
+ "preview": {}
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "user-input-rpc-secret",
4
+ "method": "userInput.request",
5
+ "params": {
6
+ "interactionId": "00000000-0000-4000-8000-000000000006",
7
+ "threadId": "00000000-0000-4000-8000-000000000002",
8
+ "turnId": "00000000-0000-4000-8000-000000000003",
9
+ "expiresAt": "2026-07-29T12:10:00.000Z",
10
+ "sensitivity": "secret",
11
+ "controls": [
12
+ {
13
+ "type": "text",
14
+ "id": "credential",
15
+ "label": "Credential",
16
+ "required": true
17
+ }
18
+ ]
19
+ }
20
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 2,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Unsafe interaction",
8
+ "createdAt": "2026-07-28T12:00:00.000Z",
9
+ "updatedAt": "2026-07-28T12:01:00.000Z",
10
+ "messageCount": 0
11
+ },
12
+ "messages": {
13
+ "items": [],
14
+ "nextBeforeSequence": null
15
+ },
16
+ "operations": {
17
+ "items": [],
18
+ "nextBeforeSequence": null
19
+ },
20
+ "pendingApprovals": [],
21
+ "pendingInteractions": [
22
+ {
23
+ "method": "approval.request",
24
+ "interactionId": "00000000-0000-4000-8000-000000000006",
25
+ "threadId": "00000000-0000-4000-8000-000000000002",
26
+ "turnId": "00000000-0000-4000-8000-000000000003",
27
+ "expiresAt": "2026-07-29T12:10:00.000Z",
28
+ "sensitivity": "normal",
29
+ "approvalId": "00000000-0000-4000-8000-000000000005",
30
+ "preview": {
31
+ "selector": "#submit"
32
+ }
33
+ }
34
+ ],
35
+ "transcriptCompleteness": "complete"
36
+ }
37
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "user-input-rpc-1",
4
+ "result": {
5
+ "status": "submitted",
6
+ "values": [
7
+ {
8
+ "id": "deployment-region",
9
+ "value": { "secret": "not-a-supported-value" }
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "approval-rpc-2",
4
+ "method": "approval.request",
5
+ "params": {
6
+ "interactionId": "00000000-0000-4000-8000-000000000006",
7
+ "threadId": "00000000-0000-4000-8000-000000000002",
8
+ "turnId": "00000000-0000-4000-8000-000000000003",
9
+ "expiresAt": "2026-07-29T12:10:00.000Z",
10
+ "sensitivity": "normal",
11
+ "approval": {
12
+ "id": "00000000-0000-4000-8000-000000000005",
13
+ "turnId": "00000000-0000-4000-8000-000000000003",
14
+ "agentName": "browser-use-agent",
15
+ "toolName": "click",
16
+ "preview": {
17
+ "selector": "#submit"
18
+ },
19
+ "reason": "此操作会提交表单"
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "capability-rpc-1",
4
+ "method": "client.capabilities.set",
5
+ "params": {
6
+ "revision": 1,
7
+ "serverRequestMethods": ["future.request", "approval.request"]
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "capability-rpc-1",
4
+ "result": {
5
+ "revision": 1,
6
+ "acceptedServerRequestMethods": ["approval.request"]
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.serverRequest.cancel",
4
+ "params": {
5
+ "interactionId": "00000000-0000-4000-8000-000000000006",
6
+ "reason": "turn-cancelled"
7
+ }
8
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 2,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Golden thread",
8
+ "model": "fixture-model",
9
+ "createdAt": "2026-07-28T12:00:00.000Z",
10
+ "updatedAt": "2026-07-28T12:01:00.000Z",
11
+ "messageCount": 1
12
+ },
13
+ "messages": {
14
+ "items": [
15
+ {
16
+ "sequence": 0,
17
+ "role": "user",
18
+ "createdAt": "2026-07-28T12:00:00.000Z",
19
+ "parts": [{ "type": "text", "text": "hello" }]
20
+ }
21
+ ],
22
+ "nextBeforeSequence": null
23
+ },
24
+ "operations": {
25
+ "items": [],
26
+ "nextBeforeSequence": null
27
+ },
28
+ "pendingApprovals": [],
29
+ "pendingInteractions": [
30
+ {
31
+ "method": "approval.request",
32
+ "interactionId": "00000000-0000-4000-8000-000000000006",
33
+ "threadId": "00000000-0000-4000-8000-000000000002",
34
+ "turnId": "00000000-0000-4000-8000-000000000003",
35
+ "expiresAt": "2026-07-29T12:10:00.000Z",
36
+ "sensitivity": "normal",
37
+ "approvalId": "00000000-0000-4000-8000-000000000005"
38
+ }
39
+ ],
40
+ "transcriptCompleteness": "complete"
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "user-input-rpc-1",
4
+ "result": {
5
+ "status": "submitted",
6
+ "values": [
7
+ { "id": "deployment-region", "value": "华东" },
8
+ { "id": "target-workspace", "value": "workspace-a" }
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": "user-input-rpc-1",
4
+ "method": "userInput.request",
5
+ "params": {
6
+ "interactionId": "00000000-0000-4000-8000-000000000006",
7
+ "threadId": "00000000-0000-4000-8000-000000000002",
8
+ "turnId": "00000000-0000-4000-8000-000000000003",
9
+ "expiresAt": "2026-07-29T12:10:00.000Z",
10
+ "sensitivity": "normal",
11
+ "title": "部署配置",
12
+ "description": "请确认普通部署配置。",
13
+ "controls": [
14
+ {
15
+ "type": "text",
16
+ "id": "deployment-region",
17
+ "label": "部署区域",
18
+ "required": true,
19
+ "minLength": 2,
20
+ "maxLength": 20
21
+ },
22
+ {
23
+ "type": "choice",
24
+ "id": "target-workspace",
25
+ "label": "目标 Workspace",
26
+ "required": true,
27
+ "multiple": false,
28
+ "options": [
29
+ { "id": "workspace-a", "label": "Workspace A" },
30
+ { "id": "workspace-b", "label": "Workspace B" }
31
+ ]
32
+ }
33
+ ]
34
+ }
35
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.event",
4
+ "params": {
5
+ "protocolVersion": "1.3",
6
+ "runtimeInstanceId": "00000000-0000-4000-8000-000000000001",
7
+ "sequence": 10,
8
+ "timestamp": "2026-07-30T12:00:02.000Z",
9
+ "threadId": "00000000-0000-4000-8000-000000000002",
10
+ "durability": "durable",
11
+ "eventId": "00000000-0000-4000-8000-000000000007",
12
+ "cursor": "rte1:00000000-0000-4000-8000-000000000008:0:00000000-0000-4000-8000-000000000007",
13
+ "event": {
14
+ "type": "message.delta",
15
+ "streamId": "00000000-0000-4000-8000-000000000004",
16
+ "delta": "unsafe to replay"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.event",
4
+ "params": {
5
+ "protocolVersion": "1.3",
6
+ "runtimeInstanceId": "00000000-0000-4000-8000-000000000001",
7
+ "sequence": 11,
8
+ "timestamp": "2026-07-30T12:00:03.000Z",
9
+ "threadId": "00000000-0000-4000-8000-000000000002",
10
+ "durability": "ephemeral",
11
+ "event": {
12
+ "type": "turn.completed"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 13,
4
+ "method": "runtime.events.resume",
5
+ "params": {
6
+ "threadId": "00000000-0000-4000-8000-000000000002",
7
+ "afterCursor": "00000000-0000-4000-8000-000000000007"
8
+ }
9
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 16,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Invalid recovery",
8
+ "model": "fixture-model",
9
+ "createdAt": "2026-07-30T12:00:00.000Z",
10
+ "updatedAt": "2026-07-30T12:00:00.000Z",
11
+ "messageCount": 1
12
+ },
13
+ "messages": {
14
+ "items": [
15
+ {
16
+ "sequence": 0,
17
+ "role": "assistant",
18
+ "createdAt": "2026-07-30T12:00:00.000Z",
19
+ "parts": [{ "type": "text", "text": "must not appear" }]
20
+ }
21
+ ],
22
+ "nextBeforeSequence": null
23
+ },
24
+ "operations": { "items": [], "nextBeforeSequence": null },
25
+ "pendingApprovals": [],
26
+ "pendingInteractions": [],
27
+ "transcriptCompleteness": "complete",
28
+ "eventCursor": null,
29
+ "recoveryProjection": true
30
+ }
31
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 17,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Invalid recovery timestamp",
8
+ "model": "fixture-model",
9
+ "createdAt": "2026-07-30T12:00:00.1111111111111111111111111111111111111111111111111111111111111111Z",
10
+ "updatedAt": "2026-07-30T12:00:00.000Z",
11
+ "messageCount": 0
12
+ },
13
+ "messages": { "items": [], "nextBeforeSequence": null },
14
+ "operations": { "items": [], "nextBeforeSequence": null },
15
+ "pendingApprovals": [],
16
+ "pendingInteractions": [],
17
+ "transcriptCompleteness": "complete",
18
+ "eventCursor": null,
19
+ "recoveryProjection": true
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.event",
4
+ "params": {
5
+ "protocolVersion": "1.3",
6
+ "runtimeInstanceId": "00000000-0000-4000-8000-000000000001",
7
+ "sequence": 8,
8
+ "timestamp": "2026-07-30T12:00:00.000Z",
9
+ "threadId": "00000000-0000-4000-8000-000000000002",
10
+ "turnId": "00000000-0000-4000-8000-000000000003",
11
+ "durability": "durable",
12
+ "eventId": "00000000-0000-4000-8000-000000000007",
13
+ "cursor": "rte1:00000000-0000-4000-8000-000000000008:0:00000000-0000-4000-8000-000000000007",
14
+ "event": {
15
+ "type": "message.completed",
16
+ "streamId": "00000000-0000-4000-8000-000000000004",
17
+ "text": "hello"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "method": "runtime.event",
4
+ "params": {
5
+ "protocolVersion": "1.3",
6
+ "runtimeInstanceId": "00000000-0000-4000-8000-000000000001",
7
+ "sequence": 9,
8
+ "timestamp": "2026-07-30T12:00:01.000Z",
9
+ "threadId": "00000000-0000-4000-8000-000000000002",
10
+ "turnId": "00000000-0000-4000-8000-000000000003",
11
+ "durability": "ephemeral",
12
+ "event": {
13
+ "type": "message.delta",
14
+ "streamId": "00000000-0000-4000-8000-000000000004",
15
+ "delta": "hello"
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 12,
4
+ "method": "runtime.events.resume",
5
+ "params": {
6
+ "threadId": "00000000-0000-4000-8000-000000000002",
7
+ "afterCursor": null
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 12,
4
+ "result": {
5
+ "throughCursor": null,
6
+ "replayedCount": 0
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 15,
4
+ "method": "thread.snapshot",
5
+ "params": {
6
+ "threadId": "00000000-0000-4000-8000-000000000002",
7
+ "limit": 1,
8
+ "recovery": true
9
+ }
10
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 15,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Bounded recovery",
8
+ "model": "fixture-model",
9
+ "createdAt": "2026-07-30T12:00:00.000Z",
10
+ "updatedAt": "2026-07-30T12:00:00.000Z",
11
+ "messageCount": 42
12
+ },
13
+ "messages": { "items": [], "nextBeforeSequence": null },
14
+ "operations": { "items": [], "nextBeforeSequence": null },
15
+ "pendingApprovals": [],
16
+ "pendingInteractions": [],
17
+ "transcriptCompleteness": "complete",
18
+ "eventCursor": null,
19
+ "recoveryProjection": true
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 14,
4
+ "result": {
5
+ "thread": {
6
+ "id": "00000000-0000-4000-8000-000000000002",
7
+ "title": "Empty durable log",
8
+ "model": "fixture-model",
9
+ "createdAt": "2026-07-30T12:00:00.000Z",
10
+ "updatedAt": "2026-07-30T12:00:00.000Z",
11
+ "messageCount": 0
12
+ },
13
+ "messages": { "items": [], "nextBeforeSequence": null },
14
+ "operations": { "items": [], "nextBeforeSequence": null },
15
+ "pendingApprovals": [],
16
+ "pendingInteractions": [],
17
+ "transcriptCompleteness": "complete",
18
+ "eventCursor": null
19
+ }
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/protocol",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,6 +16,11 @@
16
16
  "default": "./dist/index.js"
17
17
  },
18
18
  "./schema": "./dist/schema/roll-runtime-protocol-v1.schema.json",
19
+ "./schema/latest": "./dist/schema/roll-runtime-protocol-v1.schema.json",
20
+ "./schema/1.3": "./dist/schema/roll-runtime-protocol-v1.3.schema.json",
21
+ "./schema/1.2": "./dist/schema/roll-runtime-protocol-v1.2.schema.json",
22
+ "./schema/1.1": "./dist/schema/roll-runtime-protocol-v1.1.schema.json",
23
+ "./schema/1.0": "./dist/schema/roll-runtime-protocol-v1.0.schema.json",
19
24
  "./fixtures/*": "./fixtures/*"
20
25
  },
21
26
  "publishConfig": {