refactor: centralize presence routing and version precedence coverage (#19609)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 10d9df5263
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-02-18 00:02:51 -05:00
committed by GitHub
parent 5c69e625f5
commit 07fdceb5fd
12 changed files with 305 additions and 33 deletions

View File

@@ -1,6 +1,7 @@
import { spawnSync } from "node:child_process";
import os from "node:os";
import { pickPrimaryLanIPv4 } from "../gateway/net.js";
import { resolveRuntimeServiceVersion } from "../version.js";
export type SystemPresence = {
host?: string;
@@ -50,11 +51,7 @@ function resolvePrimaryIPv4(): string | undefined {
function initSelfPresence() {
const host = os.hostname();
const ip = resolvePrimaryIPv4() ?? undefined;
const version =
process.env.OPENCLAW_VERSION ??
process.env.OPENCLAW_SERVICE_VERSION ??
process.env.npm_package_version ??
"unknown";
const version = resolveRuntimeServiceVersion(process.env, "unknown");
const modelIdentifier = (() => {
const p = os.platform();
if (p === "darwin") {