@moxt-ai/cli 0.10.0-beta.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7383,9 +7383,40 @@ function createAppServerEnvironment(environment) {
7383
7383
  function digestOpaque(value) {
7384
7384
  return (0, import_node_crypto6.createHash)("sha256").update(value).digest("hex");
7385
7385
  }
7386
- function extractCodexVersion(userAgent) {
7386
+ async function resolveCodexVersion(options) {
7387
+ const userAgentVersion = extractKnownCodexVersion(options.userAgent).value;
7388
+ if (userAgentVersion !== void 0) {
7389
+ return userAgentVersion;
7390
+ }
7391
+ const executableVersion = (await probeCodexVersion(options.executable, options.processBaseDirectory, options.environment)).value;
7392
+ return executableVersion ?? options.userAgent.slice(0, 64);
7393
+ }
7394
+ function extractKnownCodexVersion(userAgent) {
7387
7395
  const matched = /(?:codex_cli_rs|codex-cli|codex(?: desktop)?)\/([0-9][^\s/]*)/i.exec(userAgent);
7388
- return matched?.[1] ?? userAgent.slice(0, 64);
7396
+ return matched === null ? {} : { value: matched[1] };
7397
+ }
7398
+ async function probeCodexVersion(executable, processBaseDirectory, environment) {
7399
+ const result = await new Promise((resolve10) => {
7400
+ (0, import_node_child_process3.execFile)(executable, ["--version"], {
7401
+ cwd: processBaseDirectory,
7402
+ encoding: "utf8",
7403
+ env: { ...environment },
7404
+ maxBuffer: maximumCodexVersionOutputBytes,
7405
+ timeout: codexVersionProbeTimeoutMilliseconds,
7406
+ windowsHide: true
7407
+ }, (error, stdout) => {
7408
+ if (error !== null || typeof stdout !== "string") {
7409
+ resolve10({});
7410
+ return;
7411
+ }
7412
+ resolve10({ output: stdout });
7413
+ });
7414
+ });
7415
+ if (result.output === void 0) {
7416
+ return {};
7417
+ }
7418
+ const matched = /(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?=\s|$)/.exec(result.output);
7419
+ return matched === null ? {} : { value: matched[1] };
7389
7420
  }
7390
7421
  function assertSupportedCodexVersion(codexVersion) {
7391
7422
  const parsed = /^(\d+)\.(\d+)\.(\d+)/.exec(codexVersion);
@@ -7667,7 +7698,7 @@ function stopWindowsProcessTree(child) {
7667
7698
  failureMessage: stopped.error?.message ?? `taskkill exited with status ${String(stopped.status)}`
7668
7699
  };
7669
7700
  }
7670
- var import_node_child_process3, import_node_crypto6, import_node_fs2, import_node_os6, maximumFrameBytes, requestTimeoutMilliseconds2, processExitGraceMilliseconds, processTreePollMilliseconds, processTableTimeoutMilliseconds, processTableRetryMilliseconds, maximumProcessTableAttempts, maximumProcessTableBytes, maximumStderrTailCharacters, minimumCodexVersion, defaultProcessTableExecutable, appServerArguments, AppServerProcessTreeCaptureStatus, AppServerProcessLostError, AppServerProtocolError, AppServerUnsupportedVersionError, AppServerRequestTimeoutError, AppServerResponseError, AppServerClient, LocalCodexAppServerSupervisor;
7701
+ var import_node_child_process3, import_node_crypto6, import_node_fs2, import_node_os6, maximumFrameBytes, requestTimeoutMilliseconds2, processExitGraceMilliseconds, processTreePollMilliseconds, processTableTimeoutMilliseconds, processTableRetryMilliseconds, maximumProcessTableAttempts, maximumProcessTableBytes, maximumStderrTailCharacters, codexVersionProbeTimeoutMilliseconds, maximumCodexVersionOutputBytes, minimumCodexVersion, defaultProcessTableExecutable, appServerArguments, AppServerProcessTreeCaptureStatus, AppServerProcessLostError, AppServerProtocolError, AppServerUnsupportedVersionError, AppServerRequestTimeoutError, AppServerResponseError, AppServerClient, LocalCodexAppServerSupervisor;
7671
7702
  var init_app_server_client = __esm({
7672
7703
  "../machine-connector/dist/runtime/local-codex-runtime/app-server-client.js"() {
7673
7704
  "use strict";
@@ -7687,6 +7718,8 @@ var init_app_server_client = __esm({
7687
7718
  maximumProcessTableAttempts = 3;
7688
7719
  maximumProcessTableBytes = 8e6;
7689
7720
  maximumStderrTailCharacters = 4e3;
7721
+ codexVersionProbeTimeoutMilliseconds = 5e3;
7722
+ maximumCodexVersionOutputBytes = 4096;
7690
7723
  minimumCodexVersion = "0.146.0";
7691
7724
  defaultProcessTableExecutable = resolveDefaultProcessTableExecutable();
7692
7725
  appServerArguments = [
@@ -7806,7 +7839,12 @@ var init_app_server_client = __esm({
7806
7839
  version: connectorVersion
7807
7840
  }
7808
7841
  });
7809
- const codexVersion = extractCodexVersion(initialized.userAgent);
7842
+ const codexVersion = await resolveCodexVersion({
7843
+ environment,
7844
+ executable,
7845
+ processBaseDirectory: options.processBaseDirectory,
7846
+ userAgent: initialized.userAgent
7847
+ });
7810
7848
  assertSupportedCodexVersion(codexVersion);
7811
7849
  client.initializationCompleted = true;
7812
7850
  await client.notify("initialized");
@@ -14336,7 +14374,7 @@ function getApiKeyOrUndefined() {
14336
14374
 
14337
14375
  // src/utils/http.ts
14338
14376
  function getUserAgent() {
14339
- return `moxt-cli/${"0.10.0-beta.6"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
14377
+ return `moxt-cli/${"0.10.0"} (${(0, import_os.platform)()}/${(0, import_os.arch)()}) node/${process.versions.node}`;
14340
14378
  }
14341
14379
  async function sendRequest(method, path4, init) {
14342
14380
  return await fetch(`${getApiBaseUrl()}${path4}`, {
@@ -28758,7 +28796,7 @@ var FLUSH_TIMEOUT_MS = 3e3;
28758
28796
  var MAX_BATCH_SIZE = 100;
28759
28797
  function commonLabels() {
28760
28798
  return {
28761
- cli_version: "0.10.0-beta.6",
28799
+ cli_version: "0.10.0",
28762
28800
  node_version: process.versions.node,
28763
28801
  os: (0, import_node_os11.platform)(),
28764
28802
  arch: (0, import_node_os11.arch)(),
@@ -28804,7 +28842,7 @@ async function flush() {
28804
28842
  }
28805
28843
  const batch = buffer.splice(0, MAX_BATCH_SIZE);
28806
28844
  const payload = {
28807
- release_id: "0.10.0-beta.6",
28845
+ release_id: "0.10.0",
28808
28846
  client_type: "cli",
28809
28847
  metric_data_list: batch.map((m) => ({
28810
28848
  profile: "cli",
@@ -29187,9 +29225,9 @@ function commandPath3(command) {
29187
29225
  }
29188
29226
 
29189
29227
  // src/index.ts
29190
- var program2 = createProgram("0.10.0-beta.6");
29191
- installDaemonReconcileHook(program2, "0.10.0-beta.6");
29192
- installUpdateHook(program2, "0.10.0-beta.6");
29228
+ var program2 = createProgram("0.10.0");
29229
+ installDaemonReconcileHook(program2, "0.10.0");
29230
+ installUpdateHook(program2, "0.10.0");
29193
29231
  instrumentProgram(program2);
29194
29232
  installExitHandler();
29195
29233
  program2.parseAsync(process.argv).then(async () => {