@moxt-ai/cli 0.9.1 → 0.10.0-beta.2

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/README.md CHANGED
@@ -25,15 +25,18 @@ When a same-channel update is cached, the next eligible command offers **Update
25
25
  command stdout remains safe to pipe. Daemon, help, version, telemetry, CI, and
26
26
  non-interactive invocations never prompt or install.
27
27
 
28
- After a CLI update, Moxt refreshes a running Local Machine Connector installed
29
- under launchd, a systemd user service, or Supervisor. The refresh preserves the
30
- configured service manager and updates its absolute Node and CLI paths. Active
31
- Jobs are reported before the restart and recover as interrupted with
32
- `daemon_restarted`. A foreground `moxt machine daemon` process is never
33
- restarted automatically. Updates performed by Homebrew, a package manager, or
34
- the standalone installer are reconciled on the new CLI's next normal command
35
- when it uses the managed service's recorded stable launcher path. A different
36
- CLI installation cannot take over the service automatically.
28
+ After a CLI update, Moxt refreshes a running Local Machine Connector or recovers
29
+ a temporarily offline managed Connector installed under launchd, a systemd user
30
+ service, or Supervisor. The refresh preserves the configured service manager
31
+ and updates its absolute Node and CLI paths. Active Jobs are reported before the
32
+ restart and recover as interrupted with `daemon_restarted`. A foreground `moxt
33
+ machine daemon` process is never restarted automatically. Updates performed by
34
+ Homebrew, a package manager, or the standalone installer are reconciled on the
35
+ new CLI's next normal command when it uses the managed service's recorded stable
36
+ launcher path. A different CLI installation cannot take over the service
37
+ automatically. A managed Connector explicitly stopped with `moxt machine
38
+ service stop` remains stopped across later CLI invocations until the user runs
39
+ `moxt machine service restart` or installs the service again.
37
40
 
38
41
  If the CLI installation succeeds but the Connector refresh fails, the CLI
39
42
  update remains successful. Moxt validates the new CLI entrypoint before changing
package/dist/index.cjs CHANGED
@@ -5175,7 +5175,7 @@ var init_codex_executor = __esm({
5175
5175
  });
5176
5176
 
5177
5177
  // ../machine-connector/dist/runtime/runtime-types.js
5178
- var PersistedMachineJobPhase;
5178
+ var PersistedMachineJobPhase, ManagedServiceDesiredState;
5179
5179
  var init_runtime_types = __esm({
5180
5180
  "../machine-connector/dist/runtime/runtime-types.js"() {
5181
5181
  "use strict";
@@ -5186,6 +5186,10 @@ var init_runtime_types = __esm({
5186
5186
  PersistedMachineJobPhase2["TerminalPendingUpload"] = "terminal_pending_upload";
5187
5187
  PersistedMachineJobPhase2["Uploaded"] = "uploaded";
5188
5188
  })(PersistedMachineJobPhase || (PersistedMachineJobPhase = {}));
5189
+ (function(ManagedServiceDesiredState2) {
5190
+ ManagedServiceDesiredState2["Running"] = "running";
5191
+ ManagedServiceDesiredState2["Stopped"] = "stopped";
5192
+ })(ManagedServiceDesiredState || (ManagedServiceDesiredState = {}));
5189
5193
  }
5190
5194
  });
5191
5195
 
@@ -7321,6 +7325,12 @@ var init_contracts2 = __esm({
7321
7325
  });
7322
7326
 
7323
7327
  // ../machine-connector/dist/runtime/local-codex-runtime/app-server-client.js
