@roamcode.ai/server 1.4.5 → 2.0.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.
@@ -1,134 +0,0 @@
1
- import { FastifyInstance } from 'fastify';
2
-
3
- type RelayAccountStoreMode = "sqlite" | "memory";
4
- type RelayAccountStatus = "active" | "suspended" | "deleted";
5
- type RelayAccountPlan = "free" | "team" | "enterprise";
6
- interface RelayAccountRecord {
7
- id: string;
8
- label: string;
9
- status: RelayAccountStatus;
10
- plan: RelayAccountPlan;
11
- maxRoutes: number;
12
- maxDevicesPerRoute: number;
13
- revision: number;
14
- createdAt: number;
15
- updatedAt: number;
16
- }
17
- interface RelayAccountFields {
18
- /** Stable control-plane identity. Omit for the legacy server-generated account flow. */
19
- id?: string;
20
- label: string;
21
- plan?: RelayAccountPlan;
22
- maxRoutes?: number;
23
- maxDevicesPerRoute?: number;
24
- }
25
- interface RelayAccountCredentialMaterial {
26
- credentialHash: string;
27
- credentialLookup: string;
28
- }
29
- type CreateRelayAccountInput = RelayAccountFields & (({
30
- credential: string;
31
- } & Partial<Record<keyof RelayAccountCredentialMaterial, never>>) | ({
32
- credential?: never;
33
- } & RelayAccountCredentialMaterial));
34
- type RelayAccountCredentialInput = string | RelayAccountCredentialMaterial;
35
- interface UpdateRelayAccountInput {
36
- label?: string;
37
- status?: RelayAccountStatus;
38
- plan?: RelayAccountPlan;
39
- maxRoutes?: number;
40
- maxDevicesPerRoute?: number;
41
- }
42
- interface RelayAccountStore {
43
- readonly mode: RelayAccountStoreMode;
44
- createAccount(input: CreateRelayAccountInput, now?: number): RelayAccountRecord;
45
- getAccount(id: string): RelayAccountRecord | undefined;
46
- listAccounts(options?: {
47
- includeDeleted?: boolean;
48
- }): RelayAccountRecord[];
49
- /** Verify ownership for recovery without granting a suspended account route access. */
50
- verifyCredential(credential: string): RelayAccountRecord | undefined;
51
- authenticate(credential: string): RelayAccountRecord | undefined;
52
- /** Constant-time comparison for idempotent control-plane provisioning and credential rotation. */
53
- credentialMatches(id: string, credential: RelayAccountCredentialInput): boolean;
54
- updateAccount(id: string, input: UpdateRelayAccountInput, expectedRevision: number, now?: number): RelayAccountRecord | undefined;
55
- rotateCredential(id: string, credential: RelayAccountCredentialInput, expectedRevision: number, now?: number): RelayAccountRecord | undefined;
56
- close(): void;
57
- }
58
-
59
- type RelayStoreMode = "sqlite" | "memory";
60
- interface RelayRouteRecord {
61
- id: string;
62
- label: string;
63
- hostCredentialHash: string;
64
- ownerAccountId?: string;
65
- createdAt: number;
66
- updatedAt: number;
67
- }
68
- interface RelayDeviceRouteRecord {
69
- routeId: string;
70
- deviceId: string;
71
- credentialHash: string;
72
- createdAt: number;
73
- updatedAt: number;
74
- /** Bootstrap credentials expire unless the host promotes the device after the E2E pairing claim. */
75
- expiresAt?: number;
76
- }
77
- interface PublicRelayRouteRecord {
78
- id: string;
79
- label: string;
80
- deviceCount: number;
81
- createdAt: number;
82
- updatedAt: number;
83
- }
84
- interface RelayRouteStore {
85
- readonly mode: RelayStoreMode;
86
- createRoute(input: {
87
- id?: string;
88
- label: string;
89
- hostCredentialHash: string;
90
- ownerAccountId?: string;
91
- }, now?: number): RelayRouteRecord;
92
- getRoute(id: string): RelayRouteRecord | undefined;
93
- listRoutes(now?: number): PublicRelayRouteRecord[];
94
- listRoutesByOwner(ownerAccountId: string, now?: number): PublicRelayRouteRecord[];
95
- countDevices(routeId: string, now?: number): number;
96
- rotateHostCredential(routeId: string, credentialHash: string, now?: number): boolean;
97
- deleteRoute(id: string): boolean;
98
- authenticateHost(routeId: string, credential: string): boolean;
99
- putDevice(input: {
100
- routeId: string;
101
- deviceId: string;
102
- credentialHash: string;
103
- expiresAt?: number;
104
- }, now?: number): RelayDeviceRouteRecord;
105
- getDevice(routeId: string, deviceId: string, now?: number): RelayDeviceRouteRecord | undefined;
106
- authenticateDevice(routeId: string, deviceId: string, credential: string, now?: number): boolean;
107
- revokeDevice(routeId: string, deviceId: string): boolean;
108
- close(): void;
109
- }
110
-
111
- interface BlindRelayMetrics {
112
- activeConnections: number;
113
- activeHosts: number;
114
- activeDevices: number;
115
- acceptedConnections: number;
116
- rejectedConnections: number;
117
- forwardedFrames: number;
118
- forwardedBytes: number;
119
- droppedFrames: number;
120
- }
121
- interface BlindRelayServer {
122
- app: FastifyInstance;
123
- store: RelayRouteStore;
124
- accountStore?: RelayAccountStore;
125
- metrics(): BlindRelayMetrics;
126
- }
127
-
128
- interface StartedBlindRelay extends BlindRelayServer {
129
- url: string;
130
- }
131
- declare function startBlindRelay(env?: NodeJS.ProcessEnv): Promise<StartedBlindRelay>;
132
- declare function isRelayDirectExecution(moduleUrl: string, argv1: string | undefined, embeddedContainerBuild?: boolean): boolean;
133
-
134
- export { type StartedBlindRelay, isRelayDirectExecution, startBlindRelay };