@codexhost/cli-win32-x64 0.3.0-test.3 → 0.3.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/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.3.0-test.3
10
+ npm install -g @codexhost/cli@0.3.0
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.3.0-test.3","distribution":"npm","target":"windows-x64"}
1
+ {"schemaVersion":1,"version":"0.3.0","distribution":"npm","target":"windows-x64"}
@@ -21451,6 +21451,10 @@ ${error51.stderrTail}`] : []
21451
21451
  if (!isLateConversationTarget(mountedTarget, currentTarget)) return "none";
21452
21452
  return mountedTarget?.[0] === "default" && (sourcePhase === "locked" || submissionPending) ? "transfer" : "inspect";
21453
21453
  }
21454
+ function scopedComposerTarget(target, hostId) {
21455
+ if (target?.[0] !== "conversation" || !hostId) return target;
21456
+ return ["conversation", target[1], hostId];
21457
+ }
21454
21458
  function isComposerModelWriteAllowed(target) {
21455
21459
  return target?.[0] === "default";
21456
21460
  }
@@ -21504,6 +21508,11 @@ ${error51.stderrTail}`] : []
21504
21508
  let adapterDispose = null;
21505
21509
  let applyAdapterAgent = null;
21506
21510
  let modelControl = null;
21511
+ const activeModelHostId = () => {
21512
+ if (!modelControl) return null;
21513
+ return modelControl.currentHostId ? modelControl.currentHostId() : "local";
21514
+ };
21515
+ const controllerTarget = (target, hostId) => scopedComposerTarget(target, hostId);
21507
21516
  let usageNotificationDispose = null;
21508
21517
  const localAgentForSidebarThread = (input) => {
21509
21518
  const mountedHostId = modelControl?.currentHostId?.() ?? "local";
@@ -21722,14 +21731,18 @@ ${error51.stderrTail}`] : []
21722
21731
  mounted.ownershipStatus = "not-required";
21723
21732
  return;
21724
21733
  }
21734
+ const requestModelControl = modelControl;
21735
+ const requestHostId = activeModelHostId();
21736
+ const client = requestModelControl && requestHostId ? requestModelControl.clientForHost?.(requestHostId) ?? requestModelControl : null;
21725
21737
  const generation = controller.beginOwnershipRequest(mounted.composer);
21726
21738
  const usageGeneration = mounted.usageRequestGeneration;
21727
21739
  mounted.ownershipStatus = "loading";
21728
21740
  renderMounted(mounted);
21729
21741
  try {
21730
- if (!modelControl) throw new Error("Thread ownership control is unavailable");
21731
- const inspection = await modelControl.inspectThread({ threadId });
21732
- if (!isCurrentOwnershipRequest(mounted, generation) || mountedByComposer.get(mounted.composer) !== mounted || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId) {
21742
+ if (!client || !requestHostId) throw new Error("Thread ownership control is unavailable");
21743
+ mounted.hostId = requestHostId;
21744
+ const inspection = await client.inspectThread({ threadId });
21745
+ if (!isCurrentOwnershipRequest(mounted, generation) || mountedByComposer.get(mounted.composer) !== mounted || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || mounted.hostId !== requestHostId || modelControl !== requestModelControl || activeModelHostId() !== requestHostId) {
21733
21746
  return;
21734
21747
  }
21735
21748
  const { agent, model, thinkingOptionId, permissionModeId } = restoredThreadOwnership(inspection);
@@ -21794,8 +21807,11 @@ ${error51.stderrTail}`] : []
21794
21807
  );
21795
21808
  if (resolution === "none") return false;
21796
21809
  const previousTarget = mounted.modelTarget;
21810
+ const nextHostId = activeModelHostId() ?? mounted.hostId;
21811
+ const nextControllerTarget = controllerTarget(currentTarget, nextHostId);
21797
21812
  mounted.modelTarget = currentTarget;
