@roamcode.ai/server 1.0.23 → 1.2.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/dist/container/relay.js +2028 -0
- package/dist/health-watchdog.js +87 -0
- package/dist/index.d.ts +1821 -24
- package/dist/index.js +18902 -3853
- package/dist/managed-update-helper.js +4 -1
- package/dist/relay-start.d.ts +130 -0
- package/dist/relay-start.js +2023 -0
- package/dist/start.d.ts +504 -19
- package/dist/start.js +17559 -4662
- package/package.json +6 -5
|
@@ -406,7 +406,10 @@ async function smokeServer(serverEntry, dataDir, nodePath, log) {
|
|
|
406
406
|
ACCESS_TOKEN: `rc-smoke-${randomUUID()}`,
|
|
407
407
|
ROAMCODE_DATA_DIR: smokeDir,
|
|
408
408
|
RC_TMUX_SOCKET: `rc-smoke-${process.pid}`,
|
|
409
|
-
ROAMCODE_INSTALL_ROOT: ""
|
|
409
|
+
ROAMCODE_INSTALL_ROOT: "",
|
|
410
|
+
// The boot smoke already owns this isolated child and health-checks it directly. Never let an
|
|
411
|
+
// inherited managed-launcher marker create a second supervisor for the throwaway process.
|
|
412
|
+
ROAMCODE_DISABLE_WATCHDOG: "1"
|
|
410
413
|
},
|
|
411
414
|
stdio: ["ignore", "pipe", "pipe"]
|
|
412
415
|
});
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
label: string;
|
|
19
|
+
plan?: RelayAccountPlan;
|
|
20
|
+
maxRoutes?: number;
|
|
21
|
+
maxDevicesPerRoute?: number;
|
|
22
|
+
}
|
|
23
|
+
interface RelayAccountCredentialMaterial {
|
|
24
|
+
credentialHash: string;
|
|
25
|
+
credentialLookup: string;
|
|
26
|
+
}
|
|
27
|
+
type CreateRelayAccountInput = RelayAccountFields & (({
|
|
28
|
+
credential: string;
|
|
29
|
+
} & Partial<Record<keyof RelayAccountCredentialMaterial, never>>) | ({
|
|
30
|
+
credential?: never;
|
|
31
|
+
} & RelayAccountCredentialMaterial));
|
|
32
|
+
type RelayAccountCredentialInput = string | RelayAccountCredentialMaterial;
|
|
33
|
+
interface UpdateRelayAccountInput {
|
|
34
|
+
label?: string;
|
|
35
|
+
status?: RelayAccountStatus;
|
|
36
|
+
plan?: RelayAccountPlan;
|
|
37
|
+
maxRoutes?: number;
|
|
38
|
+
maxDevicesPerRoute?: number;
|
|
39
|
+
}
|
|
40
|
+
interface RelayAccountStore {
|
|
41
|
+
readonly mode: RelayAccountStoreMode;
|
|
42
|
+
createAccount(input: CreateRelayAccountInput, now?: number): RelayAccountRecord;
|
|
43
|
+
getAccount(id: string): RelayAccountRecord | undefined;
|
|
44
|
+
listAccounts(options?: {
|
|
45
|
+
includeDeleted?: boolean;
|
|
46
|
+
}): RelayAccountRecord[];
|
|
47
|
+
/** Verify ownership for recovery without granting a suspended account route access. */
|
|
48
|
+
verifyCredential(credential: string): RelayAccountRecord | undefined;
|
|
49
|
+
authenticate(credential: string): RelayAccountRecord | undefined;
|
|
50
|
+
updateAccount(id: string, input: UpdateRelayAccountInput, expectedRevision: number, now?: number): RelayAccountRecord | undefined;
|
|
51
|
+
rotateCredential(id: string, credential: RelayAccountCredentialInput, expectedRevision: number, now?: number): RelayAccountRecord | undefined;
|
|
52
|
+
close(): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type RelayStoreMode = "sqlite" | "memory";
|
|
56
|
+
interface RelayRouteRecord {
|
|
57
|
+
id: string;
|
|
58
|
+
label: string;
|
|
59
|
+
hostCredentialHash: string;
|
|
60
|
+
ownerAccountId?: string;
|
|
61
|
+
createdAt: number;
|
|
62
|
+
updatedAt: number;
|
|
63
|
+
}
|
|
64
|
+
interface RelayDeviceRouteRecord {
|
|
65
|
+
routeId: string;
|
|
66
|
+
deviceId: string;
|
|
67
|
+
credentialHash: string;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
updatedAt: number;
|
|
70
|
+
/** Bootstrap credentials expire unless the host promotes the device after the E2E pairing claim. */
|
|
71
|
+
expiresAt?: number;
|
|
72
|
+
}
|
|
73
|
+
interface PublicRelayRouteRecord {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
deviceCount: number;
|
|
77
|
+
createdAt: number;
|
|
78
|
+
updatedAt: number;
|
|
79
|
+
}
|
|
80
|
+
interface RelayRouteStore {
|
|
81
|
+
readonly mode: RelayStoreMode;
|
|
82
|
+
createRoute(input: {
|
|
83
|
+
id?: string;
|
|
84
|
+
label: string;
|
|
85
|
+
hostCredentialHash: string;
|
|
86
|
+
ownerAccountId?: string;
|
|
87
|
+
}, now?: number): RelayRouteRecord;
|
|
88
|
+
getRoute(id: string): RelayRouteRecord | undefined;
|
|
89
|
+
listRoutes(now?: number): PublicRelayRouteRecord[];
|
|
90
|
+
listRoutesByOwner(ownerAccountId: string, now?: number): PublicRelayRouteRecord[];
|
|
91
|
+
countDevices(routeId: string, now?: number): number;
|
|
92
|
+
rotateHostCredential(routeId: string, credentialHash: string, now?: number): boolean;
|
|
93
|
+
deleteRoute(id: string): boolean;
|
|
94
|
+
authenticateHost(routeId: string, credential: string): boolean;
|
|
95
|
+
putDevice(input: {
|
|
96
|
+
routeId: string;
|
|
97
|
+
deviceId: string;
|
|
98
|
+
credentialHash: string;
|
|
99
|
+
expiresAt?: number;
|
|
100
|
+
}, now?: number): RelayDeviceRouteRecord;
|
|
101
|
+
getDevice(routeId: string, deviceId: string, now?: number): RelayDeviceRouteRecord | undefined;
|
|
102
|
+
authenticateDevice(routeId: string, deviceId: string, credential: string, now?: number): boolean;
|
|
103
|
+
revokeDevice(routeId: string, deviceId: string): boolean;
|
|
104
|
+
close(): void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface BlindRelayMetrics {
|
|
108
|
+
activeConnections: number;
|
|
109
|
+
activeHosts: number;
|
|
110
|
+
activeDevices: number;
|
|
111
|
+
acceptedConnections: number;
|
|
112
|
+
rejectedConnections: number;
|
|
113
|
+
forwardedFrames: number;
|
|
114
|
+
forwardedBytes: number;
|
|
115
|
+
droppedFrames: number;
|
|
116
|
+
}
|
|
117
|
+
interface BlindRelayServer {
|
|
118
|
+
app: FastifyInstance;
|
|
119
|
+
store: RelayRouteStore;
|
|
120
|
+
accountStore?: RelayAccountStore;
|
|
121
|
+
metrics(): BlindRelayMetrics;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface StartedBlindRelay extends BlindRelayServer {
|
|
125
|
+
url: string;
|
|
126
|
+
}
|
|
127
|
+
declare function startBlindRelay(env?: NodeJS.ProcessEnv): Promise<StartedBlindRelay>;
|
|
128
|
+
declare function isRelayDirectExecution(moduleUrl: string, argv1: string | undefined, embeddedContainerBuild?: boolean): boolean;
|
|
129
|
+
|
|
130
|
+
export { type StartedBlindRelay, isRelayDirectExecution, startBlindRelay };
|