Move clineAuth into open-sse/shared (src re-exports back). Add standalone open-sse/shared/machineId for codex session hashing (no @/lib/dataDir). sttCore receives sttConfig via param instead of importing AI_PROVIDERS. No behavior change; gate: no regression (26 known-fails unchanged). Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
506 B
JavaScript
20 lines
506 B
JavaScript
import { machineIdSync } from "node-machine-id";
|
|
import crypto from "node:crypto";
|
|
|
|
let cachedRawId = null;
|
|
|
|
function loadRawMachineId() {
|
|
if (cachedRawId) return cachedRawId;
|
|
try {
|
|
cachedRawId = machineIdSync();
|
|
} catch {
|
|
cachedRawId = crypto.randomUUID();
|
|
}
|
|
return cachedRawId;
|
|
}
|
|
|
|
export async function getConsistentMachineId(salt = "endpoint-proxy-salt") {
|
|
const rawId = loadRawMachineId();
|
|
return crypto.createHash("sha256").update(rawId + salt).digest("hex").substring(0, 16);
|
|
}
|