@roll-agent/relay-protocol 0.3.3 → 0.4.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 (32) hide show
  1. package/dist/control.d.ts +73 -0
  2. package/dist/control.js +18 -0
  3. package/dist/index.d.ts +1971 -3
  4. package/dist/index.js +184 -4
  5. package/dist/schema/roll-relay-protocol-v1.2.schema.json +4436 -0
  6. package/fixtures/v1.2/invalid-approval-projection-raw-input-leak.json +19 -0
  7. package/fixtures/v1.2/invalid-authentication-local-only.json +12 -0
  8. package/fixtures/v1.2/invalid-file-picker-local-only.json +12 -0
  9. package/fixtures/v1.2/invalid-interaction-cancelled-reason-leak.json +10 -0
  10. package/fixtures/v1.2/invalid-interaction-resolved-result-leak.json +18 -0
  11. package/fixtures/v1.2/invalid-legacy-approval-candidate.json +7 -0
  12. package/fixtures/v1.2/invalid-legacy-approval-respond.json +7 -0
  13. package/fixtures/v1.2/invalid-n-minus-one-device-connect.json +6 -0
  14. package/fixtures/v1.2/invalid-non-normal-sensitivity.json +21 -0
  15. package/fixtures/v1.2/invalid-runtime-event-tool-input-leak.json +22 -0
  16. package/fixtures/v1.2/invalid-runtime-event-tool-output-leak.json +21 -0
  17. package/fixtures/v1.2/invalid-user-input-projection-secret-leak.json +22 -0
  18. package/fixtures/v1.2/manifest.json +479 -0
  19. package/fixtures/v1.2/valid-device-connect.json +6 -0
  20. package/fixtures/v1.2/valid-interaction-cancelled.json +9 -0
  21. package/fixtures/v1.2/valid-interaction-candidate-user-input.json +25 -0
  22. package/fixtures/v1.2/valid-interaction-request-approval.json +17 -0
  23. package/fixtures/v1.2/valid-interaction-request-user-input.json +40 -0
  24. package/fixtures/v1.2/valid-interaction-resolved.json +9 -0
  25. package/fixtures/v1.2/valid-runtime-ack.json +5 -0
  26. package/fixtures/v1.2/valid-runtime-encrypted-interaction.json +10 -0
  27. package/fixtures/v1.2/valid-runtime-event-runtime-n-minus-one.json +16 -0
  28. package/fixtures/v1.2/valid-runtime-event.json +16 -0
  29. package/fixtures/v1.2/valid-runtime-gap.json +7 -0
  30. package/fixtures/v1.2/valid-runtime-request.json +10 -0
  31. package/fixtures/v1.2/valid-runtime-response.json +8 -0
  32. package/package.json +5 -4
package/dist/control.d.ts CHANGED
@@ -63,6 +63,38 @@ export declare const relaySessionReadyControlMessageSchema: z.ZodReadonly<z.ZodO
63
63
  offline: "offline";
64
64
  }>;
65
65
  }, z.core.$strict>>;
66
+ export declare const relaySessionReadyControlMessageSchemaV12: z.ZodReadonly<z.ZodObject<{
67
+ type: z.ZodLiteral<"session.ready">;
68
+ controlVersion: z.ZodLiteral<"1.0">;
69
+ sessionId: z.core.$ZodBranded<z.ZodString, "RelayBrowserSessionId">;
70
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
71
+ workspaceStatus: z.ZodEnum<{
72
+ online: "online";
73
+ offline: "offline";
74
+ }>;
75
+ relayProtocolVersion: z.ZodLiteral<"1.2">;
76
+ }, z.core.$strict>>;
77
+ export declare const relaySessionReadyControlMessageSchemaAny: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
78
+ type: z.ZodLiteral<"session.ready">;
79
+ controlVersion: z.ZodLiteral<"1.0">;
80
+ relayProtocolVersion: z.ZodLiteral<"1.1">;
81
+ sessionId: z.core.$ZodBranded<z.ZodString, "RelayBrowserSessionId">;
82
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
83
+ workspaceStatus: z.ZodEnum<{
84
+ online: "online";
85
+ offline: "offline";
86
+ }>;
87
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
88
+ type: z.ZodLiteral<"session.ready">;
89
+ controlVersion: z.ZodLiteral<"1.0">;
90
+ sessionId: z.core.$ZodBranded<z.ZodString, "RelayBrowserSessionId">;
91
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
92
+ workspaceStatus: z.ZodEnum<{
93
+ online: "online";
94
+ offline: "offline";
95
+ }>;
96
+ relayProtocolVersion: z.ZodLiteral<"1.2">;
97
+ }, z.core.$strict>>]>;
66
98
  export declare const relayWorkspaceStatusControlMessageSchema: z.ZodReadonly<z.ZodObject<{
67
99
  type: z.ZodLiteral<"workspace.status">;
68
100
  workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
@@ -83,6 +115,45 @@ export declare const relaySessionErrorControlMessageSchema: z.ZodReadonly<z.ZodO
83
115
  }>;
84
116
  retryable: z.ZodBoolean;
85
117
  }, z.core.$strict>>;