7328
+ function appServerResponseMessage(response) {
7329
+ if (typeof response === "object" && response !== null && "message" in response && typeof response.message === "string") {
7330
+ return response.message;
7331
+ }
7332
+ return "";
7333
+ }
7324
7334
  function rpcIdentifier(value) {
7325
7335
  if (typeof value === "string") {
7326
7336
  return { value };
@@ -7383,7 +7393,7 @@ function killAppServerProcess(child) {
7383
7393
  child.kill("SIGKILL");
7384
7394
  }
7385
7395
  }
7386
- var import_node_child_process3, import_node_crypto6, import_node_os5, maximumFrameBytes, requestTimeoutMilliseconds2, AppServerProcessLostError, AppServerProtocolError, AppServerRequestTimeoutError, AppServerClient, LocalCodexAppServerSupervisor;
7396
+ var import_node_child_process3, import_node_crypto6, import_node_os5, maximumFrameBytes, requestTimeoutMilliseconds2, AppServerProcessLostError, AppServerProtocolError, AppServerRequestTimeoutError, AppServerResponseError, AppServerClient, LocalCodexAppServerSupervisor;
7387
7397
  var init_app_server_client = __esm({
7388
7398
  "../machine-connector/dist/runtime/local-codex-runtime/app-server-client.js"() {
7389
7399
  "use strict";
@@ -7415,6 +7425,15 @@ var init_app_server_client = __esm({
7415
7425
  this.name = "AppServerRequestTimeoutError";
7416
7426
  }
7417
7427
  };
7428
+ AppServerResponseError = class extends AppServerProtocolError {
7429
+ responseMessage;
7430
+ constructor(response) {
7431
+ const responseMessage = appServerResponseMessage(response);
7432
+ super(`Codex App Server rejected request: ${JSON.stringify(response)}`);
7433
+ this.name = "AppServerResponseError";
7434
+ this.responseMessage = responseMessage;
7435
+ }
7436
+ };
7418
7437
  AppServerClient = class _AppServerClient {
7419
7438
  child;
7420
7439
  handlers;
@@ -7574,7 +7593,7 @@ var init_app_server_client = __esm({
7574
7593
  this.pending.delete(responseId);
7575
7594
  clearTimeout(pending.timeout);
7576
7595
  if (message.error !== void 0) {
7577
- pending.reject(new AppServerProtocolError(`Codex App Server rejected request: ${JSON.stringify(message.error)}`));
7596
+ pending.reject(new AppServerResponseError(message.error));
7578
7597
  } else {
7579
7598
  pending.resolve(message.result);
7580
7599
  }
@@ -8256,6 +8275,9 @@ var init_event_normalizer = __esm({
8256
8275
  });
8257
8276
 
8258
8277
  // ../machine-connector/dist/runtime/local-codex-runtime/runtime-worker.js
8278
+ function isMissingThreadResponse(message, threadId) {
8279
+ return message === `thread not found: ${threadId}` || message === `no rollout found for thread id ${threadId}` || message === `no rollout found for conversation id ${threadId}`;
8280
+ }
8259
8281
  function createActiveAttempt(claim, durable, workingDirectory) {
8260
8282
  let resolveTerminal = (_value) => void 0;
8261
8283
  const terminal = new Promise((resolve9) => {
@@ -8780,9 +8802,19 @@ var init_runtime_worker = __esm({
8780
8802
  const controlLoop = this.runControlLoop(active);
8781
8803
  try {
8782
8804
  active.workingDirectory = await resolveCanonicalWorkingDirectory(this.connection.rootPath, claim.relativeWorkingDirectory);
8783
- const client = await this.processPool.ensureStarted();
8805
+ let client = await this.processPool.ensureStarted();
8784
8806
  const isNewThread = active.nativeThreadId === void 0;
8785
- const nativeThreadId = await this.prepareThread(client, active);
8807
+ let nativeThreadId;
8808
+ try {
8809
+ nativeThreadId = await this.prepareThread(client, active);
8810
+ } catch (error) {
8811
+ if (!(error instanceof AppServerRequestTimeoutError) || error.method !== "thread/resume") {
8812
+ throw error;
8813
+ }
8814
+ await this.processPool.quarantineCurrentProcess();
8815
+ client = await this.processPool.ensureStarted();
8816
+ nativeThreadId = await this.prepareThread(client, active);
8817
+ }
8786
8818
  active.nativeThreadId = nativeThreadId;
8787
8819
  await durable.markThreadPrepared(nativeThreadId);
8788
8820
  await active.spoolQueue;
@@ -8840,7 +8872,6 @@ var init_runtime_worker = __esm({
8840
8872
  });
8841
8873
  await durable.markUploaded();
8842
8874
  await this.store.deleteLocalCodexAttempt(claim.attemptId);
8843
- await this.unsubscribe(client, nativeThreadId);
8844
8875
  } catch (error) {
8845
8876
  if (error instanceof LeaseLostError) {
8846
8877
  await this.logger.error(`Local Codex attempt ${claim.attemptId} stopped after losing its execution lease`, error);
@@ -8872,7 +8903,12 @@ var init_runtime_worker = __esm({
8872
8903
  };
8873
8904
  const preparedThreadId = active.nativeThreadId;
8874
8905
  if (preparedThreadId === void 0) {
8875
- return requireThreadId(await client.request("thread/start", parameters));
8906
+ const startedThreadId = requireThreadId(await client.request("thread/start", parameters));
8907
+ this.processPool.rememberThreadLoaded(startedThreadId);
8908
+ return startedThreadId;
8909
+ }
8910
+ if (this.processPool.isThreadLoaded(preparedThreadId)) {
8911
+ return preparedThreadId;
8876
8912
  }
8877
8913
  try {
8878
8914
  const resumed = await client.request("thread/resume", {
@@ -8883,12 +8919,16 @@ var init_runtime_worker = __esm({
8883
8919
  if (resumedId !== preparedThreadId) {
8884
8920
  throw new AppServerProtocolError("thread/resume returned another native thread");
8885
8921
  }
8922
+ this.processPool.rememberThreadLoaded(resumedId);
8886
8923
  return resumedId;
8887
8924
  } catch (error) {
8888
- if (error instanceof AppServerProcessLostError) {
8925
+ if (error instanceof AppServerProcessLostError || error instanceof AppServerRequestTimeoutError) {
8889
8926
  throw error;
8890
8927
  }
8891
- throw new ThreadUnavailableError(errorMessage2(error));
8928
+ if (error instanceof AppServerResponseError && isMissingThreadResponse(error.responseMessage, preparedThreadId)) {
8929
+ throw new ThreadUnavailableError(errorMessage2(error));
8930
+ }
8931
+ throw error;
8892
8932
  }
8893
8933
  }
8894
8934
  async failAttempt(active, error) {
@@ -9243,7 +9283,9 @@ var init_runtime_worker = __esm({
9243
9283
  await action();
9244
9284
  });
9245
9285
  active.spoolQueue = operation.catch((error) => {
9246
- const failure = new SpoolPersistenceError(`Durable Local Codex spool failed: ${errorMessage2(error)}`, { cause: error });
9286
+ const failure = new SpoolPersistenceError(`Durable Local Codex spool failed: ${errorMessage2(error)}`, {
9287
+ cause: error
9288
+ });
9247
9289
  this.signalFatal(active, failure);
9248
9290
  });
9249
9291
  return operation;
@@ -9302,13 +9344,6 @@ var init_runtime_worker = __esm({
9302
9344
  await this.logger.error(`Failed to name Local Codex thread ${threadId}`, error);
9303
9345
  }
9304
9346
  }
9305
- async unsubscribe(client, threadId) {
9306
- try {
9307
- await client.request("thread/unsubscribe", { threadId });
9308
- } catch {
9309
- return;
9310
- }
9311
- }
9312
9347
  unregisterRoute() {
9313
9348
  if (!this.registered) {
9314
9349
  return;
@@ -9343,6 +9378,7 @@ var init_process_pool = __esm({
9343
9378
  poolKey;
9344
9379
  logger;
9345
9380
  activeOwner = {};
9381
+ loadedThreadIds = /* @__PURE__ */ new Set();
9346
9382
  routes = /* @__PURE__ */ new Map();
9347
9383
  retiredTurnIds = /* @__PURE__ */ new Set();
9348
9384
  supervisor;
@@ -9358,6 +9394,7 @@ var init_process_pool = __esm({
9358
9394
  if (!this.supervisor.markProcessLost(processGeneration)) {
9359
9395
  return;
9360
9396
  }
9397
+ this.loadedThreadIds.clear();
9361
9398
  await this.logger.error(`Shared Codex App Server generation ${processGeneration} exited`, error);
9362
9399
  await this.activeRoute().value?.onProcessExit(error);
9363
9400
  },
@@ -9432,6 +9469,19 @@ var init_process_pool = __esm({
9432
9469
  isRetiredTurn(nativeTurnId) {
9433
9470
  return this.retiredTurnIds.has(nativeTurnId);
9434
9471
  }
9472
+ isThreadLoaded(nativeThreadId) {
9473
+ return this.loadedThreadIds.has(nativeThreadId);
9474
+ }
9475
+ rememberThreadLoaded(nativeThreadId) {
9476
+ this.loadedThreadIds.add(nativeThreadId);
9477
+ if (this.loadedThreadIds.size <= 4096) {
9478
+ return;
9479
+ }
9480
+ const oldest = this.loadedThreadIds.values().next().value;
9481
+ if (typeof oldest === "string") {
9482
+ this.loadedThreadIds.delete(oldest);
9483
+ }
9484
+ }
9435
9485
  status() {
9436
9486
  return this.supervisor.status();
9437
9487
  }
@@ -9442,9 +9492,11 @@ var init_process_pool = __esm({
9442
9492
  return await this.supervisor.ensureStarted();
9443
9493
  }
9444
9494
  async quarantineCurrentProcess() {
9495
+ this.loadedThreadIds.clear();
9445
9496
  await this.supervisor.quarantineCurrentProcess();
9446
9497
  }
9447
9498
  async stop() {
9499
+ this.loadedThreadIds.clear();
9448
9500
  await this.supervisor.stop();
9449
9501
  }
9450
9502
  activeRoute() {
@@ -10549,6 +10601,9 @@ function createServiceEnvironment(options) {
10549
10601
  async function restartUserService(store, runtime = defaultServiceManagerRuntime) {
10550
10602
  const manager = await configuredServiceManager(store, runtime);
10551
10603
  await restartManager(manager, store, runtime);
10604
+ if (manager !== UserServiceManager.None) {
10605
+ await persistServiceDesiredState(store, manager, ManagedServiceDesiredState.Running);
10606
+ }
10552
10607
  return manager;
10553
10608
  }
10554
10609
  async function refreshManagedUserService(store, options, runtime = defaultServiceManagerRuntime) {
@@ -10620,9 +10675,24 @@ async function managedServiceOwnsProcess(manager, processId, store, runtime = de
10620
10675
  async function recordedServiceManager(store) {
10621
10676
  return await readStoredServiceManager(store);
10622
10677
  }
10678
+ async function recordedServiceDesiredState(store) {
10679
+ const desiredState = (await store.readServiceManager()).value?.desiredState;
10680
+ if (desiredState === void 0)
10681
+ return ManagedServiceDesiredState.Running;
10682
+ if (desiredState === ManagedServiceDesiredState.Running) {
10683
+ return ManagedServiceDesiredState.Running;
10684
+ }
10685
+ if (desiredState === ManagedServiceDesiredState.Stopped) {
10686
+ return ManagedServiceDesiredState.Stopped;
10687
+ }
10688
+ throw new Error(`Unsupported managed service desired state: ${desiredState}`);
10689
+ }
10623
10690
  async function stopUserService(store, runtime = defaultServiceManagerRuntime) {
10624
10691
  const manager = await configuredServiceManager(store, runtime);
10625
10692
  await stopManager(manager, store, runtime);
10693
+ if (manager !== UserServiceManager.None) {
10694
+ await persistServiceDesiredState(store, manager, ManagedServiceDesiredState.Stopped);
10695
+ }
10626
10696
  return manager;
10627
10697
  }
10628
10698
  async function uninstallUserService(store, runtime = defaultServiceManagerRuntime) {
@@ -10833,13 +10903,18 @@ function parseProcessId(value) {
10833
10903
  const processId = Number.parseInt(value.trim(), 10);
10834
10904
  return Number.isSafeInteger(processId) && processId > 0 ? processId : void 0;
10835
10905
  }
10836
- async function persistServiceManager(store, manager, managedEntrypointPath) {
10906
+ async function persistServiceManager(store, manager, managedEntrypointPath, desiredState = ManagedServiceDesiredState.Running) {
10837
10907
  await store.writeServiceManager({
10908
+ desiredState,
10838
10909
  ...managedEntrypointPath ? { managedEntrypointPath: (0, import_node_path10.resolve)(managedEntrypointPath) } : {},
10839
10910
  manager,
10840
10911
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
10841
10912
  });
10842
10913
  }
10914
+ async function persistServiceDesiredState(store, manager, desiredState) {
10915
+ const stored = (await store.readServiceManager()).value;
10916
+ await persistServiceManager(store, manager, stored?.managedEntrypointPath, desiredState);
10917
+ }
10843
10918
  async function assertManagedServiceProvenance(store, candidateEntrypointPath) {
10844
10919
  const stored = (await store.readServiceManager()).value;
10845
10920
  if (!stored || stored.manager === UserServiceManager.None)
@@ -11065,33 +11140,23 @@ async function startSupervisorUserService(store, runtime, previousSupervisorProc
11065
11140
  }
11066
11141
  async function reloadSupervisorConfiguration(store, runtime) {
11067
11142
  const configPath = supervisorConfigPath(store);
11068
- const processIdBeforeStop = await runServiceProbe(runtime, "supervisorctl", [
11069
- "-c",
11070
- configPath,
11071
- "pid",
11072
- supervisorProgramName
11073
- ]);
11074
- if ((parseProcessId(processIdBeforeStop.stdout) ?? 0) > 0) {
11143
+ const processIdBeforeStop = await currentSupervisorProgramProcessId(store, runtime);
11144
+ if (processIdBeforeStop !== void 0) {
11075
11145
  await runtime.run("supervisorctl", [
11076
11146
  "-c",
11077
11147
  configPath,
11078
11148
  "stop",
11079
11149
  supervisorProgramName
11080
11150
  ]);
11081
- const processIdAfterStop = await runServiceProbe(runtime, "supervisorctl", ["-c", configPath, "pid", supervisorProgramName]);
11082
- if ((parseProcessId(processIdAfterStop.stdout) ?? 0) > 0) {
11151
+ const processIdAfterStop = await currentSupervisorProgramProcessId(store, runtime);
11152
+ if (processIdAfterStop !== void 0) {
11083
11153
  throw new Error("Supervisor did not stop the existing Moxt Machine Connector process");
11084
11154
  }
11085
11155
  }
11086
11156
  await runtime.run("supervisorctl", ["-c", configPath, "reread"]);
11087
11157
  await runtime.run("supervisorctl", ["-c", configPath, "update"]);
11088
- const processId = await runServiceProbe(runtime, "supervisorctl", [
11089
- "-c",
11090
- configPath,
11091
- "pid",
11092
- supervisorProgramName
11093
- ]);
11094
- if ((parseProcessId(processId.stdout) ?? 0) > 0)
11158
+ const processId = await currentSupervisorProgramProcessId(store, runtime);
11159
+ if (processId !== void 0)
11095
11160
  return;
11096
11161
  await runtime.run("supervisorctl", [
11097
11162
  "-c",
@@ -11280,6 +11345,7 @@ var init_service_manager = __esm({
11280
11345
  import_node_os7 = require("os");
11281
11346
  import_node_path10 = require("path");
11282
11347
  import_node_util2 = require("util");
11348
+ init_runtime_types();
11283
11349
  init_shell_environment();
11284
11350
  execFileAsync = (0, import_node_util2.promisify)(import_node_child_process5.execFile);
11285
11351
  launchAgentLabel = "ai.moxt.machine-connector";
@@ -11335,24 +11401,27 @@ async function reconcileManagedDaemon(options, store = new MachineRuntimeStore()
11335
11401
  if (!lock)
11336
11402
  return { outcome: DaemonReconcileOutcome.Skipped };
11337
11403
  try {
11338
- const initial = await reachableRuntimeStatus(store);
11339
- if (!initial)
11340
- return { outcome: DaemonReconcileOutcome.Skipped };
11341
11404
  const manager = await recordedServiceManager(store);
11342
11405
  if (manager === UserServiceManager.None) {
11343
11406
  return { outcome: DaemonReconcileOutcome.Skipped };
11344
11407
  }
11345
- if (initial.cliVersion === options.cliVersion) {
11408
+ if (await recordedServiceDesiredState(store) === ManagedServiceDesiredState.Stopped) {
11346
11409
  return { manager, outcome: DaemonReconcileOutcome.Skipped };
11347
11410
  }
11348
- let managerOwnsProcess;
11349
- try {
11350
- managerOwnsProcess = await managedServiceOwnsProcess(manager, initial.pid, store);
11351
- } catch (error) {
11352
- throw new DaemonRefreshError("ownership", `could not verify that the reachable Connector belongs to ${manager}: ${errorMessage4(error)}`, { cause: error });
11411
+ const initial = await reachableRuntimeStatus(store);
11412
+ if (initial?.cliVersion === options.cliVersion) {
11413
+ return { manager, outcome: DaemonReconcileOutcome.Skipped };
11353
11414
  }
11354
- if (!managerOwnsProcess) {
11355
- return { outcome: DaemonReconcileOutcome.Skipped };
11415
+ if (initial) {
11416
+ let managerOwnsProcess;
11417
+ try {
11418
+ managerOwnsProcess = await managedServiceOwnsProcess(manager, initial.pid, store);
11419
+ } catch (error) {
11420
+ throw new DaemonRefreshError("ownership", `could not verify that the reachable Connector belongs to ${manager}: ${errorMessage4(error)}`, { cause: error });
11421
+ }
11422
+ if (!managerOwnsProcess) {
11423
+ return { outcome: DaemonReconcileOutcome.Skipped };
11424
+ }
11356
11425
  }
11357
11426
  try {
11358
11427
  await validateCliEntrypoint(options, store);
@@ -11361,7 +11430,7 @@ async function reconcileManagedDaemon(options, store = new MachineRuntimeStore()
11361
11430
  cause: error
11362
11431
  });
11363
11432
  }
11364
- if (initial.activeJobs.length > 0) {
11433
+ if (initial && initial.activeJobs.length > 0) {
11365
11434
  options.onActiveJobs?.(initial.activeJobs.length);
11366
11435
  }
11367
11436
  let refresh;
@@ -11381,12 +11450,12 @@ async function reconcileManagedDaemon(options, store = new MachineRuntimeStore()
11381
11450
  const deadline = Date.now() + reconcileTimeoutMilliseconds;
11382
11451
  while (Date.now() < deadline) {
11383
11452
  const current2 = await reachableRuntimeStatus(store);
11384
- if (current2?.cliVersion === options.cliVersion && current2.connectorInstanceId !== initial.connectorInstanceId) {
11453
+ if (current2?.cliVersion === options.cliVersion && current2.connectorInstanceId !== initial?.connectorInstanceId) {
11385
11454
  return { manager, outcome: DaemonReconcileOutcome.Restarted };
11386
11455
  }
11387
11456
  await delay6(100);
11388
11457
  }
11389
- const verificationMessage = `managed daemon did not report CLI ${options.cliVersion} with a new instance ID`;
11458
+ const verificationMessage = initial ? `managed daemon did not report CLI ${options.cliVersion} with a new instance ID` : `managed daemon did not become reachable with CLI ${options.cliVersion}`;
11390
11459
  try {
11391
11460
  await refresh.rollback();
11392
11461
  } catch (error) {
@@ -11450,6 +11519,7 @@ var init_daemon_reconcile = __esm({
11450
11519
  init_local_ipc();
11451
11520
  init_process_lock();
11452
11521
  init_service_manager();
11522
+ init_runtime_types();
11453
11523
  init_store();
11454
11524
  reconcileTimeoutMilliseconds = 12e3;
11455
11525
  execFileAsync2 = (0, import_node_util3.promisify)(import_node_child_process6.execFile);
@@ -12353,6 +12423,7 @@ var init_device_identity = __esm({
12353
12423
  async function pairMachine(store, options) {
12354
12424
  await store.initialize();
12355
12425
  const canonicalRoot = await store.getCanonicalRoot(options.rootPath);
12426
+ const rootDisplayName = displayNameForRoot(canonicalRoot);
12356
12427
  const identity = await ensureMachineIdentity(store);
12357
12428
  const machineName = options.machineName ?? (0, import_node_os8.hostname)();
12358
12429
  const operatingSystem = getOperatingSystem();
@@ -12365,7 +12436,7 @@ async function pairMachine(store, options) {
12365
12436
  machineName,
12366
12437
  operatingSystem,
12367
12438
  protocolVersion: machineProtocolVersion,
12368
- rootDisplayName: (0, import_node_path12.basename)(canonicalRoot),
12439
+ rootDisplayName,
12369
12440
  rootHandle
12370
12441
  });
12371
12442
  options.onConfirmation?.(proposal.confirmationUrl);
@@ -12394,7 +12465,7 @@ async function pairMachine(store, options) {
12394
12465
  purpose: credentials.purpose,
12395
12466
  refreshToken: credentials.refreshToken,
12396
12467
  relayOrigin: options.relayOrigin.replace(/\/+$/, ""),
12397
- rootDisplayName: (0, import_node_path12.basename)(canonicalRoot),
12468
+ rootDisplayName,
12398
12469
  rootHandle,
12399
12470
  rootPath: canonicalRoot,
12400
12471
  targetId: credentials.targetId,
@@ -12414,6 +12485,10 @@ async function pairMachine(store, options) {
12414
12485
  }
12415
12486
  throw new Error("Local Machine pairing expired");
12416
12487
  }
12488
+ function displayNameForRoot(canonicalRoot) {
12489
+ const name = (0, import_node_path12.basename)(canonicalRoot);
12490
+ return name.length > 0 ? name : canonicalRoot;
12491
+ }
12417
12492
  function getOperatingSystem() {
12418
12493
  if ((0, import_node_os8.platform)() === "darwin") {
12419
12494
  return MachineOperatingSystem.MacOS;
@@ -12895,6 +12970,7 @@ __export(dist_exports, {
12895
12970
  MachineProtocolInvariantError: () => MachineProtocolInvariantError,
12896
12971
  MachineRelayClient: () => MachineRelayClient,
12897
12972
  MachineRuntimeStore: () => MachineRuntimeStore,
12973
+ ManagedServiceDesiredState: () => ManagedServiceDesiredState,
12898
12974
  PairingRelayClient: () => PairingRelayClient,
12899
12975
  PersistedMachineJobPhase: () => PersistedMachineJobPhase,
12900
12976
  RelayHttpError: () => RelayHttpError,
@@ -12928,6 +13004,7 @@ __export(dist_exports, {
12928
13004
  parseLocalMachineJobExecutionContext: () => parseLocalMachineJobExecutionContext,
12929
13005
  parseServiceManagerPreference: () => parseServiceManagerPreference,
12930
13006
  reconcileManagedDaemon: () => reconcileManagedDaemon,
13007
+ recordedServiceDesiredState: () => recordedServiceDesiredState,
12931
13008
  recordedServiceManager: () => recordedServiceManager,
12932
13009
  refreshManagedUserService: () => refreshManagedUserService,
12933
13010
  renderMachineManager: () => renderMachineManager,
@@ -13141,7 +13218,7 @@ function getApiKeyOrUndefined() {
13141
13218
 
13142
13219
  // src/utils/http.ts
13143
13220
  function getUserAgent() {
13144
- return `moxt-cli/${"0.9.1"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
13221
+ return `moxt-cli/${"0.10.0-beta.2"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
13145
13222
  }
13146
13223
  async function sendRequest(method, path4, init) {
13147
13224
  return await fetch(`${getApiBaseUrl()}${path4}`, {
@@ -26724,7 +26801,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
26724
26801
  var MAX_BATCH_SIZE = 100;
26725
26802
  function commonLabels() {
26726
26803
  return {
26727
- cli_version: "0.9.1",
26804
+ cli_version: "0.10.0-beta.2",
26728
26805
  node_version: process.versions.node,
26729
26806
  os: (0, import_node_os9.platform)(),
26730
26807
  arch: (0, import_node_os9.arch)(),
@@ -26770,7 +26847,7 @@ async function flush() {
26770
26847
  }
26771
26848
  const batch = buffer.splice(0, MAX_BATCH_SIZE);
26772
26849
  const payload = {
26773
- release_id: "0.9.1",
26850
+ release_id: "0.10.0-beta.2",
26774
26851
  client_type: "cli",
26775
26852
  metric_data_list: batch.map((m) => ({
26776
26853
  profile: "cli",
@@ -27153,9 +27230,9 @@ function commandPath3(command) {
27153
27230
  }
27154
27231
 
27155
27232
  // src/index.ts
27156
- var program2 = createProgram("0.9.1");
27157
- installDaemonReconcileHook(program2, "0.9.1");
27158
- installUpdateHook(program2, "0.9.1");
27233
+ var program2 = createProgram("0.10.0-beta.2");
27234
+ installDaemonReconcileHook(program2, "0.10.0-beta.2");
27235
+ installUpdateHook(program2, "0.10.0-beta.2");
27159
27236
  instrumentProgram(program2);
27160
27237
  installExitHandler();
27161
27238
  program2.parseAsync(process.argv).then(async () => {