@bitkyc08/opencodex 2.96.0 → 2.97.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.
- package/bin/ocx.mjs +214 -19
- package/gui/dist/assets/{App-bwugJRKn.js → App-DuNhggE1.js} +15 -15
- package/gui/dist/assets/{Tray-BOPQyDbH.js → Tray-CEw0y0jR.js} +1 -1
- package/gui/dist/assets/index-CynE_Rue.js +94 -0
- package/gui/dist/assets/{quota-summary-6HsrHQAy.js → quota-summary-VHFSlUuM.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/command-code.ts +15 -16
- package/src/adapters/cursor/transport-retry.ts +2 -2
- package/src/adapters/devin/cloud-direct/chat.ts +15 -6
- package/src/adapters/kiro/stream.ts +63 -4
- package/src/adapters/kiro-constants.ts +15 -1
- package/src/adapters/kiro-events.ts +31 -1
- package/src/adapters/kiro-retry.ts +3 -3
- package/src/adapters/ollama-native.ts +11 -1
- package/src/adapters/openai-responses/empty-assistant.ts +15 -3
- package/src/adapters/openai-responses/passthrough.ts +5 -4
- package/src/adapters/openai-responses/reasoning.ts +9 -4
- package/src/adapters/openai-responses/request-strips.ts +1 -1
- package/src/adapters/physical-send.ts +3 -3
- package/src/adapters/zed-openai-stream.ts +2 -1
- package/src/bridge/errors.ts +11 -2
- package/src/bridge/response-json.ts +2 -1
- package/src/bridge/sse.ts +14 -6
- package/src/chat/failure-verdict.ts +21 -0
- package/src/chat/outbound.ts +139 -21
- package/src/claude/outbound.ts +49 -2
- package/src/cli/capabilities-base.ts +25 -3
- package/src/cli/capabilities-command.ts +12 -3
- package/src/cli/capability-contracts.ts +2 -0
- package/src/cli/codex-launch-auth.ts +30 -1
- package/src/cli/codex-launcher.ts +12 -5
- package/src/cli/codex-shim-autorestore.ts +5 -4
- package/src/cli/dispatch.ts +11 -176
- package/src/cli/help.ts +2 -2
- package/src/cli/index.ts +5 -1
- package/src/cli/link.ts +1 -1
- package/src/cli/registry.ts +11 -3
- package/src/cli/root.ts +8 -0
- package/src/cli/sync-command.ts +243 -0
- package/src/cli/sync-fanout-process.ts +92 -0
- package/src/cli/sync-fanout.ts +150 -0
- package/src/cli/sync-flags.ts +10 -0
- package/src/cli/sync-link-status.ts +39 -0
- package/src/cli/sync-update-guard.ts +18 -0
- package/src/client/connect.ts +31 -14
- package/src/client/link-home.ts +3 -2
- package/src/client/machine-listener.ts +3 -0
- package/src/client/restore-ownership.ts +19 -1
- package/src/client/runtime-restart.ts +12 -4
- package/src/client/runtime.ts +40 -11
- package/src/client/stop-routing.ts +62 -0
- package/src/client/sync-runtime.ts +65 -0
- package/src/clients/config-export.ts +32 -3
- package/src/codex/auth-context.ts +49 -103
- package/src/codex/catalog/antigravity-discovery.ts +16 -5
- package/src/codex/catalog/provider-models.ts +6 -8
- package/src/codex/forward-transport-headers.ts +35 -6
- package/src/codex/inject/config-toml.ts +88 -0
- package/src/codex/inject/multi-agent-v2.ts +30 -4
- package/src/codex/inject/plan.ts +34 -7
- package/src/codex/inject-coordination.ts +11 -0
- package/src/codex/inject.ts +18 -7
- package/src/codex/lineage.ts +13 -7
- package/src/codex/quota.ts +22 -6
- package/src/codex/request-owned-affinity-key.ts +11 -0
- package/src/codex/request-owned-affinity.ts +118 -0
- package/src/codex/request-owned-main-pin.ts +86 -0
- package/src/codex/role-capability.ts +52 -41
- package/src/codex/routing/active-account.ts +13 -5
- package/src/codex/routing/selection.ts +40 -1
- package/src/codex/routing/thread-affinity-store.ts +916 -0
- package/src/codex/routing/thread-affinity.ts +90 -12
- package/src/codex/toml-source-lines.ts +72 -13
- package/src/combos/failover.ts +6 -109
- package/src/combos/request.ts +2 -2
- package/src/combos/resolve.ts +29 -11
- package/src/config/process-state.ts +5 -0
- package/src/config/schema/leaf-validators.ts +1 -0
- package/src/generated/compatibility-version.json +433 -165
- package/src/images/loop.ts +2 -1
- package/src/lib/client-error-body.ts +184 -0
- package/src/lib/client-retry-after.ts +66 -0
- package/src/lib/config-ownership.ts +4 -0
- package/src/lib/context-overflow-verdict.ts +113 -0
- package/src/lib/desktop-cli-handoff.d.mts +1 -1
- package/src/lib/desktop-cli-handoff.mjs +11 -1
- package/src/lib/empty-tool-catalog.ts +25 -3
- package/src/lib/error-destination.ts +47 -0
- package/src/lib/failure-detail.ts +66 -0
- package/src/lib/model-identity.ts +44 -0
- package/src/lib/private-sqlite-path.ts +124 -0
- package/src/lib/response-service-tier.ts +17 -0
- package/src/lib/retry-after.ts +3 -0
- package/src/lib/spend-ledger-owner.ts +43 -4
- package/src/lib/upstream-condition.ts +142 -0
- package/src/lib/upstream-retry.ts +14 -11
- package/src/lib/windows-owner-acl.ts +13 -6
- package/src/link/remote-platform.ts +14 -0
- package/src/link/remote-windows.ts +51 -9
- package/src/link/ssh-argv.ts +63 -10
- package/src/oauth/generic-account-failover.ts +13 -11
- package/src/oauth/index.ts +36 -74
- package/src/oauth/oauth-errors.ts +67 -0
- package/src/oauth/store.ts +1 -1
- package/src/protocols/codecs/ollama.ts +197 -0
- package/src/protocols/encoders/adapter-events.ts +4 -0
- package/src/protocols/encoders/chat.ts +18 -10
- package/src/protocols/trace.ts +18 -0
- package/src/providers/fastwire.ts +3 -2
- package/src/providers/quota/anthropic-usage-windows.ts +13 -3
- package/src/providers/quota/vendor-probes-key.ts +60 -24
- package/src/providers/request-pacing.ts +3 -2
- package/src/responses/apply-patch-envelope.ts +45 -19
- package/src/responses/compaction-history-framing.ts +5 -1
- package/src/responses/freeform-wrapper-scan.ts +5 -3
- package/src/responses/progressive-freeform-input.ts +354 -45
- package/src/routing/fallback-policy.ts +3 -1
- package/src/server/admission-model-scope.ts +17 -6
- package/src/server/admitted-http-turn.ts +56 -0
- package/src/server/auth-cors.ts +5 -0
- package/src/server/chat-completions.ts +45 -20
- package/src/server/chat-native-sse.ts +52 -7
- package/src/server/chat-native.ts +60 -35
- package/src/server/claude-bridge-pool-session.ts +59 -0
- package/src/server/claude-messages.ts +51 -24
- package/src/server/context-history.ts +5 -1
- package/src/server/inbound-body-admission.ts +11 -4
- package/src/server/index/ollama-routes.ts +89 -0
- package/src/server/index/serve-options.ts +21 -4
- package/src/server/index/websocket-handler.ts +4 -2
- package/src/server/index.ts +6 -36
- package/src/server/inference/client-encoder-delivery.ts +4 -2
- package/src/server/json-serialized-bytes.ts +44 -0
- package/src/server/management/agent-settings-routes.ts +24 -21
- package/src/server/management/codex-cli-update-routes.ts +2 -1
- package/src/server/management/route-registry.ts +1 -1
- package/src/server/messages-native-scope.ts +2 -1
- package/src/server/messages-native-tool-guard.ts +1 -1
- package/src/server/messages-native.ts +12 -7
- package/src/server/messages-shared.ts +6 -2
- package/src/server/native-final-log.ts +93 -0
- package/src/server/ollama-inbound.ts +349 -0
- package/src/server/ollama-native-paths.ts +21 -0
- package/src/server/ollama-route-policy.ts +73 -0
- package/src/server/relay.ts +22 -3
- package/src/server/request-decompress.ts +4 -2
- package/src/server/request-log-failure-attribution.ts +22 -0
- package/src/server/request-log-failure-detail.ts +80 -0
- package/src/server/request-log-terminal-status.ts +4 -2
- package/src/server/request-log.ts +79 -42
- package/src/server/response-log-body.ts +6 -1
- package/src/server/responses/account-change-state.ts +17 -6
- package/src/server/responses/adapter-continuation.ts +9 -4
- package/src/server/responses/adapter-delivery.ts +5 -4
- package/src/server/responses/adapter-dispatch.ts +31 -30
- package/src/server/responses/anthropic-thinking-recovery.ts +3 -0
- package/src/server/responses/codex-auth-error.ts +19 -18
- package/src/server/responses/codex-ws-exchange.ts +11 -8
- package/src/server/responses/codex-ws-metadata.ts +94 -21
- package/src/server/responses/codex-ws-request.ts +3 -1
- package/src/server/responses/compact.ts +53 -23
- package/src/server/responses/compaction-recovery.ts +4 -2
- package/src/server/responses/compaction-routing.ts +9 -4
- package/src/server/responses/core-auth.ts +32 -14
- package/src/server/responses/core-codex-account.ts +17 -6
- package/src/server/responses/core-combo-failure.ts +5 -1
- package/src/server/responses/core-combo-native.ts +2 -1
- package/src/server/responses/core-combo.ts +41 -27
- package/src/server/responses/core-errors.ts +22 -20
- package/src/server/responses/core-lifetime.ts +6 -3
- package/src/server/responses/core-normalize.ts +1 -0
- package/src/server/responses/core-options.ts +7 -0
- package/src/server/responses/core-pipeline.ts +4 -3
- package/src/server/responses/fetch-helpers.ts +7 -1
- package/src/server/responses/input-admission.ts +28 -2
- package/src/server/responses/native-injection.ts +1 -1
- package/src/server/responses/native-response-json.ts +13 -4
- package/src/server/responses/native-response-output.ts +1 -2
- package/src/server/responses/non-replayable-error.ts +2 -1
- package/src/server/responses/pacing-overload.ts +3 -2
- package/src/server/responses/passthrough-delivery.ts +55 -14
- package/src/server/responses/passthrough-dispatch.ts +19 -17
- package/src/server/responses/passthrough-error.ts +9 -9
- package/src/server/responses/policy-fallback.ts +2 -1
- package/src/server/responses/request-prepare.ts +67 -48
- package/src/server/responses/request-transport.ts +35 -31
- package/src/server/responses/run-turn-execution.ts +6 -6
- package/src/server/responses/sidecar-execution.ts +16 -12
- package/src/server/responses/spend-storage-error.ts +2 -1
- package/src/server/responses/ws-upstream.ts +9 -0
- package/src/server/responses-custom-tool-repair.ts +14 -3
- package/src/server/responses-terminal-repair.ts +5 -2
- package/src/server/responses-undeclared-tool-guard.ts +39 -16
- package/src/server/safe-response-headers.ts +162 -13
- package/src/server/turn-state-handles.ts +164 -0
- package/src/server/workflow-refusal.ts +2 -1
- package/src/service/ownership-mutation-lease.d.mts +11 -2
- package/src/service/ownership-mutation-lease.mjs +53 -11
- package/src/types/config.ts +2 -0
- package/src/update/index.ts +133 -25
- package/src/update/npm-install.d.mts +8 -0
- package/src/update/npm-install.mjs +20 -1
- package/src/update/orchestrated-admission.d.mts +4 -0
- package/src/update/orchestrated-admission.mjs +12 -0
- package/src/update/orchestrated-arguments.d.mts +12 -0
- package/src/update/orchestrated-arguments.mjs +64 -0
- package/src/update/orchestrated-child.d.mts +12 -0
- package/src/update/orchestrated-child.mjs +70 -0
- package/src/update/orchestrated-entry.ts +234 -0
- package/src/update/orchestrated-identity-probe-entry.ts +20 -0
- package/src/update/orchestrated-identity.ts +53 -0
- package/src/update/orchestrated-live-identity.ts +48 -0
- package/src/update/orchestrated-node-driver.mjs +99 -0
- package/src/update/orchestrated-outcome.d.mts +21 -0
- package/src/update/orchestrated-outcome.mjs +40 -0
- package/src/update/orchestrated-plan.ts +49 -0
- package/src/update/orchestrated-pnpm.d.mts +8 -0
- package/src/update/orchestrated-pnpm.mjs +33 -0
- package/src/update/orchestrated-session.d.mts +37 -0
- package/src/update/orchestrated-session.mjs +264 -0
- package/src/update/orchestrated-token.d.mts +10 -0
- package/src/update/orchestrated-token.mjs +21 -0
- package/src/update/orchestrated-token.ts +3 -0
- package/src/update/orchestrated-tree.d.mts +1 -0
- package/src/update/orchestrated-tree.mjs +14 -0
- package/src/update/pnpm-global-install.d.mts +6 -0
- package/src/update/pnpm-global-install.mjs +9 -2
- package/src/update/posix-install-supervisor-entry.mjs +6 -0
- package/src/update/posix-install-supervisor.d.mts +10 -0
- package/src/update/posix-install-supervisor.mjs +88 -0
- package/src/update/sync-update-mutex.d.mts +10 -0
- package/src/update/sync-update-mutex.mjs +164 -0
- package/src/update/sync-update-mutex.ts +1 -0
- package/src/update/test-home-guard.mjs +33 -0
- package/src/update/transactional-install.mjs +2 -2
- package/src/usage/error-detail.ts +225 -0
- package/src/usage/log.ts +60 -27
- package/src/web-search/loop.ts +31 -5
- package/gui/dist/assets/index-ebuVUtB7.js +0 -94
package/bin/ocx.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { guardedRun, guardedSpawn, guardedSpawnSync, guardedExit, probeProcessAl
|
|
|
12
12
|
import { probeSpawn, probeSpawnSync } from "../src/update/mutation-guard.mjs";
|
|
13
13
|
import { createSupervisionLatch, inspectDesktopSupervision } from "../src/service/desktop-supervision.mjs";
|
|
14
14
|
import { planDesktopCliHandoff, runDesktopCliHandoff } from "../src/lib/desktop-cli-handoff.mjs";
|
|
15
|
+
import { acquireSyncGuard } from "../src/update/sync-update-mutex.mjs";
|
|
15
16
|
import { desktopCliRecordPath } from "../src/lib/desktop-cli-record.mjs";
|
|
16
17
|
import { STOP_HISTORY_INCOMPLETE_EXIT_CODE } from "../src/update/stop-contract.mjs";
|
|
17
18
|
import { probeProxyLiveness } from "../src/update/proxy-liveness-probe.mjs";
|
|
@@ -43,9 +44,14 @@ import { isRealBunBinary } from "../src/lib/bun-binary-validator.mjs";
|
|
|
43
44
|
import { scopeTranspilerCacheToRuntime } from "../src/lib/bun-transpiler-cache-scope.mjs";
|
|
44
45
|
import { findDesktopCli, findPathBun } from "../src/lib/bun-path-runtime.mjs";
|
|
45
46
|
import { npmInvocation } from "../src/update/npm-invocation.mjs";
|
|
46
|
-
import { runNpmInstall } from "../src/update/npm-install.mjs";
|
|
47
|
+
import { runNpmInstall, runWindowsInstallerSync } from "../src/update/npm-install.mjs";
|
|
48
|
+
import { runPosixInstallerSync } from "../src/update/posix-install-supervisor.mjs";
|
|
47
49
|
import { pnpmInvocationForPath, resolvePnpmCommands } from "../src/update/pnpm-invocation.mjs";
|
|
48
50
|
import { detectInstallOwnershipFromPath } from "../src/update/install-detection.mjs";
|
|
51
|
+
import { isOrchestratedUpdateArgv, parseOrchestratedUpdateArgs, parseOrchestratedChildArgs } from "../src/update/orchestrated-arguments.mjs";
|
|
52
|
+
import { createLegacyUpdateSession, createOrchestratedChildSession, decodeOrchestratedExpect } from "../src/update/orchestrated-session.mjs";
|
|
53
|
+
import { createUpdatePlanToken } from "../src/update/orchestrated-token.mjs";
|
|
54
|
+
import { applyNodeOrchestratedUpdate } from "../src/update/orchestrated-node-driver.mjs";
|
|
49
55
|
import {
|
|
50
56
|
pnpmOwnerInvocation,
|
|
51
57
|
resolvePnpmGlobalOwner,
|
|
@@ -232,7 +238,48 @@ function runningPnpmShimPath() {
|
|
|
232
238
|
return resolve(invoked);
|
|
233
239
|
}
|
|
234
240
|
|
|
235
|
-
async function runPackageManagerSelfUpdate(manager) {
|
|
241
|
+
async function runPackageManagerSelfUpdate(manager, child) {
|
|
242
|
+
let session, enteredMutation = false;
|
|
243
|
+
let childOutcome = { phase: "failed", rollbackPerformed: false };
|
|
244
|
+
if (child) {
|
|
245
|
+
try {
|
|
246
|
+
const expected = decodeOrchestratedExpect(child.expect);
|
|
247
|
+
session = createOrchestratedChildSession({ home: configDir(), resultPath: child.resultPath, resultCapability: child.resultCapability, expect: expected,
|
|
248
|
+
notAfter: child.notAfter, verifyIdentity: () => {
|
|
249
|
+
const bun = resolveBun({ allowInstall: false, allowMissing: true });
|
|
250
|
+
if (!bun) return false;
|
|
251
|
+
const probe = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), "__update-orchestrated-identity"], {
|
|
252
|
+
encoding: "utf8", timeout: 8000, maxBuffer: 8192, windowsHide: true, stdio: ["ignore", "pipe", "ignore"],
|
|
253
|
+
env: { ...updateHomeProbeEnvironment(process.env, { codexHome: process.env.CODEX_HOME ?? "", opencodexHome: configDir() }),
|
|
254
|
+
OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: manager, OCX_IDENTITY_TARGET: child.version },
|
|
255
|
+
});
|
|
256
|
+
if (probe.status !== 0 || probe.error || probe.signal || typeof probe.stdout !== "string") return false;
|
|
257
|
+
const observed = JSON.parse(probe.stdout);
|
|
258
|
+
return observed.permits === true && observed.cliRoot === expected.cliRoot && observed.planToken === expected.planToken
|
|
259
|
+
&& (observed.kind === "absent" ? expected.servingRoot === null && expected.runtimePid === null
|
|
260
|
+
: observed.kind === "live" && observed.servingRoot === expected.servingRoot && observed.runtime?.pid === expected.runtimePid);
|
|
261
|
+
} });
|
|
262
|
+
if (!session.start().ok) process.exit(10);
|
|
263
|
+
// The parent may forward a signal while a synchronous installer is running. Keep the
|
|
264
|
+
// owner alive through its transaction and recovery so the mutex cannot outlive us.
|
|
265
|
+
for (const signal of ["SIGINT", "SIGTERM", ...(process.platform === "win32" ? [] : ["SIGHUP"])]) process.on(signal, () => {});
|
|
266
|
+
process.once("exit", () => {
|
|
267
|
+
try { if (enteredMutation) session.finish(childOutcome); else session.finishPreflight(); }
|
|
268
|
+
catch (error) { console.error(`Orchestrated outcome write failed: ${error?.message ?? error}`); process.exitCode = 1; }
|
|
269
|
+
});
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error(`Orchestrated update preflight failed: ${error?.message ?? error}`);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
session = createLegacyUpdateSession({ home: configDir() });
|
|
276
|
+
const started = session.start();
|
|
277
|
+
if (!started.ok) { console.error(`opencodex: ${started.error}`); process.exit(1); }
|
|
278
|
+
process.once("exit", () => {
|
|
279
|
+
try { if (enteredMutation) session.finish(childOutcome); else session.finishPreflight(); }
|
|
280
|
+
catch (error) { console.error(`Update outcome write failed: ${error?.message ?? error}`); process.exitCode = 1; }
|
|
281
|
+
});
|
|
282
|
+
}
|
|
236
283
|
const current = currentPackageVersion();
|
|
237
284
|
const tag = updateTag(current);
|
|
238
285
|
let owner;
|
|
@@ -279,17 +326,18 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
279
326
|
: invocation.env ? { env: invocation.env } : {}),
|
|
280
327
|
...invocation.options,
|
|
281
328
|
});
|
|
282
|
-
const
|
|
329
|
+
const selector = child?.version ?? tag;
|
|
330
|
+
const latestInvocation = managerInvocation(["view", `${PKG}@${selector}`, "version"]);
|
|
283
331
|
const installArgs = manager === "pnpm"
|
|
284
|
-
? ["add", "-g", "--allow-build=bun", `${PKG}@${
|
|
285
|
-
: ["install", "-g", `${PKG}@${
|
|
332
|
+
? ["add", "-g", "--allow-build=bun", `${PKG}@${selector}`]
|
|
333
|
+
: ["install", "-g", `${PKG}@${selector}`];
|
|
286
334
|
const installInvocation = managerInvocation(installArgs);
|
|
287
335
|
if (!latestInvocation || !installInvocation) {
|
|
288
336
|
console.error(`opencodex: could not resolve ${manager} from a trusted absolute PATH entry; aborting before stopping the proxy.`);
|
|
289
337
|
process.exit(1);
|
|
290
338
|
}
|
|
291
339
|
const latestResult = probeSpawnSync(latestInvocation.file, latestInvocation.args, readProbeOptions(latestInvocation));
|
|
292
|
-
const latest = latestResult.status === 0 && typeof latestResult.stdout === "string" ? latestResult.stdout.trim() : "";
|
|
340
|
+
const latest = child?.version ?? (latestResult.status === 0 && typeof latestResult.stdout === "string" ? latestResult.stdout.trim() : "");
|
|
293
341
|
|
|
294
342
|
console.log(`opencodex v${current} (installed via ${manager}, tag ${tag})`);
|
|
295
343
|
if (latest && latest === current) {
|
|
@@ -752,6 +800,12 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
752
800
|
runtimePlan = lockedPlan;
|
|
753
801
|
const stoppedOwnershipIdentity = ownershipIdentity(lockedOwnership);
|
|
754
802
|
|
|
803
|
+
if (session) {
|
|
804
|
+
const entered = await session.enterMutation();
|
|
805
|
+
if (!entered.ok) { releaseUpdateLease(); process.exit(10); }
|
|
806
|
+
enteredMutation = true;
|
|
807
|
+
}
|
|
808
|
+
|
|
755
809
|
// Never replace package files under a live proxy — stop it first (full `ocx stop`
|
|
756
810
|
// semantics: graceful drain, service stop, native Codex restore). Gate on the service
|
|
757
811
|
// and the runtime-port record too: a service-managed or orphaned proxy can be live
|
|
@@ -940,7 +994,7 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
940
994
|
try {
|
|
941
995
|
if (manager === "npm") {
|
|
942
996
|
const packageDir = resolve(here, "..");
|
|
943
|
-
const transactionalNpmUpdate =
|
|
997
|
+
const transactionalNpmUpdate = session ? transactionalNpmUpdateAsync : transactionalNpmUpdateSync;
|
|
944
998
|
if (!homePolicy.authorizeMutation("package")) throw new Error("Automatic package update refused.");
|
|
945
999
|
const tx = await transactionalNpmUpdate({
|
|
946
1000
|
packageDir,
|
|
@@ -958,12 +1012,31 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
958
1012
|
runNpm: (args) => {
|
|
959
1013
|
const invocation = npmInvocation(args);
|
|
960
1014
|
if (!homePolicy.authorizeMutation("package")) return { status: 1 };
|
|
961
|
-
if (process.platform === "win32")
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1015
|
+
if (process.platform === "win32") {
|
|
1016
|
+
if (session) session.noteUntrackedInstaller();
|
|
1017
|
+
return runNpmInstall(invocation, {
|
|
1018
|
+
authorizeMutation: homePolicy.authorizeMutation,
|
|
1019
|
+
env: unprivilegedOwnershipMutationEnvironment(invocation?.options?.env ?? process.env),
|
|
1020
|
+
}).then(result => {
|
|
1021
|
+
if (session && result.processTreeExited === true && Number.isInteger(result.status)) session.confirmInstallerExit();
|
|
1022
|
+
else if (session) { session.retainInstallerFence(); return { ...result, processTreeExited: false }; }
|
|
1023
|
+
return result;
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
965
1026
|
if (!invocation) return { status: 1 };
|
|
966
1027
|
if (!homePolicy.authorizeMutation("package")) return { status: 1 };
|
|
1028
|
+
if (session) {
|
|
1029
|
+
try {
|
|
1030
|
+
const result = runPosixInstallerSync({ file: invocation.file, args: invocation.args,
|
|
1031
|
+
markerPath: join(configDir(), "update-orchestrated.json"), authorizeMutation: homePolicy.authorizeMutation,
|
|
1032
|
+
env: unprivilegedOwnershipMutationEnvironment(invocation.options?.env ?? process.env) });
|
|
1033
|
+
if (!Number.isInteger(result.status) || result.signal || !result.groupExited || result.groupKilled !== false || result.processTreeExited === false) {
|
|
1034
|
+
session.retainInstallerFence();
|
|
1035
|
+
return { ...result, processTreeExited: false };
|
|
1036
|
+
}
|
|
1037
|
+
return { ...result, processTreeExited: true };
|
|
1038
|
+
} catch (error) { session.retainInstallerFence(); throw error; }
|
|
1039
|
+
}
|
|
967
1040
|
return guardedSpawnSync(homePolicy.authorizeMutation, "package", invocation.file, invocation.args, {
|
|
968
1041
|
...invocation.options,
|
|
969
1042
|
stdio: "inherit",
|
|
@@ -974,6 +1047,9 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
974
1047
|
},
|
|
975
1048
|
log: (line) => console.log(line),
|
|
976
1049
|
});
|
|
1050
|
+
if (session) childOutcome = tx.ok ? { phase: "installed", activeRoot: packageDir }
|
|
1051
|
+
: { phase: "failed", rollbackPerformed: tx.rolledBack === true,
|
|
1052
|
+
...(tx.processTreeExited === false ? { error: "installer-termination-unconfirmed", terminationConfirmed: false } : {}) };
|
|
977
1053
|
postUpdateLauncherUsable = launcherUsableAfterNpmUpdate(tx);
|
|
978
1054
|
if (!tx.ok) npmFailure = tx;
|
|
979
1055
|
if (tx.ok) {
|
|
@@ -998,6 +1074,25 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
998
1074
|
runPnpm: (args, capture = false) => {
|
|
999
1075
|
const invocation = pnpmOwnerInvocation(owner, args);
|
|
1000
1076
|
if (!invocation) return { status: 1 };
|
|
1077
|
+
if (session && !capture) return withPnpmCommandCwd(args, cwd => {
|
|
1078
|
+
const env = pnpmReadEnvironment(unprivilegedOwnershipMutationEnvironment(invocation.env ?? process.env));
|
|
1079
|
+
if (process.platform === "win32") {
|
|
1080
|
+
session.noteUntrackedInstaller();
|
|
1081
|
+
const result = runWindowsInstallerSync(invocation, { cwd, env, authorizeMutation: homePolicy.authorizeMutation });
|
|
1082
|
+
if (result.processTreeExited === true && Number.isInteger(result.status)) session.confirmInstallerExit();
|
|
1083
|
+
else { session.retainInstallerFence(); return { ...result, processTreeExited: false }; }
|
|
1084
|
+
return result;
|
|
1085
|
+
}
|
|
1086
|
+
try {
|
|
1087
|
+
const result = runPosixInstallerSync({ file: invocation.file, args: invocation.args, cwd, markerPath: join(configDir(), "update-orchestrated.json"),
|
|
1088
|
+
authorizeMutation: homePolicy.authorizeMutation, env });
|
|
1089
|
+
if (!Number.isInteger(result.status) || result.signal || !result.groupExited || result.groupKilled !== false || result.processTreeExited === false) {
|
|
1090
|
+
session.retainInstallerFence();
|
|
1091
|
+
return { ...result, processTreeExited: false };
|
|
1092
|
+
}
|
|
1093
|
+
return { ...result, processTreeExited: true };
|
|
1094
|
+
} catch (error) { session.retainInstallerFence(); throw error; }
|
|
1095
|
+
});
|
|
1001
1096
|
return withPnpmCommandCwd(args, cwd => homePolicy.authorizeMutation("package") ? guardedSpawnSync(homePolicy.authorizeMutation, "package", invocation.file, invocation.args, {
|
|
1002
1097
|
...invocation.options,
|
|
1003
1098
|
stdio: capture ? "pipe" : "inherit",
|
|
@@ -1012,6 +1107,9 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
1012
1107
|
},
|
|
1013
1108
|
log: line => console.log(line),
|
|
1014
1109
|
});
|
|
1110
|
+
if (session) childOutcome = update.ok ? { phase: "installed", activeRoot: update.path }
|
|
1111
|
+
: { phase: "failed", rollbackPerformed: update.rollbackPerformed === true,
|
|
1112
|
+
...(update.processTreeExited === false ? { error: "installer-termination-unconfirmed", terminationConfirmed: false } : {}) };
|
|
1015
1113
|
if (update.ok) {
|
|
1016
1114
|
// pnpm switches the active global group and updates its shim. Continue recovery
|
|
1017
1115
|
// through that fresh package tree, not the old group whose launcher is still
|
|
@@ -1037,12 +1135,13 @@ async function runPackageManagerSelfUpdate(manager) {
|
|
|
1037
1135
|
`Run 'ocx update' again or follow the manual recovery steps below.`);
|
|
1038
1136
|
res = { status: 1 };
|
|
1039
1137
|
}
|
|
1040
|
-
if (res.status !== 0) recoverStoppedRuntimeAfterFailure("update failed");
|
|
1138
|
+
if (res.status !== 0 && childOutcome.error !== "installer-termination-unconfirmed") recoverStoppedRuntimeAfterFailure("update failed");
|
|
1041
1139
|
} finally {
|
|
1042
1140
|
// Expected aborts release before process.exit(); this covers every thrown or newly-added
|
|
1043
1141
|
// path and keeps token restoration coupled to the lease itself.
|
|
1044
1142
|
releaseUpdateLease();
|
|
1045
1143
|
}
|
|
1144
|
+
if (childOutcome.error === "installer-termination-unconfirmed") process.exit(1);
|
|
1046
1145
|
const postInstallPlan = planUpdateRuntimeHandling({ ...readOwnership(), serviceInstalled: serviceWasInstalled, supervision: observeSupervision() });
|
|
1047
1146
|
if (res.status === 0) {
|
|
1048
1147
|
authorityLauncher = postUpdateLauncher;
|
|
@@ -1218,10 +1317,10 @@ function resolveBun({ allowInstall = true, launcherPath, allowMissing = false }
|
|
|
1218
1317
|
// intercepts `update` before the Bun CLI starts, so the help short-circuit must live
|
|
1219
1318
|
// here too — otherwise --help runs the real self-update, stops the proxy, and drops
|
|
1220
1319
|
// in-flight routed streams (issue #168).
|
|
1221
|
-
const updateHelpRequested = process.argv[2] === "update" &&
|
|
1320
|
+
const updateHelpRequested = process.argv[2] === "update" && !isOrchestratedUpdateArgv(process.argv.slice(3)) &&
|
|
1222
1321
|
process.argv.slice(3).some(a => a === "--help" || a === "-h" || a === "help");
|
|
1223
1322
|
if (updateHelpRequested) {
|
|
1224
|
-
console.log("Usage: ocx update [--tag latest|preview]\n\
|
|
1323
|
+
console.log("Usage: ocx update [--tag latest|preview]\n ocx update --plan --json [--tag latest|preview | --version <version>]\n ocx update --yes --json [--tag latest|preview | --version <version>] [--expect-plan <token>] [--not-after <unix-ms>]\n\nPreview with --plan; apply with --yes. --expect-plan binds apply to the planToken; --not-after sets a Unix millisecond mutation deadline.\nOrchestrated exit codes: 0 verified or up-to-date; 10 refused; 11 failed with previous version verified; 12 unverified or still running; 64 invalid usage.\nPreview installs stay on the preview tag unless overridden.");
|
|
1225
1324
|
process.exit(0);
|
|
1226
1325
|
}
|
|
1227
1326
|
|
|
@@ -1237,7 +1336,59 @@ if (process.argv[2] === "__update-home-probe") {
|
|
|
1237
1336
|
console.log(JSON.stringify({ schemaVersion: 1, ...readNodeUpdateHome(fileURLToPath(import.meta.url)), launcherProtocolVersion: UPDATE_HOME_LAUNCHER_PROTOCOL }));
|
|
1238
1337
|
process.exit(0);
|
|
1239
1338
|
}
|
|
1339
|
+
if (process.argv[2] === "__update-orchestrated-identity") {
|
|
1340
|
+
if (process.argv.length !== 3) process.exit(1);
|
|
1341
|
+
const bun = resolveBun({ allowInstall: false, allowMissing: true });
|
|
1342
|
+
if (!bun) process.exit(1);
|
|
1343
|
+
const result = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), process.argv[2]], {
|
|
1344
|
+
stdio: "inherit", timeout: 8000, windowsHide: true, env: { ...process.env, OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: "", OCX_IDENTITY_TARGET: "" },
|
|
1345
|
+
});
|
|
1346
|
+
process.exit(result.status ?? 1);
|
|
1347
|
+
}
|
|
1240
1348
|
|
|
1349
|
+
const orchestratedUpdate = process.argv[2] === "update" && isOrchestratedUpdateArgv(process.argv.slice(3));
|
|
1350
|
+
const childArgs = orchestratedUpdate && process.env.OCX_UPDATE_ORCHESTRATED_CHILD === "1"
|
|
1351
|
+
? parseOrchestratedChildArgs(process.argv.slice(3), process.env) : null;
|
|
1352
|
+
const orchestratedArgs = orchestratedUpdate && !childArgs?.ok ? parseOrchestratedUpdateArgs(process.argv.slice(3)) : null;
|
|
1353
|
+
if (orchestratedArgs && !orchestratedArgs.ok) {
|
|
1354
|
+
console.log(JSON.stringify({ error: "usage" }));
|
|
1355
|
+
console.error("Usage: ocx update (--plan | --yes) --json [--tag latest|preview | --version <version>]");
|
|
1356
|
+
process.exit(64);
|
|
1357
|
+
}
|
|
1358
|
+
if (childArgs?.ok && isNodeModulesInstall() && !isBunGlobalInstall() && (installMethod === "npm" || installMethod === "pnpm")) {
|
|
1359
|
+
await runPackageManagerSelfUpdate(installMethod, childArgs);
|
|
1360
|
+
}
|
|
1361
|
+
if (orchestratedArgs?.ok && orchestratedArgs.mode === "apply" && process.env.OCX_UPDATE_ORCHESTRATED_CHILD !== "1"
|
|
1362
|
+
&& isNodeModulesInstall() && !isBunGlobalInstall() && (installMethod === "npm" || installMethod === "pnpm")) {
|
|
1363
|
+
const result = await applyNodeOrchestratedUpdate(orchestratedArgs, {
|
|
1364
|
+
installer: installMethod, currentVersion: String(currentPackageVersion()), cliRoot: resolve(here, ".."),
|
|
1365
|
+
home: configDir(), launcher: fileURLToPath(import.meta.url), resolveBun: () => resolveBun({ allowInstall: false, allowMissing: true }),
|
|
1366
|
+
plan: (bun, version, tag) => probeSpawnSync(bun.path, ["--no-env-file", cliPath, "update", "--plan", "--json",
|
|
1367
|
+
...(version ? ["--version", version] : tag ? ["--tag", tag] : [])], { encoding: "utf8", maxBuffer: 65536, timeout: 60000, windowsHide: true,
|
|
1368
|
+
stdio: ["ignore", "pipe", 2], env: process.env }),
|
|
1369
|
+
identity: bun => {
|
|
1370
|
+
const probe = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), "__update-orchestrated-identity"], {
|
|
1371
|
+
encoding: "utf8", maxBuffer: 8192, timeout: 8000, windowsHide: true, stdio: ["ignore", "pipe", 2],
|
|
1372
|
+
env: { ...updateHomeProbeEnvironment(process.env, { codexHome: process.env.CODEX_HOME ?? "", opencodexHome: configDir() }),
|
|
1373
|
+
OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: "", OCX_IDENTITY_TARGET: "" },
|
|
1374
|
+
});
|
|
1375
|
+
if (probe.status !== 0 || probe.error || probe.signal) throw Error("identity unavailable");
|
|
1376
|
+
return JSON.parse(probe.stdout);
|
|
1377
|
+
},
|
|
1378
|
+
pnpmCommands: resolvePnpmCommands(), runningShimPath: runningPnpmShimPath(),
|
|
1379
|
+
runPnpm: (commandPath, args, capture = false) => {
|
|
1380
|
+
const invocation = pnpmInvocationForPath(commandPath, args);
|
|
1381
|
+
if (!invocation) return { status: 1 };
|
|
1382
|
+
return probeSpawnSync(invocation.file, invocation.args, { stdio: capture ? "pipe" : "ignore", encoding: "utf8",
|
|
1383
|
+
timeout: 20000, windowsHide: true, cwd: PNPM_READ_CWD,
|
|
1384
|
+
env: pnpmReadEnvironment(unprivilegedOwnershipMutationEnvironment(process.env)), ...invocation.options });
|
|
1385
|
+
},
|
|
1386
|
+
spawn: probeSpawn,
|
|
1387
|
+
});
|
|
1388
|
+
await new Promise(resolveOutput => process.stdout.write(`${JSON.stringify(result.result)}\n`, resolveOutput));
|
|
1389
|
+
process.exit(result.exitCode);
|
|
1390
|
+
}
|
|
1391
|
+
const passiveCapabilities = process.argv[2] === "capabilities";
|
|
1241
1392
|
const codexCliUpdateInspection = isCodexCliUpdateInspectionArgv(process.argv);
|
|
1242
1393
|
// Windows inspection currently refuses before candidate I/O, so a long-lived
|
|
1243
1394
|
// Windows server does not duplicate PATH into its inherited environment block.
|
|
@@ -1249,6 +1400,9 @@ if (codexCliUpdateInspection && typeof process.versions.bun === "string") {
|
|
|
1249
1400
|
}
|
|
1250
1401
|
|
|
1251
1402
|
const { launchProof, launchContext, inheritedEnv } = createNodeLaunchContext();
|
|
1403
|
+
delete inheritedEnv.OCX_SYNC_MUTEX_HELD_BY;
|
|
1404
|
+
// The parsed child capability was removed from process.env; only the Bun CLI handoff of this same child receives it.
|
|
1405
|
+
if (childArgs?.ok) inheritedEnv.OCX_UPDATE_RESULT_CAPABILITY = childArgs.resultCapability;
|
|
1252
1406
|
const desktopPlan = planDesktopCliHandoff({ selfPaths: [fileURLToPath(import.meta.url), process.execPath] });
|
|
1253
1407
|
if (desktopPlan.kind === "error") {
|
|
1254
1408
|
if (desktopPlan.issue.startsWith("record-")) {
|
|
@@ -1258,15 +1412,30 @@ if (desktopPlan.kind === "error") {
|
|
|
1258
1412
|
}
|
|
1259
1413
|
process.exit(1);
|
|
1260
1414
|
}
|
|
1415
|
+
let releaseSyncLease = () => {};
|
|
1416
|
+
let addSyncDelegate = () => {};
|
|
1417
|
+
if (process.argv[2] === "sync") {
|
|
1418
|
+
const syncLease = acquireSyncGuard(configDir(), process.argv.slice(2));
|
|
1419
|
+
if (syncLease.kind === "refused") process.exit(syncLease.exit);
|
|
1420
|
+
addSyncDelegate = pid => syncLease.addDelegate(pid);
|
|
1421
|
+
inheritedEnv.OCX_SYNC_MUTEX_HELD_BY = String(process.pid);
|
|
1422
|
+
let released = false;
|
|
1423
|
+
releaseSyncLease = () => {
|
|
1424
|
+
if (released) return;
|
|
1425
|
+
try { syncLease.release(); released = true; } catch (error) { console.error(`opencodex: sync mutex release failed: ${error.message}`); }
|
|
1426
|
+
};
|
|
1427
|
+
process.once("exit", releaseSyncLease);
|
|
1428
|
+
}
|
|
1261
1429
|
if (desktopPlan.kind === "handoff") {
|
|
1262
1430
|
const result = await runDesktopCliHandoff(desktopPlan, {
|
|
1263
|
-
argv: process.argv.slice(2), env: inheritedEnv, proof: launchProof, context: launchContext,
|
|
1431
|
+
argv: process.argv.slice(2), env: inheritedEnv, proof: launchProof, context: launchContext, onSpawn: addSyncDelegate,
|
|
1264
1432
|
});
|
|
1265
1433
|
if (result.kind === "error") {
|
|
1266
1434
|
console.error(`opencodex: Desktop CLI handoff failed (${result.issue}). Repair the terminal command in OpenCodex Desktop, or run with OCX_NO_DESKTOP_HANDOFF=1.`);
|
|
1267
1435
|
process.exit(127);
|
|
1268
1436
|
}
|
|
1269
1437
|
if (result.kind === "exit") {
|
|
1438
|
+
releaseSyncLease();
|
|
1270
1439
|
if (result.signal) {
|
|
1271
1440
|
relayOwnSignal(result.signal);
|
|
1272
1441
|
} else {
|
|
@@ -1278,7 +1447,7 @@ if (desktopPlan.kind === "handoff") {
|
|
|
1278
1447
|
// Only confirmed target ENOENT reaches the ordinary package path below.
|
|
1279
1448
|
}
|
|
1280
1449
|
|
|
1281
|
-
if (process.argv[2] === "update" && installMethod === "mise") {
|
|
1450
|
+
if (!orchestratedUpdate && process.argv[2] === "update" && installMethod === "mise") {
|
|
1282
1451
|
if (installOwnership.owner) {
|
|
1283
1452
|
console.error(
|
|
1284
1453
|
`opencodex: this installation is externally managed by mise; update it with: mise upgrade ${installOwnership.owner.tool}`,
|
|
@@ -1291,7 +1460,7 @@ if (process.argv[2] === "update" && installMethod === "mise") {
|
|
|
1291
1460
|
process.exit(1);
|
|
1292
1461
|
}
|
|
1293
1462
|
|
|
1294
|
-
if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstall()) {
|
|
1463
|
+
if (!orchestratedUpdate && process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstall()) {
|
|
1295
1464
|
if (installMethod === "npm") await runNpmSelfUpdate();
|
|
1296
1465
|
if (installMethod === "pnpm") await runPnpmSelfUpdate();
|
|
1297
1466
|
}
|
|
@@ -1299,7 +1468,7 @@ if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstal
|
|
|
1299
1468
|
// #1849 boot probe: a prior update that lost power (or double-faulted) mid-swap leaves a
|
|
1300
1469
|
// backup sibling and a broken live tree. Restore before anything tries to run from the
|
|
1301
1470
|
// broken tree; reap stale backups once the live tree verifies healthy.
|
|
1302
|
-
if (!codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall() && !isBunGlobalInstall()) {
|
|
1471
|
+
if (process.argv[2] !== "sync" && !orchestratedUpdate && !passiveCapabilities && !codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall() && !isBunGlobalInstall()) {
|
|
1303
1472
|
try {
|
|
1304
1473
|
const probe = bootRestoreProbe(resolve(here, ".."));
|
|
1305
1474
|
if (probe.action === "restored") {
|
|
@@ -1310,7 +1479,22 @@ if (!codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall
|
|
|
1310
1479
|
} catch { /* the probe must never block launch */ }
|
|
1311
1480
|
}
|
|
1312
1481
|
|
|
1313
|
-
const
|
|
1482
|
+
const passiveSync = process.argv[2] === "sync";
|
|
1483
|
+
const bunRuntime = resolveBun({ allowInstall: !passiveSync && !orchestratedUpdate && !passiveCapabilities && !codexCliUpdateInspection, allowMissing: orchestratedUpdate || passiveSync });
|
|
1484
|
+
if (!bunRuntime && passiveSync) fail("Bun is unavailable; install Bun before running sync.");
|
|
1485
|
+
if (!bunRuntime && orchestratedArgs?.ok) {
|
|
1486
|
+
const currentVersion = String(currentPackageVersion()), cliRoot = resolve(here, "..");
|
|
1487
|
+
if (orchestratedArgs.mode === "plan") {
|
|
1488
|
+
const identity = { currentVersion, targetVersion: null, installer: installMethod, cliRoot, servingRoot: null, runtimeOwner: "unknown", runtime: null };
|
|
1489
|
+
console.log(JSON.stringify({ schema: "ocx.update.plan/1", currentVersion, targetVersion: null, installer: installMethod,
|
|
1490
|
+
runtimeOwner: "unknown", servingPath: null, cliPath: cliRoot, canApply: false, reason: "plan-unavailable", restartRequired: false,
|
|
1491
|
+
planToken: createUpdatePlanToken(identity), updateInFlight: true, mutationBoundMs: 900000 }));
|
|
1492
|
+
process.exit(0);
|
|
1493
|
+
}
|
|
1494
|
+
console.log(JSON.stringify({ schema: "ocx.update.result/1", applied: false, fromVersion: currentVersion, toVersion: null,
|
|
1495
|
+
installer: installMethod, restarted: false, healthy: false, rolledBack: false, error: "plan-unavailable" }));
|
|
1496
|
+
process.exit(10);
|
|
1497
|
+
}
|
|
1314
1498
|
const bun = bunRuntime.path;
|
|
1315
1499
|
|
|
1316
1500
|
// Run the Bun child asynchronously and FORWARD termination signals to it, then wait
|
|
@@ -1438,6 +1622,15 @@ const child = probeSpawn(bun, [cliPath, `${NODE_LAUNCH_PROOF_PREFIX}${launchProo
|
|
|
1438
1622
|
[BUN_RUNTIME_PATH_ENV]: bunRuntime.path,
|
|
1439
1623
|
},
|
|
1440
1624
|
});
|
|
1625
|
+
let delegateError = false;
|
|
1626
|
+
if (child.pid) {
|
|
1627
|
+
try { addSyncDelegate(child.pid); }
|
|
1628
|
+
catch (error) {
|
|
1629
|
+
delegateError = true;
|
|
1630
|
+
console.error(`opencodex: sync mutex delegate publication failed: ${error.message}`);
|
|
1631
|
+
try { child.kill(); } catch (killError) { console.error(`opencodex: failed to stop sync child: ${killError.message}`); }
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1441
1634
|
|
|
1442
1635
|
// Windows has no real POSIX signals (no SIGHUP); forwarding is best-effort there.
|
|
1443
1636
|
const FORWARDED = process.platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
@@ -1464,6 +1657,8 @@ child.on("error", err => {
|
|
|
1464
1657
|
|
|
1465
1658
|
child.on("exit", (code, signal) => {
|
|
1466
1659
|
clearHandlers();
|
|
1660
|
+
releaseSyncLease();
|
|
1661
|
+
if (delegateError) process.exit(1);
|
|
1467
1662
|
// Mirror the child's terminating signal/exit code so this launcher's status matches.
|
|
1468
1663
|
if (signal) {
|
|
1469
1664
|
relayOwnSignal(signal);
|