@rstreamlabs/tunnels 3.2.1 → 3.5.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/README.md +17 -1
- package/dist/chunk-6OUCIT5G.mjs +1330 -0
- package/dist/index.d.mts +2918 -83
- package/dist/index.d.ts +2918 -83
- package/dist/index.js +862 -165
- package/dist/index.mjs +109 -3
- package/dist/openapi.d.mts +4 -1
- package/dist/openapi.d.ts +4 -1
- package/dist/openapi.js +479 -58
- package/dist/openapi.mjs +1 -1
- package/package.json +5 -5
- package/dist/chunk-VUAM3LRU.mjs +0 -710
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
RstreamTunnelsClient: () => RstreamTunnelsClient,
|
|
40
40
|
RstreamTunnelsResource: () => RstreamTunnelsResource,
|
|
41
41
|
RstreamTunnelsRessource: () => RstreamTunnelsResource,
|
|
42
|
+
RstreamWebTTYResource: () => RstreamWebTTYResource,
|
|
42
43
|
RstreamWebhookResource: () => RstreamWebhookResource,
|
|
43
44
|
RstreamWebhookRessource: () => RstreamWebhookResource,
|
|
44
45
|
Tunnels: () => RstreamTunnelsClient,
|
|
@@ -48,6 +49,7 @@ __export(index_exports, {
|
|
|
48
49
|
WEBHOOK_ID_HEADER: () => WEBHOOK_ID_HEADER,
|
|
49
50
|
WEBHOOK_SIGNATURE_HEADER: () => WEBHOOK_SIGNATURE_HEADER,
|
|
50
51
|
Watch: () => Watch,
|
|
52
|
+
attachWebTTYParticipantParamsSchema: () => attachWebTTYParticipantParamsSchema,
|
|
51
53
|
buildWebhookHeaders: () => buildWebhookHeaders,
|
|
52
54
|
clientFilterSchema: () => clientFilterSchema,
|
|
53
55
|
clientSchema: () => clientSchema,
|
|
@@ -56,30 +58,59 @@ __export(index_exports, {
|
|
|
56
58
|
createAuthTokenFromClientCredentials: () => createAuthTokenFromClientCredentials,
|
|
57
59
|
createPATTURNCredentials: () => createPATTURNCredentials,
|
|
58
60
|
createTURNCredentials: () => createTURNCredentials,
|
|
61
|
+
createWebTTYControlRequestParamsSchema: () => createWebTTYControlRequestParamsSchema,
|
|
62
|
+
detachWebTTYParticipantParamsSchema: () => detachWebTTYParticipantParamsSchema,
|
|
59
63
|
engineOpenApiDocument: () => engineOpenApiDocument,
|
|
60
64
|
engineOpenApiJson: () => engineOpenApiJson,
|
|
61
65
|
eventSchema: () => eventSchema,
|
|
66
|
+
formatStreamAccessPath: () => formatStreamAccessPath,
|
|
62
67
|
formatTunnelHost: () => formatTunnelHost,
|
|
63
68
|
generateWebhookSigningSecret: () => generateWebhookSigningSecret,
|
|
64
69
|
listClientsParamsSchema: () => listClientsParamsSchema,
|
|
65
70
|
listClientsResponseSchema: () => listClientsResponseSchema,
|
|
66
71
|
listTunnelsParamsSchema: () => listTunnelsParamsSchema,
|
|
67
72
|
listTunnelsResponseSchema: () => listTunnelsResponseSchema,
|
|
73
|
+
listWebTTYControlRequestsParamsSchema: () => listWebTTYControlRequestsParamsSchema,
|
|
74
|
+
listWebTTYKeyGrantDecryptMaterialParamsSchema: () => listWebTTYKeyGrantDecryptMaterialParamsSchema,
|
|
75
|
+
listWebTTYSessionGroupsParamsSchema: () => listWebTTYSessionGroupsParamsSchema,
|
|
76
|
+
listWebTTYSessionsParamsSchema: () => listWebTTYSessionsParamsSchema,
|
|
68
77
|
normalizeEngineAddress: () => normalizeEngineAddress,
|
|
69
78
|
parseWebTTYServers: () => parseWebTTYServers,
|
|
70
79
|
projectLogEventsSchema: () => projectLogEventsSchema,
|
|
80
|
+
readWebTTYSessionEventsParamsSchema: () => readWebTTYSessionEventsParamsSchema,
|
|
71
81
|
resolveControlPlaneCredentials: () => resolveControlPlaneCredentials,
|
|
72
82
|
resolveManagedTunnelsProject: () => resolveManagedTunnelsProject,
|
|
73
83
|
resolveTunnelsAPIURL: () => resolveTunnelsAPIURL,
|
|
74
84
|
resolveTunnelsCredentials: () => resolveTunnelsCredentials,
|
|
75
85
|
resolveTunnelsEngine: () => resolveTunnelsEngine,
|
|
86
|
+
resolveWebTTYControlRequestParamsSchema: () => resolveWebTTYControlRequestParamsSchema,
|
|
76
87
|
signWebhookPayload: () => signWebhookPayload,
|
|
77
88
|
streamEndpointSchema: () => streamEndpointSchema,
|
|
89
|
+
streamEntrySchema: () => streamEntrySchema,
|
|
78
90
|
streamSummaryEventSchema: () => streamSummaryEventSchema,
|
|
79
91
|
streamSummarySchema: () => streamSummarySchema,
|
|
80
92
|
streamTLSInfoSchema: () => streamTLSInfoSchema,
|
|
93
|
+
streamWebTTYMetadataSchema: () => streamWebTTYMetadataSchema,
|
|
81
94
|
tunnelFilterSchema: () => tunnelFilterSchema,
|
|
82
95
|
turnCredentialModeSchema: () => turnCredentialModeSchema,
|
|
96
|
+
webTTYCapabilitiesSchema: () => webTTYCapabilitiesSchema,
|
|
97
|
+
webTTYContextMetadataSchema: () => webTTYContextMetadataSchema,
|
|
98
|
+
webTTYControlRequestSchema: () => webTTYControlRequestSchema,
|
|
99
|
+
webTTYCryptoMetadataSchema: () => webTTYCryptoMetadataSchema,
|
|
100
|
+
webTTYEncryptionModeSchema: () => webTTYEncryptionModeSchema,
|
|
101
|
+
webTTYKeyGrantDecryptMaterialSchema: () => webTTYKeyGrantDecryptMaterialSchema,
|
|
102
|
+
webTTYKeyGrantSchema: () => webTTYKeyGrantSchema,
|
|
103
|
+
webTTYOriginSchema: () => webTTYOriginSchema,
|
|
104
|
+
webTTYParticipantLiveSchema: () => webTTYParticipantLiveSchema,
|
|
105
|
+
webTTYParticipantRoleSchema: () => webTTYParticipantRoleSchema,
|
|
106
|
+
webTTYParticipantSchema: () => webTTYParticipantSchema,
|
|
107
|
+
webTTYRecordingModeSchema: () => webTTYRecordingModeSchema,
|
|
108
|
+
webTTYSessionEventSchema: () => webTTYSessionEventSchema,
|
|
109
|
+
webTTYSessionGroupSchema: () => webTTYSessionGroupSchema,
|
|
110
|
+
webTTYSessionLiveSchema: () => webTTYSessionLiveSchema,
|
|
111
|
+
webTTYSessionModeSchema: () => webTTYSessionModeSchema,
|
|
112
|
+
webTTYSessionSchema: () => webTTYSessionSchema,
|
|
113
|
+
webTTYTransportSchema: () => webTTYTransportSchema,
|
|
83
114
|
webhookEventsSchema: () => webhookEventsSchema,
|
|
84
115
|
webttyServerSchema: () => webttyServerSchema,
|
|
85
116
|
wsEventsSchema: () => wsEventsSchema
|
|
@@ -302,191 +333,264 @@ var RstreamClientsResource = class {
|
|
|
302
333
|
}
|
|
303
334
|
};
|
|
304
335
|
|
|
305
|
-
// src/
|
|
336
|
+
// src/webtty-schemas.ts
|
|
306
337
|
var z2 = __toESM(require("zod"));
|
|
307
|
-
var
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
var
|
|
313
|
-
|
|
314
|
-
|
|
338
|
+
var webTTYTransportSchema = z2.enum([
|
|
339
|
+
"plain",
|
|
340
|
+
"websocket",
|
|
341
|
+
"webtransport"
|
|
342
|
+
]);
|
|
343
|
+
var webTTYRecordingModeSchema = z2.enum(["recorded", "private"]);
|
|
344
|
+
var webTTYEncryptionModeSchema = z2.enum(["managed", "e2e"]);
|
|
345
|
+
var webTTYSessionModeSchema = z2.enum([
|
|
346
|
+
"interactive",
|
|
347
|
+
"non-interactive"
|
|
348
|
+
]);
|
|
349
|
+
var webTTYOriginSchema = z2.enum([
|
|
350
|
+
"human",
|
|
351
|
+
"codex",
|
|
352
|
+
"api",
|
|
353
|
+
"automation",
|
|
354
|
+
"ci",
|
|
355
|
+
"scheduled-job"
|
|
356
|
+
]);
|
|
357
|
+
var webTTYParticipantRoleSchema = z2.enum(["controller", "spectator"]);
|
|
358
|
+
var webTTYInitiatorKindSchema = z2.enum([
|
|
359
|
+
"user",
|
|
360
|
+
"app",
|
|
361
|
+
"agent",
|
|
362
|
+
"service-account"
|
|
363
|
+
]);
|
|
364
|
+
var webTTYContextMetadataSchema = z2.object({
|
|
365
|
+
origin: webTTYOriginSchema.optional(),
|
|
366
|
+
origin_id: z2.string().optional(),
|
|
367
|
+
purpose: z2.string().optional(),
|
|
368
|
+
initiator_kind: webTTYInitiatorKindSchema.optional(),
|
|
369
|
+
agent_name: z2.string().optional(),
|
|
370
|
+
agent_version: z2.string().optional(),
|
|
371
|
+
request_id: z2.string().optional(),
|
|
372
|
+
labels: z2.record(z2.string(), z2.string()).optional()
|
|
373
|
+
}).passthrough();
|
|
374
|
+
|
|
375
|
+
// src/stream.ts
|
|
376
|
+
var z3 = __toESM(require("zod"));
|
|
377
|
+
var nonEmptyStringSchema = z3.string().min(1);
|
|
378
|
+
var isoDateTimeSchema = z3.string().datetime({ offset: true });
|
|
379
|
+
var ipAddressSchema = z3.string();
|
|
380
|
+
var intNonNegSchema = z3.number().int().nonnegative();
|
|
381
|
+
var numNonNegSchema = z3.number().nonnegative();
|
|
382
|
+
var geolocationSchema = z3.object({
|
|
383
|
+
country: z3.string().optional(),
|
|
384
|
+
region: z3.string().optional()
|
|
315
385
|
});
|
|
316
|
-
var streamTLSInfoSchema =
|
|
317
|
-
version:
|
|
318
|
-
cipher:
|
|
319
|
-
protocol:
|
|
320
|
-
curve:
|
|
321
|
-
ech:
|
|
386
|
+
var streamTLSInfoSchema = z3.object({
|
|
387
|
+
version: z3.string().min(1).optional(),
|
|
388
|
+
cipher: z3.string().min(1).optional(),
|
|
389
|
+
protocol: z3.string().min(1).optional(),
|
|
390
|
+
curve: z3.string().min(1).optional(),
|
|
391
|
+
ech: z3.boolean().optional()
|
|
322
392
|
});
|
|
323
|
-
var streamEndpointSchema =
|
|
393
|
+
var streamEndpointSchema = z3.object({
|
|
324
394
|
ip: ipAddressSchema.optional(),
|
|
325
395
|
geolocation: geolocationSchema.optional(),
|
|
326
396
|
tls: streamTLSInfoSchema.optional()
|
|
327
397
|
});
|
|
328
|
-
var httpHeadersSchema =
|
|
329
|
-
|
|
330
|
-
|
|
398
|
+
var httpHeadersSchema = z3.record(
|
|
399
|
+
z3.string(),
|
|
400
|
+
z3.union([z3.string(), z3.array(z3.string())])
|
|
331
401
|
);
|
|
332
|
-
var httpProtocolSchema =
|
|
333
|
-
var httpRequestSchema =
|
|
402
|
+
var httpProtocolSchema = z3.enum(["http/1.1", "h2", "h2c", "h3"]);
|
|
403
|
+
var httpRequestSchema = z3.object({
|
|
334
404
|
method: nonEmptyStringSchema,
|
|
335
|
-
scheme:
|
|
405
|
+
scheme: z3.string().min(1).optional(),
|
|
336
406
|
host: nonEmptyStringSchema.optional(),
|
|
337
407
|
path: nonEmptyStringSchema.optional(),
|
|
338
|
-
query:
|
|
408
|
+
query: z3.string().optional(),
|
|
339
409
|
url: nonEmptyStringSchema.optional(),
|
|
340
410
|
headers: httpHeadersSchema.optional(),
|
|
341
|
-
userAgent:
|
|
411
|
+
userAgent: z3.string().optional()
|
|
342
412
|
});
|
|
343
|
-
var httpResponseSchema =
|
|
344
|
-
status:
|
|
413
|
+
var httpResponseSchema = z3.object({
|
|
414
|
+
status: z3.number().int().min(100).max(999),
|
|
345
415
|
headers: httpHeadersSchema.optional()
|
|
346
416
|
});
|
|
347
|
-
var httpRequestStageSchema =
|
|
417
|
+
var httpRequestStageSchema = z3.object({
|
|
348
418
|
protocol: httpProtocolSchema.optional(),
|
|
349
419
|
request: httpRequestSchema
|
|
350
420
|
});
|
|
351
|
-
var httpResponseStageSchema =
|
|
421
|
+
var httpResponseStageSchema = z3.object({
|
|
352
422
|
protocol: httpProtocolSchema.optional(),
|
|
353
423
|
response: httpResponseSchema
|
|
354
424
|
});
|
|
355
|
-
var
|
|
425
|
+
var streamEntrySchema = z3.object({
|
|
426
|
+
kind: z3.enum([
|
|
427
|
+
"published_tunnel",
|
|
428
|
+
"private_rstream",
|
|
429
|
+
"proxy_egress",
|
|
430
|
+
"internal"
|
|
431
|
+
]),
|
|
432
|
+
transport: z3.enum(["rstream", "tls", "quic", "dtls", "http", "tcp"]).optional()
|
|
433
|
+
});
|
|
434
|
+
var tokenSourceSchema = z3.enum([
|
|
356
435
|
"authorization",
|
|
357
436
|
"query",
|
|
358
437
|
"client",
|
|
359
438
|
"unknown"
|
|
360
439
|
]);
|
|
361
|
-
var tokenTypeSchema =
|
|
362
|
-
var firewallRuleSchema =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
kind:
|
|
367
|
-
source:
|
|
440
|
+
var tokenTypeSchema = z3.enum(["auth", "pat", "app", "unknown"]);
|
|
441
|
+
var firewallRuleSchema = z3.discriminatedUnion("kind", [
|
|
442
|
+
z3.object({ kind: z3.literal("none") }),
|
|
443
|
+
z3.object({ kind: z3.literal("mtls") }),
|
|
444
|
+
z3.object({
|
|
445
|
+
kind: z3.literal("rstream_auth"),
|
|
446
|
+
source: z3.literal("rstream_auth")
|
|
368
447
|
}),
|
|
369
|
-
|
|
370
|
-
kind:
|
|
448
|
+
z3.object({
|
|
449
|
+
kind: z3.literal("rstream"),
|
|
450
|
+
source: z3.literal("private_rstream").optional()
|
|
451
|
+
}),
|
|
452
|
+
z3.object({
|
|
453
|
+
kind: z3.literal("token"),
|
|
371
454
|
source: tokenSourceSchema.optional(),
|
|
372
455
|
tokenType: tokenTypeSchema.optional()
|
|
373
456
|
})
|
|
374
457
|
]);
|
|
375
|
-
var unauthorizedSourceSchema =
|
|
458
|
+
var unauthorizedSourceSchema = z3.object({
|
|
376
459
|
source: tokenSourceSchema
|
|
377
460
|
});
|
|
378
|
-
var unauthorizedReasonSchema = (shape) =>
|
|
379
|
-
var unauthorizedSchema =
|
|
461
|
+
var unauthorizedReasonSchema = (shape) => z3.object(shape).merge(unauthorizedSourceSchema);
|
|
462
|
+
var unauthorizedSchema = z3.discriminatedUnion("reason", [
|
|
380
463
|
unauthorizedReasonSchema({
|
|
381
|
-
reason:
|
|
464
|
+
reason: z3.literal("missing_token")
|
|
382
465
|
}),
|
|
383
466
|
unauthorizedReasonSchema({
|
|
384
|
-
reason:
|
|
467
|
+
reason: z3.literal("invalid_token")
|
|
385
468
|
}),
|
|
386
469
|
unauthorizedReasonSchema({
|
|
387
|
-
reason:
|
|
470
|
+
reason: z3.literal("expired_token")
|
|
388
471
|
}),
|
|
389
472
|
unauthorizedReasonSchema({
|
|
390
|
-
reason:
|
|
473
|
+
reason: z3.literal("invalid_secret")
|
|
391
474
|
}),
|
|
392
475
|
unauthorizedReasonSchema({
|
|
393
|
-
reason:
|
|
476
|
+
reason: z3.literal("user_mismatch")
|
|
394
477
|
}),
|
|
395
478
|
unauthorizedReasonSchema({
|
|
396
|
-
reason:
|
|
479
|
+
reason: z3.literal("insufficient_scope")
|
|
397
480
|
}),
|
|
398
481
|
unauthorizedReasonSchema({
|
|
399
|
-
reason:
|
|
400
|
-
policy:
|
|
401
|
-
value:
|
|
482
|
+
reason: z3.literal("policy_denied"),
|
|
483
|
+
policy: z3.enum(["ip", "geo", "mtls", "challenge", "other"]),
|
|
484
|
+
value: z3.string().optional()
|
|
402
485
|
})
|
|
403
486
|
]);
|
|
404
|
-
var failureSchema =
|
|
405
|
-
|
|
406
|
-
kind:
|
|
487
|
+
var failureSchema = z3.discriminatedUnion("kind", [
|
|
488
|
+
z3.object({
|
|
489
|
+
kind: z3.literal("timeout"),
|
|
407
490
|
timeoutMs: intNonNegSchema.optional(),
|
|
408
|
-
message:
|
|
491
|
+
message: z3.string().optional()
|
|
409
492
|
}),
|
|
410
|
-
|
|
411
|
-
kind:
|
|
493
|
+
z3.object({
|
|
494
|
+
kind: z3.literal("unauthorized"),
|
|
412
495
|
why: unauthorizedSchema,
|
|
413
|
-
message:
|
|
496
|
+
message: z3.string().optional()
|
|
414
497
|
}),
|
|
415
|
-
|
|
416
|
-
kind:
|
|
417
|
-
resource:
|
|
418
|
-
message:
|
|
498
|
+
z3.object({
|
|
499
|
+
kind: z3.literal("not_found"),
|
|
500
|
+
resource: z3.enum(["tunnel", "client", "route"]),
|
|
501
|
+
message: z3.string().optional()
|
|
419
502
|
}),
|
|
420
|
-
|
|
421
|
-
kind:
|
|
422
|
-
reason:
|
|
423
|
-
message:
|
|
503
|
+
z3.object({
|
|
504
|
+
kind: z3.literal("refused"),
|
|
505
|
+
reason: z3.enum(["capacity", "policy", "unsupported", "other"]),
|
|
506
|
+
message: z3.string().optional()
|
|
424
507
|
}),
|
|
425
|
-
|
|
426
|
-
|
|
508
|
+
z3.object({ kind: z3.literal("io"), message: z3.string().optional() }),
|
|
509
|
+
z3.object({ kind: z3.literal("internal"), message: z3.string().optional() })
|
|
427
510
|
]);
|
|
428
|
-
var firewallSchema =
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
decision:
|
|
511
|
+
var firewallSchema = z3.discriminatedUnion("decision", [
|
|
512
|
+
z3.object({ decision: z3.literal("allowed"), rule: firewallRuleSchema }),
|
|
513
|
+
z3.object({
|
|
514
|
+
decision: z3.literal("denied"),
|
|
432
515
|
rule: firewallRuleSchema,
|
|
433
516
|
failure: failureSchema
|
|
434
517
|
})
|
|
435
518
|
]);
|
|
436
|
-
var routedTunnelSchema =
|
|
519
|
+
var routedTunnelSchema = z3.object({
|
|
437
520
|
tunnelId: nonEmptyStringSchema.optional(),
|
|
438
|
-
tunnelName:
|
|
439
|
-
hostname:
|
|
440
|
-
protocol:
|
|
441
|
-
published:
|
|
442
|
-
type:
|
|
443
|
-
tlsMode:
|
|
444
|
-
httpVersion:
|
|
445
|
-
httpUseTls:
|
|
446
|
-
upstreamTls:
|
|
447
|
-
tokenAuth:
|
|
448
|
-
mtls_auth:
|
|
521
|
+
tunnelName: z3.string().optional(),
|
|
522
|
+
hostname: z3.string().optional(),
|
|
523
|
+
protocol: z3.string().optional(),
|
|
524
|
+
published: z3.boolean().optional(),
|
|
525
|
+
type: z3.string().optional(),
|
|
526
|
+
tlsMode: z3.string().optional(),
|
|
527
|
+
httpVersion: z3.string().optional(),
|
|
528
|
+
httpUseTls: z3.boolean().optional(),
|
|
529
|
+
upstreamTls: z3.boolean().optional(),
|
|
530
|
+
tokenAuth: z3.boolean().optional(),
|
|
531
|
+
mtls_auth: z3.boolean().optional()
|
|
449
532
|
});
|
|
450
|
-
var routingSchema =
|
|
451
|
-
|
|
452
|
-
|
|
533
|
+
var routingSchema = z3.discriminatedUnion("decision", [
|
|
534
|
+
z3.object({ decision: z3.literal("routed"), tunnel: routedTunnelSchema }),
|
|
535
|
+
z3.object({ decision: z3.literal("not_routed"), failure: failureSchema })
|
|
453
536
|
]);
|
|
454
|
-
var streamConnectedMetricsSchema =
|
|
537
|
+
var streamConnectedMetricsSchema = z3.object({
|
|
455
538
|
establish_ms: numNonNegSchema,
|
|
456
539
|
duration_ms: numNonNegSchema,
|
|
457
540
|
upstream_bytes: intNonNegSchema,
|
|
458
541
|
downstream_bytes: intNonNegSchema
|
|
459
542
|
});
|
|
460
|
-
var streamFailedMetricsSchema =
|
|
543
|
+
var streamFailedMetricsSchema = z3.object({
|
|
461
544
|
time_to_fail_ms: numNonNegSchema.optional(),
|
|
462
545
|
establish_ms: numNonNegSchema.optional()
|
|
463
546
|
});
|
|
464
|
-
var terminationSchema =
|
|
465
|
-
by:
|
|
466
|
-
reason:
|
|
467
|
-
message:
|
|
547
|
+
var terminationSchema = z3.object({
|
|
548
|
+
by: z3.enum(["downstream", "upstream", "server", "unknown"]),
|
|
549
|
+
reason: z3.enum(["closed", "reset", "timeout", "error", "unknown"]),
|
|
550
|
+
message: z3.string().optional()
|
|
468
551
|
});
|
|
469
|
-
var responseConnectedSchema =
|
|
470
|
-
outcome:
|
|
552
|
+
var responseConnectedSchema = z3.object({
|
|
553
|
+
outcome: z3.literal("connected"),
|
|
471
554
|
established_at: isoDateTimeSchema,
|
|
472
555
|
upstream: streamEndpointSchema.optional(),
|
|
473
556
|
metrics: streamConnectedMetricsSchema,
|
|
474
557
|
termination: terminationSchema.optional(),
|
|
475
558
|
http: httpResponseStageSchema.optional()
|
|
476
559
|
});
|
|
477
|
-
var responseFailedSchema =
|
|
478
|
-
outcome:
|
|
560
|
+
var responseFailedSchema = z3.object({
|
|
561
|
+
outcome: z3.literal("failed"),
|
|
479
562
|
failure: failureSchema,
|
|
480
563
|
upstream: streamEndpointSchema.optional(),
|
|
481
564
|
metrics: streamFailedMetricsSchema.optional(),
|
|
482
565
|
termination: terminationSchema.optional(),
|
|
483
566
|
http: httpResponseStageSchema.optional()
|
|
484
567
|
});
|
|
485
|
-
var responseSchema =
|
|
568
|
+
var responseSchema = z3.discriminatedUnion("outcome", [
|
|
486
569
|
responseConnectedSchema,
|
|
487
570
|
responseFailedSchema
|
|
488
571
|
]);
|
|
489
|
-
var
|
|
572
|
+
var streamWebTTYMetadataSchema = z3.object({
|
|
573
|
+
server_id: nonEmptyStringSchema.optional(),
|
|
574
|
+
session_id: nonEmptyStringSchema.optional(),
|
|
575
|
+
session_group_id: nonEmptyStringSchema.optional(),
|
|
576
|
+
participant_id: nonEmptyStringSchema.optional(),
|
|
577
|
+
participant_role: webTTYParticipantRoleSchema.optional(),
|
|
578
|
+
controller: z3.boolean().optional(),
|
|
579
|
+
recording_mode: webTTYRecordingModeSchema.optional(),
|
|
580
|
+
encryption_mode: webTTYEncryptionModeSchema.optional(),
|
|
581
|
+
encryption_policy: z3.enum(["disabled", "explicit_key", "workspace_managed"]).optional(),
|
|
582
|
+
e2e: z3.boolean().optional(),
|
|
583
|
+
client_proof: z3.enum(["none", "required"]).optional(),
|
|
584
|
+
session_mode: webTTYSessionModeSchema.optional(),
|
|
585
|
+
downstream_transport: webTTYTransportSchema.optional(),
|
|
586
|
+
upstream_transport: webTTYTransportSchema.optional(),
|
|
587
|
+
origin: webTTYOriginSchema.optional(),
|
|
588
|
+
origin_id: z3.string().optional(),
|
|
589
|
+
initiator_kind: webTTYInitiatorKindSchema.optional(),
|
|
590
|
+
device_id: z3.string().optional(),
|
|
591
|
+
browser_id: z3.string().optional()
|
|
592
|
+
}).passthrough();
|
|
593
|
+
var streamSummarySchema = z3.object({
|
|
490
594
|
workspace_id: nonEmptyStringSchema.optional(),
|
|
491
595
|
project_id: nonEmptyStringSchema.optional(),
|
|
492
596
|
cluster_id: nonEmptyStringSchema.optional(),
|
|
@@ -496,80 +600,561 @@ var streamSummarySchema = z2.object({
|
|
|
496
600
|
stream_id: nonEmptyStringSchema,
|
|
497
601
|
created_at: isoDateTimeSchema,
|
|
498
602
|
terminated_at: isoDateTimeSchema,
|
|
499
|
-
request:
|
|
603
|
+
request: z3.object({
|
|
500
604
|
downstream: streamEndpointSchema,
|
|
605
|
+
entry: streamEntrySchema.optional(),
|
|
501
606
|
http: httpRequestStageSchema.optional()
|
|
502
607
|
}),
|
|
503
608
|
firewall: firewallSchema,
|
|
504
609
|
routing: routingSchema,
|
|
610
|
+
webtty: streamWebTTYMetadataSchema.optional(),
|
|
505
611
|
response: responseSchema
|
|
506
612
|
});
|
|
613
|
+
function formatStreamAccessPath(entry) {
|
|
614
|
+
if (!entry) return void 0;
|
|
615
|
+
switch (entry.kind) {
|
|
616
|
+
case "published_tunnel":
|
|
617
|
+
return "Public URL";
|
|
618
|
+
case "private_rstream":
|
|
619
|
+
return "Private rstream dial";
|
|
620
|
+
case "proxy_egress":
|
|
621
|
+
return "Proxy egress";
|
|
622
|
+
case "internal":
|
|
623
|
+
return "Internal";
|
|
624
|
+
default:
|
|
625
|
+
return void 0;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/webtty-resource.ts
|
|
630
|
+
var z4 = __toESM(require("zod"));
|
|
631
|
+
var isoDateTimeSchema2 = z4.string().datetime({ offset: true });
|
|
632
|
+
var decimalCursorSchema = z4.string().regex(/^\d+$/);
|
|
633
|
+
var webTTYSequenceCursorInputSchema = z4.union([
|
|
634
|
+
decimalCursorSchema,
|
|
635
|
+
z4.number().int().nonnegative().safe().transform(String)
|
|
636
|
+
]);
|
|
637
|
+
var webTTYSessionStatusSchema = z4.enum([
|
|
638
|
+
"opening",
|
|
639
|
+
"active",
|
|
640
|
+
"closing",
|
|
641
|
+
"closed",
|
|
642
|
+
"errored"
|
|
643
|
+
]);
|
|
644
|
+
var webTTYControlRequestStatusSchema = z4.enum([
|
|
645
|
+
"pending",
|
|
646
|
+
"granted",
|
|
647
|
+
"refused",
|
|
648
|
+
"revoked",
|
|
649
|
+
"expired"
|
|
650
|
+
]);
|
|
651
|
+
var webTTYEventDirectionSchema = z4.enum([
|
|
652
|
+
"client_to_server",
|
|
653
|
+
"server_to_client",
|
|
654
|
+
"engine_internal"
|
|
655
|
+
]);
|
|
656
|
+
var webTTYStreamTypeSchema = z4.enum(["stdin", "stdout", "stderr"]);
|
|
657
|
+
var webTTYSessionEventTypeSchema = z4.enum([
|
|
658
|
+
"open",
|
|
659
|
+
"ack",
|
|
660
|
+
"data",
|
|
661
|
+
"resize",
|
|
662
|
+
"close",
|
|
663
|
+
"error",
|
|
664
|
+
"participant",
|
|
665
|
+
"control",
|
|
666
|
+
"recording_state"
|
|
667
|
+
]);
|
|
668
|
+
var jsonRecordSchema = z4.record(z4.string(), z4.unknown());
|
|
669
|
+
function rejectCryptoKeyEnvelopes(crypto3, ctx, path) {
|
|
670
|
+
if (crypto3 === null || typeof crypto3 !== "object") {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
if (Object.prototype.hasOwnProperty.call(crypto3, "key_envelopes")) {
|
|
674
|
+
ctx.addIssue({
|
|
675
|
+
code: z4.ZodIssueCode.custom,
|
|
676
|
+
message: "key_envelopes are available only from the WebTTY decrypt-material endpoint.",
|
|
677
|
+
path: [...path, "key_envelopes"]
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
var webTTYCapabilitiesSchema = z4.object({
|
|
682
|
+
managed_protocol: z4.boolean(),
|
|
683
|
+
store_configured: z4.boolean(),
|
|
684
|
+
session_listing: z4.boolean(),
|
|
685
|
+
recording: z4.boolean(),
|
|
686
|
+
replay: z4.boolean(),
|
|
687
|
+
live_attach: z4.boolean(),
|
|
688
|
+
control_transfer: z4.boolean(),
|
|
689
|
+
e2e: z4.boolean(),
|
|
690
|
+
implemented_transports: z4.array(webTTYTransportSchema),
|
|
691
|
+
recording_modes: z4.array(webTTYRecordingModeSchema),
|
|
692
|
+
encryption_modes: z4.array(webTTYEncryptionModeSchema),
|
|
693
|
+
required_permissions: z4.record(z4.string(), z4.array(z4.string()))
|
|
694
|
+
});
|
|
695
|
+
var webTTYSessionLiveSchema = z4.object({
|
|
696
|
+
available: z4.boolean(),
|
|
697
|
+
attachable: z4.boolean(),
|
|
698
|
+
participant_count: z4.number().int().nonnegative(),
|
|
699
|
+
controller_participant_id: z4.string().optional(),
|
|
700
|
+
has_upstream: z4.boolean()
|
|
701
|
+
});
|
|
702
|
+
var webTTYParticipantLiveSchema = z4.object({
|
|
703
|
+
connected: z4.boolean(),
|
|
704
|
+
controller: z4.boolean()
|
|
705
|
+
});
|
|
706
|
+
var webTTYSessionSchema = z4.object({
|
|
707
|
+
id: z4.string(),
|
|
708
|
+
workspace_id: z4.string().optional(),
|
|
709
|
+
project_id: z4.string().optional(),
|
|
710
|
+
cluster_id: z4.string().optional(),
|
|
711
|
+
server_id: z4.string().optional(),
|
|
712
|
+
tunnel_id: z4.string(),
|
|
713
|
+
client_id: z4.string().optional(),
|
|
714
|
+
initiator_user_id: z4.string().optional(),
|
|
715
|
+
group_id: z4.string().optional(),
|
|
716
|
+
status: webTTYSessionStatusSchema,
|
|
717
|
+
session_mode: webTTYSessionModeSchema,
|
|
718
|
+
recording_mode: webTTYRecordingModeSchema,
|
|
719
|
+
encryption_mode: webTTYEncryptionModeSchema,
|
|
720
|
+
downstream_transport: webTTYTransportSchema.optional(),
|
|
721
|
+
upstream_transport: webTTYTransportSchema.optional(),
|
|
722
|
+
command_meta: z4.unknown().optional(),
|
|
723
|
+
context: webTTYContextMetadataSchema.optional(),
|
|
724
|
+
started_at: isoDateTimeSchema2,
|
|
725
|
+
ended_at: isoDateTimeSchema2.optional(),
|
|
726
|
+
exit_code: z4.number().int().optional(),
|
|
727
|
+
error_code: z4.string().optional(),
|
|
728
|
+
error_message: z4.string().optional(),
|
|
729
|
+
live: webTTYSessionLiveSchema.optional()
|
|
730
|
+
}).passthrough();
|
|
731
|
+
var webTTYSessionGroupSchema = z4.object({
|
|
732
|
+
id: z4.string(),
|
|
733
|
+
workspace_id: z4.string().optional(),
|
|
734
|
+
project_id: z4.string().optional(),
|
|
735
|
+
initiator_user_id: z4.string().optional(),
|
|
736
|
+
context: webTTYContextMetadataSchema.optional(),
|
|
737
|
+
created_at: isoDateTimeSchema2,
|
|
738
|
+
updated_at: isoDateTimeSchema2,
|
|
739
|
+
closed_at: isoDateTimeSchema2.optional()
|
|
740
|
+
}).passthrough();
|
|
741
|
+
var webTTYParticipantSchema = z4.object({
|
|
742
|
+
id: z4.string(),
|
|
743
|
+
session_id: z4.string(),
|
|
744
|
+
user_id: z4.string().optional(),
|
|
745
|
+
device_id: z4.string().optional(),
|
|
746
|
+
browser_id: z4.string().optional(),
|
|
747
|
+
role: webTTYParticipantRoleSchema,
|
|
748
|
+
attached_at: isoDateTimeSchema2,
|
|
749
|
+
detached_at: isoDateTimeSchema2.optional(),
|
|
750
|
+
controller: z4.boolean(),
|
|
751
|
+
grant_state: z4.string().optional(),
|
|
752
|
+
attach_grant: z4.string().optional(),
|
|
753
|
+
attach_grant_expires_at: isoDateTimeSchema2.optional(),
|
|
754
|
+
live: webTTYParticipantLiveSchema.optional()
|
|
755
|
+
}).passthrough();
|
|
756
|
+
var webTTYCryptoMetadataSchema = z4.object({
|
|
757
|
+
payload_suite: z4.string().optional(),
|
|
758
|
+
payload_key_id: z4.string().optional(),
|
|
759
|
+
nonce: z4.string().optional(),
|
|
760
|
+
key_envelope_suite: z4.string().optional(),
|
|
761
|
+
key_envelopes: z4.unknown().optional(),
|
|
762
|
+
key_context: z4.unknown().optional(),
|
|
763
|
+
key_context_raw: z4.string().optional()
|
|
764
|
+
}).passthrough();
|
|
765
|
+
var webTTYSessionEventSchema = z4.object({
|
|
766
|
+
id: z4.string(),
|
|
767
|
+
session_id: z4.string(),
|
|
768
|
+
seq: decimalCursorSchema,
|
|
769
|
+
created_at: isoDateTimeSchema2,
|
|
770
|
+
type: webTTYSessionEventTypeSchema,
|
|
771
|
+
direction: webTTYEventDirectionSchema.optional(),
|
|
772
|
+
stream_type: webTTYStreamTypeSchema.optional(),
|
|
773
|
+
participant_id: z4.string().optional(),
|
|
774
|
+
payload_length: z4.number().int().nonnegative().optional(),
|
|
775
|
+
payload_ciphertext: z4.string().optional(),
|
|
776
|
+
payload_plaintext: z4.string().optional(),
|
|
777
|
+
crypto: webTTYCryptoMetadataSchema.optional(),
|
|
778
|
+
prev_hash: z4.string().optional(),
|
|
779
|
+
hash: z4.string().optional(),
|
|
780
|
+
metadata: z4.unknown().optional()
|
|
781
|
+
}).passthrough().superRefine((value, ctx) => {
|
|
782
|
+
rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
|
|
783
|
+
});
|
|
784
|
+
var webTTYKeyGrantBaseShape = {
|
|
785
|
+
id: z4.string(),
|
|
786
|
+
session_id: z4.string(),
|
|
787
|
+
recipient_id: z4.string(),
|
|
788
|
+
recipient_kind: z4.string(),
|
|
789
|
+
granted_by: z4.string().optional(),
|
|
790
|
+
crypto: webTTYCryptoMetadataSchema,
|
|
791
|
+
created_at: isoDateTimeSchema2,
|
|
792
|
+
revoked_at: isoDateTimeSchema2.optional()
|
|
793
|
+
};
|
|
794
|
+
var webTTYKeyGrantSchema = z4.object(webTTYKeyGrantBaseShape).passthrough().superRefine((value, ctx) => {
|
|
795
|
+
if (Object.prototype.hasOwnProperty.call(value, "wrapped_key")) {
|
|
796
|
+
ctx.addIssue({
|
|
797
|
+
code: z4.ZodIssueCode.custom,
|
|
798
|
+
message: "wrapped_key is available only from the WebTTY decrypt-material endpoint.",
|
|
799
|
+
path: ["wrapped_key"]
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
rejectCryptoKeyEnvelopes(value.crypto, ctx, ["crypto"]);
|
|
803
|
+
});
|
|
804
|
+
var webTTYKeyGrantDecryptMaterialSchema = z4.object({
|
|
805
|
+
...webTTYKeyGrantBaseShape,
|
|
806
|
+
wrapped_key: z4.string().optional()
|
|
807
|
+
}).passthrough();
|
|
808
|
+
var webTTYControlRequestSchema = z4.object({
|
|
809
|
+
id: z4.string(),
|
|
810
|
+
session_id: z4.string(),
|
|
811
|
+
requester_participant_id: z4.string(),
|
|
812
|
+
requester_user_id: z4.string().optional(),
|
|
813
|
+
approver_participant_id: z4.string().optional(),
|
|
814
|
+
approver_user_id: z4.string().optional(),
|
|
815
|
+
status: webTTYControlRequestStatusSchema,
|
|
816
|
+
reason: z4.string().optional(),
|
|
817
|
+
metadata: z4.unknown().optional(),
|
|
818
|
+
created_at: isoDateTimeSchema2,
|
|
819
|
+
updated_at: isoDateTimeSchema2,
|
|
820
|
+
resolved_at: isoDateTimeSchema2.optional(),
|
|
821
|
+
expires_at: isoDateTimeSchema2.optional()
|
|
822
|
+
}).passthrough();
|
|
823
|
+
var listWebTTYSessionsFiltersSchema = z4.object({
|
|
824
|
+
server_id: z4.string().optional(),
|
|
825
|
+
tunnel_id: z4.string().optional(),
|
|
826
|
+
user_id: z4.string().optional(),
|
|
827
|
+
group_id: z4.string().optional(),
|
|
828
|
+
origin: webTTYOriginSchema.optional(),
|
|
829
|
+
status: webTTYSessionStatusSchema.optional(),
|
|
830
|
+
started_from: isoDateTimeSchema2.optional(),
|
|
831
|
+
started_to: isoDateTimeSchema2.optional()
|
|
832
|
+
});
|
|
833
|
+
var listWebTTYSessionsParamsSchema = z4.object({
|
|
834
|
+
limit: z4.number().int().min(1).optional(),
|
|
835
|
+
filters: listWebTTYSessionsFiltersSchema.optional()
|
|
836
|
+
});
|
|
837
|
+
var listWebTTYSessionGroupsFiltersSchema = z4.object({
|
|
838
|
+
initiator_user_id: z4.string().optional(),
|
|
839
|
+
origin: webTTYOriginSchema.optional(),
|
|
840
|
+
created_from: isoDateTimeSchema2.optional(),
|
|
841
|
+
created_to: isoDateTimeSchema2.optional()
|
|
842
|
+
});
|
|
843
|
+
var listWebTTYSessionGroupsParamsSchema = z4.object({
|
|
844
|
+
limit: z4.number().int().min(1).optional(),
|
|
845
|
+
filters: listWebTTYSessionGroupsFiltersSchema.optional()
|
|
846
|
+
});
|
|
847
|
+
var readWebTTYSessionEventsParamsSchema = z4.object({
|
|
848
|
+
from_seq: webTTYSequenceCursorInputSchema.optional(),
|
|
849
|
+
limit: z4.number().int().min(1).optional()
|
|
850
|
+
});
|
|
851
|
+
var listWebTTYKeyGrantDecryptMaterialParamsSchema = z4.object({
|
|
852
|
+
recipient_id: z4.string().optional(),
|
|
853
|
+
recipient_kind: z4.string().optional()
|
|
854
|
+
});
|
|
855
|
+
var listWebTTYControlRequestsFiltersSchema = z4.object({
|
|
856
|
+
status: webTTYControlRequestStatusSchema.optional(),
|
|
857
|
+
requester_user_id: z4.string().optional()
|
|
858
|
+
});
|
|
859
|
+
var listWebTTYControlRequestsParamsSchema = z4.object({
|
|
860
|
+
limit: z4.number().int().min(1).optional(),
|
|
861
|
+
filters: listWebTTYControlRequestsFiltersSchema.optional()
|
|
862
|
+
});
|
|
863
|
+
var attachWebTTYParticipantParamsSchema = z4.object({
|
|
864
|
+
role: z4.literal("spectator").optional(),
|
|
865
|
+
device_id: z4.string().optional(),
|
|
866
|
+
browser_id: z4.string().optional(),
|
|
867
|
+
transport: webTTYTransportSchema.optional(),
|
|
868
|
+
grant_state: z4.string().optional(),
|
|
869
|
+
metadata: jsonRecordSchema.optional()
|
|
870
|
+
});
|
|
871
|
+
var detachWebTTYParticipantParamsSchema = z4.object({
|
|
872
|
+
reason: z4.string().optional(),
|
|
873
|
+
metadata: jsonRecordSchema.optional()
|
|
874
|
+
});
|
|
875
|
+
var createWebTTYControlRequestParamsSchema = z4.object({
|
|
876
|
+
participant_id: z4.string(),
|
|
877
|
+
reason: z4.string().optional(),
|
|
878
|
+
metadata: jsonRecordSchema.optional(),
|
|
879
|
+
expires_at: isoDateTimeSchema2.optional()
|
|
880
|
+
});
|
|
881
|
+
var resolveWebTTYControlRequestParamsSchema = z4.object({
|
|
882
|
+
action: z4.enum(["grant", "refuse", "revoke"]),
|
|
883
|
+
approver_participant_id: z4.string().optional(),
|
|
884
|
+
reason: z4.string().optional()
|
|
885
|
+
});
|
|
886
|
+
var webTTYSessionListSchema = z4.array(webTTYSessionSchema);
|
|
887
|
+
var webTTYSessionGroupListSchema = z4.array(webTTYSessionGroupSchema);
|
|
888
|
+
var webTTYParticipantListSchema = z4.array(webTTYParticipantSchema);
|
|
889
|
+
var webTTYSessionEventListSchema = z4.array(webTTYSessionEventSchema);
|
|
890
|
+
var webTTYKeyGrantListSchema = z4.array(webTTYKeyGrantSchema);
|
|
891
|
+
var webTTYKeyGrantDecryptMaterialListSchema = z4.array(
|
|
892
|
+
webTTYKeyGrantDecryptMaterialSchema
|
|
893
|
+
);
|
|
894
|
+
var webTTYControlRequestListSchema = z4.array(webTTYControlRequestSchema);
|
|
895
|
+
function pathId(kind, value) {
|
|
896
|
+
const normalized = value.trim();
|
|
897
|
+
if (!normalized) {
|
|
898
|
+
throw new Error(`${kind} is required.`);
|
|
899
|
+
}
|
|
900
|
+
return encodeURIComponent(normalized);
|
|
901
|
+
}
|
|
902
|
+
function pathWithParams(path, params) {
|
|
903
|
+
if (params === void 0) {
|
|
904
|
+
return path;
|
|
905
|
+
}
|
|
906
|
+
return `${path}?params=${encodeURIComponent(JSON.stringify(params))}`;
|
|
907
|
+
}
|
|
908
|
+
var RstreamWebTTYResource = class {
|
|
909
|
+
client;
|
|
910
|
+
constructor(client) {
|
|
911
|
+
this.client = client;
|
|
912
|
+
}
|
|
913
|
+
async capabilities() {
|
|
914
|
+
const response = await this.client.request(
|
|
915
|
+
"/webtty/capabilities",
|
|
916
|
+
{
|
|
917
|
+
method: "GET"
|
|
918
|
+
}
|
|
919
|
+
);
|
|
920
|
+
return webTTYCapabilitiesSchema.parse(response);
|
|
921
|
+
}
|
|
922
|
+
async listGroups(params) {
|
|
923
|
+
const parsed = params === void 0 ? void 0 : listWebTTYSessionGroupsParamsSchema.parse(params);
|
|
924
|
+
const response = await this.client.request(
|
|
925
|
+
pathWithParams("/webtty/groups", parsed),
|
|
926
|
+
{ method: "GET" }
|
|
927
|
+
);
|
|
928
|
+
return webTTYSessionGroupListSchema.parse(response);
|
|
929
|
+
}
|
|
930
|
+
async getGroup(groupId) {
|
|
931
|
+
const response = await this.client.request(
|
|
932
|
+
`/webtty/groups/${pathId("Session group ID", groupId)}`,
|
|
933
|
+
{ method: "GET" }
|
|
934
|
+
);
|
|
935
|
+
return webTTYSessionGroupSchema.parse(response);
|
|
936
|
+
}
|
|
937
|
+
async listSessions(params) {
|
|
938
|
+
const parsed = params === void 0 ? void 0 : listWebTTYSessionsParamsSchema.parse(params);
|
|
939
|
+
const response = await this.client.request(
|
|
940
|
+
pathWithParams("/webtty/sessions", parsed),
|
|
941
|
+
{ method: "GET" }
|
|
942
|
+
);
|
|
943
|
+
return webTTYSessionListSchema.parse(response);
|
|
944
|
+
}
|
|
945
|
+
async getSession(sessionId) {
|
|
946
|
+
const response = await this.client.request(
|
|
947
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}`,
|
|
948
|
+
{ method: "GET" }
|
|
949
|
+
);
|
|
950
|
+
return webTTYSessionSchema.parse(response);
|
|
951
|
+
}
|
|
952
|
+
async listParticipants(sessionId) {
|
|
953
|
+
const response = await this.client.request(
|
|
954
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/participants`,
|
|
955
|
+
{ method: "GET" }
|
|
956
|
+
);
|
|
957
|
+
return webTTYParticipantListSchema.parse(response);
|
|
958
|
+
}
|
|
959
|
+
async attachParticipant(sessionId, params = {}) {
|
|
960
|
+
const response = await this.client.request(
|
|
961
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/participants`,
|
|
962
|
+
{
|
|
963
|
+
body: JSON.stringify(attachWebTTYParticipantParamsSchema.parse(params)),
|
|
964
|
+
headers: { "Content-Type": "application/json" },
|
|
965
|
+
method: "POST"
|
|
966
|
+
}
|
|
967
|
+
);
|
|
968
|
+
return webTTYParticipantSchema.parse(response);
|
|
969
|
+
}
|
|
970
|
+
async detachParticipant(sessionId, participantId, params = {}) {
|
|
971
|
+
const response = await this.client.request(
|
|
972
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/participants/${pathId("Participant ID", participantId)}`,
|
|
973
|
+
{
|
|
974
|
+
body: JSON.stringify(detachWebTTYParticipantParamsSchema.parse(params)),
|
|
975
|
+
headers: { "Content-Type": "application/json" },
|
|
976
|
+
method: "POST"
|
|
977
|
+
}
|
|
978
|
+
);
|
|
979
|
+
return webTTYParticipantSchema.parse(response);
|
|
980
|
+
}
|
|
981
|
+
async readEvents(sessionId, params) {
|
|
982
|
+
const parsed = params === void 0 ? void 0 : readWebTTYSessionEventsParamsSchema.parse(params);
|
|
983
|
+
const response = await this.client.request(
|
|
984
|
+
pathWithParams(
|
|
985
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/events`,
|
|
986
|
+
parsed
|
|
987
|
+
),
|
|
988
|
+
{ method: "GET" }
|
|
989
|
+
);
|
|
990
|
+
return webTTYSessionEventListSchema.parse(response);
|
|
991
|
+
}
|
|
992
|
+
async listKeyGrants(sessionId) {
|
|
993
|
+
const response = await this.client.request(
|
|
994
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/key-grants`,
|
|
995
|
+
{ method: "GET" }
|
|
996
|
+
);
|
|
997
|
+
return webTTYKeyGrantListSchema.parse(response);
|
|
998
|
+
}
|
|
999
|
+
async listKeyGrantDecryptMaterial(sessionId, params) {
|
|
1000
|
+
const parsed = params === void 0 ? void 0 : listWebTTYKeyGrantDecryptMaterialParamsSchema.parse(params);
|
|
1001
|
+
const response = await this.client.request(
|
|
1002
|
+
pathWithParams(
|
|
1003
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/key-grants/decrypt-material`,
|
|
1004
|
+
parsed
|
|
1005
|
+
),
|
|
1006
|
+
{ method: "GET" }
|
|
1007
|
+
);
|
|
1008
|
+
return webTTYKeyGrantDecryptMaterialListSchema.parse(response);
|
|
1009
|
+
}
|
|
1010
|
+
async listControlRequests(sessionId, params) {
|
|
1011
|
+
const parsed = params === void 0 ? void 0 : listWebTTYControlRequestsParamsSchema.parse(params);
|
|
1012
|
+
const response = await this.client.request(
|
|
1013
|
+
pathWithParams(
|
|
1014
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/control-requests`,
|
|
1015
|
+
parsed
|
|
1016
|
+
),
|
|
1017
|
+
{ method: "GET" }
|
|
1018
|
+
);
|
|
1019
|
+
return webTTYControlRequestListSchema.parse(response);
|
|
1020
|
+
}
|
|
1021
|
+
async createControlRequest(sessionId, params) {
|
|
1022
|
+
const response = await this.client.request(
|
|
1023
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/control-requests`,
|
|
1024
|
+
{
|
|
1025
|
+
body: JSON.stringify(
|
|
1026
|
+
createWebTTYControlRequestParamsSchema.parse(params)
|
|
1027
|
+
),
|
|
1028
|
+
headers: { "Content-Type": "application/json" },
|
|
1029
|
+
method: "POST"
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
return webTTYControlRequestSchema.parse(response);
|
|
1033
|
+
}
|
|
1034
|
+
async resolveControlRequest(sessionId, requestId, params) {
|
|
1035
|
+
const response = await this.client.request(
|
|
1036
|
+
`/webtty/sessions/${pathId("Session ID", sessionId)}/control-requests/${pathId("Control request ID", requestId)}`,
|
|
1037
|
+
{
|
|
1038
|
+
body: JSON.stringify(
|
|
1039
|
+
resolveWebTTYControlRequestParamsSchema.parse(params)
|
|
1040
|
+
),
|
|
1041
|
+
headers: { "Content-Type": "application/json" },
|
|
1042
|
+
method: "POST"
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
return webTTYControlRequestSchema.parse(response);
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
507
1048
|
|
|
508
1049
|
// src/event.ts
|
|
509
1050
|
var import_tunnel = require("@rstreamlabs/rstream/tunnel");
|
|
510
|
-
var
|
|
511
|
-
var
|
|
512
|
-
var initialStateSchema =
|
|
513
|
-
snapshot_at:
|
|
514
|
-
clients:
|
|
515
|
-
tunnels:
|
|
1051
|
+
var z5 = __toESM(require("zod"));
|
|
1052
|
+
var isoDateTimeSchema3 = z5.string().datetime({ offset: true });
|
|
1053
|
+
var initialStateSchema = z5.object({
|
|
1054
|
+
snapshot_at: isoDateTimeSchema3,
|
|
1055
|
+
clients: z5.array(clientSchema),
|
|
1056
|
+
tunnels: z5.array(import_tunnel.tunnelSchema)
|
|
516
1057
|
});
|
|
517
|
-
var eventBaseSchema =
|
|
518
|
-
id:
|
|
519
|
-
created_at:
|
|
520
|
-
user_id:
|
|
521
|
-
workspace_id:
|
|
522
|
-
project_id:
|
|
523
|
-
cluster_id:
|
|
1058
|
+
var eventBaseSchema = z5.object({
|
|
1059
|
+
id: z5.string().optional(),
|
|
1060
|
+
created_at: isoDateTimeSchema3.optional(),
|
|
1061
|
+
user_id: z5.string().optional(),
|
|
1062
|
+
workspace_id: z5.string().optional(),
|
|
1063
|
+
project_id: z5.string().optional(),
|
|
1064
|
+
cluster_id: z5.string().optional()
|
|
524
1065
|
});
|
|
525
|
-
var withEventBase = (shape) =>
|
|
1066
|
+
var withEventBase = (shape) => z5.object(shape).merge(eventBaseSchema).passthrough();
|
|
526
1067
|
var stateInitialEventSchema = withEventBase({
|
|
527
|
-
type:
|
|
1068
|
+
type: z5.literal("state.initial"),
|
|
528
1069
|
object: initialStateSchema
|
|
529
1070
|
});
|
|
530
1071
|
var streamSummaryEventSchema = withEventBase({
|
|
531
|
-
type:
|
|
1072
|
+
type: z5.literal("stream.summary"),
|
|
532
1073
|
object: streamSummarySchema
|
|
533
1074
|
});
|
|
534
1075
|
var commonEventsSchema = [
|
|
535
1076
|
withEventBase({
|
|
536
|
-
type:
|
|
1077
|
+
type: z5.literal("client.created"),
|
|
537
1078
|
object: clientSchema
|
|
538
1079
|
}),
|
|
539
1080
|
withEventBase({
|
|
540
|
-
type:
|
|
1081
|
+
type: z5.literal("client.updated"),
|
|
541
1082
|
object: clientSchema
|
|
542
1083
|
}),
|
|
543
1084
|
withEventBase({
|
|
544
|
-
type:
|
|
1085
|
+
type: z5.literal("client.deleted"),
|
|
545
1086
|
object: clientSchema
|
|
546
1087
|
}),
|
|
547
1088
|
withEventBase({
|
|
548
|
-
type:
|
|
1089
|
+
type: z5.literal("tunnel.created"),
|
|
549
1090
|
object: import_tunnel.tunnelSchema
|
|
550
1091
|
}),
|
|
551
1092
|
withEventBase({
|
|
552
|
-
type:
|
|
1093
|
+
type: z5.literal("tunnel.updated"),
|
|
553
1094
|
object: import_tunnel.tunnelSchema
|
|
554
1095
|
}),
|
|
555
1096
|
withEventBase({
|
|
556
|
-
type:
|
|
1097
|
+
type: z5.literal("tunnel.deleted"),
|
|
557
1098
|
object: import_tunnel.tunnelSchema
|
|
558
1099
|
})
|
|
559
1100
|
];
|
|
1101
|
+
var webTTYEventsSchema = [
|
|
1102
|
+
withEventBase({
|
|
1103
|
+
type: z5.literal("webtty.session.created"),
|
|
1104
|
+
object: webTTYSessionSchema
|
|
1105
|
+
}),
|
|
1106
|
+
withEventBase({
|
|
1107
|
+
type: z5.literal("webtty.session.updated"),
|
|
1108
|
+
object: z5.union([webTTYSessionSchema, webTTYSessionGroupSchema])
|
|
1109
|
+
}),
|
|
1110
|
+
withEventBase({
|
|
1111
|
+
type: z5.literal("webtty.session.ended"),
|
|
1112
|
+
object: webTTYSessionSchema
|
|
1113
|
+
}),
|
|
1114
|
+
withEventBase({
|
|
1115
|
+
type: z5.literal("webtty.participant.joined"),
|
|
1116
|
+
object: webTTYParticipantSchema
|
|
1117
|
+
}),
|
|
1118
|
+
withEventBase({
|
|
1119
|
+
type: z5.literal("webtty.participant.updated"),
|
|
1120
|
+
object: webTTYParticipantSchema
|
|
1121
|
+
}),
|
|
1122
|
+
withEventBase({
|
|
1123
|
+
type: z5.literal("webtty.participant.left"),
|
|
1124
|
+
object: webTTYParticipantSchema
|
|
1125
|
+
}),
|
|
1126
|
+
withEventBase({
|
|
1127
|
+
type: z5.literal("webtty.control.requested"),
|
|
1128
|
+
object: webTTYControlRequestSchema
|
|
1129
|
+
}),
|
|
1130
|
+
withEventBase({
|
|
1131
|
+
type: z5.literal("webtty.control.granted"),
|
|
1132
|
+
object: webTTYControlRequestSchema
|
|
1133
|
+
}),
|
|
1134
|
+
withEventBase({
|
|
1135
|
+
type: z5.literal("webtty.control.refused"),
|
|
1136
|
+
object: webTTYControlRequestSchema
|
|
1137
|
+
}),
|
|
1138
|
+
withEventBase({
|
|
1139
|
+
type: z5.literal("webtty.control.revoked"),
|
|
1140
|
+
object: webTTYControlRequestSchema
|
|
1141
|
+
})
|
|
1142
|
+
];
|
|
560
1143
|
var webhookDeliverableEventsSchema = [
|
|
561
1144
|
commonEventsSchema[0],
|
|
562
1145
|
commonEventsSchema[2],
|
|
563
1146
|
commonEventsSchema[3],
|
|
564
|
-
commonEventsSchema[5]
|
|
1147
|
+
commonEventsSchema[5],
|
|
1148
|
+
...webTTYEventsSchema
|
|
565
1149
|
];
|
|
566
|
-
var wsEventsSchema =
|
|
1150
|
+
var wsEventsSchema = z5.union([
|
|
567
1151
|
stateInitialEventSchema,
|
|
568
|
-
...commonEventsSchema
|
|
1152
|
+
...commonEventsSchema,
|
|
1153
|
+
...webTTYEventsSchema
|
|
569
1154
|
]);
|
|
570
|
-
var webhookEventsSchema =
|
|
1155
|
+
var webhookEventsSchema = z5.union(webhookDeliverableEventsSchema);
|
|
571
1156
|
var projectLogEventsSchema = streamSummaryEventSchema;
|
|
572
|
-
var eventSchema =
|
|
1157
|
+
var eventSchema = z5.union([
|
|
573
1158
|
wsEventsSchema,
|
|
574
1159
|
webhookEventsSchema,
|
|
575
1160
|
projectLogEventsSchema
|
|
@@ -577,7 +1162,7 @@ var eventSchema = z3.union([
|
|
|
577
1162
|
|
|
578
1163
|
// src/tunnel.ts
|
|
579
1164
|
var import_tunnel2 = require("@rstreamlabs/rstream/tunnel");
|
|
580
|
-
var
|
|
1165
|
+
var z6 = __toESM(require("zod"));
|
|
581
1166
|
var DEFAULT_PUBLISHED_PORT = 443;
|
|
582
1167
|
var tunnelFilterSchema = import_tunnel2.tunnelSchema.pick({
|
|
583
1168
|
id: true,
|
|
@@ -592,11 +1177,11 @@ var tunnelFilterSchema = import_tunnel2.tunnelSchema.pick({
|
|
|
592
1177
|
http_version: true,
|
|
593
1178
|
labels: true
|
|
594
1179
|
}).partial();
|
|
595
|
-
var listTunnelsParamsSchema =
|
|
596
|
-
limit:
|
|
1180
|
+
var listTunnelsParamsSchema = z6.object({
|
|
1181
|
+
limit: z6.number().int().min(1).optional(),
|
|
597
1182
|
filters: tunnelFilterSchema.optional()
|
|
598
1183
|
});
|
|
599
|
-
var listTunnelsResponseSchema =
|
|
1184
|
+
var listTunnelsResponseSchema = z6.array(import_tunnel2.tunnelSchema);
|
|
600
1185
|
function formatTunnelHost(tunnel) {
|
|
601
1186
|
if (!tunnel.hostname) return tunnel.host;
|
|
602
1187
|
if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
|
|
@@ -607,7 +1192,7 @@ function formatTunnelHost(tunnel) {
|
|
|
607
1192
|
|
|
608
1193
|
// src/openapi.ts
|
|
609
1194
|
var import_tunnel5 = require("@rstreamlabs/rstream/tunnel");
|
|
610
|
-
var
|
|
1195
|
+
var z7 = __toESM(require("zod"));
|
|
611
1196
|
var jsonContentType = "application/json";
|
|
612
1197
|
var openApiContentType = "application/vnd.oai.openapi+json;version=3.1";
|
|
613
1198
|
function isRecord(value) {
|
|
@@ -621,10 +1206,10 @@ function dropSchemaKeyword(value) {
|
|
|
621
1206
|
}
|
|
622
1207
|
function jsonSchemaFor(schema) {
|
|
623
1208
|
return dropSchemaKeyword(
|
|
624
|
-
|
|
1209
|
+
z7.toJSONSchema(schema, {
|
|
625
1210
|
unrepresentable: "any",
|
|
626
1211
|
override: (ctx) => {
|
|
627
|
-
if (ctx.zodSchema instanceof
|
|
1212
|
+
if (ctx.zodSchema instanceof z7.ZodDate) {
|
|
628
1213
|
ctx.jsonSchema.type = "string";
|
|
629
1214
|
ctx.jsonSchema.format = "date-time";
|
|
630
1215
|
}
|
|
@@ -691,7 +1276,7 @@ var readEngineStreamsRules = [
|
|
|
691
1276
|
action: "read"
|
|
692
1277
|
}
|
|
693
1278
|
];
|
|
694
|
-
var watchParamsSchema =
|
|
1279
|
+
var watchParamsSchema = z7.object({
|
|
695
1280
|
clients: clientFilterSchema.optional(),
|
|
696
1281
|
tunnels: tunnelFilterSchema.optional()
|
|
697
1282
|
});
|
|
@@ -720,6 +1305,40 @@ var enginePermissions = {
|
|
|
720
1305
|
action: ["create", "delete"]
|
|
721
1306
|
}
|
|
722
1307
|
]
|
|
1308
|
+
},
|
|
1309
|
+
"webtty.sessions.read-only": {
|
|
1310
|
+
name: "WebTTY Sessions: Read-Only",
|
|
1311
|
+
description: "List managed WebTTY sessions, participants, replay state, and join as a spectator.",
|
|
1312
|
+
rules: [
|
|
1313
|
+
{
|
|
1314
|
+
resource: "engine.webtty.sessions",
|
|
1315
|
+
action: "read"
|
|
1316
|
+
}
|
|
1317
|
+
]
|
|
1318
|
+
},
|
|
1319
|
+
"webtty.sessions.read-write": {
|
|
1320
|
+
name: "WebTTY Sessions: Read and Write",
|
|
1321
|
+
description: "Create managed WebTTY sessions and coordinate control requests for active sessions.",
|
|
1322
|
+
rules: [
|
|
1323
|
+
{
|
|
1324
|
+
resource: "engine.webtty.sessions",
|
|
1325
|
+
action: ["read", "write"]
|
|
1326
|
+
}
|
|
1327
|
+
]
|
|
1328
|
+
},
|
|
1329
|
+
"webtty.logs.read-only": {
|
|
1330
|
+
name: "WebTTY Session Logs: Read-Only",
|
|
1331
|
+
description: "Read managed WebTTY session logs. End-to-end encrypted content still requires trusted local key material.",
|
|
1332
|
+
rules: [
|
|
1333
|
+
{
|
|
1334
|
+
resource: "engine.webtty.sessions",
|
|
1335
|
+
action: "read"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
resource: "engine.webtty.logs",
|
|
1339
|
+
action: "read"
|
|
1340
|
+
}
|
|
1341
|
+
]
|
|
723
1342
|
}
|
|
724
1343
|
};
|
|
725
1344
|
var engineOpenApiDocument = {
|
|
@@ -839,11 +1458,14 @@ var engineOpenApiDocument = {
|
|
|
839
1458
|
"tunnels.resources.read-only",
|
|
840
1459
|
"tunnels.streams.create-delete"
|
|
841
1460
|
],
|
|
842
|
-
"
|
|
1461
|
+
"run-tunnel-webtty": [
|
|
843
1462
|
"tunnels.resources.read-only",
|
|
844
1463
|
"tunnels.tunnels.create-delete",
|
|
845
1464
|
"tunnels.streams.create-delete"
|
|
846
|
-
]
|
|
1465
|
+
],
|
|
1466
|
+
"join-managed-webtty": ["webtty.sessions.read-only"],
|
|
1467
|
+
"control-managed-webtty": ["webtty.sessions.read-write"],
|
|
1468
|
+
"read-managed-webtty-recordings": ["webtty.logs.read-only"]
|
|
847
1469
|
},
|
|
848
1470
|
paths: {
|
|
849
1471
|
"/api/openapi.json": {
|
|
@@ -1111,20 +1733,20 @@ var import_rstream8 = require("@rstreamlabs/rstream");
|
|
|
1111
1733
|
var import_rstream9 = require("@rstreamlabs/rstream");
|
|
1112
1734
|
var import_rstream10 = require("@rstreamlabs/rstream");
|
|
1113
1735
|
var import_turn = require("@rstreamlabs/rstream/turn");
|
|
1114
|
-
var
|
|
1736
|
+
var z8 = __toESM(require("zod"));
|
|
1115
1737
|
var import_crypto = __toESM(require("crypto"));
|
|
1116
1738
|
var defaultTURNPort = 3478;
|
|
1117
1739
|
var defaultTURNSPort = 5349;
|
|
1118
1740
|
var defaultTURNCredentialTTLSeconds = 10 * 60;
|
|
1119
1741
|
var maxTURNCredentialTTLSeconds = 60 * 60;
|
|
1120
|
-
var turnTokenClaimsSchema =
|
|
1121
|
-
exp:
|
|
1122
|
-
iat:
|
|
1123
|
-
token_endpoint:
|
|
1124
|
-
tokendpoint:
|
|
1125
|
-
type:
|
|
1742
|
+
var turnTokenClaimsSchema = z8.object({
|
|
1743
|
+
exp: z8.number().int().optional(),
|
|
1744
|
+
iat: z8.number().int().optional(),
|
|
1745
|
+
token_endpoint: z8.string().regex(/^[0-9a-f]{8}$/i).optional(),
|
|
1746
|
+
tokendpoint: z8.string().regex(/^[0-9a-f]{8}$/i).optional(),
|
|
1747
|
+
type: z8.enum(["app", "auth", "pat"])
|
|
1126
1748
|
});
|
|
1127
|
-
var turnCredentialModeSchema =
|
|
1749
|
+
var turnCredentialModeSchema = z8.enum(["api", "app", "pat"]);
|
|
1128
1750
|
function normalizeOptionalString2(value) {
|
|
1129
1751
|
const normalized = value?.trim();
|
|
1130
1752
|
return normalized ? normalized : void 0;
|
|
@@ -1740,6 +2362,9 @@ var RstreamTunnelsClient = class {
|
|
|
1740
2362
|
get webhooks() {
|
|
1741
2363
|
return new RstreamWebhookResource();
|
|
1742
2364
|
}
|
|
2365
|
+
get webtty() {
|
|
2366
|
+
return new RstreamWebTTYResource(this);
|
|
2367
|
+
}
|
|
1743
2368
|
get turn() {
|
|
1744
2369
|
return new RstreamTURNResource(this);
|
|
1745
2370
|
}
|
|
@@ -1954,8 +2579,8 @@ var Watch = class {
|
|
|
1954
2579
|
};
|
|
1955
2580
|
|
|
1956
2581
|
// src/webtty.ts
|
|
1957
|
-
var
|
|
1958
|
-
var osFamilySchema =
|
|
2582
|
+
var z9 = __toESM(require("zod"));
|
|
2583
|
+
var osFamilySchema = z9.enum([
|
|
1959
2584
|
"linux",
|
|
1960
2585
|
"macos",
|
|
1961
2586
|
"windows",
|
|
@@ -1963,25 +2588,45 @@ var osFamilySchema = z7.enum([
|
|
|
1963
2588
|
"openbsd",
|
|
1964
2589
|
"freebsd"
|
|
1965
2590
|
]);
|
|
1966
|
-
var webttyCapabilitySchema =
|
|
1967
|
-
var webttyFSModeSchema =
|
|
1968
|
-
var
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2591
|
+
var webttyCapabilitySchema = z9.enum(["exec", "fs"]);
|
|
2592
|
+
var webttyFSModeSchema = z9.enum(["read-write", "read-only"]);
|
|
2593
|
+
var webttyEncryptionPolicySchema = z9.enum([
|
|
2594
|
+
"disabled",
|
|
2595
|
+
"explicit_key",
|
|
2596
|
+
"workspace_managed"
|
|
2597
|
+
]);
|
|
2598
|
+
var webttyServerSchema = z9.object({
|
|
2599
|
+
tunnel_id: z9.string(),
|
|
2600
|
+
tunnel_name: z9.string().optional(),
|
|
2601
|
+
target: z9.string().optional(),
|
|
2602
|
+
rstream_url: z9.string().optional(),
|
|
2603
|
+
status: z9.string().optional(),
|
|
2604
|
+
publish: z9.boolean().optional(),
|
|
2605
|
+
workspace_id: z9.string().optional(),
|
|
2606
|
+
project_id: z9.string().optional(),
|
|
2607
|
+
tunnel_protocol: z9.enum(["http", "webtty"]),
|
|
2608
|
+
managed: z9.boolean(),
|
|
2609
|
+
host: z9.string(),
|
|
2610
|
+
token_auth: z9.boolean(),
|
|
2611
|
+
server_id: z9.string().optional(),
|
|
2612
|
+
server_name: z9.string().optional(),
|
|
2613
|
+
host_key_id: z9.string().optional(),
|
|
2614
|
+
e2e: z9.enum(["disabled", "required"]).optional(),
|
|
2615
|
+
client_proof: z9.enum(["none", "required"]).optional(),
|
|
2616
|
+
encryption_policy: webttyEncryptionPolicySchema.optional(),
|
|
2617
|
+
capabilities: z9.array(webttyCapabilitySchema).optional(),
|
|
2618
|
+
exec_path: z9.string().optional(),
|
|
2619
|
+
fs_path: z9.string().optional(),
|
|
1975
2620
|
fs_mode: webttyFSModeSchema.optional(),
|
|
1976
2621
|
os_family: osFamilySchema.optional(),
|
|
1977
|
-
arch:
|
|
1978
|
-
os_id:
|
|
1979
|
-
os_version_id:
|
|
1980
|
-
os_version_codename:
|
|
1981
|
-
os_pretty_name:
|
|
1982
|
-
kernel_release:
|
|
1983
|
-
hostname:
|
|
1984
|
-
labels:
|
|
2622
|
+
arch: z9.string().optional(),
|
|
2623
|
+
os_id: z9.string().optional(),
|
|
2624
|
+
os_version_id: z9.string().optional(),
|
|
2625
|
+
os_version_codename: z9.string().optional(),
|
|
2626
|
+
os_pretty_name: z9.string().optional(),
|
|
2627
|
+
kernel_release: z9.string().optional(),
|
|
2628
|
+
hostname: z9.string().optional(),
|
|
2629
|
+
labels: z9.record(z9.string(), z9.string().optional()).optional()
|
|
1985
2630
|
});
|
|
1986
2631
|
function isWebTTYCapability(value) {
|
|
1987
2632
|
return webttyCapabilitySchema.safeParse(value).success;
|
|
@@ -2002,9 +2647,10 @@ function webTTYHasCapability(capabilities, capability) {
|
|
|
2002
2647
|
function parser(tunnel) {
|
|
2003
2648
|
if (tunnel.status !== "online") return null;
|
|
2004
2649
|
if (tunnel.publish !== true) return null;
|
|
2005
|
-
|
|
2650
|
+
const managedProtocol = tunnel.protocol === "webtty";
|
|
2651
|
+
if (tunnel.protocol !== "http" && !managedProtocol) return null;
|
|
2006
2652
|
const tunnelLabels = tunnel.labels ?? {};
|
|
2007
|
-
if (tunnelLabels["application-protocol"] !== "rstream.webtty") {
|
|
2653
|
+
if (!managedProtocol && tunnelLabels["application-protocol"] !== "rstream.webtty") {
|
|
2008
2654
|
return null;
|
|
2009
2655
|
}
|
|
2010
2656
|
const capabilities = webTTYCapabilitiesForLabels(tunnelLabels);
|
|
@@ -2015,10 +2661,30 @@ function parser(tunnel) {
|
|
|
2015
2661
|
if (labelKey.length === 0) continue;
|
|
2016
2662
|
labels[labelKey] = value;
|
|
2017
2663
|
}
|
|
2664
|
+
const name = (tunnel.name ?? "").trim();
|
|
2665
|
+
const serverId = (tunnelLabels["rstream.webtty.server_id"] ?? "").trim();
|
|
2666
|
+
const serverName = (tunnelLabels["rstream.webtty.server_name"] ?? "").trim();
|
|
2667
|
+
const target = serverName || name || tunnel.id;
|
|
2668
|
+
const rstreamTarget = serverId || name || tunnel.id;
|
|
2018
2669
|
const candidate = {
|
|
2019
2670
|
tunnel_id: tunnel.id,
|
|
2671
|
+
tunnel_name: name || void 0,
|
|
2672
|
+
target,
|
|
2673
|
+
rstream_url: `rstrm://${rstreamTarget}`,
|
|
2674
|
+
status: tunnel.status,
|
|
2675
|
+
publish: tunnel.publish === true,
|
|
2676
|
+
workspace_id: tunnel.workspace_id,
|
|
2677
|
+
project_id: tunnel.project_id,
|
|
2678
|
+
tunnel_protocol: tunnel.protocol,
|
|
2679
|
+
managed: managedProtocol,
|
|
2020
2680
|
host: formatTunnelHost(tunnel),
|
|
2021
2681
|
token_auth: tunnel.token_auth === true,
|
|
2682
|
+
server_id: serverId || void 0,
|
|
2683
|
+
server_name: serverName || void 0,
|
|
2684
|
+
host_key_id: tunnelLabels["rstream.webtty.host_key_id"],
|
|
2685
|
+
e2e: tunnelLabels["rstream.webtty.e2e"],
|
|
2686
|
+
client_proof: tunnelLabels["rstream.webtty.client_proof"],
|
|
2687
|
+
encryption_policy: tunnelLabels["rstream.webtty.encryption_policy"],
|
|
2022
2688
|
capabilities,
|
|
2023
2689
|
exec_path: webTTYHasCapability(capabilities, "exec") ? tunnelLabels["rstream.webtty.exec.path"] ?? "/" : void 0,
|
|
2024
2690
|
fs_path: webTTYHasCapability(capabilities, "fs") ? tunnelLabels["rstream.webtty.fs.path"] ?? "/fs" : void 0,
|
|
@@ -2051,6 +2717,7 @@ function parseWebTTYServers(tunnels) {
|
|
|
2051
2717
|
RstreamTunnelsClient,
|
|
2052
2718
|
RstreamTunnelsResource,
|
|
2053
2719
|
RstreamTunnelsRessource,
|
|
2720
|
+
RstreamWebTTYResource,
|
|
2054
2721
|
RstreamWebhookResource,
|
|
2055
2722
|
RstreamWebhookRessource,
|
|
2056
2723
|
Tunnels,
|
|
@@ -2060,6 +2727,7 @@ function parseWebTTYServers(tunnels) {
|
|
|
2060
2727
|
WEBHOOK_ID_HEADER,
|
|
2061
2728
|
WEBHOOK_SIGNATURE_HEADER,
|
|
2062
2729
|
Watch,
|
|
2730
|
+
attachWebTTYParticipantParamsSchema,
|
|
2063
2731
|
buildWebhookHeaders,
|
|
2064
2732
|
clientFilterSchema,
|
|
2065
2733
|
clientSchema,
|
|
@@ -2068,30 +2736,59 @@ function parseWebTTYServers(tunnels) {
|
|
|
2068
2736
|
createAuthTokenFromClientCredentials,
|
|
2069
2737
|
createPATTURNCredentials,
|
|
2070
2738
|
createTURNCredentials,
|
|
2739
|
+
createWebTTYControlRequestParamsSchema,
|
|
2740
|
+
detachWebTTYParticipantParamsSchema,
|
|
2071
2741
|
engineOpenApiDocument,
|
|
2072
2742
|
engineOpenApiJson,
|
|
2073
2743
|
eventSchema,
|
|
2744
|
+
formatStreamAccessPath,
|
|
2074
2745
|
formatTunnelHost,
|
|
2075
2746
|
generateWebhookSigningSecret,
|
|
2076
2747
|
listClientsParamsSchema,
|
|
2077
2748
|
listClientsResponseSchema,
|
|
2078
2749
|
listTunnelsParamsSchema,
|
|
2079
2750
|
listTunnelsResponseSchema,
|
|
2751
|
+
listWebTTYControlRequestsParamsSchema,
|
|
2752
|
+
listWebTTYKeyGrantDecryptMaterialParamsSchema,
|
|
2753
|
+
listWebTTYSessionGroupsParamsSchema,
|
|
2754
|
+
listWebTTYSessionsParamsSchema,
|
|
2080
2755
|
normalizeEngineAddress,
|
|
2081
2756
|
parseWebTTYServers,
|
|
2082
2757
|
projectLogEventsSchema,
|
|
2758
|
+
readWebTTYSessionEventsParamsSchema,
|
|
2083
2759
|
resolveControlPlaneCredentials,
|
|
2084
2760
|
resolveManagedTunnelsProject,
|
|
2085
2761
|
resolveTunnelsAPIURL,
|
|
2086
2762
|
resolveTunnelsCredentials,
|
|
2087
2763
|
resolveTunnelsEngine,
|
|
2764
|
+
resolveWebTTYControlRequestParamsSchema,
|
|
2088
2765
|
signWebhookPayload,
|
|
2089
2766
|
streamEndpointSchema,
|
|
2767
|
+
streamEntrySchema,
|
|
2090
2768
|
streamSummaryEventSchema,
|
|
2091
2769
|
streamSummarySchema,
|
|
2092
2770
|
streamTLSInfoSchema,
|
|
2771
|
+
streamWebTTYMetadataSchema,
|
|
2093
2772
|
tunnelFilterSchema,
|
|
2094
2773
|
turnCredentialModeSchema,
|
|
2774
|
+
webTTYCapabilitiesSchema,
|
|
2775
|
+
webTTYContextMetadataSchema,
|
|
2776
|
+
webTTYControlRequestSchema,
|
|
2777
|
+
webTTYCryptoMetadataSchema,
|
|
2778
|
+
webTTYEncryptionModeSchema,
|
|
2779
|
+
webTTYKeyGrantDecryptMaterialSchema,
|
|
2780
|
+
webTTYKeyGrantSchema,
|
|
2781
|
+
webTTYOriginSchema,
|
|
2782
|
+
webTTYParticipantLiveSchema,
|
|
2783
|
+
webTTYParticipantRoleSchema,
|
|
2784
|
+
webTTYParticipantSchema,
|
|
2785
|
+
webTTYRecordingModeSchema,
|
|
2786
|
+
webTTYSessionEventSchema,
|
|
2787
|
+
webTTYSessionGroupSchema,
|
|
2788
|
+
webTTYSessionLiveSchema,
|
|
2789
|
+
webTTYSessionModeSchema,
|
|
2790
|
+
webTTYSessionSchema,
|
|
2791
|
+
webTTYTransportSchema,
|
|
2095
2792
|
webhookEventsSchema,
|
|
2096
2793
|
webttyServerSchema,
|
|
2097
2794
|
wsEventsSchema
|