Bump to 0.1.0:1 — portability + endpoint display
- configureSparks.ts: generic placeholders (e.g. 192.168.1.10), no Alice-specific IPs; descriptions explain the role of each node instead of naming his hardware - showPublicKey.ts: reads sparkConfig.yaml; emits a ready-to-paste one-liner (KEY='...' followed by 'ssh user@host "echo $KEY >> authorized_keys"' for each configured Spark). Falls back to generic instructions if Configure Sparks hasn't been run yet. - /api/status now includes vllm.base_url for the OpenAI endpoint - New endpoint panel in UI: base URL + model ID rows with copy buttons + collapsible curl example - Bump version to 0.1.0:1
This commit is contained in:
@@ -1,22 +1,21 @@
|
||||
import { sdk } from '../sdk'
|
||||
import { promises as fs } from 'fs'
|
||||
import * as path from 'path'
|
||||
import { sparkConfigYaml } from '../fileModels/sparkConfig.yaml'
|
||||
|
||||
export const showPublicKey = sdk.Action.withoutInput(
|
||||
'show-public-key',
|
||||
async () => ({
|
||||
name: 'Show Public Key',
|
||||
description:
|
||||
'Display the SSH public key. Paste it into ~/.ssh/authorized_keys on each Spark to grant access.',
|
||||
'Display the SSH public key and a ready-to-paste install command for granting this package SSH access to your Sparks.',
|
||||
warning: null,
|
||||
visibility: 'enabled',
|
||||
allowedStatuses: 'any',
|
||||
group: null,
|
||||
}),
|
||||
async () => {
|
||||
async ({ effects }) => {
|
||||
// The container generates the key under /data/ssh/id_ed25519.pub on first boot.
|
||||
// The volume "main" is mounted at the host path that StartOS exposes via `sdk.volumes.main`.
|
||||
// For an Action running in the host, we read the file directly through the volume path.
|
||||
const pubKeyPath = path.join(
|
||||
sdk.volumes.main.path,
|
||||
'ssh',
|
||||
@@ -28,22 +27,50 @@ export const showPublicKey = sdk.Action.withoutInput(
|
||||
} catch (e) {
|
||||
return {
|
||||
version: '1' as const,
|
||||
title: 'Public Key Not Found',
|
||||
title: 'Public Key Not Ready',
|
||||
message:
|
||||
'The container has not yet generated its SSH keypair. Start the service, wait a few seconds, and try again.',
|
||||
'The service has not generated its SSH keypair yet. Start the service from the dashboard, wait a few seconds, then run this action again.',
|
||||
result: null,
|
||||
}
|
||||
}
|
||||
|
||||
// If hosts are configured, construct a ready-to-paste one-liner.
|
||||
const cfg = await sparkConfigYaml.read().once()
|
||||
const hosts: Array<{ user: string; host: string }> = []
|
||||
if (cfg) {
|
||||
if (cfg.spark1_host) hosts.push({ user: cfg.spark1_user || '<spark-user>', host: cfg.spark1_host })
|
||||
if (cfg.spark2_host) hosts.push({ user: cfg.spark2_user || '<spark-user>', host: cfg.spark2_host })
|
||||
}
|
||||
|
||||
let message: string
|
||||
if (hosts.length > 0) {
|
||||
const sshLines = hosts
|
||||
.map(
|
||||
(h) =>
|
||||
`ssh ${h.user}@${h.host} "mkdir -p ~/.ssh && echo '$KEY' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"`,
|
||||
)
|
||||
.join('\n')
|
||||
|
||||
const oneLiner = `KEY='${key}'\n${sshLines}`
|
||||
message =
|
||||
'Paste this block into any machine that already has SSH access to your Sparks (your laptop or one of the Sparks itself). It grants this Spark Control service permission to log in.\n\n' +
|
||||
oneLiner +
|
||||
'\n\nYou will be prompted for the SSH password of each Spark once. After both commands succeed, run "Test Connection" or open the Web Interface to verify.'
|
||||
} else {
|
||||
message =
|
||||
'Run the "Configure Sparks" action first, then come back to this one — once your Spark hostnames are saved, this message will include a ready-to-paste install command.\n\nFor reference, the raw public key is:\n\n' +
|
||||
key
|
||||
}
|
||||
|
||||
return {
|
||||
version: '1' as const,
|
||||
title: 'SSH Public Key',
|
||||
message:
|
||||
'Append this single line to ~/.ssh/authorized_keys on EACH Spark (<spark-user> user):\n\n' +
|
||||
key,
|
||||
message,
|
||||
result: {
|
||||
type: 'single' as const,
|
||||
name: 'Public Key',
|
||||
description: 'Copy this line to each Spark.',
|
||||
name: 'Raw Public Key',
|
||||
description:
|
||||
'The bare public key line. Copy the full message above for the ready-to-paste install command.',
|
||||
value: key,
|
||||
masked: false,
|
||||
copyable: true,
|
||||
|
||||
Reference in New Issue
Block a user