@le-space/ui 0.7.0 → 0.9.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/shared/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ type CrnSource = 'list' | 'aggregate';
2
+ type CrnSourcePreference = 'auto' | 'aggregate' | 'list';
3
+
1
4
  type MessageStatus = 'processed' | 'pending' | 'rejected' | 'removing' | 'removed' | 'unknown';
2
5
  interface BalanceResponse {
3
6
  address: string;
@@ -220,6 +223,12 @@ interface SponsorRelayProps {
220
223
  apiHost?: string;
221
224
  apiHosts?: string | readonly string[];
222
225
  crnListUrl?: string;
226
+ /**
227
+ * Which CRN source to read. `auto` falls back to the corechannel aggregate
228
+ * when crns.json is down, `aggregate` skips crns.json, `list` disables the
229
+ * fallback. `localStorage.LE_SPACE_CRN_SOURCE` overrides this at runtime.
230
+ */
231
+ crnSource?: CrnSourcePreference;
223
232
  schedulerApiHost?: string;
224
233
  twoN6ApiHost?: string;
225
234
  }
@@ -253,6 +262,12 @@ interface CompactInstanceDetails {
253
262
  vmIpv4: string | null;
254
263
  webUrl: string | null;
255
264
  sshCommand: string | null;
265
+ /**
266
+ * Hostname of the deployment's HTTPS proxy. The mapped ports are plain HTTP,
267
+ * which a browser on an HTTPS page refuses to fetch, so this is the only
268
+ * address the card can read the relay's own documents from.
269
+ */
270
+ proxyHostname: string | null;
256
271
  mappedPorts: Array<{
257
272
  label: string;
258
273
  hostPort: number | null;
@@ -260,6 +275,32 @@ interface CompactInstanceDetails {
260
275
  execution: InstanceExecution | null;
261
276
  error: string | null;
262
277
  }
278
+ /** One transport's worth of addresses, as the relay itself groups them. */
279
+ interface SponsorRelayAddressGroup {
280
+ key: string;
281
+ label: string;
282
+ addresses: string[];
283
+ }
284
+ /**
285
+ * What a deployment reports about itself at `/multiaddrs`. Deliberately not
286
+ * normalised into "the best address": the card shows what the relay says, and
287
+ * choosing between addresses is the consumer's business, not this UI's.
288
+ */
289
+ interface SponsorRelayInstanceAddresses {
290
+ status: 'idle' | 'loading' | 'ready' | 'unsupported' | 'error';
291
+ /** Transport groups, empty for a profile that publishes no libp2p addresses. */
292
+ groups: SponsorRelayAddressGroup[];
293
+ /** Ready-to-paste environment block, when the profile publishes one. */
294
+ pwaEnv: Record<string, string> | null;
295
+ /** Raw payload, rendered verbatim on the health tab. */
296
+ payload: Record<string, unknown> | null;
297
+ peerId: string | null;
298
+ version: string | null;
299
+ fetchedAt: number | null;
300
+ error: string | null;
301
+ /** Source URL, shown so a person can curl exactly what the card read. */
302
+ sourceUrl: string | null;
303
+ }
263
304
  interface CompactInstanceRecord {
264
305
  instance: InstanceMessage;
265
306
  details: CompactInstanceDetails;
@@ -312,6 +353,8 @@ interface SponsorRelayState {
312
353
  pricingSummary: SponsorRelayPricingSummary;
313
354
  balance: BalanceResponse | null;
314
355
  crns: Crn[];
356
+ /** Which source the current `crns` came from; `null` until the first load. */
357
+ crnSource: CrnSource | null;
315
358
  selectedCrn: Crn | null;
316
359
  crnOptions: Array<{
317
360
  hash: string;
@@ -324,6 +367,13 @@ interface SponsorRelayState {
324
367
  orphanBootstrapRegistrations: CompactBootstrapRegistrationRecord[];
325
368
  lastDeploymentHash: string | null;
326
369
  deploymentProgress: DeploymentProgressEvent;
370
+ /**
371
+ * What each deployment reports at `/multiaddrs`, keyed by instance item hash.
372
+ * Fetched on demand rather than with the instance list: AutoTLS addresses only
373
+ * appear a minute or two after a deploy reports success, so this is state that
374
+ * has to be refreshable on its own.
375
+ */
376
+ instanceAddresses: Record<string, SponsorRelayInstanceAddresses>;
327
377
  }
328
378
  type SponsorRelaySubscriber = (state: SponsorRelayState) => void;
329
379
 
@@ -347,7 +397,7 @@ declare const STALE_INSTANCE_ALLOCATION_COOLDOWN_MS: number;
347
397
  declare const RECENT_INSTANCE_RUNTIME_GRACE_MS: number;
348
398
  declare const DEPLOYMENT_PENDING_WARNING_MS: number;
349
399
 
350
- declare const UI_PACKAGE_VERSION = "0.7.0";
400
+ declare const UI_PACKAGE_VERSION = "0.9.0";
351
401
 
352
402
  interface RootfsRequiredPortForward {
353
403
  port: number;
@@ -383,6 +433,14 @@ declare function connectWallet(provider?: EthereumProviderLike | null): Promise<
383
433
  declare function personalSign(address: string, message: string, provider?: EthereumProviderLike | null): Promise<string>;
384
434
  declare function watchWallet(onChange: () => void, provider?: EthereumProviderLike | null): () => void;
385
435
 
436
+ /**
437
+ * Normalise the two address documents in the fleet into one list of groups.
438
+ *
439
+ * orbitdb-relay reports `byTransport`; uc-go-peer's describe output uses
440
+ * `<transport>_multiaddrs` keys. Neither is rewritten or ranked here — the card
441
+ * shows what the relay said, and picking an address is the consumer's job.
442
+ */
443
+ declare function parseInstanceAddressPayload(payload: Record<string, unknown>): SponsorRelayInstanceAddresses;
386
444
  declare function rootfsHealth(args: {
387
445
  manifestState: RootfsManifestState;
388
446
  rootfsVerified: boolean;
@@ -438,6 +496,18 @@ declare class SponsorRelayController {
438
496
  private refreshWalletDerivedState;
439
497
  refresh(): Promise<void>;
440
498
  deploy(): Promise<void>;
499
+ /**
500
+ * Read one deployment's own address document over its HTTPS proxy.
501
+ *
502
+ * The mapped ports are plain HTTP, which a browser on an HTTPS page refuses to
503
+ * fetch, so the proxy hostname is the only way in. Deliberately single-shot:
504
+ * unlike the deploy-time readiness probe this backs a button someone pressed,
505
+ * and a caller who wants newer data presses it again.
506
+ */
507
+ loadInstanceAddresses(instanceHash: string, options?: {
508
+ force?: boolean;
509
+ }): Promise<void>;
510
+ private patchInstanceAddresses;
441
511
  deleteInstance(instanceHash: string): Promise<void>;
442
512
  deleteBootstrapRegistration(registrationHash: string): Promise<void>;
443
513
  }
@@ -450,4 +520,4 @@ interface DeploymentProgressEmitter {
450
520
  }
451
521
  declare function createDeploymentProgressEmitter(): DeploymentProgressEmitter;
452
522
 
453
- export { type CompactBootstrapRegistrationRecord, type CompactInstanceDetails, type CompactInstanceRecord, DEFAULT_INSTANCE_NAME, DEFAULT_MANIFEST_URL, DEFAULT_TIER_ID, DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES, DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS, DEFAULT_UCAN_STORE_PWA_ORIGIN, DEFAULT_UCAN_STORE_SERVICE_DID, DEFAULT_UCAN_STORE_SERVICE_ORIGIN, DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS, DEPLOYMENT_PENDING_WARNING_MS, type DeploymentProgressEmitter, type EthereumProviderLike, IDLE_DEPLOYMENT_PROGRESS, INSTANCE_RUNTIME_PENDING_REFRESH_MS, INSTANCE_RUNTIME_READY_REFRESH_MS, INSTANCE_RUNTIME_STALE_REFRESH_MS, MANIFEST_SOURCE_REFRESH_DEBOUNCE_MS, RECENT_INSTANCE_RUNTIME_GRACE_MS, REFRESH_INTERVAL_MS, ROOTFS_MISSING_STATE, STALE_INSTANCE_ALLOCATION_COOLDOWN_MS, SponsorRelayController, type SponsorRelayHealthTone, type SponsorRelayPricingSummary, type SponsorRelayProps, type SponsorRelayRootfsHealth, type SponsorRelayState, type SponsorRelaySubscriber, type SponsorRelayUcanStoreBootstrapInput, type SponsorRelayWalletState, UI_PACKAGE_VERSION, buildSshCommand, connectWallet, createDeploymentProgressEmitter, createSponsorRelayController, formatDateTime, formatNumber, formatTierSpecLabel, getEthereumProvider, joinMappedPorts, joinRequiredPortForwards, personalSign, resolveManifestSource, rootfsHealth, shortHash, toChecksumAddress, watchWallet };
523
+ export { type CompactBootstrapRegistrationRecord, type CompactInstanceDetails, type CompactInstanceRecord, DEFAULT_INSTANCE_NAME, DEFAULT_MANIFEST_URL, DEFAULT_TIER_ID, DEFAULT_UCAN_STORE_ALLOWED_CAPABILITIES, DEFAULT_UCAN_STORE_MAX_DELEGATION_EXPIRATION_SECONDS, DEFAULT_UCAN_STORE_PWA_ORIGIN, DEFAULT_UCAN_STORE_SERVICE_DID, DEFAULT_UCAN_STORE_SERVICE_ORIGIN, DEFAULT_UCAN_STORE_USER_DELEGATION_EXPIRATION_SECONDS, DEPLOYMENT_PENDING_WARNING_MS, type DeploymentProgressEmitter, type EthereumProviderLike, IDLE_DEPLOYMENT_PROGRESS, INSTANCE_RUNTIME_PENDING_REFRESH_MS, INSTANCE_RUNTIME_READY_REFRESH_MS, INSTANCE_RUNTIME_STALE_REFRESH_MS, MANIFEST_SOURCE_REFRESH_DEBOUNCE_MS, RECENT_INSTANCE_RUNTIME_GRACE_MS, REFRESH_INTERVAL_MS, ROOTFS_MISSING_STATE, STALE_INSTANCE_ALLOCATION_COOLDOWN_MS, type SponsorRelayAddressGroup, SponsorRelayController, type SponsorRelayHealthTone, type SponsorRelayInstanceAddresses, type SponsorRelayPricingSummary, type SponsorRelayProps, type SponsorRelayRootfsHealth, type SponsorRelayState, type SponsorRelaySubscriber, type SponsorRelayUcanStoreBootstrapInput, type SponsorRelayWalletState, UI_PACKAGE_VERSION, buildSshCommand, connectWallet, createDeploymentProgressEmitter, createSponsorRelayController, formatDateTime, formatNumber, formatTierSpecLabel, getEthereumProvider, joinMappedPorts, joinRequiredPortForwards, parseInstanceAddressPayload, personalSign, resolveManifestSource, rootfsHealth, shortHash, toChecksumAddress, watchWallet };