Skip to content

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.

Merge main into codex/orchestrator-workspace

0xken157fd6066998b2
diff --cc cli/package.json
index b0a3bdf03,4bfcc1fb0..c549294b1
--- a/cli/package.json
+++ b/cli/package.json
@@@ -12,7 -12,10 +12,11 @@@
"typecheck": "tsc --noEmit",
"start": "node dist/cli.js",
"test": "vitest run",
+ "test:orchestrator": "vitest run src/orchestrator --maxWorkers=1 --coverage --coverage.include='src/orchestrator/**' --coverage.thresholds.lines=100 --coverage.thresholds.statements=100 --coverage.thresholds.functions=100 --coverage.thresholds.branches=100 --coverage.reporter=text --coverage.reporter=json --coverage.reportsDirectory=coverage/orchestrator",
+ "test:dsh-updates": "vitest run --config vitest.dsh-updates.config.ts",
+ "test:sharing": "vitest run src/sharing --coverage --coverage.include='src/sharing/**' --coverage.thresholds.lines=100 --coverage.thresholds.statements=100 --coverage.thresholds.branches=100 --coverage.thresholds.functions=100",
+ "test:sharing-e2e": "tsx scripts/share-harness-e2e.ts",
+ "test:remote-viewers": "vitest run --config vitest.viewer.config.ts",
"test:cursor-e2e": "RUN_CURSOR_E2E=1 vitest run src/engines/cursor/localE2e.spec.ts",
"test:tmux-real": "RUN_REAL_TMUX_DISCOVERY=1 vitest run src/lib/tmuxAgentDiscovery.real.spec.ts --reporter=verbose",
"test:herdr-real": "RUN_REAL_HERDR=1 vitest run src/lib/herdrBackend.real.spec.ts --reporter=verbose",
diff --cc cli/src/authCommand.spec.ts
index 63bb9ec9d,af68e21a0..20978d170
--- a/cli/src/authCommand.spec.ts
+++ b/cli/src/authCommand.spec.ts
@@@ -49,10 -49,6 +49,7 @@@ function envFor(root: string, backendUr
HOME: root,
HARNESS_AUTH_DIR: join(root, 'auth'),
ADAPTER_DATA_DIR: join(root, 'data'),
+ ADAPTER_RUNTIME_DIR: join(root, 'runtime'),
- // These tests assert the no-grid handoff. A developer's installed grid
- // must not turn this local auth fixture into a real network login attempt.
- HARNESS_GRID_BIN: join(root, 'grid-not-installed'),
ADAPTER_CLI_DIR: join(root, 'cli'),
ADAPTER_COMPUTER_ID_FILE: join(root, 'computer-id'),
ADAPTER_UPDATE_DISABLE: 'true',
diff --cc cli/src/backendSocket.ts
index 39ff19542,94e0fc555..34d200c38
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@@ -800,7 -779,7 +823,8 @@@ export class BackendSocket
async stop(): Promise<void> {
this.closed = true
+ this.orchestratorService?.stop()
+ this.viewerForwarder.closeAll()
if (this.heartbeat) this.heartbeat.stop()
if (this.appPing) clearInterval(this.appPing)
await this.terminalStreams?.stop()
@@@ -1227,7 -1214,7 +1262,7 @@@
// than as an opaque __e2e envelope.
// Terminal frames contain raw keystrokes, paste text and screen bytes after
// unwrap. Never pass them to the frame logger, even in diagnostic mode.
- if (env.LOG_FRAMES && !type.startsWith('terminal_') && type !== 'agent_read_file' && type !== 'project_preview' && type !== 'orchestrator') {
- if (env.LOG_FRAMES && !type.startsWith('terminal_') && !type.startsWith('viewer_') && type !== 'agent_read_file' && type !== 'project_preview' && !SHARE_REQUEST_TYPES.has(type)) {
++ if (env.LOG_FRAMES && !type.startsWith('terminal_') && !type.startsWith('viewer_') && type !== 'agent_read_file' && type !== 'project_preview' && type !== 'orchestrator' && !SHARE_REQUEST_TYPES.has(type)) {
logFrame('←', connId ? `conn:${sid(connId)}` : 'backend', frame)
}
const reply = (t: string, rid: unknown, p: Record<string, unknown>): void => this.emitReply(connId, t, rid, p)
@@@ -1293,17 -1287,13 +1335,24 @@@
const payload = (frame.payload ?? {}) as Record<string, unknown>
const requestId = payload.requestId
+ // Same-host only until remote viewer transport and remote task ownership exist.
+ // Refuse before parsing project content; never send it to the relay as plaintext.
+ if (type === 'orchestrator') {
+ if (!local) { reply(type, requestId, { error: 'LOCAL_ONLY', detail: 'Orchestrator projects run on the local machine.' }); return }
+ // Detached: a large artifact snapshot must not block cancel/status on this connection.
+ void orchestratorRequest(this.orchestration(), payload)
+ .then(result => reply(type, requestId, result))
+ .catch(() => reply(type, requestId, { error: 'ORCHESTRATOR_FAILED' }))
+ return
+ }
+
+ if (type.startsWith('viewer_')) {
+ if (VIEWER_DOWN_TYPES.has(type) && (local || this.e2ee.sessionRole(connId) === 'web')) {
+ this.viewerForwarder.handle(connId, type, payload)
+ }
+ return
+ }
+
if (type.startsWith('terminal_')) {
this.noteTerminalInputRoute(connId, type, payload, transport)
if (this.terminalStreams) await this.terminalStreams.handleFrame(connId, type, payload)
diff --cc desktop/lib/terminal/terminal_session.dart
index 6bdc14da2,de04b765f..98ef8c91e
--- a/desktop/lib/terminal/terminal_session.dart
+++ b/desktop/lib/terminal/terminal_session.dart
@@@ -79,9 -79,12 +79,15 @@@ class TerminalSession extends ChangeNot
final TerminalFrameSender send;
final TerminalBinarySender sendBinary;
final Duration resyncTimeout;
+ final bool readOnly;
+
+ // A controllable clock keeps coalescing tests independent of host scheduling.
+ final DateTime Function() _now;
+
+ /// Lets input batching tests hold the clock inside the four-millisecond window under host load.
+ @visibleForTesting
- DateTime Function() inputClockForTest = DateTime.now;
++ late DateTime Function() inputClockForTest = _now;
+
/// Forces a fresh transport dial (see `WsConn.forceReconnect`) — called once when the very first
/// `terminal_open` never gets a `terminal_ready` back within [resyncTimeout]. Covers the relay
/// going stale silently (the relayed machine's own Harness process restarted, dropping its E2EE
@@@ -97,9 -100,9 +103,10 @@@
required this.send,
required this.sendBinary,
this.onOpenStalled,
+ this.readOnly = false,
this.resyncTimeout = const Duration(seconds: 4),
- }) {
+ DateTime Function()? now,
+ }) : _now = now ?? DateTime.now {
terminal = _newTerminal();
}