@karlorz/codexhost-cli-linux-x64 0.13.3-7 → 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
  }
@@ -14931,10 +14931,19 @@ var model = external_exports.string().min(1).max(512);
14931
14931
  var project = external_exports.string().min(1).max(4096);
14932
14932
  var usageStatisticsParamsSchema = external_exports.strictObject({
14933
14933
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14934
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
14935
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
14936
+ try {
14937
+ new Intl.DateTimeFormat("en", { timeZone: value });
14938
+ return true;
14939
+ } catch {
14940
+ return false;
14941
+ }
14942
+ }, "Unsupported usage statistics timezone").optional(),
14934
14943
  harness: harness.optional(),
14935
14944
  model: model.nullable().optional(),
14936
14945
  project: project.nullable().optional(),
14937
- /** One local date inside the range. */
14946
+ /** One date in the query timezone inside the range. */
14938
14947
  date: localDate.optional()
14939
14948
  });
14940
14949
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -14970,7 +14979,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
14970
14979
  });
14971
14980
  var usageStatisticsResultSchema = external_exports.strictObject({
14972
14981
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
14973
- /** First local date of the range; null for all time. */
14982
+ /** First date in the query timezone (Host local when omitted); null for all time. */
14974
14983
  from: localDate.nullable(),
14975
14984
  to: localDate,
14976
14985
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -15010,7 +15019,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15010
15019
  totals: usageStatisticsTotalsSchema,
15011
15020
  /** Each date and Harness of the range: every filter except the day. */
15012
15021
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
15013
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
15022
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
15014
15023
  hourly: external_exports.array(external_exports.strictObject({
15015
15024
  weekday: external_exports.number().int().min(0).max(6),
15016
15025
  hour: external_exports.number().int().min(0).max(23),
@@ -15101,6 +15110,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15101
15110
  "codexhost/harness/display-settings/set",
15102
15111
  "codexhost/harness/inspect",
15103
15112
  "codexhost/harness/installation",
15113
+ "codexhost/harness/installation/start",
15114
+ "codexhost/harness/installation/status",
15104
15115
  "codexhost/harness/launch-settings/get",
15105
15116
  "codexhost/harness/launch-settings/set",
15106
15117
  "codexhost/harness/grok-computer-use/get",
@@ -15178,7 +15189,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15178
15189
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15179
15190
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15180
15191
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15192
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
15193
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
15194
+ kind: external_exports.literal("countdown"),
15195
+ id: external_exports.string().min(1).max(64),
15196
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
15197
+ label: indicatorTextSchema(256).optional(),
15198
+ tooltip: indicatorTextSchema(1024).optional()
15199
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
15200
+ message: "Composer indicator IDs must be unique"
15201
+ });
15181
15202
  var threadUsageSnapshotSchema = external_exports.object({
15203
+ composerIndicators: composerIndicatorsSchema.optional(),
15182
15204
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
15183
15205
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
15184
15206
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15586,7 +15608,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15586
15608
  }).strict().optional(),
15587
15609
  autonomousTurns: external_exports.object({
15588
15610
  observe: external_exports.boolean()
15589
- }).strict().optional()
15611
+ }).strict().optional(),
15612
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15613
+ steer: external_exports.boolean().optional()
15590
15614
  }).strict();
15591
15615
  var harnessConfigurationStateSchema = external_exports.object({
15592
15616
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15718,6 +15742,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15718
15742
  seen.add(thread.threadId);
15719
15743
  }
15720
15744
  });
15745
+ var threadSteeringInspectParamsSchema = external_exports.object({
15746
+ threadId: hostThreadIdSchema,
15747
+ /** The text about to be steered; a Harness command always stops and restarts. */
15748
+ text: external_exports.string().optional()
15749
+ }).strict();
15750
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15751
+ var threadSteeringInspectResultSchema = external_exports.object({
15752
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15753
+ }).strict();
15721
15754
 
15722
15755
  // packages/shared-contracts/dist/harness-plugins.js
