Neutralize Electron daemon target identity
This commit is contained in:
parent
0b7ed068ec
commit
62eed3a41a
5 changed files with 69 additions and 60 deletions
|
|
@ -183,7 +183,7 @@ export class AetheriaCultMeshClient {
|
|||
public constructor(
|
||||
daemonTarget: string | AetheriaCultMeshDaemonTarget,
|
||||
statePath: string,
|
||||
private readonly runtimeId = "aetheria-rts-electron",
|
||||
private readonly runtimeId = "aetheria-electron-client",
|
||||
options: AetheriaCultMeshClientOptions = {},
|
||||
) {
|
||||
this.daemonTarget = normalizeDaemonTarget(daemonTarget);
|
||||
|
|
@ -372,8 +372,8 @@ export class AetheriaCultMeshClient {
|
|||
payloadEncoding: "messagepack",
|
||||
payload: encode(command),
|
||||
sourceRuntimeId: this.runtimeId,
|
||||
sourceRole: "rts-client",
|
||||
tags: ["aetheria-rts", "eve-command"],
|
||||
sourceRole: "aetheria-client",
|
||||
tags: ["aetheria", "eve-command"],
|
||||
},
|
||||
};
|
||||
const peer = await this.peer();
|
||||
|
|
@ -581,8 +581,8 @@ export class AetheriaCultMeshClient {
|
|||
payloadEncoding: "messagepack",
|
||||
payload: encode(command),
|
||||
sourceRuntimeId: context.runtimeId,
|
||||
sourceRole: "rts-client",
|
||||
tags: ["aetheria-rts"],
|
||||
sourceRole: "aetheria-client",
|
||||
tags: ["aetheria"],
|
||||
},
|
||||
};
|
||||
const peer = await this.peer();
|
||||
|
|
@ -651,9 +651,9 @@ function normalizeDaemonTarget(target: string | AetheriaCultMeshDaemonTarget): R
|
|||
}
|
||||
return {
|
||||
uri: value.uri,
|
||||
peerId: value.peerId?.trim() || "aetheria-rts-daemon",
|
||||
peerId: value.peerId?.trim() || "aetheria-daemon",
|
||||
verseId: value.verseId?.trim() || "aetheria.local",
|
||||
role: value.role?.trim() || "aetheria-rts-daemon",
|
||||
role: value.role?.trim() || "aetheria-daemon",
|
||||
endpoints: value.endpoints ?? [],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,25 +17,25 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|||
const projectRoot = resolve(__dirname, "..");
|
||||
const repoRoot = resolve(projectRoot, "..");
|
||||
const logsRoot = resolve(projectRoot, "logs");
|
||||
const runtimeRoot = resolve(process.env.AETHERIA_RTS_RUNTIME_ROOT ?? resolve(projectRoot, "runtime"));
|
||||
const runtimeStatePath = resolve(runtimeRoot, "aetheria-rts.cc");
|
||||
const runtimeRoot = resolve(process.env.AETHERIA_RUNTIME_ROOT ?? resolve(projectRoot, "runtime"));
|
||||
const runtimeStatePath = resolve(runtimeRoot, "aetheria.cc");
|
||||
const debugSurfacePath = resolve(process.env.AETHERIA_CULTUI_DEBUG_SURFACE_PATH ?? resolve(repoRoot, "GameData", "cultui-debug-surface.cultui"));
|
||||
const daemonDll = resolve(repoRoot, "Aetheria.State.Daemon", "bin", "Debug", "net10.0", "Aetheria.State.Daemon.dll");
|
||||
const rendererIndex = resolve(projectRoot, "wwwroot", "index.html");
|
||||
const rtsCultMeshPort = Number.parseInt(process.env.AETHERIA_RTS_CULTMESH_PORT ?? "3076", 10);
|
||||
const rtsVerseId = process.env.AETHERIA_RTS_VERSE_ID?.trim() || "aetheria.local";
|
||||
const rtsDaemonId = process.env.AETHERIA_RTS_DAEMON_ID?.trim() || "starfire-rts";
|
||||
const configuredDaemonUri = process.env.AETHERIA_RTS_CULTMESH_URI?.trim() ?? "";
|
||||
const clientCultMeshPort = Number.parseInt(process.env.AETHERIA_CLIENT_CULTMESH_PORT ?? "3076", 10);
|
||||
const verseId = process.env.AETHERIA_VERSE_ID?.trim() || "aetheria.local";
|
||||
const daemonId = process.env.AETHERIA_DAEMON_ID?.trim() || "aetheria-daemon";
|
||||
const configuredDaemonUri = process.env.AETHERIA_CULTMESH_URI?.trim() ?? "";
|
||||
const launchLocalDaemon = configuredDaemonUri.length === 0;
|
||||
const rtsCultMeshUri = configuredDaemonUri || `cultmesh://aetheria/daemon/${encodeURIComponent(rtsDaemonId)}`;
|
||||
const rtsCultMeshAdvertiseHost = process.env.AETHERIA_RTS_CULTMESH_ADVERTISE_HOST?.trim() || "127.0.0.1";
|
||||
const localDaemonRudpEndpoint = launchLocalDaemon ? `rudp://127.0.0.1:${rtsCultMeshPort}` : "";
|
||||
const electronSmoke = process.env.AETHERIA_RTS_ELECTRON_SMOKE === "1";
|
||||
const electronSmokeResultPath = process.env.AETHERIA_RTS_ELECTRON_SMOKE_RESULT;
|
||||
const daemonCultMeshUri = configuredDaemonUri || `cultmesh://aetheria/daemon/${encodeURIComponent(daemonId)}`;
|
||||
const clientCultMeshAdvertiseHost = process.env.AETHERIA_CLIENT_CULTMESH_ADVERTISE_HOST?.trim() || "127.0.0.1";
|
||||
const localDaemonRudpEndpoint = launchLocalDaemon ? `rudp://127.0.0.1:${clientCultMeshPort}` : "";
|
||||
const electronSmoke = process.env.AETHERIA_ELECTRON_SMOKE === "1";
|
||||
const electronSmokeResultPath = process.env.AETHERIA_ELECTRON_SMOKE_RESULT;
|
||||
|
||||
let daemonProcess: ChildProcessWithoutNullStreams | null = null;
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
let rtsClient: AetheriaCultMeshClient | null = null;
|
||||
let aetheriaClient: AetheriaCultMeshClient | null = null;
|
||||
let isQuitting = false;
|
||||
let debugSurfaceWatcher: FSWatcher | null = null;
|
||||
let debugSurfaceWatchTimer: NodeJS.Timeout | null = null;
|
||||
|
|
@ -90,13 +90,13 @@ app.whenReady().then(async () => {
|
|||
"--state",
|
||||
runtimeStatePath,
|
||||
"--verse-id",
|
||||
rtsVerseId,
|
||||
verseId,
|
||||
"--daemon-id",
|
||||
rtsDaemonId,
|
||||
daemonId,
|
||||
"--client-cultmesh-port",
|
||||
rtsCultMeshPort.toString(),
|
||||
clientCultMeshPort.toString(),
|
||||
"--client-cultmesh-advertise-host",
|
||||
rtsCultMeshAdvertiseHost,
|
||||
clientCultMeshAdvertiseHost,
|
||||
"--tick-interval-ms",
|
||||
"20",
|
||||
"--fixed-delta-ms",
|
||||
|
|
@ -106,24 +106,24 @@ app.whenReady().then(async () => {
|
|||
"--no-odin-announcements",
|
||||
]);
|
||||
} else {
|
||||
showStartup("Connecting Aetheria RTS", `Using daemon ${rtsCultMeshUri}.`);
|
||||
showStartup("Connecting Aetheria RTS", `Using daemon ${daemonCultMeshUri}.`);
|
||||
mkdirSync(runtimeRoot, { recursive: true });
|
||||
}
|
||||
|
||||
rtsClient = new AetheriaCultMeshClient(
|
||||
aetheriaClient = new AetheriaCultMeshClient(
|
||||
{
|
||||
uri: rtsCultMeshUri,
|
||||
peerId: rtsDaemonId,
|
||||
verseId: rtsVerseId,
|
||||
role: "aetheria-rts-daemon",
|
||||
uri: daemonCultMeshUri,
|
||||
peerId: daemonId,
|
||||
verseId,
|
||||
role: "aetheria-daemon",
|
||||
endpoints: localDaemonRudpEndpoint ? [localDaemonRudpEndpoint] : [],
|
||||
},
|
||||
runtimeStatePath,
|
||||
"aetheria-rts-electron",
|
||||
"aetheria-electron-client",
|
||||
{ publicationMode: launchLocalDaemon ? "local" : "remote" });
|
||||
|
||||
showStartup("Launching Aetheria RTS", "Waiting for the daemon CultMesh frame.");
|
||||
await rtsClient.waitForFrame(30000);
|
||||
await aetheriaClient.waitForFrame(30000);
|
||||
await mainWindow.loadFile(rendererIndex);
|
||||
if (electronSmoke) {
|
||||
const result = await runElectronSmoke(mainWindow);
|
||||
|
|
@ -150,7 +150,7 @@ app.on("window-all-closed", () => {
|
|||
|
||||
app.on("before-quit", () => {
|
||||
isQuitting = true;
|
||||
void rtsClient?.close();
|
||||
void aetheriaClient?.close();
|
||||
stopChild(daemonProcess);
|
||||
closeDebugSurfaceWatcher();
|
||||
});
|
||||
|
|
@ -217,7 +217,7 @@ async function runElectronSmoke(window: BrowserWindow): Promise<Record<string, u
|
|||
providerId: "aetheria.daemon",
|
||||
surfaceId: "aetheria.game",
|
||||
command: "sensor_ping",
|
||||
clientId: "aetheria-rts-electron-smoke",
|
||||
clientId: "aetheria-electron-smoke",
|
||||
payload: {},
|
||||
}) : null;
|
||||
return {
|
||||
|
|
@ -333,8 +333,8 @@ function writeElectronSmokeResult(result: Record<string, unknown>): void {
|
|||
|
||||
function exitElectronSmoke(exitCode: number): void {
|
||||
isQuitting = true;
|
||||
void rtsClient?.close();
|
||||
rtsClient = null;
|
||||
void aetheriaClient?.close();
|
||||
aetheriaClient = null;
|
||||
stopChild(daemonProcess);
|
||||
daemonProcess = null;
|
||||
mainWindow?.destroy();
|
||||
|
|
@ -349,9 +349,9 @@ function registerIpc(): void {
|
|||
() => ({
|
||||
status: "ok",
|
||||
transport: "cultmesh-rudp",
|
||||
endpoint: rtsCultMeshUri,
|
||||
verseId: rtsVerseId,
|
||||
daemonId: rtsDaemonId,
|
||||
endpoint: daemonCultMeshUri,
|
||||
verseId,
|
||||
daemonId,
|
||||
peerEndpoints: [],
|
||||
daemonRunning: daemonProcess != null && !daemonProcess.killed,
|
||||
daemonMode: launchLocalDaemon ? "local" : "remote",
|
||||
|
|
@ -535,9 +535,9 @@ function stringOr(value: unknown, fallback: string): string {
|
|||
}
|
||||
|
||||
function requireClient(): AetheriaCultMeshClient {
|
||||
if (!rtsClient)
|
||||
if (!aetheriaClient)
|
||||
throw new Error("Aetheria CultMesh client is not initialized.");
|
||||
return rtsClient;
|
||||
return aetheriaClient;
|
||||
}
|
||||
|
||||
async function ensureDotnetBuild(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -39,12 +39,21 @@ if (-not $mainText.Contains('await api.submitEveCommand') -or
|
|||
Write-Error "Stage 7C Electron RTS verifier failed: Electron smoke does not verify typed operation receipts through preload."
|
||||
}
|
||||
|
||||
if (-not $mainText.Contains('AETHERIA_RTS_VERSE_ID') -or
|
||||
if (-not $mainText.Contains('AETHERIA_VERSE_ID') -or
|
||||
-not $mainText.Contains('--verse-id') -or
|
||||
-not $mainText.Contains('AETHERIA_RTS_DAEMON_ID') -or
|
||||
-not $mainText.Contains('AETHERIA_DAEMON_ID') -or
|
||||
-not $mainText.Contains('--daemon-id')) {
|
||||
Write-Error "Stage 7C Electron RTS verifier failed: Electron launcher does not configure daemon Verse identity."
|
||||
}
|
||||
if ($mainText.Contains('AETHERIA_RTS_') -or
|
||||
$mainText.Contains('starfire-rts') -or
|
||||
$mainText.Contains('aetheria-rts-daemon') -or
|
||||
$mainText.Contains('aetheria-rts-electron') -or
|
||||
$mainText.Contains('rtsCultMesh') -or
|
||||
$mainText.Contains('rtsDaemonId') -or
|
||||
$mainText.Contains('rtsVerseId')) {
|
||||
Write-Error "Stage 7C Electron RTS verifier failed: Electron launcher still uses RTS-branded daemon connection authority."
|
||||
}
|
||||
|
||||
$electron = Join-Path $root "node_modules\electron\dist\electron.exe"
|
||||
if (!(Test-Path -LiteralPath $electron)) {
|
||||
|
|
@ -59,12 +68,12 @@ $port = ([System.Net.IPEndPoint]$udp.Client.LocalEndPoint).Port
|
|||
$udp.Close()
|
||||
|
||||
try {
|
||||
$env:AETHERIA_RTS_ELECTRON_SMOKE = "1"
|
||||
$env:AETHERIA_RTS_RUNTIME_ROOT = $tempRoot
|
||||
$env:AETHERIA_RTS_CULTMESH_PORT = $port.ToString()
|
||||
$env:AETHERIA_RTS_VERSE_ID = "aetheria.stage7c.electron"
|
||||
$env:AETHERIA_RTS_DAEMON_ID = "stage7c-starfire"
|
||||
$env:AETHERIA_RTS_ELECTRON_SMOKE_RESULT = $resultPath
|
||||
$env:AETHERIA_ELECTRON_SMOKE = "1"
|
||||
$env:AETHERIA_RUNTIME_ROOT = $tempRoot
|
||||
$env:AETHERIA_CLIENT_CULTMESH_PORT = $port.ToString()
|
||||
$env:AETHERIA_VERSE_ID = "aetheria.stage7c.electron"
|
||||
$env:AETHERIA_DAEMON_ID = "stage7c-aetheria-daemon"
|
||||
$env:AETHERIA_ELECTRON_SMOKE_RESULT = $resultPath
|
||||
$process = Start-Process -FilePath $electron -ArgumentList "." -WorkingDirectory $root -Wait -PassThru
|
||||
if ($process.ExitCode -ne 0) {
|
||||
Write-Error "Stage 7C Electron RTS verifier failed: Electron exited with code $($process.ExitCode)."
|
||||
|
|
@ -80,12 +89,12 @@ try {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
Remove-Item Env:\AETHERIA_RTS_ELECTRON_SMOKE -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_RUNTIME_ROOT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_CULTMESH_PORT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_VERSE_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_DAEMON_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_ELECTRON_SMOKE_RESULT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_ELECTRON_SMOKE -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RUNTIME_ROOT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_CLIENT_CULTMESH_PORT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_VERSE_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_DAEMON_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_ELECTRON_SMOKE_RESULT -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if ($LASTEXITCODE -ne 0) {
|
|||
|
||||
$tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("aetheria-stage7c-" + [Guid]::NewGuid().ToString("N"))
|
||||
New-Item -ItemType Directory -Path $tempRoot | Out-Null
|
||||
$statePath = Join-Path $tempRoot "aetheria-rts.cc"
|
||||
$statePath = Join-Path $tempRoot "aetheria.cc"
|
||||
$endpoint = $null
|
||||
|
||||
try {
|
||||
|
|
@ -55,10 +55,10 @@ if (!clientModulePath)
|
|||
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
|
||||
|
||||
const client = new AetheriaCultMeshClient({
|
||||
uri: "cultmesh://odin/aetheria/rts/stage7c-verifier",
|
||||
uri: "cultmesh://aetheria/daemon/stage7c-aetheria-daemon",
|
||||
peerId: "stage7c-daemon",
|
||||
verseId: "aetheria.local",
|
||||
role: "aetheria-rts-daemon",
|
||||
role: "aetheria-daemon",
|
||||
endpoints: [endpoint],
|
||||
}, statePath, "stage7c-verifier");
|
||||
const viewport = await client.mapViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ if (!clientModulePath)
|
|||
|
||||
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
|
||||
const client = new AetheriaCultMeshClient({
|
||||
uri: "cultmesh://odin/aetheria/rts/stage7d-starfire",
|
||||
uri: "cultmesh://aetheria/daemon/stage7d-aetheria-daemon",
|
||||
peerId: "stage7d-daemon",
|
||||
verseId: "aetheria.local",
|
||||
role: "aetheria-rts-daemon",
|
||||
role: "aetheria-daemon",
|
||||
endpoints: [endpoint],
|
||||
}, "unused-local-state.cc", "stage7d-starfire", {
|
||||
}, "unused-local-state.cc", "stage7d-verifier", {
|
||||
publicationMode: "remote",
|
||||
snapshotTimeoutMs: 5000,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue