@codexhost/cli-darwin-x64 0.2.6 → 0.3.0-test.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 +4 -1
- package/THIRD_PARTY_NOTICES.txt +4 -0
- package/app/codexhost-distribution.json +1 -1
- package/app/desktop-controller.mjs +55 -20
- package/app/host-runtime.mjs +6762 -1624
- package/app/renderer-extension.js +440 -141
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/licenses/ws-LICENSE.txt +20 -0
- package/package.json +1 -1
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.
|
|
10
|
+
npm install -g @codexhost/cli@0.3.0-test.1
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Do not install this package directly. npm selects it through the optional dependencies of `@codexhost/cli`.
|
|
@@ -21,6 +21,9 @@ codexhost
|
|
|
21
21
|
codexhost --version
|
|
22
22
|
codexhost inspect
|
|
23
23
|
codexhost launch
|
|
24
|
+
codexhost remote install
|
|
25
|
+
codexhost remote status
|
|
26
|
+
codexhost remote uninstall
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
The `codexhost` command launches the packaged Rust launcher with:
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":1,"version":"0.
|
|
1
|
+
{"schemaVersion":1,"version":"0.3.0-test.1","distribution":"npm","target":"macos-x64"}
|
|
@@ -560,6 +560,9 @@ async function readMainProcessTitlePolicyCounters(inspector) {
|
|
|
560
560
|
// packages/desktop-control/src/renderer-draft-prewarm-runtime.ts
|
|
561
561
|
function installDraftPrewarmPolicyBridge(bridge, hostId, target, prewarmedThreadManager) {
|
|
562
562
|
const existing = target.__codexhostDraftPrewarmPolicyV1;
|
|
563
|
+
if (existing?.owns?.(bridge, hostId) === true) {
|
|
564
|
+
return { state: "ready", reason: "owned-request-bridge" };
|
|
565
|
+
}
|
|
563
566
|
existing?.dispose?.();
|
|
564
567
|
const originalSend = bridge.sendRequest;
|
|
565
568
|
const originalPrewarm = bridge.prewarmThreadStart;
|
|
@@ -603,6 +606,10 @@ function installDraftPrewarmPolicyBridge(bridge, hostId, target, prewarmedThread
|
|
|
603
606
|
if (originalPrewarm) bridge.prewarmThreadStart = routedPrewarm;
|
|
604
607
|
const policy = Object.freeze({
|
|
605
608
|
state: "ready",
|
|
609
|
+
hostId,
|
|
610
|
+
owns(candidate, candidateHostId) {
|
|
611
|
+
return candidate === bridge && candidateHostId === hostId;
|
|
612
|
+
},
|
|
606
613
|
select(model) {
|
|
607
614
|
if (model !== null && (typeof model !== "string" || !model.startsWith("codexhost/"))) {
|
|
608
615
|
throw new Error("Draft route Model must be a codexhost transport carrier");
|
|
@@ -638,6 +645,9 @@ function installDraftPrewarmPolicyBridge(bridge, hostId, target, prewarmedThread
|
|
|
638
645
|
configurable: true,
|
|
639
646
|
value: policy
|
|
640
647
|
});
|
|
648
|
+
if (typeof target.dispatchEvent === "function" && typeof CustomEvent === "function") {
|
|
649
|
+
target.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
650
|
+
}
|
|
641
651
|
return { state: "ready", reason: "owned-request-bridge" };
|
|
642
652
|
}
|
|
643
653
|
async function installDraftPrewarmPolicyInRenderer(contents, findRequestManagerExpression, installRendererPolicyFunction) {
|
|
@@ -672,7 +682,7 @@ async function installDraftPrewarmPolicyInRenderer(contents, findRequestManagerE
|
|
|
672
682
|
const prewarmedThreadManager = managerProperties.result?.find(
|
|
673
683
|
(property) => property.name === "prewarmedThreadManager"
|
|
674
684
|
)?.value;
|
|
675
|
-
if (candidateCount !== 1 || hostId !== "
|
|
685
|
+
if (candidateCount !== 1 || typeof hostId !== "string" || hostId.length === 0 || typeof manager?.objectId !== "string") {
|
|
676
686
|
throw new Error("Renderer request manager is ambiguous");
|
|
677
687
|
}
|
|
678
688
|
const managerFunctions = await contents.debugger.sendCommand("Runtime.getProperties", {
|
|
@@ -763,6 +773,19 @@ async function installDraftPrewarmPolicyInRenderer(contents, findRequestManagerE
|
|
|
763
773
|
}
|
|
764
774
|
|
|
765
775
|
// packages/desktop-control/src/renderer-draft-prewarm-policy.ts
|
|
776
|
+
function selectRendererRequestManager(candidates, activeHostIds) {
|
|
777
|
+
const unique = /* @__PURE__ */ new Map();
|
|
778
|
+
for (const candidate of candidates) unique.set(candidate.manager, candidate);
|
|
779
|
+
const hosts = new Set(
|
|
780
|
+
activeHostIds.filter((value) => typeof value === "string" && value.length > 0)
|
|
781
|
+
);
|
|
782
|
+
if (hosts.size > 1) return null;
|
|
783
|
+
const activeHostId = hosts.values().next().value;
|
|
784
|
+
const eligible = [...unique.values()].filter(
|
|
785
|
+
(candidate) => activeHostId === void 0 || candidate.hostId === activeHostId
|
|
786
|
+
);
|
|
787
|
+
return eligible.length === 1 ? eligible[0] ?? null : null;
|
|
788
|
+
}
|
|
766
789
|
function isRecord3(value) {
|
|
767
790
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
768
791
|
}
|
|
@@ -783,7 +806,15 @@ var FIND_REQUEST_MANAGER_EXPRESSION = `(() => {
|
|
|
783
806
|
element = element.parentElement;
|
|
784
807
|
}
|
|
785
808
|
const managers = new Set();
|
|
809
|
+
const activeHostIds = new Set();
|
|
786
810
|
for (let depth = 0; fiber != null && depth < 200; depth += 1, fiber = fiber.return) {
|
|
811
|
+
const props = fiber.memoizedProps;
|
|
812
|
+
if (props != null && typeof props === 'object') {
|
|
813
|
+
for (const name of ['executionTargetHostId', 'permissionsHostId']) {
|
|
814
|
+
const value = props[name];
|
|
815
|
+
if (typeof value === 'string' && value.length > 0) activeHostIds.add(value);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
787
818
|
let hook = fiber.memoizedState;
|
|
788
819
|
for (let index = 0; hook != null && index < 120; index += 1, hook = hook.next) {
|
|
789
820
|
const value = hook.memoizedState;
|
|
@@ -800,19 +831,26 @@ var FIND_REQUEST_MANAGER_EXPRESSION = `(() => {
|
|
|
800
831
|
}
|
|
801
832
|
}
|
|
802
833
|
}
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
834
|
+
const candidates = [...managers].map((manager) => {
|
|
835
|
+
const requestClient =
|
|
836
|
+
typeof manager.requestClient?.sendRequest === 'function' &&
|
|
837
|
+
typeof manager.requestClient?.prewarmThreadStart === 'function' &&
|
|
838
|
+
typeof manager.requestClient?.enqueueRequest === 'function'
|
|
839
|
+
? manager.requestClient
|
|
840
|
+
: manager;
|
|
841
|
+
return {
|
|
842
|
+
manager,
|
|
843
|
+
requestClient,
|
|
844
|
+
hostId: manager?.getHostId?.() ?? requestClient?.hostId ?? null,
|
|
845
|
+
prewarmedThreadManager: manager?.prewarmedThreadManager ?? null,
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
const selected = (${selectRendererRequestManager.toString()})(candidates, [...activeHostIds]);
|
|
811
849
|
return {
|
|
812
|
-
candidateCount:
|
|
813
|
-
hostId:
|
|
814
|
-
manager: requestClient,
|
|
815
|
-
prewarmedThreadManager:
|
|
850
|
+
candidateCount: selected == null ? candidates.length : 1,
|
|
851
|
+
hostId: selected?.hostId ?? null,
|
|
852
|
+
manager: selected?.requestClient ?? null,
|
|
853
|
+
prewarmedThreadManager: selected?.prewarmedThreadManager ?? null,
|
|
816
854
|
};
|
|
817
855
|
})()`;
|
|
818
856
|
var INSTALL_RENDERER_POLICY_FUNCTION = `function(hostId, prewarmedThreadManager) {
|
|
@@ -1013,11 +1051,6 @@ var defaultOperations = {
|
|
|
1013
1051
|
installTitlePolicy: installMainProcessTitlePolicy,
|
|
1014
1052
|
markTitlePolicyReady: markRendererTitlePolicyReady,
|
|
1015
1053
|
installDraftPrewarmPolicy: installRendererDraftPrewarmPolicy,
|
|
1016
|
-
readDraftPrewarmPolicy: (inspector, rendererWebContentsId) => executeInWebContents(
|
|
1017
|
-
inspector,
|
|
1018
|
-
rendererWebContentsId,
|
|
1019
|
-
"window.__codexhostDraftPrewarmPolicyV1?.state ?? null"
|
|
1020
|
-
),
|
|
1021
1054
|
reload: reloadRenderer,
|
|
1022
1055
|
execute: executeInWebContents,
|
|
1023
1056
|
readBinding: (inspector, rendererWebContentsId) => executeInWebContents(
|
|
@@ -1088,8 +1121,10 @@ var InstalledRendererControlSession = class {
|
|
|
1088
1121
|
);
|
|
1089
1122
|
const existing = await this.operations.readBinding(this.inspector, selected.id).catch(() => null);
|
|
1090
1123
|
if (existing !== null) {
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1124
|
+
const draftPrewarmPolicy2 = await this.operations.installDraftPrewarmPolicy(
|
|
1125
|
+
this.inspector,
|
|
1126
|
+
selected.id
|
|
1127
|
+
);
|
|
1093
1128
|
let binding2;
|
|
1094
1129
|
try {
|
|
1095
1130
|
binding2 = validateBindingStatus(existing, this.enabledAgents);
|