@shumkov/orchestra 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,10 +33,23 @@ reads without a legacy `workspaceWrite` request policy.
33
33
  - Orchestra baseline: `v0.5.0`, commit
34
34
  `b788efb1f99e5fbf8669d4efa7ce5a1f9c0f7dcb`.
35
35
  - Codex: `codex-cli 0.145.0`.
36
- - Binary SHA-256:
37
- `1da3f4e0e96028b8a771814293c3033dafd1971f943f6c7e79b0897fe705f590`.
38
- - Stable and experimental generated schema hashes remain pinned in
36
+ - Reviewed native target receipts:
37
+ - `aarch64-apple-darwin`:
38
+ `codex-cli 0.145.0`,
39
+ `1da3f4e0e96028b8a771814293c3033dafd1971f943f6c7e79b0897fe705f590`;
40
+ - `x86_64-unknown-linux-musl`:
41
+ `codex-cli 0.145.0`,
42
+ `a2a05dafaa1acb002a45eaec0a462de5b13694fcfcd7bc43305f14781ce7be14`.
43
+ - The deprecated scalar binary checksum remains macOS-arm64 provenance.
44
+ Runtime checks resolve the current target receipt lazily.
45
+ - Target-specific raw hashes pin the four deterministic stable and experimental
46
+ `ClientRequest.json` and legacy protocol files in
39
47
  `tests/fixtures/codex-app-server-0.145.0/manifest.json`.
48
+ - The nondeterministically serialized stable and experimental v2 bundles are
49
+ enforced only through their shared recursively canonical hashes:
50
+ `02d8bf6651cd504bff0335f566c011e51ba77c5cc0538cb64ca7ac57739a1597`
51
+ and
52
+ `1bc09dedc506075562d4d49b702ecab6d947dd5a8c2a9014a5cde592a0938efb`.
40
53
  - `turn/steer` still requires `threadId`, `input`, and `expectedTurnId`.
41
54
  - The authenticated direct-binary checker passed every named-profile evidence
42
55
  bit on 2026-07-26. This Mac has no configured session launcher, so the local
@@ -69,14 +82,41 @@ node scripts/spikes/codex-app-server-real.mjs \
69
82
  --binary /absolute/versioned/path/to/codex \
70
83
  --codex-home /absolute/non-temporary/codex-home \
71
84
  --workspace /absolute/workspace \
