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 pull request #90 from autonomous-ai/codex/grid-harness-fleet

0xdiego25f66611bd0602
diff --cc cli/src/backendSocket.ts
index cc02156c1,f9d3299fd..ed259a55d
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@@ -1,5 -1,3 +1,5 @@@
+import type { HarnessShareOwner } from './sharing/owner.js'
- import { SHARE_REQUEST_TYPES, SHARE_RESULT_TYPES } from './sharing/protocol.js'
++import { SHARE_REQUEST_TYPES } from './sharing/protocol.js'
import { AutonomousDeviceRelay } from './lib/autonomous-device/relay.js'
import type { AutonomousDeviceService, AutonomousDeviceFrame } from './lib/autonomous-device/service.js'
/**
@@@ -1250,7 -1108,7 +1253,7 @@@ export class BackendSocket
private emitReply(connId: string, type: string, requestId: unknown, payload: Record<string, unknown>): void {
const resultType = `${type}_result`
// Before the E2EE wrap: an RPC reply is only readable here.
- if (env.LOG_FRAMES && type !== 'agent_read_file' && type !== 'project_preview' && !SHARE_REQUEST_TYPES.has(type)) logFrame('→', connId ? `conn:${sid(connId)}` : 'backend', { type: resultType, payload: { requestId, ...payload } })
- if (env.LOG_FRAMES && !type.startsWith('grid_fleet_') && type !== 'agent_read_file' && type !== 'project_preview') logFrame('→', connId ? `conn:${sid(connId)}` : 'backend', { type: resultType, payload: { requestId, ...payload } })
++ if (env.LOG_FRAMES && !type.startsWith('grid_fleet_') && type !== 'agent_read_file' && type !== 'project_preview' && !SHARE_REQUEST_TYPES.has(type)) logFrame('→', connId ? `conn:${sid(connId)}` : 'backend', { type: resultType, payload: { requestId, ...payload } })
if (this.localClients.has(connId)) {
this.sendTo(connId, { type: resultType, payload: { requestId, ...payload } })
return
@@@ -1349,7 -1182,7 +1352,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.startsWith('viewer_') && type !== 'agent_read_file' && type !== 'project_preview' && type !== 'orchestrator' && !SHARE_REQUEST_TYPES.has(type)) {
- if (env.LOG_FRAMES && !type.startsWith('terminal_') && !type.startsWith('grid_fleet_') && type !== 'agent_read_file' && type !== 'project_preview') {
++ if (env.LOG_FRAMES && !type.startsWith('terminal_') && !type.startsWith('viewer_') && !type.startsWith('grid_fleet_') && 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)
diff --cc cli/src/lib/e2ee/applicationFrames.ts
index 000000000,37ed920c9..a9cea490d
mode 000000,100644..100644
--- a/cli/src/lib/e2ee/applicationFrames.ts
+++ b/cli/src/lib/e2ee/applicationFrames.ts
@@@ -1,0 -1,9 +1,19 @@@
+ /** Harness-only RPC extensions. The shared, pinned crypto core remains byte-identical across clients.
+ * Both the originating machine relay and receiving daemon use these classifications. Older clients
- * do not send these frames; older targets answer UNSUPPORTED before any command is attempted. */
++ * do not send these frames; older targets answer UNSUPPORTED before any command is attempted.
++ *
++ * ONE place for every extension: the grid fleet RPCs (#90), harness sharing (`SHARE_*`) and CLI-to-CLI
++ * viewer forwarding (`VIEWER_DOWN_TYPES`, #85). A type listed in none of these travels plaintext, and
++ * the two callers (relayClient's wrap, backendSocket's unwrap and reply) must agree — they used to
++ * spell the union inline, in three places, and merging two of these features meant merging the spelling.
++ */
+ import { ENCRYPTED_RPC_RESULT_TYPES, isEncryptedDownType } from './core.js'
++import { SHARE_REQUEST_TYPES, SHARE_RESULT_TYPES } from '../../sharing/protocol.js'
++import { VIEWER_DOWN_TYPES } from '../viewerWire.js'
+
+ const FLEET_REQUESTS = new Set(['grid_fleet_capabilities', 'grid_fleet_run', 'grid_fleet_cancel'])
+ const FLEET_RESULTS = new Set([...FLEET_REQUESTS].map(type => `${type}_result`))
-export const encryptDownFrame = (type: string): boolean => isEncryptedDownType(type) || FLEET_REQUESTS.has(type)
-export const encryptRpcResult = (type: string): boolean => ENCRYPTED_RPC_RESULT_TYPES.has(type) || FLEET_RESULTS.has(type)
++export const encryptDownFrame = (type: string): boolean =>
++ isEncryptedDownType(type) || FLEET_REQUESTS.has(type) || SHARE_REQUEST_TYPES.has(type) || VIEWER_DOWN_TYPES.has(type)
++export const encryptRpcResult = (type: string): boolean =>
++ ENCRYPTED_RPC_RESULT_TYPES.has(type) || FLEET_RESULTS.has(type) || SHARE_RESULT_TYPES.has(type)
diff --cc cli/src/lib/e2ee/relayClient.ts
index f984f2655,335b70ee1..3126efa93
--- a/cli/src/lib/e2ee/relayClient.ts
+++ b/cli/src/lib/e2ee/relayClient.ts
@@@ -108,8 -104,7 +107,9 @@@ export class RelaySessionCrypto
/** Encrypt an outgoing (local app → remote machine) frame if its type requires it. */
wrapOutgoing(frame: Frame): Frame {
const type = frame.type as string | undefined
- // CLI-to-CLI viewer forwarding is a negotiated extension; the shared crypto core stays byte-identical.
- if (!type || !this.c2s || !(C.isEncryptedDownType(type) || SHARE_REQUEST_TYPES.has(type) || VIEWER_DOWN_TYPES.has(type))) return frame
++ // Sharing, viewer forwarding and fleet RPCs are negotiated extensions; the shared crypto core stays
++ // byte-identical — see applicationFrames.ts for the one list.
+ if (!type || !this.c2s || !encryptDownFrame(type)) return frame
const payload = C.wrapPayload(this.c2s, 'p', this.c2sCounter++, type, undefined, frame.payload)
return { ...frame, payload }
}