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 remote-tracking branch 'origin/main' into harness-web-release-readiness

dee118c33c315d8
diff --cc cli/src/backendSocket.ts
index db0c0b092,3be513ae2..a3277fcd7
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@@ -523,9 -522,10 +524,11 @@@ export class BackendSocket
onTerminalHandoff: ((tmuxPane: string) => string | null) | null = null
/** What the daemon knows about an agent's DSH companions (viewer URL, verdict); null when nothing. */
harnessSharing: HarnessShareOwner | null = null
+ /** Answers the trust group's roster exchange (`group_sync`); null until the daemon wires it. */
+ groupSync: { handle: (peerPub: string, payload: Record<string, unknown>) => Record<string, unknown> } | null = null
dshFrameProvider: ((session: RegisteredSession) => AgentDshContext | null) | null = null
viewerTargetProvider: ((agentId: string) => string | null) | null = null
+ readonly interactiveViewers = new InteractiveViewers(agentId => this.viewerTargetProvider?.(agentId) ?? null)
readonly viewerForwarder = new ViewerForwarder({
target: (agentId) => this.viewerTargetProvider?.(agentId) ?? null,
send: (connId, type, payload) => {
@@@ -781,7 -784,16 +788,16 @@@
isConnectionAvailable: connId => this.directDeviceSinks.has(connId) || this.isConnected(),
onIdentityPaired: (connId, pub) => { if (this.directDeviceSinks.has(connId)) this.directDevicePins.set(connId, pub) },
onIdentityRevoked: identity => { this.autonomousDeviceRelay?.revoke(identity); this.onDirectDeviceRevoked?.(fingerprint(b64d(identity))) },
- onSessionDropped: (connId) => this.viewerForwarder.closeConnection(connId),
+ onSessionDropped: (connId) => { this.viewerForwarder.closeConnection(connId); this.interactiveViewers.closeConnection(connId); this.ownerCommands.closeConnection(connId) },
+ onPeerLinked: (peer) => {
+ // The mutual half of a password link: a machine that proved this one's password is pinned back,
+ // so this machine can dial it without that machine's own password.
+ if (peer.kind === 'machine' && peer.machineId && peer.machineId !== this.machineId) {
+ new MachinePeerStore().pin(peer.machineId, peer.pub, peer.label)
+ }
+ this.onPeerLinked?.(peer)
+ },
+ onUnpaired: (pub) => this.onUnpaired?.(pub),
})
this.terminalP2p = new TerminalP2pResponderPool({
sendSignal: (connId, type, payload) => this.sendP2pSignal(connId, type, payload),
@@@ -1673,15 -1686,15 +1700,24 @@@
return
}
+ if (type === 'viewer_surface') {
+ if (!local && this.e2ee.sessionRole(connId) !== 'web') return
+ // Rendering and input never hold up terminal traffic on the ordered machine queue.
+ void this.interactiveViewers.request(connId, payload)
+ .then(result => reply(type, requestId, result))
+ .catch(() => reply(type, requestId, { error: 'VIEWER_UNAVAILABLE' }))
+ return
+ }
+
+ // Trust-group roster exchange: only over an E2EE session, from the identity that session proved —
+ // the roster carries the keys this machine trusts, and the peer's own entry must be that identity.
+ if (type === 'group_sync') {
+ const peerPub = local ? null : this.e2ee.sessionIdentity(connId)
+ if (!peerPub || this.e2ee.sessionRole(connId) !== 'web' || !this.groupSync) { reply(type, requestId, { error: 'UNSUPPORTED' }); return }
+ try { reply(type, requestId, this.groupSync.handle(peerPub, payload)) } catch { reply(type, requestId, { error: 'GROUP_SYNC_FAILED' }) }
+ return
+ }
+
if (type.startsWith('viewer_')) {
if (VIEWER_DOWN_TYPES.has(type) && (local || this.e2ee.sessionRole(connId) === 'web')) {
this.viewerForwarder.handle(connId, type, payload)
diff --cc cli/src/lib/e2ee/applicationFrames.ts
index c17fc9ea3,a829e5366..062b4dd98
--- a/cli/src/lib/e2ee/applicationFrames.ts
+++ b/cli/src/lib/e2ee/applicationFrames.ts
@@@ -15,7 -14,8 +15,8 @@@ export const OWNER_COMMAND_TYPES = new
const FLEET_REQUESTS = new Set(['grid_fleet_capabilities', 'grid_fleet_run', 'grid_fleet_cancel',
'grid_fleet_models_list', 'grid_fleet_model_download', 'grid_fleet_model_start', 'grid_fleet_model_stop'])
const FLEET_RESULTS = new Set([...FLEET_REQUESTS].map(type => `${type}_result`))
- const MACHINE_REQUESTS = new Set(['git_project_info', 'git_pull_request', 'machine_resources', 'api_connections', 'phone_pair', 'viewer_surface', 'orchestrator', ...OWNER_COMMAND_TYPES])
+ // `group_sync`: the trust-group roster exchange (groupSyncer.ts) — keys, so always sealed.
-const MACHINE_REQUESTS = new Set(['git_project_info', 'git_pull_request', 'machine_resources', 'api_connections', 'group_sync'])
++const MACHINE_REQUESTS = new Set(['git_project_info', 'git_pull_request', 'machine_resources', 'api_connections', 'group_sync', 'phone_pair', 'viewer_surface', 'orchestrator', ...OWNER_COMMAND_TYPES])
const MACHINE_RESULTS = new Set([...MACHINE_REQUESTS].map(type => `${type}_result`))
export const encryptDownFrame = (type: string): boolean =>
isEncryptedDownType(type) || MACHINE_REQUESTS.has(type) || FLEET_REQUESTS.has(type) || SHARE_REQUEST_TYPES.has(type) || VIEWER_DOWN_TYPES.has(type)