Open History to see the last commit
1import {
2 type AuthClientPresentationMetadata,
3 type AuthEnvironmentScope,
4 type DesktopSshEnvironmentBootstrap,
5 type DesktopSshEnvironmentTarget,
6 EnvironmentId,
7} from "@t3tools/contracts";
8import * as Context from "effect/Context";
9import type * as Effect from "effect/Effect";
10import type * as Option from "effect/Option";
11
12import type { ConnectionAttemptError } from "../connection/model.ts";
13
14export interface PreparedSshEnvironment {
15 readonly bootstrap: DesktopSshEnvironmentBootstrap;
16 readonly bearerToken: string;
17}
18
19export interface ProvisionedSshEnvironment extends PreparedSshEnvironment {
20 readonly environmentId: EnvironmentId;
21 readonly label: string;
22}
23
24export class CloudSession extends Context.Service<
25 CloudSession,
26 {
27 readonly clerkToken: Effect.Effect<string, ConnectionAttemptError>;
28 }
29>()("@t3tools/client-runtime/platform/capabilities/CloudSession") {}
30
31export class RelayDeviceIdentity extends Context.Service<
32 RelayDeviceIdentity,
33 {
34 readonly deviceId: Effect.Effect<Option.Option<string>, ConnectionAttemptError>;
35 }
36>()("@t3tools/client-runtime/platform/capabilities/RelayDeviceIdentity") {}
37
38export class ClientPresentation extends Context.Service<
39 ClientPresentation,
40 {
41 readonly metadata: AuthClientPresentationMetadata;
42 readonly scopes: ReadonlyArray<AuthEnvironmentScope>;
43 }
44>()("@t3tools/client-runtime/platform/capabilities/ClientPresentation") {}
45
46export class PrimaryEnvironmentAuth extends Context.Service<
47 PrimaryEnvironmentAuth,
48 {
49 readonly bearerToken: Effect.Effect<Option.Option<string>, ConnectionAttemptError>;
50 }
51>()("@t3tools/client-runtime/platform/capabilities/PrimaryEnvironmentAuth") {}
52
53export class SshEnvironmentGateway extends Context.Service<
54 SshEnvironmentGateway,
55 {
56 readonly provision: (
57 target: DesktopSshEnvironmentTarget,
58 ) => Effect.Effect<ProvisionedSshEnvironment, ConnectionAttemptError>;
59 readonly prepare: (input: {
60 readonly connectionId: string;
61 readonly expectedEnvironmentId: EnvironmentId;
62 readonly target: DesktopSshEnvironmentTarget;
63 }) => Effect.Effect<PreparedSshEnvironment, ConnectionAttemptError>;
64 readonly disconnect: (
65 target: DesktopSshEnvironmentTarget,
66 ) => Effect.Effect<void, ConnectionAttemptError>;
67 }
68>()("@t3tools/client-runtime/platform/capabilities/SshEnvironmentGateway") {}