feat: add Sprite host keepalive to prevent auto-pause
- Add SpriteHostKeepalive (server/sprite-keepalive.ts) maintaining a lightweight heartbeat session per enabled Sprite host so Fly Sprites does not auto-pause and drop the Paseo relay connection - Wire keepalive into agent hooks, RPC handlers, and host connect/launch paths via onHostReady/onHostRemoved hooks - Reconcile every 30s against ~/.paseo/hosts.json enabled hosts with backoff reconnect; persist desired set to plugin-data - Add keepSpriteHostsAwake setting (default true) with settings UI toggle and live subscription
This commit is contained in:
1 parent
2ded63183b
commit
0b923ff019
6 files changed
+491
-3
No files matched your search
@@ -357,6 +357,7 @@ export async function ensureSpriteHost(options: {
|
||||
syncLocalPath?: string;
|
||||
remoteDir?: string;
|
||||
onProgress?: (phase: string, spriteName?: string) => void;
|
||||
onHostReady?: (spriteName: string) => void;
|
||||
}): Promise<{
|
||||
spriteName: string;
|
||||
serverId: string;
|
||||
@@ -378,6 +379,7 @@ export async function ensureSpriteHost(options: {
|
||||
const dir = await options.paseo.hosts.list();
|
||||
const existing = dir.hosts.find((h) => h.source.key === sourceKey);
|
||||
if (existing && existing.enabled && existing.status === "online" && existing.serverId) {
|
||||
options.onHostReady?.(sprite.name);
|
||||
return {
|
||||
spriteName: sprite.name,
|
||||
serverId: existing.serverId,
|
||||
@@ -410,6 +412,7 @@ export async function ensureSpriteHost(options: {
|
||||
});
|
||||
}
|
||||
invalidateSpriteHostsCache(options.paseo);
|
||||
options.onHostReady?.(sprite.name);
|
||||
|
||||
let online: HostSummary;
|
||||
if (registration.status === "online" && registration.serverId) {
|
||||
@@ -501,6 +504,7 @@ export async function launchSpriteAgent(options: {
|
||||
provider?: string;
|
||||
background?: boolean;
|
||||
onProgress?: (phase: string, spriteName?: string) => void;
|
||||
onHostReady?: (spriteName: string) => void;
|
||||
}): Promise<{
|
||||
agentId: string;
|
||||
serverId: string;
|
||||
@@ -516,6 +520,7 @@ export async function launchSpriteAgent(options: {
|
||||
syncLocalPath: options.syncLocalPath,
|
||||
remoteDir: options.remoteDir,
|
||||
onProgress: options.onProgress,
|
||||
onHostReady: options.onHostReady,
|
||||
});
|
||||
|
||||
const progress = (phase: string) => options.onProgress?.(phase, host.spriteName);
|
||||
|
||||
Reference in new issue
Block a user