15723
15756
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
@@ -15839,6 +15872,10 @@ var harnessInstallationStateSchema = external_exports.object({
15839
15872
  latestVersion: external_exports.string().min(1).max(128),
15840
15873
  updateAvailable: external_exports.boolean(),
15841
15874
  canUpdate: external_exports.boolean(),
15875
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
15876
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
15877
+ /** Official download opened by the user; does not imply an automatic installation. */
15878
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
15842
15879
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15843
15880
  message: external_exports.string().max(2048).optional(),
15844
15881
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -15846,6 +15883,20 @@ var harnessInstallationStateSchema = external_exports.object({
15846
15883
  notice: harnessLocalizedTextSchema.optional(),
15847
15884
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15848
15885
  }).strict();
15886
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
15887
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
15888
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
15889
+ external_exports.object({
15890
+ taskId: external_exports.string().uuid(),
15891
+ status: external_exports.literal("succeeded"),
15892
+ result: harnessInstallationStateSchema
15893
+ }).strict(),
15894
+ external_exports.object({
15895
+ taskId: external_exports.string().uuid(),
15896
+ status: external_exports.literal("failed"),
15897
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
15898
+ }).strict()
15899
+ ]);
15849
15900
 
15850
15901
  // packages/shared-contracts/dist/codex-accounts.js
15851
15902
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -16587,6 +16638,12 @@ function createControllerStatusPublisher(filePath = defaultControllerStatusPath(
16587
16638
  };
16588
16639
  }
16589
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
+
16590
16647
  // packages/desktop-control/src/live-voice-inject.ts
16591
16648
  import { readFileSync } from "node:fs";
16592
16649
  import os2 from "node:os";
@@ -16609,18 +16666,51 @@ var CPA_LIVE_VOICE_ENV = "CODEXHOST_CPA_LIVE_VOICE";
16609
16666
  var CPA_LIVE_VOICE_HOOK_GLOBAL = "__codexhostCpaLiveVoiceHookV1";
16610
16667
  var AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION = "26.1007.30912";
16611
16668
  var AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET = "app-initial-6350d04672d0.js";
16669
+ var DESKTOP_VERSION_ENV = "CODEXHOST_DESKTOP_VERSION";
16612
16670
  function cpaLiveVoiceHookEnabled(environment = process.env) {
16613
16671
  const value = environment[CPA_LIVE_VOICE_ENV];
16614
16672
  if (value === "0") return false;
16615
16673
  if (value === "1") return true;
16616
16674
  return readLiveVoiceInjectFile(environment);
16617
16675
  }
16618
- 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) {
16619
16707
  if (!cpaLiveVoiceHookEnabled(environment)) return "";
16708
+ const version2 = environment[DESKTOP_VERSION_ENV]?.trim() || desktopVersion || detectInstalledDesktopVersion(environment);
16620
16709
  return `globalThis.${CPA_LIVE_VOICE_HOOK_GLOBAL} = Object.freeze(${JSON.stringify({
16621
16710
  enabled: true,
16622
16711
  auditedDesktopVersion: AUDITED_CPA_LIVE_VOICE_DESKTOP_VERSION,
16623
- auditedAppInitialAsset: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET
16712
+ auditedAppInitialAsset: AUDITED_CPA_LIVE_VOICE_APP_INITIAL_ASSET,
16713
+ ...version2 ? { desktopVersion: version2 } : {}
16624
16714
  })});
16625
16715
  `;
16626
16716
  }