21798
- const rebound = resolution === "transfer" ? controller.transfer(mounted.composer, mounted.composer, currentTarget) : controller.rebindConversation(mounted.composer, currentTarget) !== null;
21813
+ mounted.hostId = nextHostId;
21814
+ const rebound = resolution === "transfer" ? controller.transfer(mounted.composer, mounted.composer, nextControllerTarget) : controller.rebindConversation(mounted.composer, nextControllerTarget) !== null;
21799
21815
  if (!rebound) {
21800
21816
  mounted.ownershipStatus = "error";
21801
21817
  renderMounted(mounted);
@@ -22510,12 +22526,43 @@ ${error51.stderrTail}`] : []
22510
22526
  );
22511
22527
  return promise2;
22512
22528
  }
22529
+ const reloadMountedOwnershipForHost = (hostId) => {
22530
+ for (const mounted of mountedByComposer.values()) {
22531
+ if (mounted.hostId === hostId || !threadIdFromComposerModelTarget(mounted.modelTarget)) {
22532
+ continue;
22533
+ }
22534
+ const target = controllerTarget(mounted.modelTarget, hostId);
22535
+ if (controller.rebindConversation(mounted.composer, target) === null) {
22536
+ mounted.ownershipStatus = "error";
22537
+ renderMounted(mounted);
22538
+ continue;
22539
+ }
22540
+ mounted.hostId = hostId;
22541
+ mounted.composerId = controller.get(mounted.composer).composerId;
22542
+ mounted.modelView = { status: "idle" };
22543
+ mounted.permissionModeView = { status: "idle" };
22544
+ mounted.threadConfiguration = void 0;
22545
+ mounted.ownershipStatus = "loading";
22546
+ mounted.usage = null;
22547
+ mounted.accountCredits = null;
22548
+ mounted.usageRequestGeneration += 1;
22549
+ usageRefreshAttempts.delete(mounted.composer);
22550
+ const timer = usageRefreshTimers.get(mounted.composer);
22551
+ if (timer !== void 0) {
22552
+ window.clearTimeout(timer);
22553
+ usageRefreshTimers.delete(mounted.composer);
22554
+ }
22555
+ renderMounted(mounted);
22556
+ void loadThreadOwnership(mounted);
22557
+ }
22558
+ sidebarAgentIcons.refresh();
22559
+ };
22513
22560
  function reconcileHarnessAvailabilityHost() {
22514
- const reportedHostId = modelControl?.currentHostId?.();
22515
- const hostId = reportedHostId ?? (modelControl?.currentHostId ? activeAvailabilityHostId : "local");
22516
- if (hostId === activeAvailabilityHostId) return;
22561
+ const hostId = activeModelHostId();
22562
+ if (!hostId || hostId === activeAvailabilityHostId) return;
22517
22563
  activeAvailabilityHostId = hostId;
22518
22564
  hostHarnessAvailabilityState(hostId);
22565
+ reloadMountedOwnershipForHost(hostId);
22519
22566
  publishConnectionStatus();
22520
22567
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
22521
22568
  void refreshHarnessAvailabilityForHost(hostId);
@@ -22565,11 +22612,12 @@ ${error51.stderrTail}`] : []
22565
22612
  const sendButton = sendButtonWithin(composer) ?? allButtons.at(-1) ?? null;
22566
22613
  if (!sendButton) return;
22567
22614
  const modelTarget = findComposerModelTarget(composer);
22615
+ const hostId = activeModelHostId();
22568
22616
  const editor = composer.querySelector(EDITOR_SELECTOR);
22569
22617
  if (!editor) return;
22570
22618
  const state = controller.mount(
22571
22619
  composer,
22572
- modelTarget,
22620
+ controllerTarget(modelTarget, hostId),
22573
22621
  modelTarget?.[0] === "default" ? readNewThreadAgentPreference(enabledAgentSet) : void 0
22574
22622
  );
22575
22623
  const inherited = pendingReplacements.get(composer)?.source;
@@ -22615,6 +22663,7 @@ ${error51.stderrTail}`] : []
22615
22663
  threadConfiguration: inherited?.threadConfiguration,
22616
22664
  usage: inherited?.usage ?? null,
22617
22665
  accountCredits: inherited?.accountCredits ?? null,
22666
+ hostId: inherited?.hostId ?? hostId,
22618
22667
  usageRequestGeneration: 0
22619
22668
  };
22620
22669
  mountedByComposer.set(composer, mounted);
@@ -22650,12 +22699,17 @@ ${error51.stderrTail}`] : []
22650
22699
  for (const [target, replacement] of pendingReplacements) {
22651
22700
  const sourceState = controller.get(replacement.source.composer);
22652
22701
  const replacementTarget = findComposerModelTarget(target);
22702
+ const replacementHostId = activeModelHostId() ?? replacement.source.hostId;
22653
22703
  if (!shouldTransferComposerState(
22654
22704
  replacement.sourceModelTarget,
22655
22705
  replacementTarget,
22656
22706
  sourceState.phase,
22657
22707
  controller.isSubmissionPending(replacement.source.composer)
22658
- ) || !controller.transfer(replacement.source.composer, target, replacementTarget)) {
22708
+ ) || !controller.transfer(
22709
+ replacement.source.composer,
22710
+ target,
22711
+ controllerTarget(replacementTarget, replacementHostId)
22712
+ )) {
22659
22713
  pendingReplacements.delete(target);
22660
22714
  }
22661
22715
  }
package/bin/codexhost.exe CHANGED
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli-win32-x64",
3
- "version": "0.3.0-test.3",
3
+ "version": "0.3.0",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "files": [