Files
spacesopsandCursor ad64a47d42
Build Service / BuildPackage (push) Has been cancelled
Release v0.1.1:2 with certrelay, nacho, and prebuilt subspaces.
Remove the embedded explorer/indexer stack, switch subspaces to prebuilt images, add certrelay and nacho as always-on services, expose Spaces and Subs APIs, and wire optional HTTP basic auth for subs and subs-prover with the correct SUBS_BASIC_AUTH_PASSWORD env var.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 12:06:16 -04:00

185 lines
5.7 KiB
TypeScript

import { i18n } from './i18n'
import { sdk } from './sdk'
import {
CERTRELAY_PORT,
NACHO_PORT,
spacedRpcPort,
SUBSPACES_PROVER_PORT,
SUBSPACES_REGISTRY_PORT,
SUBSPACES_UI_PORT,
uiPort,
} from './utils'
export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => {
const uiMulti = sdk.MultiHost.of(effects, 'ui-multi')
const uiMultiOrigin = await uiMulti.bindPort(uiPort, {
protocol: 'http',
})
const ui = sdk.createInterface(effects, {
name: i18n('Space-CLI Web UI'),
id: 'ui',
description: i18n(
'Browser terminal that exposes space-cli inside the Spaces container.',
),
type: 'ui',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const uiReceipt = await uiMultiOrigin.export([ui])
const subspacesMulti = sdk.MultiHost.of(effects, 'subspaces-multi')
const subspacesMultiOrigin = await subspacesMulti.bindPort(SUBSPACES_UI_PORT, {
protocol: 'http',
})
const subspaces = sdk.createInterface(effects, {
name: i18n('Subspaces Web UI'),
id: 'subspaces',
description: i18n(
'Off-chain Bitcoin handles via the Spaces protocol (spacesops/subs). Talks to the local spaced over loopback RPC. Only useful while Subspaces is enabled.',
),
type: 'ui',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
// The subs daemon ("subsd — HTTP REST API server for subs operations") serves
// its REST API on the same port. Expose it as a distinct `api` interface,
// separate from the prover (8888) and registry (8081) interfaces.
const subsApi = sdk.createInterface(effects, {
name: i18n('Subs API'),
id: 'subs-api',
description: i18n(
'REST API of the subs daemon (subsd) for Subspaces operations. Distinct from the Subspaces Prover and Subspaces Registry. Only useful while Subspaces is enabled.',
),
type: 'api',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const subspacesReceipt = await subspacesMultiOrigin.export([
subspaces,
subsApi,
])
const proverMulti = sdk.MultiHost.of(effects, 'subspaces-prover-multi')
const proverMultiOrigin = await proverMulti.bindPort(SUBSPACES_PROVER_PORT, {
protocol: 'http',
})
const prover = sdk.createInterface(effects, {
name: i18n('Subspaces Prover'),
id: 'subspaces-prover',
description: i18n(
'RISC Zero prover server for Subspaces (no GPU). Generates the cryptographic proofs the Subspaces UI requests. Only useful while Subspaces is enabled.',
),
type: 'api',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const proverReceipt = await proverMultiOrigin.export([prover])
const registryMulti = sdk.MultiHost.of(effects, 'subspaces-registry-multi')
const registryMultiOrigin = await registryMulti.bindPort(
SUBSPACES_REGISTRY_PORT,
{ protocol: 'http' },
)
const registry = sdk.createInterface(effects, {
name: i18n('Subspaces Registry'),
id: 'subspaces-registry',
description: i18n(
'Registry server for publishing and resolving Subspaces handles. Only useful while Subspaces is enabled.',
),
type: 'api',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const registryReceipt = await registryMultiOrigin.export([registry])
const certrelayMulti = sdk.MultiHost.of(effects, 'certrelay-multi')
const certrelayMultiOrigin = await certrelayMulti.bindPort(CERTRELAY_PORT, {
protocol: 'http',
})
const certrelay = sdk.createInterface(effects, {
name: i18n('Certrelay'),
id: 'certrelay',
description: i18n(
'Certrelay serves cryptographic proofs binding Bitcoin-anchored handles to owner keys. SETUP NOTE: run the "Configure Certrelay" action and set CERTRELAY_SELF_URL to the publicly visible URL StartOS exposes for this interface (your clearnet domain or .onion address) — peers and clients reach this relay at that URL.',
),
type: 'api',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const certrelayReceipt = await certrelayMultiOrigin.export([certrelay])
const spacedMulti = sdk.MultiHost.of(effects, 'spaced-api-multi')
const spacedMultiOrigin = await spacedMulti.bindPort(spacedRpcPort, {
protocol: 'http',
})
const spacedApi = sdk.createInterface(effects, {
name: i18n('Spaces API'),
id: 'spaces-api',
description: i18n(
'JSON-RPC API served by the spaced daemon. Authenticated with the spaced RPC credentials (SPACED_RPC_USER / SPACED_RPC_PASSWORD from store.spacedAuth). spaced binds 0.0.0.0 so external processes can reach this endpoint.',
),
type: 'api',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const spacedApiReceipt = await spacedMultiOrigin.export([spacedApi])
const nachoMulti = sdk.MultiHost.of(effects, 'nacho-multi')
const nachoMultiOrigin = await nachoMulti.bindPort(NACHO_PORT, {
protocol: 'http',
})
const nacho = sdk.createInterface(effects, {
name: i18n('Nacho'),
id: 'nacho',
description: i18n(
'Nacho Expo dev server. Configure the EXPO_PUBLIC_IGNORE_NAMES list via the "Configure Nacho" action. EXPO_PUBLIC_API_BASE_URL is derived dynamically from the Subs API StartOS interface (the .local URL is preferred).',
),
type: 'ui',
masked: false,
schemeOverride: null,
username: null,
path: '',
query: {},
})
const nachoReceipt = await nachoMultiOrigin.export([nacho])
return [
uiReceipt,
subspacesReceipt,
proverReceipt,
registryReceipt,
certrelayReceipt,
spacedApiReceipt,
nachoReceipt,
]
})