@@ -16654,13 +16744,13 @@ function committedReactAncestors(value) {
16654
16744
  const current = fiber(rootState.current);
16655
16745
  if (!current) return [];
16656
16746
  const alternate = fiber(first.alternate);
16657
- const path4 = [current];
16747
+ const path5 = [current];
16658
16748
  seen.clear();
16659
16749
  seen.add(current);
16660
16750
  for (let index = previous.length - 2; index >= 0; index -= 1) {
16661
16751
  const expected = previous[index];
16662
16752
  const expectedAlternate = fiber(expected?.alternate);
16663
- let child = fiber(path4.at(-1)?.child);
16753
+ let child = fiber(path5.at(-1)?.child);
16664
16754
  let matched = false;
16665
16755
  while (child && !seen.has(child) && seen.size < MAX_VISITED_FIBERS) {
16666
16756
  seen.add(child);
@@ -16671,10 +16761,10 @@ function committedReactAncestors(value) {
16671
16761
  child = fiber(child.sibling);
16672
16762
  }
16673
16763
  if (!matched || !child) break;
16674
- path4.push(child);
16764
+ path5.push(child);
16675
16765
  }
16676
- if (path4.length === previous.length && (path4.at(-1) === first || path4.at(-1) === alternate)) {
16677
- return path4.reverse();
16766
+ if (path5.length === previous.length && (path5.at(-1) === first || path5.at(-1) === alternate)) {
16767
+ return path5.reverse();
16678
16768
  }
16679
16769
  const stack = [{ node: current, parent: null }];
16680
16770
  seen.clear();
@@ -17335,9 +17425,13 @@ function requestManagerFromHookState(value, hostId2) {
17335
17425
  if (!record2(value)) return null;
17336
17426
  const direct = manager(value) ?? manager(value.manager);
17337
17427
  if (direct) return direct;
17338
- if (!hostId2 || typeof value.addManager !== "function" || typeof value.getForHostId !== "function" || typeof value.waitForManagerForHostId !== "function")
17428
+ if (!hostId2 || typeof value.addManager !== "function" || typeof value.getForHostId !== "function")
17429
+ return null;
17430
+ try {
17431
+ return manager(value.getForHostId(hostId2));
17432
+ } catch {
17339
17433
  return null;
17340
- return manager(value.getForHostId(hostId2));
17434
+ }
17341
17435
  }
17342
17436
  function discoverRendererHosts(root, ancestors = committedReactAncestors, managerFrom = requestManagerFromHookState) {
17343
17437
  const editors = [
@@ -17372,7 +17466,7 @@ function discoverRendererHosts(root, ancestors = committedReactAncestors, manage
17372
17466
  const value = hook.memoizedState;
17373
17467
  const manager = managerFrom(value);
17374
17468
  if (manager) managers.add(manager);
17375
- if (value && typeof value === "object" && "addManager" in value && typeof value.addManager === "function" && "getForHostId" in value && typeof value.getForHostId === "function" && "waitForManagerForHostId" in value && typeof value.waitForManagerForHostId === "function") {
17469
+ if (value && typeof value === "object" && "addManager" in value && typeof value.addManager === "function" && "getForHostId" in value && typeof value.getForHostId === "function") {
17376
17470
  registries.add(value);
17377
17471
  }
17378
17472
  hook = hook.next && typeof hook.next === "object" ? hook.next : null;
@@ -17387,7 +17481,13 @@ function discoverRendererHosts(root, ancestors = committedReactAncestors, manage
17387
17481
  }
17388
17482
  function resolveRendererHostManager(discovery, hostId2, managerFrom = requestManagerFromHookState) {
17389
17483
  if (!hostId2) return null;
17390
- const candidates = discovery.registries.length ? discovery.registries.map((registry2) => managerFrom(registry2.getForHostId(hostId2))) : discovery.managers;
17484
+ const candidates = discovery.registries.length ? discovery.registries.flatMap((registry2) => {
17485
+ try {
17486
+ return [managerFrom(registry2.getForHostId(hostId2))];
17487
+ } catch {
17488
+ return [];
17489
+ }
17490
+ }) : discovery.managers;
17391
17491
  const matching = new Set(
17392
17492
  candidates.filter(
17393
17493
  (manager) => manager && (manager.getHostId?.() ?? manager.requestClient.hostId) === hostId2 && (manager.requestClient.hostId === void 0 || manager.requestClient.hostId === hostId2)
@@ -18016,8 +18116,8 @@ function parseDesktopControllerArguments(arguments_) {
18016
18116
  if (argument === "--renderer") {
18017
18117
  if (rendererPath !== void 0) throw new Error("--renderer may only be provided once");
18018
18118
  if (!value) throw new Error("--renderer requires a value");
18019
- if (!path3.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
18020
- rendererPath = path3.normalize(value);
18119
+ if (!path4.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
18120
+ rendererPath = path4.normalize(value);
18021
18121
  index += 1;
18022
18122
  continue;
18023
18123
  }
@@ -18110,7 +18210,7 @@ async function runDesktopController(options, signal, dependencies = defaultDepen
18110
18210
  status.installing();
18111
18211
  startupTrace("reading Renderer bundle");
18112
18212
  const rendererRead = dependencies.readRenderer(options.rendererPath);
18113
- 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;
18114
18214
  const [rendererSource, overlayBundle] = overlayPath ? await Promise.all([rendererRead, dependencies.readRenderer(overlayPath)]) : [await rendererRead, void 0];
18115
18215
  if (rendererSource.trim().length === 0) throw new Error("production Renderer Bundle is empty");
18116
18216
  const overlayHookSource = bootstrap && overlayBundle && overlayBundle.trim().length > 0 ? `${RENDERER_CSP_BOOTSTRAP}