The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
refactor: rename primary log file to harness.log and update legacy migration paths
0xken15454f81cde15c
diff --git a/cli/README.md b/cli/README.mdindex 82924fcbf..1dbae305e 100644--- a/cli/README.md+++ b/cli/README.md@@ -37,13 +37,14 @@ harness join -f # reconnect in the FOREGROUND (for a supervisor: pm2/systemd)````join` prints a uniform info block (status, backend, pid, logs, and the **web chat link**-`WEB_URL/machine/<agentId>`) then detaches; raw logs go to `${ADAPTER_DATA_DIR}/machine.log`. The+`WEB_URL/machine/<agentId>`) then detaches; raw logs go to `${ADAPTER_DATA_DIR}/harness.log`. Thecredential is persisted to `${ADAPTER_DATA_DIR}/token`, so later runs are just `harness join`.The log is **capped at 10 MB**: the daemon checks the size every minute and, over the cap, rewrites thefile with the newest half (the oldest lines are dropped, marked by a `[log] trimmed` line at the top).-It's one file, not a rotation — 10 MB is the total on disk. A pre-rename `adapter.log` is adopted by-rename on the first daemon start, so existing history carries over.+It's one file, not a rotation — 10 MB is the total on disk. A log left under a pre-rename name+(`machine.log`, or the older `adapter.log`) is adopted by rename on the first start, so existing history+carries over.The daemon **auto-updates itself** — it polls the release manifest (default every 60 s) and, on a newerbuild, downloads + verifies + swaps its own bundle and restarts when idle (with rollback on a baddiff --git a/cli/src/cli.ts b/cli/src/cli.tsindex 771246467..1e52fdcc1 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -108,9 +108,12 @@ import {const STOP_HOOK_GRACE_MS = 1_500// Daemon stdout/stderr. Capped at LOG_MAX_BYTES — see prepareLogFile/trimLogFile in lib/log.ts.-const LOG_FILE = join(env.ADAPTER_DATA_DIR, 'machine.log')+const LOG_FILE = join(env.ADAPTER_DATA_DIR, 'harness.log')// Pre-rename name. Adopted (renamed, keeping the inode) the first time a daemon opens the log, so a// machine that updates mid-run keeps its history instead of stranding it in a file nobody tails.+// The log has had three names; this slot holds the OLDEST. The middle one (`machine.log`) is adopted+// earlier and elsewhere — by the table in config/env.ts, which runs at module load, before any daemon+// opens this file. Two mechanisms, one ancestor each, in the right order.const LEGACY_LOG_FILE = join(env.ADAPTER_DATA_DIR, 'adapter.log')const COMPUTER_ID_FILE = join(env.ADAPTER_DATA_DIR, 'computer-id')// The machine's display name, mirrored from the backend (`machine_meta` on connect + web renames) by the@@ -418,7 +421,7 @@ async function statBirthMs(path: string): Promise<number> {/** The daemon body: hooks + watcher + process discovery + backend socket. */async function runForeground(token: string): Promise<void> {- installTimestampedConsole() // daemon-only: every machine.log line gets a wall-clock timestamp+ installTimestampedConsole() // daemon-only: every harness.log line gets a wall-clock timestampconst startedAt = Date.now()// Claim the pid file for OURSELVES, first thing. It used to be written by whoever spawned us — the@@ -2131,8 +2134,9 @@ function clearAdapterState(): void {for (const name of ['token','adapter.pid',- 'machine.log',- 'adapter.log', // pre-rename name — still cleared so a reset leaves nothing behind+ 'harness.log',+ 'machine.log', // pre-rename names — still cleared so a reset leaves nothing behind+ 'adapter.log','computer-id','machine-name','registry.json',diff --git a/cli/src/config/env.ts b/cli/src/config/env.tsindex aebd8e721..f54648aed 100644--- a/cli/src/config/env.ts+++ b/cli/src/config/env.ts@@ -19,7 +19,8 @@ const adapterDataDir = join(adapterCliDir, 'data')// dir is FORCE-MOVED across: `~/.machine` wins outright. Anything else would silently roll those// users back to a stale token and an empty session registry.// 2. Files INSIDE the data dir were renamed (machine-id → computer-id, harness-name → machine-name,-// harness.log → machine.log). Within one tree there is nothing to arbitrate, so those only fire+// machine.log → harness.log — the log carries the PRODUCT's name, like the tree it sits in, so this+// one went out and came back). Within one tree there is nothing to arbitrate, so those only fire// when the new name is still free — and they run first, so the force-move above still wins.//// `renameSync` preserves the inode, so a daemon still holding an fd on the old path keeps writing@@ -59,7 +60,7 @@ function migrateLegacyAdapterState(): void {for (const [current, legacy] of [['computer-id', 'machine-id'],['machine-name', 'harness-name'],- ['machine.log', 'harness.log'],+ ['harness.log', 'machine.log'],]) {if (adoptPath(join(adapterDataDir, current), join(adapterDataDir, legacy))) moved++}diff --git a/cli/src/lib/log.spec.ts b/cli/src/lib/log.spec.tsindex daf18dd83..3f4ad4285 100644--- a/cli/src/lib/log.spec.ts+++ b/cli/src/lib/log.spec.ts@@ -90,8 +90,8 @@ describe('log file cap', () => {beforeEach(() => {dir = mkdtempSync(join(tmpdir(), 'adapter-log-'))- file = join(dir, 'machine.log')- legacy = join(dir, 'adapter.log')+ file = join(dir, 'harness.log')+ legacy = join(dir, 'machine.log')})afterEach(() => rmSync(dir, { recursive: true, force: true }))