@le-space/ui 0.1.52

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 ADDED
@@ -0,0 +1,22 @@
1
+ # @le-space/ui
2
+
3
+ Floating Aleph relay deployment UI components for Svelte and React.
4
+
5
+ Primary goals:
6
+
7
+ - Svelte-first floating `Sponsor Relay` panel
8
+ - lightweight React wrapper
9
+ - shared controller and browser-safe Aleph helpers
10
+ - minimal host configuration beyond a rootfs manifest URL
11
+
12
+ Entry points:
13
+
14
+ - `@le-space/ui/shared`
15
+ - `@le-space/ui/svelte`
16
+ - `@le-space/ui/react`
17
+
18
+ Example:
19
+
20
+ ```ts
21
+ import SponsorRelayFab from '@le-space/ui/svelte'
22
+ ```
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@le-space/ui",
3
+ "version": "0.1.52",
4
+ "description": "Floating Aleph sponsor relay UI components for Svelte and React.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./shared/index.js",
8
+ "types": "./shared/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./shared/index.d.ts",
12
+ "import": "./shared/index.js"
13
+ },
14
+ "./shared": {
15
+ "types": "./shared/index.d.ts",
16
+ "import": "./shared/index.js"
17
+ },
18
+ "./react": {
19
+ "types": "./react/index.d.ts",
20
+ "import": "./react/index.js"
21
+ },
22
+ "./svelte": "./svelte/index.js",
23
+ "./styles.css": "./styles.css"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "dependencies": {
29
+ "@le-space/browser": "0.1.52",
30
+ "@le-space/core": "0.1.52"
31
+ },
32
+ "peerDependencies": {
33
+ "react": ">=18",
34
+ "react-dom": ">=18",
35
+ "svelte": ">=4"
36
+ }
37
+ }
@@ -0,0 +1,315 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type MessageStatus = 'processed' | 'pending' | 'rejected' | 'unknown';
4
+ interface BalanceResponse {
5
+ address: string;
6
+ balance: string;
7
+ locked_amount: string;
8
+ details?: Record<string, string>;
9
+ credit_balance: number;
10
+ }
11
+ interface Price {
12
+ payg?: string | number | null;
13
+ holding?: string | number | null;
14
+ fixed?: string | number | null;
15
+ credit?: string | number | null;
16
+ }
17
+ interface ComputeUnit {
18
+ vcpus: number;
19
+ memory_mib: number;
20
+ disk_mib: number;
21
+ }
22
+ interface Tier {
23
+ id: string;
24
+ compute_units: number;
25
+ vram?: number | null;
26
+ model?: string | null;
27
+ }
28
+ interface InstancePricing {
29
+ price: {
30
+ storage?: Price;
31
+ compute_unit?: Price;
32
+ };
33
+ compute_unit: ComputeUnit;
34
+ tiers: Tier[];
35
+ }
36
+ interface CrnUsage {
37
+ cpu?: {
38
+ count?: number;
39
+ };
40
+ mem?: {
41
+ available_kB?: number;
42
+ };
43
+ disk?: {
44
+ available_kB?: number;
45
+ };
46
+ active?: boolean;
47
+ }
48
+ interface CrnLocation {
49
+ city?: string | null;
50
+ region?: string | null;
51
+ country?: string | null;
52
+ country_code?: string | null;
53
+ }
54
+ interface Crn {
55
+ hash: string;
56
+ name: string;
57
+ address: string;
58
+ score?: number | string | null;
59
+ performance?: number | string | null;
60
+ decentralization?: number | string | null;
61
+ qemu_support?: boolean;
62
+ confidential_support?: boolean;
63
+ gpu_support?: boolean;
64
+ system_usage?: CrnUsage | null;
65
+ payment_receiver_address?: string | null;
66
+ version?: string | null;
67
+ city?: string | null;
68
+ region?: string | null;
69
+ country?: string | null;
70
+ country_code?: string | null;
71
+ location?: CrnLocation | string | null;
72
+ resolved_ip?: string | null;
73
+ geo_source?: string | null;
74
+ }
75
+ type PaymentMode = 'hold' | 'credit';
76
+ interface InstanceMessage {
77
+ item_hash: string;
78
+ sender: string;
79
+ chain: string;
80
+ type: 'INSTANCE';
81
+ channel?: string;
82
+ content?: {
83
+ metadata?: {
84
+ name?: string;
85
+ };
86
+ payment?: {
87
+ type?: PaymentMode;
88
+ chain?: string;
89
+ };
90
+ rootfs?: {
91
+ parent?: {
92
+ ref?: string;
93
+ };
94
+ size_mib?: number;
95
+ };
96
+ requirements?: {
97
+ node?: {
98
+ node_hash?: string;
99
+ };
100
+ };
101
+ };
102
+ time?: string | number;
103
+ reception_time?: string;
104
+ confirmed?: boolean;
105
+ status?: string;
106
+ }
107
+ interface InstancePortMapping {
108
+ host?: number;
109
+ tcp?: boolean;
110
+ udp?: boolean;
111
+ }
112
+ interface InstanceExecutionStatus {
113
+ defined_at?: string | null;
114
+ preparing_at?: string | null;
115
+ prepared_at?: string | null;
116
+ starting_at?: string | null;
117
+ started_at?: string | null;
118
+ stopping_at?: string | null;
119
+ stopped_at?: string | null;
120
+ }
121
+ interface InstanceExecutionNetworking {
122
+ ipv4?: string | null;
123
+ ipv6?: string | null;
124
+ ipv4_network?: string | null;
125
+ host_ipv4?: string | null;
126
+ ipv6_network?: string | null;
127
+ ipv6_ip?: string | null;
128
+ ipv4_ip?: string | null;
129
+ proxy_url?: string | null;
130
+ mapped_ports?: Record<string, InstancePortMapping>;
131
+ }
132
+ interface InstanceExecution {
133
+ crnUrl: string;
134
+ version: 'v1' | 'v2';
135
+ running?: boolean;
136
+ networking: InstanceExecutionNetworking;
137
+ status?: InstanceExecutionStatus | null;
138
+ }
139
+ interface RootfsRequiredPortForward {
140
+ port: number;
141
+ tcp?: boolean;
142
+ udp?: boolean;
143
+ purpose?: string;
144
+ }
145
+ interface RootfsManifest {
146
+ profile?: string;
147
+ version: string;
148
+ rootfsInstallStrategy?: 'thin' | 'prebaked' | string;
149
+ requiresBootstrapNetwork?: boolean;
150
+ bootstrapSummary?: string;
151
+ requiredPortForwards?: RootfsRequiredPortForward[];
152
+ rootfsItemHash: string;
153
+ rootfsSizeMiB: number;
154
+ rootfsSourceSizeBytes?: number;
155
+ createdAt: string;
156
+ notes?: string;
157
+ }
158
+ interface RootfsManifestState {
159
+ manifest: RootfsManifest | null;
160
+ valid: boolean;
161
+ errors: string[];
162
+ }
163
+ type GatewayProbeStatus = 'reachable' | 'timeout' | 'error' | 'unavailable' | 'unknown';
164
+ interface RootfsResolution {
165
+ itemHash: string;
166
+ messageStatus: MessageStatus;
167
+ messageType: string | null;
168
+ cid: string | null;
169
+ receptionTime?: string | null;
170
+ rejectionErrorCode?: number | null;
171
+ rejectionReason?: string | null;
172
+ gatewayUrl: string | null;
173
+ gatewayStatus: GatewayProbeStatus;
174
+ gatewayError?: string | null;
175
+ }
176
+
177
+ type SponsorRelayHealthTone = 'ok' | 'caution' | 'error' | 'idle';
178
+ interface SponsorRelayProps {
179
+ libp2p?: unknown;
180
+ manifestUrl?: string;
181
+ manifestJson?: string;
182
+ sshPublicKey?: string;
183
+ instanceName?: string;
184
+ showInstances?: boolean;
185
+ openByDefault?: boolean;
186
+ launcherMode?: 'floating' | 'inline';
187
+ apiHost?: string;
188
+ crnListUrl?: string;
189
+ schedulerApiHost?: string;
190
+ twoN6ApiHost?: string;
191
+ }
192
+ interface SponsorRelayWalletState {
193
+ connected: boolean;
194
+ address: string | null;
195
+ chainId: string | null;
196
+ isMetaMask: boolean;
197
+ }
198
+ interface SponsorRelayPricingSummary {
199
+ pricing: InstancePricing | null;
200
+ tier: Tier | null;
201
+ requiredCredits: number | null;
202
+ availableCredits: number | null;
203
+ vcpus: number | null;
204
+ memoryMiB: number | null;
205
+ diskMiB: number | null;
206
+ }
207
+ interface SponsorRelayRootfsHealth {
208
+ tone: SponsorRelayHealthTone;
209
+ label: string;
210
+ detail: string | null;
211
+ }
212
+ interface RelayPingState {
213
+ tone: SponsorRelayHealthTone;
214
+ sent: boolean;
215
+ received: boolean;
216
+ lastPeerId: string | null;
217
+ lastLatencyMs: number | null;
218
+ lastSentAt: number | null;
219
+ lastReceivedAt: number | null;
220
+ error: string | null;
221
+ }
222
+ interface CompactInstanceDetails {
223
+ messageStatus: string;
224
+ allocationSource: string | null;
225
+ crnUrl: string | null;
226
+ hostIpv4: string | null;
227
+ ipv6: string | null;
228
+ vmIpv4: string | null;
229
+ webUrl: string | null;
230
+ sshCommand: string | null;
231
+ mappedPorts: Array<{
232
+ label: string;
233
+ hostPort: number | null;
234
+ }>;
235
+ execution: InstanceExecution | null;
236
+ error: string | null;
237
+ }
238
+ interface CompactInstanceRecord {
239
+ instance: InstanceMessage;
240
+ details: CompactInstanceDetails;
241
+ }
242
+ interface SponsorRelayState {
243
+ ready: boolean;
244
+ open: boolean;
245
+ wallet: SponsorRelayWalletState;
246
+ manifestUrl: string;
247
+ manifestJson: string;
248
+ sshPublicKey: string;
249
+ instanceName: string;
250
+ tierId: string;
251
+ showInstances: boolean;
252
+ showPasteManifest: boolean;
253
+ busy: {
254
+ connectingWallet: boolean;
255
+ refreshing: boolean;
256
+ deploying: boolean;
257
+ deletingInstanceHash: string | null;
258
+ };
259
+ statusText: string;
260
+ errorText: string | null;
261
+ manifestState: RootfsManifestState;
262
+ manifest: RootfsManifest | null;
263
+ rootfsResolution: RootfsResolution | null;
264
+ rootfsVerified: boolean;
265
+ rootfsHealth: SponsorRelayRootfsHealth;
266
+ pricingSummary: SponsorRelayPricingSummary;
267
+ balance: BalanceResponse | null;
268
+ crns: Crn[];
269
+ selectedCrn: Crn | null;
270
+ instances: CompactInstanceRecord[];
271
+ relayPing: RelayPingState;
272
+ lastDeploymentHash: string | null;
273
+ }
274
+ type SponsorRelaySubscriber = (state: SponsorRelayState) => void;
275
+
276
+ declare class SponsorRelayController {
277
+ private state;
278
+ private subscribers;
279
+ private client;
280
+ private refreshTimer;
281
+ private pingTimer;
282
+ private stopWalletWatch;
283
+ private props;
284
+ constructor(props?: SponsorRelayProps);
285
+ subscribe(subscriber: SponsorRelaySubscriber): () => void;
286
+ getState(): SponsorRelayState;
287
+ private emit;
288
+ private patch;
289
+ init(): Promise<void>;
290
+ destroy(): void;
291
+ setOpen(open: boolean): void;
292
+ toggleOpen(): void;
293
+ setManifestUrl(manifestUrl: string): void;
294
+ setManifestJson(manifestJson: string): void;
295
+ setShowPasteManifest(showPasteManifest: boolean): void;
296
+ setSshPublicKey(sshPublicKey: string): void;
297
+ setInstanceName(instanceName: string): void;
298
+ setTierId(tierId: string): void;
299
+ private recomputePricingSummary;
300
+ connectWallet(): Promise<void>;
301
+ private refreshWalletDerivedState;
302
+ refresh(): Promise<void>;
303
+ refreshRelayPing(): Promise<void>;
304
+ deploy(): Promise<void>;
305
+ deleteInstance(instanceHash: string): Promise<void>;
306
+ }
307
+
308
+ declare function SponsorRelayFab(props: SponsorRelayProps): react_jsx_runtime.JSX.Element;
309
+
310
+ declare function useSponsorRelayController(props: SponsorRelayProps): {
311
+ controller: SponsorRelayController;
312
+ state: SponsorRelayState;
313
+ };
314
+
315
+ export { SponsorRelayFab, SponsorRelayFab as default, useSponsorRelayController };