@rstreamlabs/tunnels 3.10.2 → 4.0.3

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.
@@ -1,23 +1,8 @@
1
1
  // src/client.ts
2
2
  import * as z from "zod";
3
- var clientSchema = z.object({
4
- id: z.string(),
5
- status: z.enum(["online", "offline"]),
6
- user_id: z.string().optional(),
7
- workspace_id: z.string().optional(),
8
- project_id: z.string().optional(),
9
- cluster_id: z.string().optional(),
10
- plan: z.string().optional(),
11
- provider: z.string().optional(),
12
- region: z.string().optional(),
13
- agent: z.string().optional(),
14
- channel: z.string().optional(),
15
- version: z.string().optional(),
16
- os: z.string().optional(),
17
- arch: z.string().optional(),
18
- protocol_version: z.string().optional(),
19
- labels: z.record(z.string(), z.string()).optional()
20
- });
3
+ import { clientSchema } from "@rstreamlabs/rstream/client";
4
+ import { clientSchema as clientSchema2 } from "@rstreamlabs/rstream/client";
5
+ var listedClientSchema = clientSchema.partial();
21
6
  var clientFilterSchema = clientSchema.pick({
22
7
  id: true,
23
8
  status: true,
@@ -34,22 +19,53 @@ var listClientsParamsSchema = z.object({
34
19
  limit: z.number().int().min(1).optional(),
35
20
  filters: clientFilterSchema.optional()
36
21
  });
37
- var listClientsResponseSchema = z.array(clientSchema);
22
+ var listClientsResponseSchema = z.array(listedClientSchema);
38
23
 
39
- // src/webtty-schemas.ts
24
+ // src/tunnel.ts
25
+ import { tunnelSchema } from "@rstreamlabs/rstream/tunnel";
40
26
  import * as z2 from "zod";
41
- var webTTYTransportSchema = z2.enum([
27
+ var DEFAULT_PUBLISHED_PORT = 443;
28
+ var tunnelFilterSchema = tunnelSchema.pick({
29
+ id: true,
30
+ name: true,
31
+ type: true,
32
+ status: true,
33
+ client_id: true,
34
+ user_id: true,
35
+ publish: true,
36
+ protocol: true,
37
+ hostname: true,
38
+ http_version: true,
39
+ labels: true
40
+ }).partial();
41
+ var listTunnelsParamsSchema = z2.object({
42
+ limit: z2.number().int().min(1).optional(),
43
+ filters: tunnelFilterSchema.optional()
44
+ });
45
+ var listedTunnelSchema = tunnelSchema.partial();
46
+ var listTunnelsResponseSchema = z2.array(listedTunnelSchema);
47
+ function formatTunnelHost(tunnel) {
48
+ if (!tunnel.hostname) return tunnel.host;
49
+ if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
50
+ return tunnel.hostname;
51
+ }
52
+ return `${tunnel.hostname}:${tunnel.port}`;
53
+ }
54
+
55
+ // src/webtty-schemas.ts
56
+ import * as z3 from "zod";
57
+ var webTTYTransportSchema = z3.enum([
42
58
  "plain",
43
59
  "websocket",
44
60
  "webtransport"
45
61
  ]);
46
- var webTTYRecordingModeSchema = z2.enum(["recorded", "private"]);
47
- var webTTYEncryptionModeSchema = z2.enum(["managed", "e2e"]);
48
- var webTTYSessionModeSchema = z2.enum([
62
+ var webTTYRecordingModeSchema = z3.enum(["recorded", "private"]);
63
+ var webTTYEncryptionModeSchema = z3.enum(["managed", "e2e"]);
64
+ var webTTYSessionModeSchema = z3.enum([
49
65
  "interactive",
50
66
  "non-interactive"
51
67
  ]);
52
- var webTTYOriginSchema = z2.enum([
68
+ var webTTYOriginSchema = z3.enum([
53
69
  "human",
54
70
  "codex",
55
71
  "api",
@@ -57,259 +73,260 @@ var webTTYOriginSchema = z2.enum([
57
73
  "ci",
58
74
  "scheduled-job"
59
75
  ]);
60
- var webTTYParticipantRoleSchema = z2.enum(["controller", "spectator"]);
61
- var webTTYInitiatorKindSchema = z2.enum([
76
+ var webTTYParticipantRoleSchema = z3.enum(["controller", "spectator"]);
77
+ var webTTYInitiatorKindSchema = z3.enum([
62
78
  "user",
63
79
  "app",
64
80
  "agent",
65
81
  "service-account"
66
82
  ]);
67
- var webTTYContextMetadataSchema = z2.object({
83
+ var webTTYContextMetadataSchema = z3.object({
68
84
  origin: webTTYOriginSchema.optional(),
69
- origin_id: z2.string().optional(),
70
- purpose: z2.string().optional(),
85
+ origin_id: z3.string().optional(),
86
+ purpose: z3.string().optional(),
71
87
  initiator_kind: webTTYInitiatorKindSchema.optional(),
72
- agent_name: z2.string().optional(),
73
- agent_version: z2.string().optional(),
74
- request_id: z2.string().optional(),
75
- labels: z2.record(z2.string(), z2.string()).optional()
88
+ agent_name: z3.string().optional(),
89
+ agent_version: z3.string().optional(),
90
+ request_id: z3.string().optional(),
91
+ labels: z3.record(z3.string(), z3.string()).optional(),
92
+ execution_deadline: z3.string().datetime({ offset: true }).optional()
76
93
  }).passthrough();
77
94
 
78
95
  // src/stream.ts
79
- import * as z3 from "zod";
80
- var nonEmptyStringSchema = z3.string().min(1);
81
- var isoDateTimeSchema = z3.string().datetime({ offset: true });
82
- var ipAddressSchema = z3.string();
83
- var intNonNegSchema = z3.number().int().nonnegative();
84
- var numNonNegSchema = z3.number().nonnegative();
85
- var geolocationSchema = z3.object({
86
- country: z3.string().optional(),
87
- region: z3.string().optional()
96
+ import * as z4 from "zod";
97
+ var nonEmptyStringSchema = z4.string().min(1);
98
+ var isoDateTimeSchema = z4.string().datetime({ offset: true });
99
+ var ipAddressSchema = z4.string();
100
+ var intNonNegSchema = z4.number().int().nonnegative();
101
+ var numNonNegSchema = z4.number().nonnegative();
102
+ var geolocationSchema = z4.object({
103
+ country: z4.string().optional(),
104
+ region: z4.string().optional()
88
105
  });
89
- var streamTLSInfoSchema = z3.object({
90
- version: z3.string().min(1).optional(),
91
- cipher: z3.string().min(1).optional(),
92
- protocol: z3.string().min(1).optional(),
93
- curve: z3.string().min(1).optional(),
94
- ech: z3.boolean().optional()
106
+ var streamTLSInfoSchema = z4.object({
107
+ version: z4.string().min(1).optional(),
108
+ cipher: z4.string().min(1).optional(),
109
+ protocol: z4.string().min(1).optional(),
110
+ curve: z4.string().min(1).optional(),
111
+ ech: z4.boolean().optional()
95
112
  });
96
- var streamEndpointSchema = z3.object({
113
+ var streamEndpointSchema = z4.object({
97
114
  ip: ipAddressSchema.optional(),
98
115
  geolocation: geolocationSchema.optional(),
99
116
  tls: streamTLSInfoSchema.optional()
100
117
  });
101
- var httpHeadersSchema = z3.record(
102
- z3.string(),
103
- z3.union([z3.string(), z3.array(z3.string())])
118
+ var httpHeadersSchema = z4.record(
119
+ z4.string(),
120
+ z4.union([z4.string(), z4.array(z4.string())])
104
121
  );
105
- var httpProtocolSchema = z3.enum(["http/1.1", "h2", "h2c", "h3"]);
106
- var httpRequestSchema = z3.object({
122
+ var httpProtocolSchema = z4.enum(["http/1.1", "h2", "h2c", "h3"]);
123
+ var httpRequestSchema = z4.object({
107
124
  method: nonEmptyStringSchema,
108
- scheme: z3.string().min(1).optional(),
125
+ scheme: z4.string().min(1).optional(),
109
126
  host: nonEmptyStringSchema.optional(),
110
127
  path: nonEmptyStringSchema.optional(),
111
- query: z3.string().optional(),
128
+ query: z4.string().optional(),
112
129
  url: nonEmptyStringSchema.optional(),
113
130
  headers: httpHeadersSchema.optional(),
114
- userAgent: z3.string().optional()
131
+ userAgent: z4.string().optional()
115
132
  });
116
- var httpResponseSchema = z3.object({
117
- status: z3.number().int().min(100).max(999),
133
+ var httpResponseSchema = z4.object({
134
+ status: z4.number().int().min(100).max(999),
118
135
  headers: httpHeadersSchema.optional()
119
136
  });
120
- var httpRequestStageSchema = z3.object({
137
+ var httpRequestStageSchema = z4.object({
121
138
  protocol: httpProtocolSchema.optional(),
122
139
  request: httpRequestSchema
123
140
  });
124
- var httpResponseStageSchema = z3.object({
141
+ var httpResponseStageSchema = z4.object({
125
142
  protocol: httpProtocolSchema.optional(),
126
143
  response: httpResponseSchema
127
144
  });
128
- var streamEntrySchema = z3.object({
129
- kind: z3.enum([
145
+ var streamEntrySchema = z4.object({
146
+ kind: z4.enum([
130
147
  "published_tunnel",
131
148
  "private_rstream",
132
149
  "proxy_egress",
133
150
  "internal"
134
151
  ]),
135
- transport: z3.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
152
+ transport: z4.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
136
153
  });
137
- var tokenSourceSchema = z3.enum([
154
+ var tokenSourceSchema = z4.enum([
138
155
  "authorization",
139
156
  "query",
140
157
  "client",
141
158
  "unknown"
142
159
  ]);
143
- var tokenTypeSchema = z3.enum(["auth", "pat", "app", "unknown"]);
144
- var firewallRuleSchema = z3.discriminatedUnion("kind", [
145
- z3.object({ kind: z3.literal("none") }),
146
- z3.object({ kind: z3.literal("mtls") }),
147
- z3.object({
148
- kind: z3.literal("rstream_auth"),
149
- source: z3.literal("rstream_auth")
160
+ var tokenTypeSchema = z4.enum(["auth", "pat", "app", "unknown"]);
161
+ var firewallRuleSchema = z4.discriminatedUnion("kind", [
162
+ z4.object({ kind: z4.literal("none") }),
163
+ z4.object({ kind: z4.literal("mtls") }),
164
+ z4.object({
165
+ kind: z4.literal("rstream_auth"),
166
+ source: z4.literal("rstream_auth")
150
167
  }),
151
- z3.object({
152
- kind: z3.literal("rstream"),
153
- source: z3.literal("private_rstream").optional()
168
+ z4.object({
169
+ kind: z4.literal("rstream"),
170
+ source: z4.literal("private_rstream").optional()
154
171
  }),
155
- z3.object({
156
- kind: z3.literal("token"),
172
+ z4.object({
173
+ kind: z4.literal("token"),
157
174
  source: tokenSourceSchema.optional(),
158
175
  tokenType: tokenTypeSchema.optional()
159
176
  })
160
177
  ]);
161
- var unauthorizedSourceSchema = z3.object({
178
+ var unauthorizedSourceSchema = z4.object({
162
179
  source: tokenSourceSchema
163
180
  });
164
- var unauthorizedReasonSchema = (shape) => z3.object(shape).merge(unauthorizedSourceSchema);
165
- var unauthorizedSchema = z3.discriminatedUnion("reason", [
181
+ var unauthorizedReasonSchema = (shape) => z4.object(shape).merge(unauthorizedSourceSchema);
182
+ var unauthorizedSchema = z4.discriminatedUnion("reason", [
166
183
  unauthorizedReasonSchema({
167
- reason: z3.literal("missing_token")
184
+ reason: z4.literal("missing_token")
168
185
  }),
169
186
  unauthorizedReasonSchema({
170
- reason: z3.literal("invalid_token")
187
+ reason: z4.literal("invalid_token")
171
188
  }),
172
189
  unauthorizedReasonSchema({
173
- reason: z3.literal("expired_token")
190
+ reason: z4.literal("expired_token")
174
191
  }),
175
192
  unauthorizedReasonSchema({
176
- reason: z3.literal("invalid_secret")
193
+ reason: z4.literal("invalid_secret")
177
194
  }),
178
195
  unauthorizedReasonSchema({
179
- reason: z3.literal("user_mismatch")
196
+ reason: z4.literal("user_mismatch")
180
197
  }),
181
198
  unauthorizedReasonSchema({
182
- reason: z3.literal("insufficient_scope")
199
+ reason: z4.literal("insufficient_scope")
183
200
  }),
184
201
  unauthorizedReasonSchema({
185
- reason: z3.literal("policy_denied"),
186
- policy: z3.enum(["ip", "geo", "mtls", "challenge", "other"]),
187
- value: z3.string().optional()
202
+ reason: z4.literal("policy_denied"),
203
+ policy: z4.enum(["ip", "geo", "mtls", "challenge", "other"]),
204
+ value: z4.string().optional()
188
205
  })
189
206
  ]);
190
- var failureSchema = z3.discriminatedUnion("kind", [
191
- z3.object({
192
- kind: z3.literal("timeout"),
207
+ var failureSchema = z4.discriminatedUnion("kind", [
208
+ z4.object({
209
+ kind: z4.literal("timeout"),
193
210
  timeoutMs: intNonNegSchema.optional(),
194
- message: z3.string().optional()
211
+ message: z4.string().optional()
195
212
  }),
196
- z3.object({
197
- kind: z3.literal("unauthorized"),
213
+ z4.object({
214
+ kind: z4.literal("unauthorized"),
198
215
  why: unauthorizedSchema,
199
- message: z3.string().optional()
216
+ message: z4.string().optional()
200
217
  }),
201
- z3.object({
202
- kind: z3.literal("not_found"),
203
- resource: z3.enum(["tunnel", "client", "route"]),
204
- message: z3.string().optional()
218
+ z4.object({
219
+ kind: z4.literal("not_found"),
220
+ resource: z4.enum(["tunnel", "client", "route"]),
221
+ message: z4.string().optional()
205
222
  }),
206
- z3.object({
207
- kind: z3.literal("refused"),
208
- reason: z3.enum(["capacity", "policy", "unsupported", "other"]),
209
- message: z3.string().optional()
223
+ z4.object({
224
+ kind: z4.literal("refused"),
225
+ reason: z4.enum(["capacity", "policy", "unsupported", "other"]),
226
+ message: z4.string().optional()
210
227
  }),
211
- z3.object({ kind: z3.literal("io"), message: z3.string().optional() }),
212
- z3.object({ kind: z3.literal("internal"), message: z3.string().optional() })
228
+ z4.object({ kind: z4.literal("io"), message: z4.string().optional() }),
229
+ z4.object({ kind: z4.literal("internal"), message: z4.string().optional() })
213
230
  ]);
214
- var firewallSchema = z3.discriminatedUnion("decision", [
215
- z3.object({ decision: z3.literal("allowed"), rule: firewallRuleSchema }),
216
- z3.object({
217
- decision: z3.literal("denied"),
231
+ var firewallSchema = z4.discriminatedUnion("decision", [
232
+ z4.object({ decision: z4.literal("allowed"), rule: firewallRuleSchema }),
233
+ z4.object({
234
+ decision: z4.literal("denied"),
218
235
  rule: firewallRuleSchema,
219
236
  failure: failureSchema
220
237
  })
221
238
  ]);
222
- var routedTunnelSchema = z3.object({
239
+ var routedTunnelSchema = z4.object({
223
240
  tunnelId: nonEmptyStringSchema.optional(),
224
- tunnelName: z3.string().optional(),
225
- hostname: z3.string().optional(),
226
- protocol: z3.string().optional(),
227
- published: z3.boolean().optional(),
228
- type: z3.string().optional(),
229
- tlsMode: z3.string().optional(),
230
- httpVersion: z3.string().optional(),
231
- httpUseTls: z3.boolean().optional(),
232
- upstreamTls: z3.boolean().optional(),
233
- tokenAuth: z3.boolean().optional(),
234
- mtls_auth: z3.boolean().optional()
241
+ tunnelName: z4.string().optional(),
242
+ hostname: z4.string().optional(),
243
+ protocol: z4.string().optional(),
244
+ published: z4.boolean().optional(),
245
+ type: z4.string().optional(),
246
+ tlsMode: z4.string().optional(),
247
+ httpVersion: z4.string().optional(),
248
+ httpUseTls: z4.boolean().optional(),
249
+ upstreamTls: z4.boolean().optional(),
250
+ tokenAuth: z4.boolean().optional(),
251
+ mtls_auth: z4.boolean().optional()
235
252
  });
236
- var routingNodeSchema = z3.object({
253
+ var routingNodeSchema = z4.object({
237
254
  engineId: nonEmptyStringSchema,
238
255
  region: nonEmptyStringSchema,
239
256
  generation: nonEmptyStringSchema.optional()
240
257
  });
241
- var routingPathSchema = z3.object({
242
- mode: z3.enum(["direct", "cross_region"]),
243
- crossRegionRoutingAllowed: z3.boolean(),
258
+ var routingPathSchema = z4.object({
259
+ mode: z4.enum(["direct", "cross_region"]),
260
+ crossRegionRoutingAllowed: z4.boolean(),
244
261
  ingress: routingNodeSchema,
245
262
  owner: routingNodeSchema,
246
263
  anchor: routingNodeSchema
247
264
  });
248
- var routingSchema = z3.discriminatedUnion("decision", [
249
- z3.object({
250
- decision: z3.literal("routed"),
265
+ var routingSchema = z4.discriminatedUnion("decision", [
266
+ z4.object({
267
+ decision: z4.literal("routed"),
251
268
  tunnel: routedTunnelSchema,
252
269
  path: routingPathSchema.optional()
253
270
  }),
254
- z3.object({ decision: z3.literal("not_routed"), failure: failureSchema })
271
+ z4.object({ decision: z4.literal("not_routed"), failure: failureSchema })
255
272
  ]);
256
- var streamConnectedMetricsSchema = z3.object({
273
+ var streamConnectedMetricsSchema = z4.object({
257
274
  establish_ms: numNonNegSchema,
258
275
  duration_ms: numNonNegSchema,
259
276
  upstream_bytes: intNonNegSchema,
260
277
  downstream_bytes: intNonNegSchema
261
278
  });
262
- var streamFailedMetricsSchema = z3.object({
279
+ var streamFailedMetricsSchema = z4.object({
263
280
  time_to_fail_ms: numNonNegSchema.optional(),
264
281
  establish_ms: numNonNegSchema.optional()
265
282
  });
266
- var terminationSchema = z3.object({
267
- by: z3.enum(["downstream", "upstream", "server", "unknown"]),
268
- reason: z3.enum(["closed", "reset", "timeout", "error", "unknown"]),
269
- message: z3.string().optional()
283
+ var terminationSchema = z4.object({
284
+ by: z4.enum(["downstream", "upstream", "server", "unknown"]),
285
+ reason: z4.enum(["closed", "reset", "timeout", "error", "unknown"]),
286
+ message: z4.string().optional()
270
287
  });
271
- var responseConnectedSchema = z3.object({
272
- outcome: z3.literal("connected"),
288
+ var responseConnectedSchema = z4.object({
289
+ outcome: z4.literal("connected"),
273
290
  established_at: isoDateTimeSchema,
274
291
  upstream: streamEndpointSchema.optional(),
275
292
  metrics: streamConnectedMetricsSchema,
276
293
  termination: terminationSchema.optional(),
277
294
  http: httpResponseStageSchema.optional()
278
295
  });
279
- var responseFailedSchema = z3.object({
280
- outcome: z3.literal("failed"),
296
+ var responseFailedSchema = z4.object({
297
+ outcome: z4.literal("failed"),
281
298
  failure: failureSchema,
282
299
  upstream: streamEndpointSchema.optional(),
283
300
  metrics: streamFailedMetricsSchema.optional(),
284
301
  termination: terminationSchema.optional(),
285
302
  http: httpResponseStageSchema.optional()
286
303
  });
287
- var responseSchema = z3.discriminatedUnion("outcome", [
304
+ var responseSchema = z4.discriminatedUnion("outcome", [
288
305
  responseConnectedSchema,
289
306
  responseFailedSchema
290
307
  ]);
291
- var streamWebTTYMetadataSchema = z3.object({
308
+ var streamWebTTYMetadataSchema = z4.object({
292
309
  server_id: nonEmptyStringSchema.optional(),
293
310
  session_id: nonEmptyStringSchema.optional(),
294
311
  session_group_id: nonEmptyStringSchema.optional(),
295
312
  participant_id: nonEmptyStringSchema.optional(),
296
313
  participant_role: webTTYParticipantRoleSchema.optional(),
297
- controller: z3.boolean().optional(),
314
+ controller: z4.boolean().optional(),
298
315
  recording_mode: webTTYRecordingModeSchema.optional(),
299
316
  encryption_mode: webTTYEncryptionModeSchema.optional(),
300
- encryption_policy: z3.enum(["disabled", "explicit_key", "workspace_managed"]).optional(),
301
- e2e: z3.boolean().optional(),
302
- client_proof: z3.enum(["none", "required"]).optional(),
317
+ encryption_policy: z4.enum(["disabled", "explicit_key", "workspace_managed"]).optional(),
318
+ e2e: z4.boolean().optional(),
319
+ client_proof: z4.enum(["none", "required"]).optional(),
303
320
  session_mode: webTTYSessionModeSchema.optional(),
304
321
  downstream_transport: webTTYTransportSchema.optional(),
305
322
  upstream_transport: webTTYTransportSchema.optional(),
306
323
  origin: webTTYOriginSchema.optional(),
307
- origin_id: z3.string().optional(),
324
+ origin_id: z4.string().optional(),
308
325
  initiator_kind: webTTYInitiatorKindSchema.optional(),
309
- device_id: z3.string().optional(),
310
- browser_id: z3.string().optional()
326
+ device_id: z4.string().optional(),
327
+ browser_id: z4.string().optional()
311
328
  }).passthrough();
312
- var streamSummarySchema = z3.object({
329
+ var streamSummarySchema = z4.object({
313
330
  workspace_id: nonEmptyStringSchema.optional(),
314
331
  project_id: nonEmptyStringSchema.optional(),
315
332
  cluster_id: nonEmptyStringSchema.optional(),
@@ -319,7 +336,7 @@ var streamSummarySchema = z3.object({
319
336
  stream_id: nonEmptyStringSchema,
320
337
  created_at: isoDateTimeSchema,
321
338
  terminated_at: isoDateTimeSchema,
322
- request: z3.object({
339
+ request: z4.object({
323
340
  downstream: streamEndpointSchema,
324
341
  entry: streamEntrySchema.optional(),
325
342
  http: httpRequestStageSchema.optional()
@@ -346,34 +363,34 @@ function formatStreamAccessPath(entry) {
346
363
  }
347
364
 
348
365
  // src/webtty-resource.ts
349
- import * as z4 from "zod";
350
- var isoDateTimeSchema2 = z4.string().datetime({ offset: true });
351
- var decimalCursorSchema = z4.string().regex(/^\d+$/);
352
- var webTTYSequenceCursorInputSchema = z4.union([
366
+ import * as z5 from "zod";
367
+ var isoDateTimeSchema2 = z5.string().datetime({ offset: true });
368
+ var decimalCursorSchema = z5.string().regex(/^\d+$/);
369
+ var webTTYSequenceCursorInputSchema = z5.union([
353
370
  decimalCursorSchema,
354
- z4.number().int().nonnegative().safe().transform(String)
371
+ z5.number().int().nonnegative().safe().transform(String)
355
372
  ]);
356
- var webTTYSessionStatusSchema = z4.enum([
373
+ var webTTYSessionStatusSchema = z5.enum([
357
374
  "opening",
358
375
  "active",
359
376
  "closing",
360
377
  "closed",
361
378
  "errored"
362
379
  ]);
363
- var webTTYControlRequestStatusSchema = z4.enum([
380
+ var webTTYControlRequestStatusSchema = z5.enum([
364
381
  "pending",
365
382
  "granted",
366
383
  "refused",
367
384
  "revoked",
368
385
  "expired"
369
386
  ]);
370
- var webTTYEventDirectionSchema = z4.enum([
387
+ var webTTYEventDirectionSchema = z5.enum([
371
388
  "client_to_server",
372
389
  "server_to_client",
373
390
  "engine_internal"
374
391
  ]);
375
- var webTTYStreamTypeSchema = z4.enum(["stdin", "stdout", "stderr"]);
376
- var webTTYSessionEventTypeSchema = z4.enum([
392
+ var webTTYStreamTypeSchema = z5.enum(["stdin", "stdout", "stderr"]);
393
+ var webTTYSessionEventTypeSchema = z5.enum([
377
394
  "open",
378
395
  "ack",
379
396
  "data",
@@ -384,233 +401,237 @@ var webTTYSessionEventTypeSchema = z4.enum([
384
401
  "control",
385
402
  "recording_state"
386
403
  ]);
387
- var jsonRecordSchema = z4.record(z4.string(), z4.unknown());
404
+ var jsonRecordSchema = z5.record(z5.string(), z5.unknown());
388
405
  function rejectCryptoKeyEnvelopes(crypto, ctx, path) {
389
406
  if (crypto === null || typeof crypto !== "object") {
390
407
  return;
391
408
  }
392
409
  if (Object.prototype.hasOwnProperty.call(crypto, "key_envelopes")) {
393
410
  ctx.addIssue({
394
- code: z4.ZodIssueCode.custom,
411
+ code: z5.ZodIssueCode.custom,
395
412
  message: "key_envelopes are available only from the WebTTY decrypt-material endpoint.",
396
413
  path: [...path, "key_envelopes"]
397
414
  });
398
415
  }
399
416
  }
400
- var webTTYCapabilitiesSchema = z4.object({
401
- managed_protocol: z4.boolean(),
402
- store_configured: z4.boolean(),
403
- session_listing: z4.boolean(),
404
- recording: z4.boolean(),
405
- replay: z4.boolean(),
406
- live_attach: z4.boolean(),
407
- control_transfer: z4.boolean(),
408
- e2e: z4.boolean(),
409
- implemented_transports: z4.array(webTTYTransportSchema),
410
- recording_modes: z4.array(webTTYRecordingModeSchema),
411
- encryption_modes: z4.array(webTTYEncryptionModeSchema),
412
- required_permissions: z4.record(z4.string(), z4.array(z4.string()))
417
+ var webTTYCapabilitiesSchema = z5.object({
418
+ managed_protocol: z5.boolean(),
419
+ store_configured: z5.boolean(),
420
+ session_listing: z5.boolean(),
421
+ recording: z5.boolean(),
422
+ replay: z5.boolean(),
423
+ live_attach: z5.boolean(),
424
+ control_transfer: z5.boolean(),
425
+ detached_execution: z5.boolean().default(false),
426
+ explicit_termination: z5.boolean().default(false),
427
+ execution_transports: z5.array(webTTYTransportSchema).default([]),
428
+ max_execution_seconds: z5.number().int().positive().optional(),
429
+ e2e: z5.boolean(),
430
+ implemented_transports: z5.array(webTTYTransportSchema),
431
+ recording_modes: z5.array(webTTYRecordingModeSchema),
432
+ encryption_modes: z5.array(webTTYEncryptionModeSchema),
433
+ required_permissions: z5.record(z5.string(), z5.array(z5.string()))
413
434
  });
414
- var webTTYSessionLiveSchema = z4.object({
415
- available: z4.boolean(),
416
- attachable: z4.boolean(),
417
- participant_count: z4.number().int().nonnegative(),
418
- controller_participant_id: z4.string().optional(),
419
- has_upstream: z4.boolean()
435
+ var webTTYSessionLiveSchema = z5.object({
436
+ available: z5.boolean(),
437
+ attachable: z5.boolean(),
438
+ participant_count: z5.number().int().nonnegative(),
439
+ controller_participant_id: z5.string().optional(),
440
+ has_upstream: z5.boolean()
420
441
  });
421
- var webTTYParticipantLiveSchema = z4.object({
422
- connected: z4.boolean(),
423
- controller: z4.boolean()
442
+ var webTTYParticipantLiveSchema = z5.object({
443
+ connected: z5.boolean(),
444
+ controller: z5.boolean()
424
445
  });
425
- var webTTYSessionSchema = z4.object({
426
- id: z4.string(),
427
- workspace_id: z4.string().optional(),
428
- project_id: z4.string().optional(),
429
- cluster_id: z4.string().optional(),
430
- server_id: z4.string().optional(),
431
- tunnel_id: z4.string(),
432
- client_id: z4.string().optional(),
433
- initiator_user_id: z4.string().optional(),
434
- group_id: z4.string().optional(),
446
+ var webTTYSessionSchema = z5.object({
447
+ id: z5.string(),
448
+ workspace_id: z5.string().optional(),
449
+ project_id: z5.string().optional(),
450
+ cluster_id: z5.string().optional(),
451
+ server_id: z5.string().optional(),
452
+ tunnel_id: z5.string(),
453
+ client_id: z5.string().optional(),
454
+ initiator_user_id: z5.string().optional(),
455
+ group_id: z5.string().optional(),
435
456
  status: webTTYSessionStatusSchema,
436
457
  session_mode: webTTYSessionModeSchema,
437
458
  recording_mode: webTTYRecordingModeSchema,
438
459
  encryption_mode: webTTYEncryptionModeSchema,
439
460
  downstream_transport: webTTYTransportSchema.optional(),
440
461
  upstream_transport: webTTYTransportSchema.optional(),
441
- command_meta: z4.unknown().optional(),
462
+ command_meta: z5.unknown().optional(),
442
463
  context: webTTYContextMetadataSchema.optional(),
443
464
  started_at: isoDateTimeSchema2,
444
465
  ended_at: isoDateTimeSchema2.optional(),
445
- exit_code: z4.number().int().optional(),
446
- error_code: z4.string().optional(),
447
- error_message: z4.string().optional(),
466
+ exit_code: z5.number().int().optional(),
467
+ error_code: z5.string().optional(),
468
+ error_message: z5.string().optional(),
448
469
  live: webTTYSessionLiveSchema.optional()
449
470
  }).passthrough();
450
- var webTTYSessionGroupSchema = z4.object({
451
- id: z4.string(),
452
- workspace_id: z4.string().optional(),
453
- project_id: z4.string().optional(),
454
- initiator_user_id: z4.string().optional(),
471
+ var webTTYSessionGroupSchema = z5.object({
472
+ id: z5.string(),
473
+ workspace_id: z5.string().optional(),
474
+ project_id: z5.string().optional(),
475
+ initiator_user_id: z5.string().optional(),
455
476
  context: webTTYContextMetadataSchema.optional(),
456
477
  created_at: isoDateTimeSchema2,
457
478
  updated_at: isoDateTimeSchema2,
458
479
  closed_at: isoDateTimeSchema2.optional()
459
480
  }).passthrough();
460
- var webTTYParticipantSchema = z4.object({
461
- id: z4.string(),
462
- session_id: z4.string(),
463
- user_id: z4.string().optional(),
464
- device_id: z4.string().optional(),
465
- browser_id: z4.string().optional(),
481
+ var webTTYParticipantSchema = z5.object({
482
+ id: z5.string(),
483
+ session_id: z5.string(),
484
+ user_id: z5.string().optional(),
485
+ device_id: z5.string().optional(),
486
+ browser_id: z5.string().optional(),
466
487
  role: webTTYParticipantRoleSchema,
467
488
  attached_at: isoDateTimeSchema2,
468
489
  detached_at: isoDateTimeSchema2.optional(),
469
- controller: z4.boolean(),
470
- grant_state: z4.string().optional(),
471
- attach_grant: z4.string().optional(),
490
+ controller: z5.boolean(),
491
+ grant_state: z5.string().optional(),
492
+ attach_grant: z5.string().optional(),
472
493
  attach_grant_expires_at: isoDateTimeSchema2.optional(),
473
494
  live: webTTYParticipantLiveSchema.optional()
474
495
  }).passthrough();
475
- var webTTYCryptoMetadataSchema = z4.object({
476
- payload_suite: z4.string().optional(),
477
- payload_key_id: z4.string().optional(),
478
- nonce: z4.string().optional(),
479
- key_envelope_suite: z4.string().optional(),
480
- key_envelopes: z4.unknown().optional(),
481
- key_context: z4.unknown().optional(),
482
- key_context_raw: z4.string().optional()
496
+ var webTTYCryptoMetadataSchema = z5.object({
497
+ payload_suite: z5.string().optional(),
498
+ payload_key_id: z5.string().optional(),
499
+ nonce: z5.string().optional(),
500
+ key_envelope_suite: z5.string().optional(),
501
+ key_envelopes: z5.unknown().optional(),
502
+ key_context: z5.unknown().optional(),
503
+ key_context_raw: z5.string().optional()
483
504
  }).passthrough();
484
- var webTTYSessionEventSchema = z4.object({
485
- id: z4.string(),
486
- session_id: z4.string(),
505
+ var webTTYSessionEventSchema = z5.object({
506
+ id: z5.string(),
507
+ session_id: z5.string(),
487
508
  seq: decimalCursorSchema,
488
509
  created_at: isoDateTimeSchema2,
489
510
  type: webTTYSessionEventTypeSchema,
490
511
  direction: webTTYEventDirectionSchema.optional(),
491
512
  stream_type: webTTYStreamTypeSchema.optional(),
492
- participant_id: z4.string().optional(),
493
- payload_length: z4.number().int().nonnegative().optional(),
494
- payload_ciphertext: z4.string().optional(),
495
- payload_plaintext: z4.string().optional(),
513
+ participant_id: z5.string().optional(),
514
+ payload_length: z5.number().int().nonnegative().optional(),
515
+ payload_ciphertext: z5.string().optional(),
516
+ payload_plaintext: z5.string().optional(),
496
517
  crypto: webTTYCryptoMetadataSchema.optional(),
497
- prev_hash: z4.string().optional(),
498
- hash: z4.string().optional(),
499
- metadata: z4.unknown().optional()
518
+ prev_hash: z5.string().optional(),
519
+ hash: z5.string().optional(),
520
+ metadata: z5.unknown().optional()
500
521
  }).passthrough().superRefine((value, ctx) => {
501
522
  rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
502
523
  });
503
524
  var webTTYKeyGrantBaseShape = {
504
- id: z4.string(),
505
- session_id: z4.string(),
506
- recipient_id: z4.string(),
507
- recipient_kind: z4.string(),
508
- granted_by: z4.string().optional(),
525
+ id: z5.string(),
526
+ session_id: z5.string(),
527
+ recipient_id: z5.string(),
528
+ recipient_kind: z5.string(),
529
+ granted_by: z5.string().optional(),
509
530
  crypto: webTTYCryptoMetadataSchema,
510
531
  created_at: isoDateTimeSchema2,
511
532
  revoked_at: isoDateTimeSchema2.optional()
512
533
  };
513
- var webTTYKeyGrantSchema = z4.object(webTTYKeyGrantBaseShape).passthrough().superRefine((value, ctx) => {
534
+ var webTTYKeyGrantSchema = z5.object(webTTYKeyGrantBaseShape).passthrough().superRefine((value, ctx) => {
514
535
  if (Object.prototype.hasOwnProperty.call(value, "wrapped_key")) {
515
536
  ctx.addIssue({
516
- code: z4.ZodIssueCode.custom,
537
+ code: z5.ZodIssueCode.custom,
517
538
  message: "wrapped_key is available only from the WebTTY decrypt-material endpoint.",
518
539
  path: ["wrapped_key"]
519
540
  });
520
541
  }
521
542
  rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
522
543
  });
523
- var webTTYKeyGrantDecryptMaterialSchema = z4.object({
544
+ var webTTYKeyGrantDecryptMaterialSchema = z5.object({
524
545
  ...webTTYKeyGrantBaseShape,
525
- wrapped_key: z4.string().optional()
546
+ wrapped_key: z5.string().optional()
526
547
  }).passthrough();
527
- var webTTYControlRequestSchema = z4.object({
528
- id: z4.string(),
529
- session_id: z4.string(),
530
- requester_participant_id: z4.string(),
531
- requester_user_id: z4.string().optional(),
532
- approver_participant_id: z4.string().optional(),
533
- approver_user_id: z4.string().optional(),
548
+ var webTTYControlRequestSchema = z5.object({
549
+ id: z5.string(),
550
+ session_id: z5.string(),
551
+ requester_participant_id: z5.string(),
552
+ requester_user_id: z5.string().optional(),
553
+ approver_participant_id: z5.string().optional(),
554
+ approver_user_id: z5.string().optional(),
534
555
  status: webTTYControlRequestStatusSchema,
535
- reason: z4.string().optional(),
536
- metadata: z4.unknown().optional(),
556
+ reason: z5.string().optional(),
557
+ metadata: z5.unknown().optional(),
537
558
  created_at: isoDateTimeSchema2,
538
559
  updated_at: isoDateTimeSchema2,
539
560
  resolved_at: isoDateTimeSchema2.optional(),
540
561
  expires_at: isoDateTimeSchema2.optional()
541
562
  }).passthrough();
542
- var listWebTTYSessionsFiltersSchema = z4.object({
543
- server_id: z4.string().optional(),
544
- tunnel_id: z4.string().optional(),
545
- user_id: z4.string().optional(),
546
- group_id: z4.string().optional(),
563
+ var listWebTTYSessionsFiltersSchema = z5.object({
564
+ server_id: z5.string().optional(),
565
+ tunnel_id: z5.string().optional(),
566
+ user_id: z5.string().optional(),
567
+ group_id: z5.string().optional(),
547
568
  origin: webTTYOriginSchema.optional(),
548
569
  status: webTTYSessionStatusSchema.optional(),
549
570
  started_from: isoDateTimeSchema2.optional(),
550
571
  started_to: isoDateTimeSchema2.optional()
551
572
  });
552
- var listWebTTYSessionsParamsSchema = z4.object({
553
- limit: z4.number().int().min(1).optional(),
573
+ var listWebTTYSessionsParamsSchema = z5.object({
574
+ limit: z5.number().int().min(1).optional(),
554
575
  filters: listWebTTYSessionsFiltersSchema.optional()
555
576
  });
556
- var listWebTTYSessionGroupsFiltersSchema = z4.object({
557
- initiator_user_id: z4.string().optional(),
577
+ var listWebTTYSessionGroupsFiltersSchema = z5.object({
578
+ initiator_user_id: z5.string().optional(),
558
579
  origin: webTTYOriginSchema.optional(),
559
580
  created_from: isoDateTimeSchema2.optional(),
560
581
  created_to: isoDateTimeSchema2.optional()
561
582
  });
562
- var listWebTTYSessionGroupsParamsSchema = z4.object({
563
- limit: z4.number().int().min(1).optional(),
583
+ var listWebTTYSessionGroupsParamsSchema = z5.object({
584
+ limit: z5.number().int().min(1).optional(),
564
585
  filters: listWebTTYSessionGroupsFiltersSchema.optional()
565
586
  });
566
- var readWebTTYSessionEventsParamsSchema = z4.object({
587
+ var readWebTTYSessionEventsParamsSchema = z5.object({
567
588
  from_seq: webTTYSequenceCursorInputSchema.optional(),
568
- limit: z4.number().int().min(1).optional()
589
+ limit: z5.number().int().min(1).optional()
569
590
  });
570
- var listWebTTYKeyGrantDecryptMaterialParamsSchema = z4.object({
571
- recipient_id: z4.string().optional(),
572
- recipient_kind: z4.string().optional()
591
+ var listWebTTYKeyGrantDecryptMaterialParamsSchema = z5.object({
592
+ recipient_id: z5.string().optional(),
593
+ recipient_kind: z5.string().optional()
573
594
  });
574
- var listWebTTYControlRequestsFiltersSchema = z4.object({
595
+ var listWebTTYControlRequestsFiltersSchema = z5.object({
575
596
  status: webTTYControlRequestStatusSchema.optional(),
576
- requester_user_id: z4.string().optional()
597
+ requester_user_id: z5.string().optional()
577
598
  });
578
- var listWebTTYControlRequestsParamsSchema = z4.object({
579
- limit: z4.number().int().min(1).optional(),
599
+ var listWebTTYControlRequestsParamsSchema = z5.object({
600
+ limit: z5.number().int().min(1).optional(),
580
601
  filters: listWebTTYControlRequestsFiltersSchema.optional()
581
602
  });
582
- var attachWebTTYParticipantParamsSchema = z4.object({
583
- role: z4.literal("spectator").optional(),
584
- device_id: z4.string().optional(),
585
- browser_id: z4.string().optional(),
603
+ var attachWebTTYParticipantParamsSchema = z5.object({
604
+ role: z5.literal("spectator").optional(),
605
+ device_id: z5.string().optional(),
606
+ browser_id: z5.string().optional(),
586
607
  transport: webTTYTransportSchema.optional(),
587
- grant_state: z4.string().optional(),
608
+ grant_state: z5.string().optional(),
588
609
  metadata: jsonRecordSchema.optional()
589
610
  });
590
- var detachWebTTYParticipantParamsSchema = z4.object({
591
- reason: z4.string().optional(),
611
+ var detachWebTTYParticipantParamsSchema = z5.object({
612
+ reason: z5.string().optional(),
592
613
  metadata: jsonRecordSchema.optional()
593
614
  });
594
- var createWebTTYControlRequestParamsSchema = z4.object({
595
- participant_id: z4.string(),
596
- reason: z4.string().optional(),
615
+ var createWebTTYControlRequestParamsSchema = z5.object({
616
+ participant_id: z5.string(),
617
+ reason: z5.string().optional(),
597
618
  metadata: jsonRecordSchema.optional(),
598
619
  expires_at: isoDateTimeSchema2.optional()
599
620
  });
600
- var resolveWebTTYControlRequestParamsSchema = z4.object({
601
- action: z4.enum(["grant", "refuse", "revoke"]),
602
- approver_participant_id: z4.string().optional(),
603
- reason: z4.string().optional()
621
+ var resolveWebTTYControlRequestParamsSchema = z5.object({
622
+ action: z5.enum(["grant", "refuse", "revoke"]),
623
+ approver_participant_id: z5.string().optional(),
624
+ reason: z5.string().optional()
604
625
  });
605
- var webTTYSessionListSchema = z4.array(webTTYSessionSchema);
606
- var webTTYSessionGroupListSchema = z4.array(webTTYSessionGroupSchema);
607
- var webTTYParticipantListSchema = z4.array(webTTYParticipantSchema);
608
- var webTTYSessionEventListSchema = z4.array(webTTYSessionEventSchema);
609
- var webTTYKeyGrantListSchema = z4.array(webTTYKeyGrantSchema);
610
- var webTTYKeyGrantDecryptMaterialListSchema = z4.array(
626
+ var webTTYSessionListSchema = z5.array(webTTYSessionSchema);
627
+ var webTTYSessionGroupListSchema = z5.array(webTTYSessionGroupSchema);
628
+ var webTTYParticipantListSchema = z5.array(webTTYParticipantSchema);
629
+ var webTTYSessionEventListSchema = z5.array(webTTYSessionEventSchema);
630
+ var webTTYKeyGrantListSchema = z5.array(webTTYKeyGrantSchema);
631
+ var webTTYKeyGrantDecryptMaterialListSchema = z5.array(
611
632
  webTTYKeyGrantDecryptMaterialSchema
612
633
  );
613
- var webTTYControlRequestListSchema = z4.array(webTTYControlRequestSchema);
634
+ var webTTYControlRequestListSchema = z5.array(webTTYControlRequestSchema);
614
635
  function pathId(kind, value) {
615
636
  const normalized = value.trim();
616
637
  if (!normalized) {
@@ -766,151 +787,146 @@ var RstreamWebTTYResource = class {
766
787
  };
767
788
 
768
789
  // src/event.ts
769
- import { tunnelSchema } from "@rstreamlabs/rstream/tunnel";
770
- import * as z5 from "zod";
771
- var isoDateTimeSchema3 = z5.string().datetime({ offset: true });
772
- var initialStateSchema = z5.object({
790
+ import { tunnelSchema as tunnelSchema2 } from "@rstreamlabs/rstream/tunnel";
791
+ import * as z6 from "zod";
792
+ var isoDateTimeSchema3 = z6.string().datetime({ offset: true });
793
+ var initialStateSchema = z6.object({
773
794
  snapshot_at: isoDateTimeSchema3,
774
- clients: z5.array(clientSchema),
775
- tunnels: z5.array(tunnelSchema)
795
+ clients: z6.array(listedClientSchema),
796
+ tunnels: z6.array(listedTunnelSchema)
776
797
  });
777
- var eventBaseSchema = z5.object({
778
- id: z5.string().optional(),
798
+ var eventBaseSchema = z6.object({
799
+ id: z6.string().optional(),
779
800
  created_at: isoDateTimeSchema3.optional(),
780
- user_id: z5.string().optional(),
781
- workspace_id: z5.string().optional(),
782
- project_id: z5.string().optional(),
783
- cluster_id: z5.string().optional()
801
+ user_id: z6.string().optional(),
802
+ workspace_id: z6.string().optional(),
803
+ project_id: z6.string().optional(),
804
+ cluster_id: z6.string().optional()
784
805
  });
785
- var withEventBase = (shape) => z5.object(shape).merge(eventBaseSchema).passthrough();
806
+ var withEventBase = (shape) => z6.object(shape).merge(eventBaseSchema).passthrough();
786
807
  var stateInitialEventSchema = withEventBase({
787
- type: z5.literal("state.initial"),
808
+ type: z6.literal("state.initial"),
788
809
  object: initialStateSchema
789
810
  });
790
811
  var streamSummaryEventSchema = withEventBase({
791
- type: z5.literal("stream.summary"),
812
+ type: z6.literal("stream.summary"),
792
813
  object: streamSummarySchema
793
814
  });
815
+ var fullInventoryEventsSchema = [
816
+ withEventBase({
817
+ type: z6.literal("client.created"),
818
+ object: clientSchema2
819
+ }),
820
+ withEventBase({
821
+ type: z6.literal("client.updated"),
822
+ object: clientSchema2
823
+ }),
824
+ withEventBase({
825
+ type: z6.literal("client.deleted"),
826
+ object: clientSchema2
827
+ }),
828
+ withEventBase({
829
+ type: z6.literal("tunnel.created"),
830
+ object: tunnelSchema2
831
+ }),
832
+ withEventBase({
833
+ type: z6.literal("tunnel.updated"),
834
+ object: tunnelSchema2
835
+ }),
836
+ withEventBase({
837
+ type: z6.literal("tunnel.deleted"),
838
+ object: tunnelSchema2
839
+ })
840
+ ];
794
841
  var commonEventsSchema = [
795
842
  withEventBase({
796
- type: z5.literal("client.created"),
797
- object: clientSchema
843
+ type: z6.literal("client.created"),
844
+ object: listedClientSchema
798
845
  }),
799
846
  withEventBase({
800
- type: z5.literal("client.updated"),
801
- object: clientSchema
847
+ type: z6.literal("client.updated"),
848
+ object: listedClientSchema
802
849
  }),
803
850
  withEventBase({
804
- type: z5.literal("client.deleted"),
805
- object: clientSchema
851
+ type: z6.literal("client.deleted"),
852
+ object: listedClientSchema
806
853
  }),
807
854
  withEventBase({
808
- type: z5.literal("tunnel.created"),
809
- object: tunnelSchema
855
+ type: z6.literal("tunnel.created"),
856
+ object: listedTunnelSchema
810
857
  }),
811
858
  withEventBase({
812
- type: z5.literal("tunnel.updated"),
813
- object: tunnelSchema
859
+ type: z6.literal("tunnel.updated"),
860
+ object: listedTunnelSchema
814
861
  }),
815
862
  withEventBase({
816
- type: z5.literal("tunnel.deleted"),
817
- object: tunnelSchema
863
+ type: z6.literal("tunnel.deleted"),
864
+ object: listedTunnelSchema
818
865
  })
819
866
  ];
820
867
  var webTTYEventsSchema = [
821
868
  withEventBase({
822
- type: z5.literal("webtty.session.created"),
869
+ type: z6.literal("webtty.session.created"),
823
870
  object: webTTYSessionSchema
824
871
  }),
825
872
  withEventBase({
826
- type: z5.literal("webtty.session.updated"),
827
- object: z5.union([webTTYSessionSchema, webTTYSessionGroupSchema])
873
+ type: z6.literal("webtty.session.updated"),
874
+ object: z6.union([webTTYSessionSchema, webTTYSessionGroupSchema])
828
875
  }),
829
876
  withEventBase({
830
- type: z5.literal("webtty.session.ended"),
877
+ type: z6.literal("webtty.session.ended"),
831
878
  object: webTTYSessionSchema
832
879
  }),
833
880
  withEventBase({
834
- type: z5.literal("webtty.participant.joined"),
881
+ type: z6.literal("webtty.participant.joined"),
835
882
  object: webTTYParticipantSchema
836
883
  }),
837
884
  withEventBase({
838
- type: z5.literal("webtty.participant.updated"),
885
+ type: z6.literal("webtty.participant.updated"),
839
886
  object: webTTYParticipantSchema
840
887
  }),
841
888
  withEventBase({
842
- type: z5.literal("webtty.participant.left"),
889
+ type: z6.literal("webtty.participant.left"),
843
890
  object: webTTYParticipantSchema
844
891
  }),
845
892
  withEventBase({
846
- type: z5.literal("webtty.control.requested"),
893
+ type: z6.literal("webtty.control.requested"),
847
894
  object: webTTYControlRequestSchema
848
895
  }),
849
896
  withEventBase({
850
- type: z5.literal("webtty.control.granted"),
897
+ type: z6.literal("webtty.control.granted"),
851
898
  object: webTTYControlRequestSchema
852
899
  }),
853
900
  withEventBase({
854
- type: z5.literal("webtty.control.refused"),
901
+ type: z6.literal("webtty.control.refused"),
855
902
  object: webTTYControlRequestSchema
856
903
  }),
857
904
  withEventBase({
858
- type: z5.literal("webtty.control.revoked"),
905
+ type: z6.literal("webtty.control.revoked"),
859
906
  object: webTTYControlRequestSchema
860
907
  })
861
908
  ];
862
909
  var webhookDeliverableEventsSchema = [
863
- commonEventsSchema[0],
864
- commonEventsSchema[2],
865
- commonEventsSchema[3],
866
- commonEventsSchema[5],
910
+ fullInventoryEventsSchema[0],
911
+ fullInventoryEventsSchema[2],
912
+ fullInventoryEventsSchema[3],
913
+ fullInventoryEventsSchema[5],
867
914
  ...webTTYEventsSchema
868
915
  ];
869
- var wsEventsSchema = z5.union([
916
+ var wsEventsSchema = z6.union([
870
917
  stateInitialEventSchema,
871
918
  ...commonEventsSchema,
872
919
  ...webTTYEventsSchema
873
920
  ]);
874
- var webhookEventsSchema = z5.union(webhookDeliverableEventsSchema);
921
+ var webhookEventsSchema = z6.union(webhookDeliverableEventsSchema);
875
922
  var projectLogEventsSchema = streamSummaryEventSchema;
876
- var eventSchema = z5.union([
923
+ var eventSchema = z6.union([
877
924
  wsEventsSchema,
878
925
  webhookEventsSchema,
879
926
  projectLogEventsSchema
880
927
  ]);
881
928
 
882
- // src/tunnel.ts
883
- import { tunnelSchema as tunnelSchema2 } from "@rstreamlabs/rstream/tunnel";
884
- import * as z6 from "zod";
885
- var DEFAULT_PUBLISHED_PORT = 443;
886
- var tunnelFilterSchema = tunnelSchema2.pick({
887
- id: true,
888
- name: true,
889
- type: true,
890
- status: true,
891
- client_id: true,
892
- user_id: true,
893
- publish: true,
894
- protocol: true,
895
- hostname: true,
896
- http_version: true,
897
- labels: true
898
- }).partial();
899
- var listTunnelsParamsSchema = z6.object({
900
- limit: z6.number().int().min(1).optional(),
901
- filters: tunnelFilterSchema.optional()
902
- });
903
- var listTunnelsResponseSchema = z6.array(tunnelSchema2);
904
- function formatTunnelHost(tunnel) {
905
- if (!tunnel.hostname) return tunnel.host;
906
- if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
907
- return tunnel.hostname;
908
- }
909
- return `${tunnel.hostname}:${tunnel.port}`;
910
- }
911
-
912
929
  // src/openapi.ts
913
- import { tunnelSchema as tunnelSchema3 } from "@rstreamlabs/rstream/tunnel";
914
930
  import * as z7 from "zod";
915
931
  var jsonContentType = "application/json";
916
932
  var openApiContentType = "application/vnd.oai.openapi+json;version=3.1";
@@ -989,12 +1005,6 @@ var readEngineStateRule = {
989
1005
  action: "read"
990
1006
  };
991
1007
  var readEngineStateRules = [readEngineStateRule];
992
- var readEngineStreamsRules = [
993
- {
994
- resource: "engine.streams",
995
- action: "read"
996
- }
997
- ];
998
1008
  var watchParamsSchema = z7.object({
999
1009
  clients: clientFilterSchema.optional(),
1000
1010
  tunnels: tunnelFilterSchema.optional()
@@ -1224,11 +1234,11 @@ var engineOpenApiDocument = {
1224
1234
  }
1225
1235
  }
1226
1236
  },
1227
- Client: jsonSchemaFor(clientSchema),
1237
+ Client: jsonSchemaFor(listedClientSchema),
1228
1238
  Event: jsonSchemaFor(wsEventsSchema),
1229
1239
  ListClientsParams: jsonSchemaFor(listClientsParamsSchema),
1230
1240
  ListTunnelsParams: jsonSchemaFor(listTunnelsParamsSchema),
1231
- TunnelListItem: jsonSchemaFor(tunnelSchema3),
1241
+ TunnelListItem: jsonSchemaFor(listedTunnelSchema),
1232
1242
  WatchParams: jsonSchemaFor(watchParamsSchema)
1233
1243
  }
1234
1244
  },
@@ -1409,19 +1419,20 @@ var engineOpenApiDocument = {
1409
1419
  get: {
1410
1420
  tags: ["Runtime inventory"],
1411
1421
  summary: "List visible engine clients.",
1422
+ "x-rstream-token-scope": "resources.tunnels.scopes.clients.list",
1412
1423
  operationId: "list_engine_clients",
1413
1424
  parameters: [{ $ref: "#/components/parameters/ListClientsParams" }],
1414
1425
  security: [{ bearerAuth: [] }, { mutualTLS: [] }],
1415
1426
  responses: {
1416
1427
  "200": jsonArrayResponse(
1417
- "Visible clients.",
1428
+ "Visible clients. Fine-grained list scopes may filter objects and project fields.",
1418
1429
  "#/components/schemas/Client"
1419
1430
  ),
1420
1431
  "400": { $ref: "#/components/responses/BadRequest" },
1421
1432
  "401": { $ref: "#/components/responses/Unauthorized" },
1422
1433
  "403": { $ref: "#/components/responses/Forbidden" }
1423
1434
  },
1424
- "x-rstream-required-rules": readEngineStreamsRules
1435
+ "x-rstream-required-rules": readEngineStateRules
1425
1436
  }
1426
1437
  },
1427
1438
  "/api/tunnels": {
@@ -1441,7 +1452,7 @@ var engineOpenApiDocument = {
1441
1452
  "403": { $ref: "#/components/responses/Forbidden" }
1442
1453
  },
1443
1454
  "x-rstream-required-rules": readEngineStateRules,
1444
- "x-rstream-token-metadata-scope": "metadata.scopes.tunnels.list"
1455
+ "x-rstream-token-scope": "resources.tunnels.scopes.tunnels.list"
1445
1456
  }
1446
1457
  },
1447
1458
  "/api/sse": {
@@ -1492,10 +1503,16 @@ var engineOpenApiJson = `${JSON.stringify(
1492
1503
  `;
1493
1504
 
1494
1505
  export {
1495
- clientSchema,
1506
+ listedClientSchema,
1496
1507
  clientFilterSchema,
1497
1508
  listClientsParamsSchema,
1498
1509
  listClientsResponseSchema,
1510
+ clientSchema2 as clientSchema,
1511
+ tunnelFilterSchema,
1512
+ listTunnelsParamsSchema,
1513
+ listedTunnelSchema,
1514
+ listTunnelsResponseSchema,
1515
+ formatTunnelHost,
1499
1516
  webTTYTransportSchema,
1500
1517
  webTTYRecordingModeSchema,
1501
1518
  webTTYEncryptionModeSchema,
@@ -1535,10 +1552,6 @@ export {
1535
1552
  webhookEventsSchema,
1536
1553
  projectLogEventsSchema,
1537
1554
  eventSchema,
1538
- tunnelFilterSchema,
1539
- listTunnelsParamsSchema,
1540
- listTunnelsResponseSchema,
1541
- formatTunnelHost,
1542
1555
  engineOpenApiDocument,
1543
1556
  engineOpenApiJson
1544
1557
  };