@codexhost/cli-win32-arm64 0.7.0 → 0.7.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.
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.7.0
10
+ npm install -g @codexhost/cli@0.7.1
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.7.0","distribution":"npm","target":"windows-arm64"}
1
+ {"schemaVersion":1,"version":"0.7.1","distribution":"npm","target":"windows-arm64"}
@@ -808,10 +808,23 @@ function selectRendererRequestManager(candidates, activeHostIds) {
808
808
  );
809
809
  return eligible.length === 1 ? eligible[0] ?? null : null;
810
810
  }
811
+ function requestManagerFromHookState(value) {
812
+ const matchesRequestManager = (candidate) => {
813
+ if (candidate == null || typeof candidate !== "object") return false;
814
+ const value2 = candidate;
815
+ return value2.requestClient != null && typeof value2.requestClient.prewarmThreadStart === "function" && typeof value2.requestClient.sendRequest === "function" && typeof value2.requestClient.enqueueRequest === "function" && typeof value2.prewarmedThreadManager?.discardAllPrewarmedThreads === "function" && typeof value2.sendRequest === "function";
816
+ };
817
+ if (matchesRequestManager(value)) return value;
818
+ if (value != null && typeof value === "object" && matchesRequestManager(value.manager)) {
819
+ return value.manager;
820
+ }
821
+ return null;
822
+ }
811
823
  function isRecord2(value) {
812
824
  return typeof value === "object" && value !== null && !Array.isArray(value);
813
825
  }
814
826
  var FIND_REQUEST_MANAGER_EXPRESSION = `(() => {
827
+ const requestManagerFromHookState = ${requestManagerFromHookState.toString()};
815
828
  const editors = [...document.querySelectorAll(
816
829
  '[data-codex-composer], [contenteditable="true"][role="textbox"]',
817
830
  )];
@@ -839,19 +852,8 @@ var FIND_REQUEST_MANAGER_EXPRESSION = `(() => {
839
852
  }
840
853
  let hook = fiber.memoizedState;
841
854
  for (let index = 0; hook != null && index < 120; index += 1, hook = hook.next) {
842
- const value = hook.memoizedState;
843
- if (
844
- value != null &&
845
- typeof value === 'object' &&
846
- value.requestClient != null &&
847
- typeof value.requestClient.prewarmThreadStart === 'function' &&
848
- typeof value.requestClient.sendRequest === 'function' &&
849
- typeof value.requestClient.enqueueRequest === 'function' &&
850
- typeof value.prewarmedThreadManager?.discardAllPrewarmedThreads === 'function' &&
851
- typeof value.sendRequest === 'function'
852
- ) {
853
- managers.add(value);
854
- }
855
+ const manager = requestManagerFromHookState(hook.memoizedState);
856
+ if (manager != null) managers.add(manager);
855
857
  }
856
858
  }
857
859
  const candidates = [...managers].map((manager) => {
@@ -22670,6 +22670,17 @@ ${error51.stderrTail}`] : []
22670
22670
  function isCurrentRequestBridge(value) {
22671
22671
  return isRecord7(value) && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.sendRequest === "function" && typeof value.prewarmThreadStart === "function" && typeof value.enqueueRequest === "function";
22672
22672
  }
22673
+ function requestTargetOwnerFromHookState(value) {
22674
+ if (!isRecord7(value)) return null;
22675
+ const ownerFrom = (candidate) => {
22676
+ if (!isRecord7(candidate)) return null;
22677
+ const requestClient = candidate.requestClient;
22678
+ const bridge = isCurrentRequestBridge(requestClient) ? requestClient : isCurrentRequestBridge(candidate) ? candidate : null;
22679
+ if (!bridge) return null;
22680
+ return typeof candidate.sendRequest === "function" ? candidate : bridge;
22681
+ };
22682
+ return ownerFrom(value) ?? ownerFrom(value.manager);
22683
+ }
22673
22684
  function findActivePrewarmTargets(root) {
22674
22685
  const editor = root.querySelector(
22675
22686
  '[data-codex-composer], [contenteditable="true"][role="textbox"]'
@@ -22695,14 +22706,8 @@ ${error51.stderrTail}`] : []
22695
22706
  for (let depth = 0; depth < 200; depth += 1) {
22696
22707
  let hook = fiber.memoizedState;
22697
22708
  for (let hookIndex = 0; hook && hookIndex < 100; hookIndex += 1) {
22698
- const hookState = hook.memoizedState;
22699
- if (isRecord7(hookState)) {
22700
- const requestClient = hookState.requestClient;
22701
- const bridge = isCurrentRequestBridge(requestClient) ? requestClient : isCurrentRequestBridge(hookState) ? hookState : null;
22702
- if (bridge) {
22703
- targets.add(typeof hookState.sendRequest === "function" ? hookState : bridge);
22704
- }
22705
- }
22709
+ const owner = requestTargetOwnerFromHookState(hook.memoizedState);
22710
+ if (owner) targets.add(owner);
22706
22711
  hook = typeof hook.next === "object" && hook.next !== null ? hook.next : null;
22707
22712
  }
22708
22713
  const parent = fiber.return;
@@ -22742,7 +22747,7 @@ ${error51.stderrTail}`] : []
22742
22747
  }
22743
22748
  return threadId;
22744
22749
  }
22745
- function isCurrentDraftWrapper(value) {
22750
+ function isLegacySevenSlotDraftWrapper(value) {
22746
22751
  if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord7(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
22747
22752
  return false;
22748
22753
  }
@@ -22753,6 +22758,20 @@ ${error51.stderrTail}`] : []
22753
22758
  return false;
22754
22759
  }
22755
22760
  }
22761
+ function duplicatedClientNewThreadId(value) {
22762
+ if (!Array.isArray(value)) return null;
22763
+ const ids = value.filter(
22764
+ (item) => typeof item === "string" && item.startsWith("client-new-thread:")
22765
+ );
22766
+ if (ids.length < 2 || ids.some((id) => id !== ids[0])) return null;
22767
+ return ids[0] ?? null;
22768
+ }
22769
+ function draftIdFromMemoValue(value) {
22770
+ if (isLegacySevenSlotDraftWrapper(value) && typeof value[2] === "string" && value[2].startsWith("client-new-thread:")) {
22771
+ return value[2];
22772
+ }
22773
+ return duplicatedClientNewThreadId(value);
22774
+ }
22756
22775
  function findComposerDomIdentity(composer) {
22757
22776
  const children = Array.from(composer.children ?? []);
22758
22777
  const portals = children.filter((child) => child.hasAttribute("data-above-composer-portal"));
@@ -22771,9 +22790,8 @@ ${error51.stderrTail}`] : []
22771
22790
  const memoCache = isRecord7(updateQueue) ? updateQueue.memoCache : null;
22772
22791
  const data = isRecord7(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
22773
22792
  for (const value of data) {
22774
- if (isCurrentDraftWrapper(value) && typeof value[2] === "string" && value[2].startsWith("client-new-thread:")) {
22775
- draftIds.add(value[2]);
22776
- }
22793
+ const draftId = draftIdFromMemoValue(value);
22794
+ if (draftId) draftIds.add(draftId);
22777
22795
  }
22778
22796
  const parent = fiber.return;
22779
22797
  fiber = (typeof parent === "object" || typeof parent === "function") && parent !== null ? parent : null;
package/bin/codexhost.exe CHANGED
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli-win32-arm64",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [