Files
OmniRoute/open-sse/utils/kimiDevice.ts
backryun 9544fb6353 feat(kimi): sync Code, Web, and Moonshot providers (#7531)
* feat(kimi): sync Code, Web, and Moonshot providers

* chore(quality): trim frozen file-size overflow in Kimi sync

The Kimi/Moonshot provider sync added a net +1 line to both
src/sse/services/auth.ts and ProviderDetailPageClient.tsx, pushing
each 1 line past its frozen cap in file-size-baseline.json. Drop one
optional blank line in each (prettier-neutral, no behavior change) to
land back at/under the frozen baseline.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-18 21:19:42 -03:00

32 lines
961 B
TypeScript

import { execFileSync } from "node:child_process";
import { arch, release, type as osType } from "node:os";
let cachedDeviceModel: string | null = null;
export function getKimiDeviceModel(): string {
if (cachedDeviceModel !== null) return cachedDeviceModel;
const type = osType();
const version = release();
const architecture = arch();
if (type === "Darwin") {
let productVersion = version;
try {
productVersion =
execFileSync("/usr/bin/sw_vers", ["-productVersion"], {
encoding: "utf8",
timeout: 1000,
}).trim() || version;
} catch {
// Fall back to the Darwin release when sw_vers is unavailable.
}
cachedDeviceModel = `macOS ${productVersion} ${architecture}`;
} else if (type === "Windows_NT") {
cachedDeviceModel = `Windows ${version} ${architecture}`;
} else {
cachedDeviceModel = `${type} ${version} ${architecture}`.trim();
}
return cachedDeviceModel;
}