72
- --daemon-secret-root /absolute/daemon-secret-root
85
+ --tmpdir /absolute/private/child-tmpdir \
86
+ --daemon-secret-root /absolute/private/child-tmpdir \
87
+ --external-network-host 1.1.1.1 \
88
+ --external-network-port 443
73
89
  ```
74
90
 
75
91
  Environment fallbacks are `POLYGRAM_CODEX_BIN`, `ORCHESTRA_CODEX_HOME`,
76
- `ORCHESTRA_CODEX_WORKSPACE`, `ORCHESTRA_SESSION_LAUNCHER`, and the
77
- path-delimited `ORCHESTRA_CODEX_DAEMON_SECRET_ROOTS`.
92
+ `ORCHESTRA_CODEX_WORKSPACE`, `ORCHESTRA_CODEX_TMPDIR`,
93
+ `ORCHESTRA_SESSION_LAUNCHER`, and the path-delimited
94
+ `ORCHESTRA_CODEX_DAEMON_SECRET_ROOTS`. Linux also requires
95
+ `ORCHESTRA_CODEX_EXTERNAL_NETWORK_HOST` and
96
+ `ORCHESTRA_CODEX_EXTERNAL_NETWORK_PORT` when the corresponding flags are not
97
+ passed. The endpoint must be an operator-approved, globally routable numeric
98
+ IPv4 address and port that are reachable from the service environment; a
99
+ hostname or private, loopback, link-local, benchmark, or documentation address
100
+ is rejected. The checker requires the same endpoint to remain reachable from
101
+ the host immediately before and after the sandbox-denial probe.
78
102
  Each synthetic daemon-secret root must contain an owner-only regular
79
103
  `.orchestra-codex-u1a-deny-probe` sentinel with no symlink or hard-link alias.
104
+ On Linux, the child `TMPDIR` must be an existing canonical service-user-owned
105
+ directory with exact mode `0700`, separate from both the workspace and
106
+ `CODEX_HOME`. The same exact directory must also be supplied as a
107
+ `--daemon-secret-root`, so the filesystem enforcement probe proves that its
108
+ sentinel is unreadable from `command/exec`. Darwin does not require or validate
109
+ this additional child-temp input.
110
+
111
+ Before Linux app-server startup, the checker requires the reviewed profile to
112
+ run a bounded harmless command using the Codex 0.145.0 CLI surface:
113
+
114
+ ```text
115
+ codex sandbox --permission-profile polygram-session -- /bin/true
116
+ ```
117
+
118
+ The checker does not trace bubblewrap. The final bounded VPS operational gate
119
+ must separately prove that this exact invocation reaches `/usr/bin/bwrap`.
80
120
 
81
121
  The checker never creates, copies, reads, hashes, or prints authentication
82
122
  contents. `CODEX_HOME` must already exist, be canonical, non-temporary, owned
@@ -330,6 +370,25 @@ passed every control and denial. The Unix-socket control uses a short,
330
370
  explicitly length-guarded macOS pathname and an asynchronous host runner so
331
371
  the control cannot false-fail while Node's listener is blocked.
332
372
 
373
+ On Linux x64, the same gate additionally requires host-positive and
374
+ sandbox-negative reads of the owned process's `/proc` command line,
375
+ environment, and inherited file descriptor, plus a bounded `strace` attach
376
+ probe. Local TCP, UDP, DNS-protocol, Unix-socket, and direct inherited-FD
377
+ checks remain mandatory. Only the macOS Keychain checks are explicitly
378
+ inapplicable on Linux; an unavailable Linux process, IPC, or network probe
379
+ stops the gate.
380
+
381
+ UDP and DNS listeners remain active until their command completes and for a
382
+ bounded settle interval afterward, so delayed packets cannot be classified as
383
+ denied early. An exact Linux `strace` ESRCH/`No such process` result counts as
384
+ PID-namespace denial only when host-side process liveness and attach controls
385
+ pass both before and after the sandbox attempt; helper failures remain
386
+ fail-closed. The direct inherited-FD probe intentionally checks the production
387
+ app-server spawn boundary, which receives only stdio pipes. The separate
388
+ `/proc/<pid>/fd` probe checks whether a sandboxed same-UID command can recover a
389
+ descriptor inherited by another owned process; no secret descriptor is
390
+ deliberately passed to app-server.
391
+
333
392
  ## Transport-cut classification is deterministic; persistence is unproved
334
393
 
335
394
  The checker now tracks every currently allowlisted state-changing request
package/index.js CHANGED
@@ -25,6 +25,7 @@ const {
25
25
  CodexAppServerClient,
26
26
  CodexAppServerError,
27
27
  protocolSchema: codexProtocolSchema,
28
+ resolveCodexTargetPin,
28
29
  } = require('./lib/codex/app-server-client');
29
30
  const sdkProcess = require('./lib/process/sdk-process');
30
31
  const { SdkProcess, extractAssistantText, sumUsage, makeInputController } = sdkProcess;
@@ -52,7 +53,7 @@ const approvalsStore = require('./lib/approvals/store');
52
53
 
53
54
  module.exports = {
54
55
  // pool + driver
55
- Process, UnsupportedOperationError, ProcessManager, CALLBACK_TO_EVENT, CliProcess, CodexProcess, CodexAppServerClient, CodexAppServerError, CodexPreflightError, SdkProcess, extractAssistantText, sumUsage, makeInputController, createProcessFactory, pickBackend, preflightCodexRuntime, reattestCodexStaticPolicy, createCodexSpawnProfile, assertCodexSpawnProfile, attestPinnedCodexHome, buildCodexAppServerEnv, codexProtocolSchema,
56
+ Process, UnsupportedOperationError, ProcessManager, CALLBACK_TO_EVENT, CliProcess, CodexProcess, CodexAppServerClient, CodexAppServerError, CodexPreflightError, SdkProcess, extractAssistantText, sumUsage, makeInputController, createProcessFactory, pickBackend, preflightCodexRuntime, reattestCodexStaticPolicy, createCodexSpawnProfile, assertCodexSpawnProfile, attestPinnedCodexHome, buildCodexAppServerEnv, resolveCodexTargetPin, codexProtocolSchema,
56
57
  // channels bridge (MCP injection protocol)
57
58
  ChannelsBridgeServer, bridgeProtocol,
58
59
  // tmux lifecycle
@@ -104,6 +104,9 @@ function assertProtocolSchema() {
104
104
  .filter(([, spec]) => spec.experimental)
105
105
  .map(([method]) => method)
106
106
  .sort();
107
+ const binaryTargets = Object.keys(
108
+ protocolSchema.binarySha256ByTarget ?? {},
109
+ ).sort();
107
110
  if (
108
111
  JSON.stringify(experimental) !== JSON.stringify([
109
112
  'thread/backgroundTerminals/clean',
@@ -114,6 +117,17 @@ function assertProtocolSchema() {
114
117
  || protocolSchema.requestIdTypes.join(',') !== 'integer,string'
115
118
  || typeof protocolSchema.generatedProtocolV2CanonicalSha256 !== 'string'
116
119
  || !/^[a-f0-9]{64}$/.test(protocolSchema.generatedProtocolV2CanonicalSha256)
120
+ || JSON.stringify(binaryTargets) !== JSON.stringify([
121
+ 'aarch64-apple-darwin',
122
+ 'x86_64-unknown-linux-musl',
123
+ ])
124
+ || binaryTargets.some(
125
+ (target) => !/^[a-f0-9]{64}$/.test(
126
+ protocolSchema.binarySha256ByTarget[target],
127
+ ),
128
+ )
129
+ || protocolSchema.binarySha256
130
+ !== protocolSchema.binarySha256ByTarget['aarch64-apple-darwin']
117
131
  ) {
118
132
  throw new Error('Codex app-server protocol pin is inconsistent');
119
133
  }
@@ -141,6 +155,37 @@ class CodexAppServerError extends Error {
141
155
  }
142
156
  }
143
157
 
158
+ const CODEX_TARGET_BY_HOST = Object.freeze({
159
+ 'darwin/arm64': 'aarch64-apple-darwin',
160
+ 'linux/x64': 'x86_64-unknown-linux-musl',
161
+ });
162
+ const CODEX_TARGET_RECEIPTS = Object.freeze(Object.fromEntries(
163
+ Object.entries(protocolSchema.binarySha256ByTarget).map(
164
+ ([target, binarySha256]) => [
165
+ target,
166
+ Object.freeze({
167
+ target,
168
+ cliVersion: protocolSchema.cliVersion,
169
+ binarySha256,
170
+ }),
171
+ ],
172
+ ),
173
+ ));
174
+
175
+ function resolveCodexTargetPin(
176
+ platform = process.platform,
177
+ arch = process.arch,
178
+ ) {
179
+ const target = CODEX_TARGET_BY_HOST[`${platform}/${arch}`];
180
+ if (!target) {
181
+ throw new CodexAppServerError(
182
+ 'The native Codex app-server beta does not support this platform',
183
+ 'CODEX_UNSUPPORTED_PLATFORM',
184
+ );
185
+ }
186
+ return CODEX_TARGET_RECEIPTS[target];
187
+ }
188
+
144
189
  function buildCodexAppServerEnv(codexHome, hostEnv = process.env) {
145
190
  return Object.fromEntries(
146
191
  Object.entries({
@@ -185,7 +230,16 @@ async function hashFile(binary) {
185
230
  return hash.digest('hex');
186
231
  }
187
232
 
188
- async function attestPinnedCodexBinary(binary) {
233
+ async function attestPinnedCodexBinary(
234
+ binary,
235
+ targetReceipt = resolveCodexTargetPin(),
236
+ ) {
237
+ if (targetReceipt !== resolveCodexTargetPin()) {
238
+ throw new CodexAppServerError(
239
+ 'pinned Codex target receipt mismatch',
240
+ 'CODEX_BINARY_MISMATCH',
241
+ );
242
+ }
189
243
  if (realpathSync(binary) !== binary) {
190
244
  throw new CodexAppServerError(
191
245
  'pinned Codex binary path is not canonical',
@@ -221,7 +275,7 @@ async function attestPinnedCodexBinary(binary) {
221
275
  );
222
276
  }
223
277
  const sha256 = await hashFile(binary);
224
- if (sha256 !== protocolSchema.binarySha256) {
278
+ if (sha256 !== targetReceipt.binarySha256) {
225
279
  throw new CodexAppServerError(
226
280
  'pinned Codex binary hash mismatch',
227
281
  'CODEX_BINARY_MISMATCH',
@@ -241,7 +295,7 @@ async function attestPinnedCodexBinary(binary) {
241
295
  'CODEX_BINARY_MISMATCH',
242
296
  );
243
297
  }
244
- if (stdout.trim() !== protocolSchema.cliVersion) {
298
+ if (stdout.trim() !== targetReceipt.cliVersion) {
245
299
  throw new CodexAppServerError(
246
300
  'pinned Codex binary version mismatch',
247
301
  'CODEX_BINARY_MISMATCH',
@@ -249,6 +303,7 @@ async function attestPinnedCodexBinary(binary) {
249
303
  }
250
304
  return {
251
305
  path: binary,
306
+ target: targetReceipt.target,
252
307
  sha256,
253
308
  version: stdout.trim(),
254
309
  fingerprint,
@@ -1732,12 +1787,7 @@ class CodexAppServerClient extends EventEmitter {
1732
1787
  'CodexAppServerClient: expectedConfigSha256 must be a lowercase SHA-256',
1733
1788
  );
1734
1789
  }
1735
- if (process.platform === 'win32') {
1736
- throw new CodexAppServerError(
1737
- 'The native Codex app-server beta does not support Windows',
1738
- 'CODEX_UNSUPPORTED_PLATFORM',
1739
- );
1740
- }
1790
+ const targetReceipt = resolveCodexTargetPin();
1741
1791
  for (const [value, label] of [
1742
1792
  [cwd, 'cwd'],
1743
1793
  [codexHome, 'codexHome'],
@@ -1824,6 +1874,7 @@ class CodexAppServerClient extends EventEmitter {
1824
1874
  onFault,
1825
1875
  attestBinaryFn,
1826
1876
  attestCodexHomeFn,
1877
+ targetReceipt,
1827
1878
  expectedConfigSha256,
1828
1879
  requestTimeoutMs,
1829
1880
  sinkTimeoutMs,
@@ -1889,7 +1940,7 @@ class CodexAppServerClient extends EventEmitter {
1889
1940
  ];
1890
1941
  try {
1891
1942
  const [attestation, homeAttestation] = await Promise.all([
1892
- this.attestBinaryFn(this.binary),
1943
+ this.attestBinaryFn(this.binary, this.targetReceipt),
1893
1944
  this.attestCodexHomeFn(
1894
1945
  this.codexHome,
1895
1946
  this.expectedConfigSha256,
@@ -1898,8 +1949,9 @@ class CodexAppServerClient extends EventEmitter {
1898
1949
  if (
1899
1950
  !attestation
1900
1951
  || attestation.path !== this.binary
1901
- || attestation.sha256 !== protocolSchema.binarySha256
1902
- || attestation.version !== protocolSchema.cliVersion
1952
+ || attestation.target !== this.targetReceipt.target
1953
+ || attestation.sha256 !== this.targetReceipt.binarySha256
1954
+ || attestation.version !== this.targetReceipt.cliVersion
1903
1955
  ) {
1904
1956
  throw new CodexAppServerError(
1905
1957
  'pinned Codex binary attestation was inconsistent',
@@ -2931,4 +2983,5 @@ module.exports = {
2931
2983
  attestPinnedCodexHome,
2932
2984
  buildCodexAppServerEnv,
2933
2985
  protocolSchema,
2986
+ resolveCodexTargetPin,
2934
2987
  };
@@ -7,6 +7,7 @@ const {
7
7
  CodexAppServerClient,
8
8
  buildCodexAppServerEnv,
9
9
  protocolSchema,
10
+ resolveCodexTargetPin,
10
11
  } = require('./app-server-client');
11
12
 
12
13
  const MAX_PAGES = 16;
@@ -22,6 +23,7 @@ const SHA256_RE = /^[a-f0-9]{64}$/;
22
23
  const EXPECTED_PROFILE_KEYS = new Set([
23
24
  'runtime',
24
25
  'binary',
26
+ 'target',
25
27
  'binarySha256',
26
28
  'cliVersion',
27
29
  'protocolSchemaSha256',
@@ -218,6 +220,7 @@ function exact(actual, expected, label) {
218
220
  }
219
221
 
220
222
  function normalizeExpectedProfile(value) {
223
+ const targetReceipt = resolveCodexTargetPin();
221
224
  const source = plainObject(value, 'expectedStaticProfile');
222
225
  for (const key of Object.keys(source)) {
223
226
  if (!EXPECTED_PROFILE_KEYS.has(key)) {
@@ -246,14 +249,16 @@ function normalizeExpectedProfile(value) {
246
249
  source.binarySha256,
247
250
  'binarySha256',
248
251
  );
252
+ const target = requiredString(source.target, 'target');
249
253
  const cliVersion = requiredString(source.cliVersion, 'cliVersion');
250
254
  const protocolSchemaSha256 = requiredSha256(
251
255
  source.protocolSchemaSha256,
252
256
  'protocolSchemaSha256',
253
257
  );
254
258
  if (
255
- binarySha256 !== protocolSchema.binarySha256
256
- || cliVersion !== protocolSchema.cliVersion
259
+ target !== targetReceipt.target
260
+ || binarySha256 !== targetReceipt.binarySha256
261
+ || cliVersion !== targetReceipt.cliVersion
257
262
  || protocolSchemaSha256
258
263
  !== protocolSchema.generatedProtocolV2CanonicalSha256
259
264
  ) {
@@ -326,6 +331,7 @@ function normalizeExpectedProfile(value) {
326
331
  const profile = {
327
332
  runtime: 'codex',
328
333
  binary,
334
+ target,
329
335
  binarySha256,
330
336
  cliVersion,
331
337
  protocolSchemaSha256,
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "cliVersion": "codex-cli 0.145.0",
3
3
  "binarySha256": "1da3f4e0e96028b8a771814293c3033dafd1971f943f6c7e79b0897fe705f590",
4
+ "binarySha256ByTarget": {
5
+ "aarch64-apple-darwin": "1da3f4e0e96028b8a771814293c3033dafd1971f943f6c7e79b0897fe705f590",
6
+ "x86_64-unknown-linux-musl": "a2a05dafaa1acb002a45eaec0a462de5b13694fcfcd7bc43305f14781ce7be14"
7
+ },
4
8
  "generatedProtocolV2CanonicalSha256": "1bc09dedc506075562d4d49b702ecab6d947dd5a8c2a9014a5cde592a0938efb",
5
9
  "requestIdTypes": [
6
10
  "integer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumkov/orchestra",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Transport-agnostic session engine for Claude Code and the native Codex app-server: spawn, steer, supervise, observe turns, and recover.",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",