@aisac/cli 0.4.0-beta.18 → 0.4.0-beta.21

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.
@@ -288,10 +288,11 @@ export function parsePinnedKeys(text) {
288
288
  * The keys ship inside the installed package, which a global install may own
289
289
  * as root, so only the size is bounded here (unlike private state files).
290
290
  * @param {string} packageRoot
291
+ * @param {string} [fileName] another pinned-keys file of the same shape (the release manifest's)
291
292
  * @returns {Promise<PinnedKey[]>}
292
293
  */
293
- export async function loadPinnedKeys(packageRoot) {
294
- const path = join(packageRoot, PUBLIC_KEY_FILE);
294
+ export async function loadPinnedKeys(packageRoot, fileName = PUBLIC_KEY_FILE) {
295
+ const path = join(packageRoot, fileName);
295
296
  const entry = await stat(path);
296
297
  if (!entry.isFile() || entry.size > MAX_SMALL_STATE_BYTES) throw new Error('pinned_keys_invalid');
297
298
  return parsePinnedKeys(await readFile(path, 'utf8'));
@@ -692,14 +693,18 @@ export async function materializeCodexPack(pack, launchDirectory) {
692
693
  return validateCodexEngineering({ schemaVersion: 1, skillsRoot, agents });
693
694
  }
694
695
 
696
+ /** The update command when the caller has no channel to hand over (release-manifest FR6). */
697
+ export const DEFAULT_UPDATE_COMMAND = 'npm install -g @aisac/cli@beta';
698
+
695
699
  /**
696
700
  * One line for the launch, in the pack locale; null when the capability is
697
701
  * not offered, so memory-only users see no change.
698
702
  * @param {PackOutcome} outcome
699
703
  * @param {PackLocale} locale
704
+ * @param {string} [updateCommand] The channel's command (release-manifest FR6).
700
705
  * @returns {string | null}
701
706
  */
702
- export function packNotice(outcome, locale) {
707
+ export function packNotice(outcome, locale, updateCommand = DEFAULT_UPDATE_COMMAND) {
703
708
  const pt = locale === 'pt-BR';
704
709
  const without = pt ? 'a sessão começa sem o método.' : 'the session starts without the method.';
705
710
  switch (outcome.outcome) {
@@ -720,8 +725,8 @@ export function packNotice(outcome, locale) {
720
725
  case 'rejected':
721
726
  if (outcome.reason === 'client_outdated')
722
727
  return pt
723
- ? `AISAC Engineering: atualize o aisac (npm install -g @aisac/cli@beta); ${without}`
724
- : `AISAC Engineering: update aisac (npm install -g @aisac/cli@beta); ${without}`;
728
+ ? `AISAC Engineering: atualize o aisac (${updateCommand}); ${without}`
729
+ : `AISAC Engineering: update aisac (${updateCommand}); ${without}`;
725
730
  return pt
726
731
  ? `AISAC Engineering: pacote recusado (${outcome.reason}); ${without}`
727
732
  : `AISAC Engineering: pack rejected (${outcome.reason}); ${without}`;
@@ -754,7 +759,7 @@ function lastLaunchOf(outcome, locale, client) {
754
759
  * throws. `hostSupported: false` (a Codex release older than the verified
755
760
  * mechanism) still checks the license but loads nothing.
756
761
  * @param {{ endpoint: string, token: string, root: string, directory: string,
757
- * packageRoot: string, client?: PackClient, hostSupported?: boolean,
762
+ * packageRoot: string, client?: PackClient, hostSupported?: boolean, updateCommand?: string,
758
763
  * env?: NodeJS.ProcessEnv, fetchImpl?: typeof fetch, timeoutMs?: number }} input
759
764
  * @returns {Promise<{ pluginRoot: string | null,
760
765
  * codex: import('./codex-engineering.mjs').CodexEngineering | null, line: string | null }>}
@@ -796,14 +801,22 @@ export async function prepareEngineeringPack(input) {
796
801
  await atomicJson(join(input.root, LAST_LAUNCH_FILE), lastLaunchOf(outcome, locale, client)).catch(
797
802
  () => undefined,
798
803
  );
799
- return { pluginRoot, codex, line: packNotice(outcome, locale) };
804
+ return { pluginRoot, codex, line: packNotice(outcome, locale, input.updateCommand) };
800
805
  }
801
806
 
807
+ /**
808
+ * The host a launch runs, as its marker records it (release-manifest FR5): the
809
+ * managed-host garbage collection never removes a version a live marker names.
810
+ * @typedef {{ name: 'claude' | 'codex', mode: 'system' | 'managed' | 'pending', version: string | null }} LaunchHost
811
+ * `pending`: the launch has not resolved its host yet (release-manifest FR5); collectors
812
+ * skip while one is live, so the version it is about to run is never removed.
813
+ */
814
+
802
815
  /**
803
816
  * Record who owns a launch directory, so a later launch can sweep it once
804
- * both processes are gone (spec FR4 step 7).
817
+ * both processes are gone (spec FR4 step 7), and which host it runs.
805
818
  * @param {string} directory
806
- * @param {{ launcherPid: number, childPid: number | null }} owners
819
+ * @param {{ launcherPid: number, childPid: number | null, host?: LaunchHost }} owners
807
820
  */
808
821
  export async function writeLaunchMarker(directory, owners) {
809
822
  const path = join(directory, LAUNCH_MARKER_FILE);
@@ -870,3 +883,76 @@ export async function sweepStaleLaunches(root, alive = processAlive) {
870
883
  }
871
884
  return removed;
872
885
  }
886
+
887
+ /**
888
+ * Launches still running after the stale sweep: directories whose marker names
889
+ * a live launcher or child. The client never updates itself under one
890
+ * (release-manifest FR6). Never throws.
891
+ * @param {string} root
892
+ * @param {(pid: number) => boolean} [alive]
893
+ * @returns {Promise<number>}
894
+ */
895
+ export async function liveLaunchCount(root, alive = processAlive) {
896
+ await sweepStaleLaunches(root, alive);
897
+ const runtime = join(root, 'runtime');
898
+ let entries;
899
+ try {
900
+ entries = await readdir(runtime, { withFileTypes: true });
901
+ } catch {
902
+ return 0;
903
+ }
904
+ let live = 0;
905
+ for (const entry of entries) {
906
+ if (!entry.isDirectory() || !LAUNCH_DIRECTORY.test(entry.name)) continue;
907
+ const marker = await readSmallStateJson(join(runtime, entry.name, LAUNCH_MARKER_FILE));
908
+ if (!isRecord(marker) || marker.schemaVersion !== 1 || !isPid(marker.launcherPid)) continue;
909
+ const childPid = isPid(marker.childPid) ? /** @type {number} */ (marker.childPid) : null;
910
+ if (alive(/** @type {number} */ (marker.launcherPid)) || (childPid !== null && alive(childPid)))
911
+ live += 1;
912
+ }
913
+ return live;
914
+ }
915
+
916
+ /** @param {unknown} value @returns {LaunchHost | null} */
917
+ function launchHostOf(value) {
918
+ if (!isRecord(value)) return null;
919
+ const { name, mode, version } = value;
920
+ if (name !== 'claude' && name !== 'codex') return null;
921
+ if (mode !== 'system' && mode !== 'managed' && mode !== 'pending') return null;
922
+ if (version !== null && (typeof version !== 'string' || version.length > 64)) return null;
923
+ return { name, mode, version: /** @type {string | null} */ (version) };
924
+ }
925
+
926
+ /**
927
+ * The hosts of the launches still running (release-manifest FR5): a managed
928
+ * host version one of them names is never garbage-collected. Never throws.
929
+ * @param {string} root
930
+ * @param {(pid: number) => boolean} [alive]
931
+ * @returns {Promise<LaunchHost[]>}
932
+ */
933
+ export async function liveLaunchHosts(root, alive = processAlive) {
934
+ await sweepStaleLaunches(root, alive);
935
+ const runtime = join(root, 'runtime');
936
+ let entries;
937
+ try {
938
+ entries = await readdir(runtime, { withFileTypes: true });
939
+ } catch {
940
+ return [];
941
+ }
942
+ /** @type {LaunchHost[]} */
943
+ const hosts = [];
944
+ for (const entry of entries) {
945
+ if (!entry.isDirectory() || !LAUNCH_DIRECTORY.test(entry.name)) continue;
946
+ const marker = await readSmallStateJson(join(runtime, entry.name, LAUNCH_MARKER_FILE));
947
+ if (!isRecord(marker) || marker.schemaVersion !== 1 || !isPid(marker.launcherPid)) continue;
948
+ const childPid = isPid(marker.childPid) ? /** @type {number} */ (marker.childPid) : null;
949
+ if (
950
+ !alive(/** @type {number} */ (marker.launcherPid)) &&
951
+ (childPid === null || !alive(childPid))
952
+ )
953
+ continue;
954
+ const host = launchHostOf(marker.host);
955
+ if (host !== null) hosts.push(host);
956
+ }
957
+ return hosts;
958
+ }
package/dist/launch.mjs CHANGED
@@ -14,11 +14,24 @@ import {
14
14
  } from './state.mjs';
15
15
  import { codexPolicyJson, makePolicy } from './policy.mjs';
16
16
  import {
17
+ liveLaunchHosts,
17
18
  prepareEngineeringPack,
19
+ readStoredLocale,
20
+ resolvePackLocale,
18
21
  sweepStaleLaunches,
19
22
  writeLaunchMarker,
20
23
  } from './engineering-pack.mjs';
21
24
  import { prepareCodexGuardrails, prepareGuardrails } from './guardrails-plugin.mjs';
25
+ import { installedClientVersion, refreshReleaseManifest } from './release-manifest.mjs';
26
+ import { readReleaseSettings, updateCommandFor } from './release-settings.mjs';
27
+ import { REEXEC_ENV, releaseUpdateLock } from './update-actions.mjs';
28
+ import {
29
+ collectManagedHosts,
30
+ hostFallbackLine,
31
+ managedHostEnvironment,
32
+ resolveHostExecutable,
33
+ } from './managed-host.mjs';
34
+ import { recordLaunchHost } from './self-update.mjs';
22
35
  import { CODEX_HOOKS_ENV, GUARDRAILS_SESSION_ENV, supportsCodexHooks } from './codex-hooks.mjs';
23
36
  import {
24
37
  CODEX_MCP_ENV,
@@ -152,6 +165,7 @@ function childEnvironment(root) {
152
165
  delete environment[CODEX_MCP_ENV];
153
166
  delete environment[CODEX_HOOKS_ENV];
154
167
  delete environment[GUARDRAILS_SESSION_ENV];
168
+ delete environment[REEXEC_ENV];
155
169
  environment.AIBRAIN_STATE_DIR = resolve(root);
156
170
  return environment;
157
171
  }
@@ -388,22 +402,34 @@ async function assertClaudeCheckpointHelper(packageRoot) {
388
402
 
389
403
  /**
390
404
  * A fresh private directory for one launch. Directories left by launches whose
391
- * processes are gone are swept first; this one records its launcher.
405
+ * processes are gone are swept first; this one records its launcher and the
406
+ * host it runs, `pending` until resolved (release-manifest FR5: a managed
407
+ * version a live launch names is never garbage-collected, and nothing is
408
+ * collected while a live launch is still resolving its host).
392
409
  * @param {string} root @param {string} prefix
410
+ * @param {import('./engineering-pack.mjs').LaunchHost} host
393
411
  */
394
- async function launchDirectory(root, prefix) {
412
+ async function launchDirectory(root, prefix, host) {
395
413
  await sweepStaleLaunches(root);
396
414
  const parent = await privateDirectory(join(root, 'runtime'));
397
415
  const directory = await mkdtemp(join(parent, `${prefix}-`));
398
416
  await chmod(directory, 0o700);
399
- await writeLaunchMarker(directory, { launcherPid: process.pid, childPid: null });
417
+ await writeLaunchMarker(directory, { launcherPid: process.pid, childPid: null, host });
418
+ // This launch now counts as live for other launchers, so the update lock the
419
+ // self-update step took can go (release-manifest FR6).
420
+ await releaseUpdateLock(root).catch(() => undefined);
400
421
  return directory;
401
422
  }
402
423
 
403
- /** @param {string} directory @param {number | undefined} childPid */
404
- async function recordChild(directory, childPid) {
424
+ /**
425
+ * @param {string} directory @param {number | undefined} childPid
426
+ * @param {import('./engineering-pack.mjs').LaunchHost} host
427
+ */
428
+ async function recordChild(directory, childPid, host) {
405
429
  if (childPid === undefined) return;
406
- await writeLaunchMarker(directory, { launcherPid: process.pid, childPid }).catch(() => undefined);
430
+ await writeLaunchMarker(directory, { launcherPid: process.pid, childPid, host }).catch(
431
+ () => undefined,
432
+ );
407
433
  }
408
434
 
409
435
  /** @param {import('node:child_process').ChildProcess} child @param {string} directory */
@@ -455,6 +481,13 @@ export async function readSessionServers(root, client, environment) {
455
481
  * @property {typeof prepareGuardrails} [prepareGuardrails] Guardrail hooks plugin writer (E6a)
456
482
  * @property {typeof readSessionServers} [readSessionServers] MCP catalog servers to load (E6c)
457
483
  * @property {typeof prepareCodexGuardrails} [prepareCodexGuardrails] Codex guardrail hooks (E6b)
484
+ * @property {typeof refreshReleaseManifest} [refreshReleaseManifest] Release manifest refresh (ADR-0056 R2)
485
+ * @property {typeof resolveHostExecutable} [resolveHost] Managed or system host resolution (ADR-0056 R4)
486
+ */
487
+
488
+ /**
489
+ * @typedef {object} LaunchOptions
490
+ * @property {import('./release-settings.mjs').HostMode | null} [hostMode] `--host managed|system` for this launch (FR5)
458
491
  */
459
492
 
460
493
  /**
@@ -462,24 +495,28 @@ export async function readSessionServers(root, client, environment) {
462
495
  * @param {string} root
463
496
  * @param {string[]} args
464
497
  * @param {LaunchDependencies} [dependencies]
498
+ * @param {LaunchOptions} [launchOptions]
465
499
  */
466
- export async function launchClaude(config, root, args, dependencies = {}) {
500
+ export async function launchClaude(config, root, args, dependencies = {}, launchOptions = {}) {
467
501
  const preparePack = dependencies.preparePack ?? prepareEngineeringPack;
502
+ const refreshManifest = dependencies.refreshReleaseManifest ?? refreshReleaseManifest;
468
503
  const writeGuardrails = dependencies.prepareGuardrails ?? prepareGuardrails;
469
504
  const readServers = dependencies.readSessionServers ?? readSessionServers;
505
+ const resolveHost = dependencies.resolveHost ?? resolveHostExecutable;
470
506
  const validated = assertConfig(config);
471
507
  const launchArgs = await parseClaudeLaunchArgs(args, process.cwd());
472
508
  assertClaudeArgs(launchArgs.args);
473
- const executable = resolveNative('claude');
474
- if (!executable) throw new Error('claude_not_found');
475
- const compatibility = await resolveClaudeCompatibility(executable, validated.packageRoot);
476
- if (compatibility.status === 'rejected') throw new Error(claudeCompatibilityError(compatibility));
477
- const pinnedExecutable = compatibility.executable ?? executable;
478
- if (compatibility.status === 'host_checked')
479
- process.stderr.write(
480
- `aisac: Claude ${compatibility.version ?? 'unknown'} accepted by the local native host contract; end-to-end recovery remains separately qualified.\n`,
481
- );
482
- const currentVersion = compatibility.version ?? nativeVersion(pinnedExecutable);
509
+ // Release manifest (ADR-0056 R2): refreshed at most every six hours, bounded by
510
+ // its own timeout; it never blocks the launch. R4 reads the Claude pin from it.
511
+ const manifest = await refreshManifest({
512
+ root,
513
+ packageRoot: validated.packageRoot,
514
+ endpoint: validated.endpoint,
515
+ token: validated.token,
516
+ host: 'claude',
517
+ });
518
+ // Everything that can fail without the host: the package's own assets, before any
519
+ // launch directory exists.
483
520
  const pluginRoot = await assertClaudeAssets(validated.packageRoot);
484
521
  const telemetryActive =
485
522
  validated.telemetry?.enabled === true && validated.telemetry?.disclosedAt != null;
@@ -499,7 +536,65 @@ export async function launchClaude(config, root, args, dependencies = {}) {
499
536
  const checkpointHelperPath = await assertClaudeCheckpointHelper(validated.packageRoot);
500
537
  const checkpointConfigDigest = claudeCheckpointConfigBinding(validated);
501
538
  const checkpointStateDir = await privateDirectory(join(root, 'claude', 'checkpoints'));
502
- const directory = await launchDirectory(root, 'claude');
539
+ // The launch marker first, its host `pending` (FR5): another launch's garbage
540
+ // collection skips while it exists, so the version this launch is about to run
541
+ // is never removed between its resolution and its spawn.
542
+ const directory = await launchDirectory(root, 'claude', {
543
+ name: 'claude',
544
+ mode: 'pending',
545
+ version: null,
546
+ });
547
+ // Managed or system host (ADR-0056 R4, FR5): the managed copy when the settings
548
+ // or `--host` ask for it and it is installed, pinned and qualified; otherwise the
549
+ // user's own binary, with the reason on stderr when a managed launch fell back.
550
+ const locale = resolvePackLocale(await readStoredLocale(root), process.env);
551
+ const host = await resolveHost({
552
+ host: 'claude',
553
+ root,
554
+ packageRoot: validated.packageRoot,
555
+ manifest,
556
+ settings: await readReleaseSettings(root),
557
+ env: process.env,
558
+ flag: launchOptions.hostMode ?? null,
559
+ clientVersion: await installedClientVersion(validated.packageRoot),
560
+ locale,
561
+ progress: (line) => process.stderr.write(`${line}\n`),
562
+ });
563
+ if (host.fallback !== null) process.stderr.write(`${hostFallbackLine('claude', host, locale)}\n`);
564
+ const executable = host.executable;
565
+ if (!executable) {
566
+ await rm(directory, { recursive: true, force: true }).catch(() => undefined);
567
+ throw new Error('claude_not_found');
568
+ }
569
+ const compatibility =
570
+ host.compatibility ?? (await resolveClaudeCompatibility(executable, validated.packageRoot));
571
+ if (compatibility.status === 'rejected') {
572
+ await rm(directory, { recursive: true, force: true }).catch(() => undefined);
573
+ throw new Error(claudeCompatibilityError(compatibility));
574
+ }
575
+ const pinnedExecutable = compatibility.executable ?? executable;
576
+ if (compatibility.status === 'host_checked')
577
+ process.stderr.write(
578
+ `aisac: Claude ${compatibility.version ?? 'unknown'} accepted by the local native host contract; end-to-end recovery remains separately qualified.\n`,
579
+ );
580
+ const currentVersion = compatibility.version ?? nativeVersion(pinnedExecutable);
581
+ /** @type {import('./engineering-pack.mjs').LaunchHost} */
582
+ const launchHost = { name: 'claude', mode: host.mode, version: compatibility.version ?? null };
583
+ await writeLaunchMarker(directory, {
584
+ launcherPid: process.pid,
585
+ childPid: null,
586
+ host: launchHost,
587
+ });
588
+ await recordLaunchHost(
589
+ root,
590
+ {
591
+ name: 'claude',
592
+ mode: host.mode,
593
+ version: launchHost.version,
594
+ reason: host.fallback ?? host.reason,
595
+ },
596
+ manifest === null ? null : { sequence: manifest.sequence, source: manifest.source },
597
+ ).catch(() => undefined);
503
598
  const settingsPath = join(directory, 'settings.json');
504
599
  const mcpPath = join(directory, 'mcp.json');
505
600
  const context = validated.context;
@@ -604,6 +699,7 @@ export async function launchClaude(config, root, args, dependencies = {}) {
604
699
  root,
605
700
  directory,
606
701
  packageRoot: validated.packageRoot,
702
+ updateCommand: await updateCommandFor(root, validated.packageRoot),
607
703
  }).catch(() => ({ pluginRoot: null, line: null }));
608
704
  if (engineering.line !== null) process.stderr.write(`${engineering.line}\n`);
609
705
  // Guardrails need the license this launch confirmed (the pack loaded), and
@@ -638,7 +734,12 @@ export async function launchClaude(config, root, args, dependencies = {}) {
638
734
  await rm(directory, { recursive: true, force: true });
639
735
  throw error;
640
736
  }
641
- const environment = childEnvironment(root);
737
+ // The managed copy never updates itself (FR5); a system launch keeps the
738
+ // user's environment as it is.
739
+ const environment =
740
+ host.mode === 'managed'
741
+ ? managedHostEnvironment(childEnvironment(root))
742
+ : childEnvironment(root);
642
743
  environment.CLAUDE_CODE_ENABLE_FUNCTION_HOOKS = '1';
643
744
  /** @type {import('node:child_process').ChildProcess} */
644
745
  let child;
@@ -666,7 +767,26 @@ export async function launchClaude(config, root, args, dependencies = {}) {
666
767
  }
667
768
  // Listen for exit before any await, so a child that exits at once is not missed.
668
769
  const finished = waitForChild(child, directory);
669
- await recordChild(directory, child.pid);
770
+ await recordChild(directory, child.pid, launchHost);
771
+ // Garbage collection after a successful launch (FR5): the versions the manifest
772
+ // still carries lock sets for stay, as does any version a live launch runs.
773
+ // The live markers are read under the host lock, by the collector; a live launch
774
+ // still resolving its host (`pending`) could run any version and vetoes it.
775
+ if (manifest !== null && manifest.manifest !== null)
776
+ await collectManagedHosts({
777
+ root,
778
+ host: 'claude',
779
+ keep: Object.keys(manifest.manifest.hosts.claude.versions),
780
+ live: async () => {
781
+ const hosts = await liveLaunchHosts(root);
782
+ if (hosts.some((entry) => entry.mode === 'pending')) return null;
783
+ return hosts.flatMap((entry) =>
784
+ entry.name === 'claude' && entry.mode === 'managed' && entry.version !== null
785
+ ? [entry.version]
786
+ : [],
787
+ );
788
+ },
789
+ }).catch(() => undefined);
670
790
  return finished;
671
791
  }
672
792
 
@@ -678,6 +798,7 @@ export async function launchClaude(config, root, args, dependencies = {}) {
678
798
  */
679
799
  export async function launchCodex(config, root, args, dependencies = {}) {
680
800
  const preparePack = dependencies.preparePack ?? prepareEngineeringPack;
801
+ const refreshManifest = dependencies.refreshReleaseManifest ?? refreshReleaseManifest;
681
802
  const readServers = dependencies.readSessionServers ?? readSessionServers;
682
803
  const writeCodexGuardrails = dependencies.prepareCodexGuardrails ?? prepareCodexGuardrails;
683
804
  const validated = assertConfig(config);
@@ -706,7 +827,9 @@ export async function launchCodex(config, root, args, dependencies = {}) {
706
827
  ]);
707
828
  const checkpoints = await privateDirectory(join(root, 'codex', 'checkpoints'));
708
829
  const notes = await privateDirectory(join(root, 'codex', 'notes'));
709
- const directory = await launchDirectory(root, 'codex');
830
+ /** @type {import('./engineering-pack.mjs').LaunchHost} */
831
+ const launchHost = { name: 'codex', mode: 'system', version: compatibility.version };
832
+ const directory = await launchDirectory(root, 'codex', launchHost);
710
833
  const environment = childEnvironment(root);
711
834
  try {
712
835
  if (
@@ -730,6 +853,14 @@ export async function launchCodex(config, root, args, dependencies = {}) {
730
853
  await rm(directory, { recursive: true, force: true });
731
854
  throw error;
732
855
  }
856
+ // Release manifest (ADR-0056 R2): same contract as for Claude.
857
+ await refreshManifest({
858
+ root,
859
+ packageRoot: validated.packageRoot,
860
+ endpoint: validated.endpoint,
861
+ token: validated.token,
862
+ host: 'codex',
863
+ });
733
864
  // The pack never blocks the launch: every failure starts Codex without it.
734
865
  const engineering = await preparePack({
735
866
  endpoint: validated.endpoint,
@@ -739,6 +870,7 @@ export async function launchCodex(config, root, args, dependencies = {}) {
739
870
  packageRoot: validated.packageRoot,
740
871
  client: 'codex',
741
872
  hostSupported: supportsCodexEngineering(compatibility.version),
873
+ updateCommand: await updateCommandFor(root, validated.packageRoot),
742
874
  }).catch(() => ({ pluginRoot: null, codex: null, line: null }));
743
875
  if (engineering.line !== null) process.stderr.write(`${engineering.line}\n`);
744
876
  if (engineering.codex != null) {
@@ -795,7 +927,7 @@ export async function launchCodex(config, root, args, dependencies = {}) {
795
927
  });
796
928
  // Listen for exit before any await, so a child that exits at once is not missed.
797
929
  const finished = waitForChild(child, directory);
798
- await recordChild(directory, child.pid);
930
+ await recordChild(directory, child.pid, launchHost);
799
931
  return finished;
800
932
  }
801
933