mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 10:14:30 +00:00
Add two new properties to every CLI telemetry event so we can tell
managed-sandbox traffic (Codex Cloud, Claude Code Web, etc.) apart from
real developer laptops without geolocation guesswork:
- sandbox_runtime: 'gvisor' | 'firecracker' | 'docker' | 'kvm' | 'wsl' | null
gVisor detected via kernel string ('4.19.0-gvisor' or legacy Sentry
'4.4.0') + /proc/version. Firecracker via /dev/vsock + DMI sys_vendor.
Docker reuses the existing /.dockerenv + cgroup probe.
- agent_runtime: claude_code | codex | cursor | copilot_agent | jules
| replit | devin | aider | gemini_cli | hermes | openclaw | null
Detected by the EXISTENCE of well-known vendor env vars only — values
are never read. Hermes rule keys on HERMES_QUIET=1 (set unconditionally
at hermes-agent/cli.py:50). openclaw rule keys on OPENCLAW_STATE_DIR
or OPENCLAW_CONFIG_PATH (set explicitly in the spawned child env at
openclaw/extensions/qa-matrix/src/runners/contract/scenario-runtime-cli.ts).
Drive-by cleanups required by fallow because system.ts and client.ts
fall into the audit scope of this PR:
- Extract detectWSL into platform.ts to break the system.ts ↔ agent_runtime.ts cycle.
- Refactor detectCI / getCIName into a single CI_PROVIDERS table.
- Dedupe flush / flushSync via a shared drainQueueToPayload helper.
Privacy posture unchanged: HYPERFRAMES_NO_TELEMETRY=1 still opts out;
disclosure in docs/packages/cli.mdx updated to enumerate the new fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
19 lines
702 B
TypeScript
19 lines
702 B
TypeScript
import { platform, release } from "node:os";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
// Shared host-platform detectors used by both system.ts (overall metadata)
|
|
// and agent_runtime.ts (sandbox fingerprinting). Lives in its own module
|
|
// to avoid an import cycle between those two files.
|
|
|
|
export function detectWSL(): boolean {
|
|
if (platform() !== "linux") return false;
|
|
try {
|
|
const osRelease = release().toLowerCase();
|
|
if (osRelease.includes("microsoft") || osRelease.includes("wsl")) return true;
|
|
const procVersion = readFileSync("/proc/version", "utf-8").toLowerCase();
|
|
return procVersion.includes("microsoft") || procVersion.includes("wsl");
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|