Files
orca/src/main/daemon/daemon-hello-protocol.ts
T
618dc62889 perf(daemon): send PTY output to main as raw bytes, not NDJSON (#27006)
* perf(daemon): send PTY output to main as raw bytes, not NDJSON

The stream socket's hello can now negotiate binary-v1 framing:
length-prefixed frames carrying PTY data as raw UTF-8 next to a small
JSON header, so neither the daemon nor main escapes or parses the
payload. Older daemons ignore the hello field and stay on NDJSON; older
mains never ask. The hello reader now hands the stream reader the exact
bytes that followed its line, which an event sharing the hello's read
used to lose. ORCA_DAEMON_BINARY_STREAM=0 keeps NDJSON.

Fixes #27003

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(daemon): preserve negotiated output and encode ordinary frames once

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Neil <neil@stably.ai>
2026-10-09 17:18:48 -07:00

29 lines
764 B
TypeScript

export type HelloMessage = {
type: 'hello'
version: number
token: string
clientId: string
role: 'control' | 'stream'
/** Stream framing the client can read. Daemons that predate it ignore it and stay on NDJSON. */
streamFraming?: string
}
export type DaemonEndpointIdentity = {
pid: number
startedAtMs: number
launchNonce: string
/** Optional launch metadata. Absent from daemons that predate it; readers must fall back. */
entryPath?: string
appVersion?: string
spawnerExecPath?: string
}
export type HelloResponse = {
type: 'hello'
ok: boolean
error?: string
daemonIdentity?: DaemonEndpointIdentity
/** Echoed only when the daemon switches this stream socket to that framing after this line. */
streamFraming?: string
}