118
+ export declare const relayBrowserControlMessageSchemaAny: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
119
+ type: z.ZodLiteral<"session.ready">;
120
+ controlVersion: z.ZodLiteral<"1.0">;
121
+ relayProtocolVersion: z.ZodLiteral<"1.1">;
122
+ sessionId: z.core.$ZodBranded<z.ZodString, "RelayBrowserSessionId">;
123
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
124
+ workspaceStatus: z.ZodEnum<{
125
+ online: "online";
126
+ offline: "offline";
127
+ }>;
128
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
129
+ type: z.ZodLiteral<"session.ready">;
130
+ controlVersion: z.ZodLiteral<"1.0">;
131
+ sessionId: z.core.$ZodBranded<z.ZodString, "RelayBrowserSessionId">;
132
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
133
+ workspaceStatus: z.ZodEnum<{
134
+ online: "online";
135
+ offline: "offline";
136
+ }>;
137
+ relayProtocolVersion: z.ZodLiteral<"1.2">;
138
+ }, z.core.$strict>>]>, z.ZodReadonly<z.ZodObject<{
139
+ type: z.ZodLiteral<"workspace.status">;
140
+ workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId">;
141
+ status: z.ZodEnum<{
142
+ online: "online";
143
+ offline: "offline";
144
+ }>;
145
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
146
+ type: z.ZodLiteral<"session.error">;
147
+ code: z.ZodEnum<{
148
+ RELAY_PROTOCOL_VERSION_UNSUPPORTED: "RELAY_PROTOCOL_VERSION_UNSUPPORTED";
149
+ WORKSPACE_NOT_FOUND: "WORKSPACE_NOT_FOUND";
150
+ WORKSPACE_OFFLINE: "WORKSPACE_OFFLINE";
151
+ CONTROLLER_CONFLICT: "CONTROLLER_CONFLICT";
152
+ RATE_LIMITED: "RATE_LIMITED";
153
+ RELAY_INTERNAL_ERROR: "RELAY_INTERNAL_ERROR";
154
+ }>;
155
+ retryable: z.ZodBoolean;
156
+ }, z.core.$strict>>]>;
86
157
  export declare const relayBrowserControlMessageSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
87
158
  type: z.ZodLiteral<"session.ready">;
88
159
  controlVersion: z.ZodLiteral<"1.0">;
@@ -186,3 +257,5 @@ export type RelayWorkspaceStatusControlMessage = z.infer<typeof relayWorkspaceSt
186
257
  export type RelaySessionErrorControlMessage = z.infer<typeof relaySessionErrorControlMessageSchema>;
187
258
  export type RelayBrowserControlMessage = z.infer<typeof relayBrowserControlMessageSchema>;
188
259
  export type RelayBrowserFirstControlFrame = z.infer<typeof relayBrowserFirstControlFrameSchema>;
260
+ export type RelayBrowserControlMessageAny = z.infer<typeof relayBrowserControlMessageSchemaAny>;
261
+ export declare function parseRelayBrowserFirstControlFrameAny(value: unknown): z.output<typeof relaySessionReadyControlMessageSchemaAny>;
package/dist/control.js CHANGED
@@ -72,6 +72,16 @@ export const relaySessionReadyControlMessageSchema = z
72
72
  })
73
73
  .strict()
74
74
  .readonly();
75
+ export const relaySessionReadyControlMessageSchemaV12 = relaySessionReadyControlMessageSchema.def.innerType
76
+ .extend({
77
+ relayProtocolVersion: z.literal("1.2"),
78
+ })
79
+ .strict()
80
+ .readonly();
81
+ export const relaySessionReadyControlMessageSchemaAny = z.union([
82
+ relaySessionReadyControlMessageSchema,
83
+ relaySessionReadyControlMessageSchemaV12,
84
+ ]);
75
85
  export const relayWorkspaceStatusControlMessageSchema = z
76
86
  .object({
77
87
  type: z.literal(RELAY_BROWSER_CONTROL_MESSAGE_TYPES.workspaceStatus),
@@ -88,6 +98,11 @@ export const relaySessionErrorControlMessageSchema = z
88
98
  })
89
99
  .strict()
90
100
  .readonly();
101
+ export const relayBrowserControlMessageSchemaAny = z.union([
102
+ relaySessionReadyControlMessageSchemaAny,
103
+ relayWorkspaceStatusControlMessageSchema,
104
+ relaySessionErrorControlMessageSchema,
105
+ ]);
91
106
  export const relayBrowserControlMessageSchema = z.discriminatedUnion("type", [
92
107
  relaySessionReadyControlMessageSchema,
93
108
  relayWorkspaceStatusControlMessageSchema,
@@ -178,3 +193,6 @@ export function isRelayBrowserWssMessageTypeAllowed(direction, messageType) {
178
193
  export function isRelayCompanionWssMessageTypeAllowed(direction, messageType) {
179
194
  return includesMessageType(RELAY_COMPANION_WSS_MESSAGE_TYPES_BY_DIRECTION, direction, messageType);
180
195
  }
196
+ export function parseRelayBrowserFirstControlFrameAny(value) {
197
+ return relaySessionReadyControlMessageSchemaAny.parse(value);
198
+ }