@karlorz/codexhost-cli-linux-arm64 0.14.0-0 → 0.14.0-1

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.
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // packages/desktop-control/src/production-controller.ts
8
8
  import { readFile } from "node:fs/promises";
9
- import path3 from "node:path";
9
+ import path4 from "node:path";
10
10
 
11
11
  // packages/desktop-control/src/renderer-local-page.ts
12
12
  import { randomUUID } from "node:crypto";
@@ -1045,10 +1045,10 @@ function mergeDefs(...defs) {
1045
1045
  function cloneDef(schema) {
1046
1046
  return mergeDefs(schema._zod.def);
1047
1047
  }
1048
- function getElementAtPath(obj, path4) {
1049
- if (!path4)
1048
+ function getElementAtPath(obj, path5) {
1049
+ if (!path5)
1050
1050
  return obj;
1051
- return path4.reduce((acc, key) => acc?.[key], obj);
1051
+ return path5.reduce((acc, key) => acc?.[key], obj);
1052
1052
  }
1053
1053
  function promiseAllObject(promisesObj) {
1054
1054
  const keys = Object.keys(promisesObj);
@@ -1457,11 +1457,11 @@ function explicitlyAborted(x, startIndex = 0) {
1457
1457
  }
1458
1458
  return false;
1459
1459
  }
1460
- function prefixIssues(path4, issues) {
1460
+ function prefixIssues(path5, issues) {
1461
1461
  return issues.map((iss) => {
1462
1462
  var _a3;
1463
1463
  (_a3 = iss).path ?? (_a3.path = []);
1464
- iss.path.unshift(path4);
1464
+ iss.path.unshift(path5);
1465
1465
  return iss;
1466
1466
  });
1467
1467
  }
@@ -1608,16 +1608,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1608
1608
  }
1609
1609
  function formatError(error51, mapper = (issue2) => issue2.message) {
1610
1610
  const fieldErrors = { _errors: [] };
1611
- const processError = (error52, path4 = []) => {
1611
+ const processError = (error52, path5 = []) => {
1612
1612
  for (const issue2 of error52.issues) {
1613
1613
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1614
- issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
1614
+ issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1615
1615
  } else if (issue2.code === "invalid_key") {
1616
- processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
1616
+ processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1617
1617
  } else if (issue2.code === "invalid_element") {
1618
- processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
1618
+ processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1619
1619
  } else {
1620
- const fullpath = [...path4, ...issue2.path];
1620
+ const fullpath = [...path5, ...issue2.path];
1621
1621
  if (fullpath.length === 0) {
1622
1622
  fieldErrors._errors.push(mapper(issue2));
1623
1623
  } else {
@@ -1644,17 +1644,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1644
1644
  }
1645
1645
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1646
1646
  const result = { errors: [] };
1647
- const processError = (error52, path4 = []) => {
1647
+ const processError = (error52, path5 = []) => {
1648
1648
  var _a3, _b;
1649
1649
  for (const issue2 of error52.issues) {
1650
1650
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1651
- issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
1651
+ issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
1652
1652
  } else if (issue2.code === "invalid_key") {
1653
- processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
1653
+ processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1654
1654
  } else if (issue2.code === "invalid_element") {
1655
- processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
1655
+ processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
1656
1656
  } else {
1657
- const fullpath = [...path4, ...issue2.path];
1657
+ const fullpath = [...path5, ...issue2.path];
1658
1658
  if (fullpath.length === 0) {
1659
1659
  result.errors.push(mapper(issue2));
1660
1660
  continue;
@@ -1686,8 +1686,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1686
1686
  }
1687
1687
  function toDotPath(_path) {
1688
1688
  const segs = [];
1689
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1690
- for (const seg of path4) {
1689
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1690
+ for (const seg of path5) {
1691
1691
  if (typeof seg === "number")
1692
1692
  segs.push(`[${seg}]`);
1693
1693
  else if (typeof seg === "symbol")
@@ -14379,13 +14379,13 @@ function resolveRef(ref, ctx) {
14379
14379
  if (!ref.startsWith("#")) {
14380
14380
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14381
14381
  }
14382
- const path4 = ref.slice(1).split("/").filter(Boolean);
14383
- if (path4.length === 0) {
14382
+ const path5 = ref.slice(1).split("/").filter(Boolean);
14383
+ if (path5.length === 0) {
14384
14384
  return ctx.rootSchema;
14385
14385
  }
14386
14386
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14387
- if (path4[0] === defsKey) {
14388
- const key = path4[1];
14387
+ if (path5[0] === defsKey) {
14388
+ const key = path5[1];
14389
14389
  if (!key || !ctx.defs[key]) {
14390
14390
  throw new Error(`Reference not found: ${ref}`);
14391
14391
  }
@@ -16638,6 +16638,12 @@ function createControllerStatusPublisher(filePath = defaultControllerStatusPath(
16638
16638
  };
16639
16639
  }
16640
16640
 
16641
+ // packages/desktop-control/src/cpa-live-voice-hook.ts
16642
+ import { existsSync } from "node:fs";
16643
+ import { execFileSync } from "node:child_process";
16644
+ import os3 from "node:os";
16645
+ import path3 from "node:path";
16646
+
16641
16647
  // packages/desktop-control/src/live-voice-inject.ts
16642
16648
  import { readFileSync } from "node:fs";
16643
16649
  import os2 from "node:os";
@@ -16660,18 +16666,51 @@ var CPA_LIVE_VOICE_ENV = "CODEXHOST_CPA_LIVE_VOICE";
16660
16666
  var CPA_LIVE_VOICE_HOOK_GLOBAL = "__codexhostCpaLiveVoiceHookV1";
16661
16667
  var AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION = "26.1007.30912";
16662
16668
  var AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET = "app-initial-6350d04672d0.js";
16669
+ var DESKTOP_VERSION_ENV = "CODEXHOST_DESKTOP_VERSION";
16663
16670
  function cpaLiveVoiceHookEnabled(environment = process.env) {
16664
16671
  const value = environment[CPA_LIVE_VOICE_ENV];
16665
16672
  if (value === "0") return false;
16666
16673
  if (value === "1") return true;
16667
16674
  return readLiveVoiceInjectFile(environment);
16668
16675
  }
16669
- function cpaLiveVoiceHookBootstrap(environment = process.env) {
16676
+ function detectInstalledDesktopVersion(environment = process.env) {
16677
+ const fromEnv = environment[DESKTOP_VERSION_ENV]?.trim();
16678
+ if (fromEnv) return fromEnv;
16679
+ if (process.platform !== "darwin") return void 0;
16680
+ const home = environment.HOME?.trim() || os3.homedir();
16681
+ const apps = [
16682
+ "/Applications/ChatGPT.app",
16683
+ "/Applications/Codex.app",
16684
+ path3.join(home, "Applications/ChatGPT.app"),
16685
+ path3.join(home, "Applications/Codex.app")
16686
+ ];
16687
+ for (const app of apps) {
16688
+ const plist = path3.join(app, "Contents/Info.plist");
16689
+ if (!existsSync(plist)) continue;
16690
+ try {
16691
+ const version2 = execFileSync(
16692
+ "/usr/bin/defaults",
16693
+ ["read", plist, "CFBundleShortVersionString"],
16694
+ {
16695
+ encoding: "utf8",
16696
+ timeout: 2e3
16697
+ }
16698
+ ).trim();
16699
+ if (version2) return version2;
16700
+ } catch {
16701
+ continue;
16702
+ }
16703
+ }
16704
+ return void 0;
16705
+ }
16706
+ function cpaLiveVoiceHookBootstrap(environment = process.env, desktopVersion) {
16670
16707
  if (!cpaLiveVoiceHookEnabled(environment)) return "";
16708
+ const version2 = environment[DESKTOP_VERSION_ENV]?.trim() || desktopVersion || detectInstalledDesktopVersion(environment);
16671
16709
  return `globalThis.${CPA_LIVE_VOICE_HOOK_GLOBAL} = Object.freeze(${JSON.stringify({
16672
16710
  enabled: true,
16673
16711
  auditedDesktopVersion: AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION,
16674
- auditedAppInitialAsset: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET
16712
+ auditedAppInitialAsset: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET,
16713
+ ...version2 ? { desktopVersion: version2 } : {}
16675
16714
  })});
16676
16715
  `;
16677
16716
  }
@@ -16705,13 +16744,13 @@ function committedReactAncestors(value) {
16705
16744
  const current = fiber(rootState.current);
16706
16745
  if (!current) return [];
16707
16746
  const alternate = fiber(first.alternate);
16708
- const path4 = [current];
16747
+ const path5 = [current];
16709
16748
  seen.clear();
16710
16749
  seen.add(current);
16711
16750
  for (let index = previous.length - 2; index >= 0; index -= 1) {
16712
16751
  const expected = previous[index];
16713
16752
  const expectedAlternate = fiber(expected?.alternate);
16714
- let child = fiber(path4.at(-1)?.child);
16753
+ let child = fiber(path5.at(-1)?.child);
16715
16754
  let matched = false;
16716
16755
  while (child && !seen.has(child) && seen.size < MAX_VISITED_FIBERS) {
16717
16756
  seen.add(child);
@@ -16722,10 +16761,10 @@ function committedReactAncestors(value) {
16722
16761
  child = fiber(child.sibling);
16723
16762
  }
16724
16763
  if (!matched || !child) break;
16725
- path4.push(child);
16764
+ path5.push(child);
16726
16765
  }
16727
- if (path4.length === previous.length && (path4.at(-1) === first || path4.at(-1) === alternate)) {
16728
- return path4.reverse();
16766
+ if (path5.length === previous.length && (path5.at(-1) === first || path5.at(-1) === alternate)) {
16767
+ return path5.reverse();
16729
16768
  }
16730
16769
  const stack = [{ node: current, parent: null }];
16731
16770
  seen.clear();
@@ -18077,8 +18116,8 @@ function parseDesktopControllerArguments(arguments_) {
18077
18116
  if (argument === "--renderer") {
18078
18117
  if (rendererPath !== void 0) throw new Error("--renderer may only be provided once");
18079
18118
  if (!value) throw new Error("--renderer requires a value");
18080
- if (!path3.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
18081
- rendererPath = path3.normalize(value);
18119
+ if (!path4.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
18120
+ rendererPath = path4.normalize(value);
18082
18121
  index += 1;
18083
18122
  continue;
18084
18123
  }
@@ -18171,7 +18210,7 @@ async function runDesktopController(options, signal, dependencies = defaultDepen
18171
18210
  status.installing();
18172
18211
  startupTrace("reading Renderer bundle");
18173
18212
  const rendererRead = dependencies.readRenderer(options.rendererPath);
18174
- const overlayPath = bootstrap ? path3.join(path3.dirname(options.rendererPath), "cpa-live-voice-hook.js") : void 0;
18213
+ const overlayPath = bootstrap ? path4.join(path4.dirname(options.rendererPath), "cpa-live-voice-hook.js") : void 0;
18175
18214
  const [rendererSource, overlayBundle] = overlayPath ? await Promise.all([rendererRead, dependencies.readRenderer(overlayPath)]) : [await rendererRead, void 0];
18176
18215
  if (rendererSource.trim().length === 0) throw new Error("production Renderer Bundle is empty");
18177
18216
  const overlayHookSource = bootstrap && overlayBundle && overlayBundle.trim().length > 0 ? `${RENDERER_CSP_BOOTSTRAP}