@codexhost/cli-darwin-arm64 0.17.2 → 0.17.3

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
@@ -7,7 +7,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @codexhost/cli@0.17.2
10
+ npm install -g @codexhost/cli@0.17.3
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@codexhost/cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.17.2","distribution":"npm","target":"macos-arm64"}
1
+ {"schemaVersion":1,"version":"0.17.3","distribution":"npm","target":"macos-arm64"}
@@ -17738,13 +17738,15 @@ function installRendererHostRpcRouting(root, target, dependencies) {
17738
17738
  return discovery;
17739
17739
  };
17740
17740
  if (!read()) return null;
17741
- const native = () => {
17742
- if (disposed) return null;
17743
- try {
17744
- nativeRouting ??= dependencies.nativeRouting?.() ?? null;
17745
- } catch {
17741
+ const discoverComposer = (composer) => {
17742
+ const owners = dependencies.discoverComposer(composer);
17743
+ if (!nativeRouting && (owners.managers.length || owners.registries.length)) {
17744
+ try {
17745
+ nativeRouting = dependencies.installNativeRouting();
17746
+ } catch {
17747
+ }
17746
17748
  }
17747
- return nativeRouting;
17749
+ return owners;
17748
17750
  };
17749
17751
  const connectionFor = (hostId2) => {
17750
17752
  if (!hostId2.startsWith("remote-control:")) return void 0;
@@ -17926,7 +17928,7 @@ function installRendererHostRpcRouting(root, target, dependencies) {
17926
17928
  const routeFor = (hostId2, nativeRoute) => {
17927
17929
  if (disposed) return null;
17928
17930
  const connection = connectionFor(hostId2);
17929
- const preferred = nativeRoute === void 0 ? native()?.forHost(hostId2) : nativeRoute;
17931
+ const preferred = nativeRoute === void 0 ? nativeRouting?.forHost(hostId2) : nativeRoute;
17930
17932
  if (connection === null || preferred) {
17931
17933
  retire(hostId2);
17932
17934
  return connection === null ? null : preferred ?? null;
@@ -17953,21 +17955,25 @@ function installRendererHostRpcRouting(root, target, dependencies) {
17953
17955
  target.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
17954
17956
  }
17955
17957
  };
17956
- const composerHostId = (composer) => {
17957
- const nativeHostId = native()?.hostIdForComposer(composer);
17958
+ const composerHostId = (owners, composer) => {
17959
+ const nativeHostId = nativeRouting?.hostIdForComposer(composer);
17958
17960
  if (nativeHostId) return nativeHostId;
17959
- const hostIds = new Set(dependencies.composerHostIds(composer).hostIds);
17961
+ const hostIds = new Set((owners ?? discoverComposer(composer)).hostIds);
17960
17962
  const hostId2 = hostIds.size === 1 ? hostIds.values().next().value : null;
17961
17963
  return typeof hostId2 === "string" && hostId2 ? hostId2 : null;
17962
17964
  };
17963
17965
  const routing = {
17964
17966
  knownHostIds() {
17965
17967
  if (disposed) return [];
17968
+ try {
17969
+ if (!nativeRouting) discoverComposer();
17970
+ } catch {
17971
+ }
17966
17972
  const current = read();
17967
17973
  return [
17968
17974
  .../* @__PURE__ */ new Set([
17969
17975
  ...current ? dependencies.hostIds(current) : [],
17970
- ...native()?.knownHostIds?.() ?? []
17976
+ ...nativeRouting?.knownHostIds?.() ?? []
17971
17977
  ])
17972
17978
  ];
17973
17979
  },
@@ -17977,7 +17983,7 @@ function installRendererHostRpcRouting(root, target, dependencies) {
17977
17983
  hostIdForComposer(composer) {
17978
17984
  if (disposed) return null;
17979
17985
  try {
17980
- return composerHostId(composer);
17986
+ return composerHostId(nativeRouting ? null : discoverComposer(composer), composer);
17981
17987
  } catch {
17982
17988
  return null;
17983
17989
  }
@@ -17987,8 +17993,9 @@ function installRendererHostRpcRouting(root, target, dependencies) {
17987
17993
  let hostId2;
17988
17994
  let preferred = null;
17989
17995
  try {
17990
- preferred = native()?.forComposer(composer) ?? null;
17991
- hostId2 = preferred?.hostId ?? composerHostId(composer);
17996
+ const owners = nativeRouting ? null : discoverComposer(composer);
17997
+ preferred = nativeRouting?.forComposer(composer) ?? null;
17998
+ hostId2 = preferred?.hostId ?? composerHostId(owners, composer);
17992
17999
  } catch {
17993
18000
  hostId2 = null;
17994
18001
  }
@@ -18071,17 +18078,14 @@ function directRendererInstaller() {
18071
18078
  findFamily: ${findRendererHostRpcFamily.toString()},
18072
18079
  resolve: ${resolveRendererHostRpc.toString()},
18073
18080
  hostIds: ${rendererHostRpcHostIds.toString()},
18074
- composerHostIds: (composer) => {
18081
+ discoverComposer: (composer) => {
18075
18082
  const source = composer?.matches?.('[data-codex-composer], [contenteditable="true"][role="textbox"]')
18076
18083
  ? { querySelectorAll: () => [composer] }
18077
18084
  : (composer ?? document);
18078
18085
  return discover(source);
18079
18086
  },
18080
18087
  portPrototype: MessagePort.prototype,
18081
- nativeRouting: () => {
18082
- const native = discover(document);
18083
- return native.managers.length || native.registries.length ? installNative(false) : null;
18084
- },
18088
+ installNativeRouting: () => installNative(false),
18085
18089
  readConnection: (hostId) => readRendererConnectionGeneration(findRendererAppScopeStore(document), hostId),
18086
18090
  });
18087
18091
  const connected = (routing) => routing.forComposer() !== null ||
@@ -23624,14 +23624,15 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23624
23624
  };
23625
23625
  if (!read())
23626
23626
  return null;
23627
- const native = () => {
23628
- if (disposed)
23629
- return null;
23630
- try {
23631
- nativeRouting ??= dependencies2.nativeRouting?.() ?? null;
23632
- } catch {
23627
+ const discoverComposer = (composer) => {
23628
+ const owners = dependencies2.discoverComposer(composer);
23629
+ if (!nativeRouting && (owners.managers.length || owners.registries.length)) {
23630
+ try {
23631
+ nativeRouting = dependencies2.installNativeRouting();
23632
+ } catch {
23633
+ }
23633
23634
  }
23634
- return nativeRouting;
23635
+ return owners;
23635
23636
  };
23636
23637
  const connectionFor = (hostId2) => {
23637
23638
  if (!hostId2.startsWith("remote-control:"))
@@ -23833,7 +23834,7 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23833
23834
  if (disposed)
23834
23835
  return null;
23835
23836
  const connection = connectionFor(hostId2);
23836
- const preferred = nativeRoute === void 0 ? native()?.forHost(hostId2) : nativeRoute;
23837
+ const preferred = nativeRoute === void 0 ? nativeRouting?.forHost(hostId2) : nativeRoute;
23837
23838
  if (connection === null || preferred) {
23838
23839
  retire(hostId2);
23839
23840
  return connection === null ? null : preferred ?? null;
@@ -23862,11 +23863,11 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23862
23863
  target.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
23863
23864
  }
23864
23865
  };
23865
- const composerHostId = (composer) => {
23866
- const nativeHostId = native()?.hostIdForComposer(composer);
23866
+ const composerHostId = (owners, composer) => {
23867
+ const nativeHostId = nativeRouting?.hostIdForComposer(composer);
23867
23868
  if (nativeHostId)
23868
23869
  return nativeHostId;
23869
- const hostIds = new Set(dependencies2.composerHostIds(composer).hostIds);
23870
+ const hostIds = new Set((owners ?? discoverComposer(composer)).hostIds);
23870
23871
  const hostId2 = hostIds.size === 1 ? hostIds.values().next().value : null;
23871
23872
  return typeof hostId2 === "string" && hostId2 ? hostId2 : null;
23872
23873
  };
@@ -23874,11 +23875,16 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23874
23875
  knownHostIds() {
23875
23876
  if (disposed)
23876
23877
  return [];
23878
+ try {
23879
+ if (!nativeRouting)
23880
+ discoverComposer();
23881
+ } catch {
23882
+ }
23877
23883
  const current = read();
23878
23884
  return [
23879
23885
  .../* @__PURE__ */ new Set([
23880
23886
  ...current ? dependencies2.hostIds(current) : [],
23881
- ...native()?.knownHostIds?.() ?? []
23887
+ ...nativeRouting?.knownHostIds?.() ?? []
23882
23888
  ])
23883
23889
  ];
23884
23890
  },
@@ -23889,7 +23895,7 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23889
23895
  if (disposed)
23890
23896
  return null;
23891
23897
  try {
23892
- return composerHostId(composer);
23898
+ return composerHostId(nativeRouting ? null : discoverComposer(composer), composer);
23893
23899
  } catch {
23894
23900
  return null;
23895
23901
  }
@@ -23900,8 +23906,9 @@ function installRendererHostRpcRouting(root, target, dependencies2) {
23900
23906
  let hostId2;
23901
23907
  let preferred = null;
23902
23908
  try {
23903
- preferred = native()?.forComposer(composer) ?? null;
23904
- hostId2 = preferred?.hostId ?? composerHostId(composer);
23909
+ const owners = nativeRouting ? null : discoverComposer(composer);
23910
+ preferred = nativeRouting?.forComposer(composer) ?? null;
23911
+ hostId2 = preferred?.hostId ?? composerHostId(owners, composer);
23905
23912
  } catch {
23906
23913
  hostId2 = null;
23907
23914
  }
@@ -23992,17 +23999,14 @@ function directRendererInstaller() {
23992
23999
  findFamily: ${findRendererHostRpcFamily.toString()},
23993
24000
  resolve: ${resolveRendererHostRpc.toString()},
23994
24001
  hostIds: ${rendererHostRpcHostIds.toString()},
23995
- composerHostIds: (composer) => {
24002
+ discoverComposer: (composer) => {
23996
24003
  const source = composer?.matches?.('[data-codex-composer], [contenteditable="true"][role="textbox"]')
23997
24004
  ? { querySelectorAll: () => [composer] }
23998
24005
  : (composer ?? document);
23999
24006
  return discover(source);
24000
24007
  },
24001
24008
  portPrototype: MessagePort.prototype,
24002
- nativeRouting: () => {
24003
- const native = discover(document);
24004
- return native.managers.length || native.registries.length ? installNative(false) : null;
24005
- },
24009
+ installNativeRouting: () => installNative(false),
24006
24010
  readConnection: (hostId) => readRendererConnectionGeneration(findRendererAppScopeStore(document), hostId),
24007
24011
  });
24008
24012
  const connected = (routing) => routing.forComposer() !== null ||
package/bin/codexhost CHANGED
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli-darwin-arm64",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [