FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

include new windows binaries in npm package. (#8140) · heathdutton/codex@3a0d9bc · GitHub

forked from openai/codex

Commit 3a0d9bc

Browse files
include new windows binaries in npm package. (openai#8140)
The Windows Elevated Sandbox uses two new binaries: codex-windows-sandbox-setup.exe codex-command-runner.exe This PR includes them when installing native deps and packaging for npm
1 parent cafcd60 commit 3a0d9bc

3 files changed

Lines changed: 69 additions & 16 deletions

File tree

‎.github/dotslash-config.json‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@
5555
"path": "codex-responses-api-proxy.exe"
5656
}
5757
}
58+
},
59+
"codex-command-runner": {
60+
"platforms": {
61+
"windows-x86_64": {
62+
"regex": "^codex-command-runner-x86_64-pc-windows-msvc\\.exe\\.zst$",
63+
"path": "codex-command-runner.exe"
64+
},
65+
"windows-aarch64": {
66+
"regex": "^codex-command-runner-aarch64-pc-windows-msvc\\.exe\\.zst$",
67+
"path": "codex-command-runner.exe"
68+
}
69+
}
70+
},
71+
"codex-windows-sandbox-setup": {
72+
"platforms": {
73+
"windows-x86_64": {
74+
"regex": "^codex-windows-sandbox-setup-x86_64-pc-windows-msvc\\.exe\\.zst$",
75+
"path": "codex-windows-sandbox-setup.exe"
76+
},
77+
"windows-aarch64": {
78+
"regex": "^codex-windows-sandbox-setup-aarch64-pc-windows-msvc\\.exe\\.zst$",
79+
"path": "codex-windows-sandbox-setup.exe"
80+
}
81+
}
5882
}
5983
}
6084
}

‎codex-cli/scripts/build_npm_package.py‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
"codex-responses-api-proxy": ["codex-responses-api-proxy"],
2121
"codex-sdk": ["codex"],
2222
}
23+
WINDOWS_ONLY_COMPONENTS: dict[str, list[str]] = {
24+
"codex": ["codex-windows-sandbox-setup", "codex-command-runner"],
25+
}
2326
COMPONENT_DEST_DIR: dict[str, str] = {
2427
"codex": "codex",
2528
"codex-responses-api-proxy": "codex-responses-api-proxy",
29+
"codex-windows-sandbox-setup": "codex",
30+
"codex-command-runner": "codex",
2631
"rg": "path",
2732
}
2833

@@ -103,7 +108,7 @@ def main() -> int:
103108
"pointing to a directory containing pre-installed binaries."
104109
)
105110

106-
copy_native_binaries(vendor_src, staging_dir, native_components)
111+
copy_native_binaries(vendor_src, staging_dir, package, native_components)
107112

108113
if release_version:
109114
staging_dir_str = str(staging_dir)
@@ -232,7 +237,12 @@ def stage_codex_sdk_sources(staging_dir: Path) -> None:
232237
shutil.copy2(license_src, staging_dir / "LICENSE")
233238

234239

235-
def copy_native_binaries(vendor_src: Path, staging_dir: Path, components: list[str]) -> None:
240+
def copy_native_binaries(
241+
vendor_src: Path,
242+
staging_dir: Path,
243+
package: str,
244+
components: list[str],
245+
) -> None:
236246
vendor_src = vendor_src.resolve()
237247
if not vendor_src.exists():
238248
raise RuntimeError(f"Vendor source directory not found: {vendor_src}")
@@ -250,6 +260,9 @@ def copy_native_binaries(vendor_src: Path, staging_dir: Path, components: list[s
250260
if not target_dir.is_dir():
251261
continue
252262

263+
if "windows" in target_dir.name:
264+
components_set.update(WINDOWS_ONLY_COMPONENTS.get(package, []))
265+
253266
dest_target_dir = vendor_dest / target_dir.name
254267
dest_target_dir.mkdir(parents=True, exist_ok=True)
255268

‎codex-cli/scripts/install_native_deps.py‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ class BinaryComponent:
3636
artifact_prefix: str # matches the artifact filename prefix (e.g. codex-<target>.zst)
3737
dest_dir: str # directory under vendor/<target>/ where the binary is installed
3838
binary_basename: str # executable name inside dest_dir (before optional .exe)
39+
targets: tuple[str, ...] | None = None # limit installation to specific targets
3940

4041

42+
WINDOWS_TARGETS = tuple(target for target in BINARY_TARGETS if "windows" in target)
43+
4144
BINARY_COMPONENTS = {
4245
"codex": BinaryComponent(
4346
artifact_prefix="codex",
@@ -49,6 +52,18 @@ class BinaryComponent:
4952
dest_dir="codex-responses-api-proxy",
5053
binary_basename="codex-responses-api-proxy",
5154
),
55+
"codex-windows-sandbox-setup": BinaryComponent(
56+
artifact_prefix="codex-windows-sandbox-setup",
57+
dest_dir="codex",
58+
binary_basename="codex-windows-sandbox-setup",
59+
targets=WINDOWS_TARGETS,
60+
),
61+
"codex-command-runner": BinaryComponent(
62+
artifact_prefix="codex-command-runner",
63+
dest_dir="codex",
64+
binary_basename="codex-command-runner",
65+
targets=WINDOWS_TARGETS,
66+
),
5267
}
5368

5469
RG_TARGET_PLATFORM_PAIRS: list[tuple[str, str]] = [
@@ -79,7 +94,8 @@ def parse_args() -> argparse.Namespace:
7994
choices=tuple(list(BINARY_COMPONENTS) + ["rg"]),
8095
help=(
8196
"Limit installation to the specified components."
82-
" May be repeated. Defaults to 'codex' and 'rg'."
97+
" May be repeated. Defaults to codex, codex-windows-sandbox-setup,"
98+
" codex-command-runner, and rg."
8399
),
84100
)
85101
parser.add_argument(
@@ -101,7 +117,12 @@ def main() -> int:
101117
vendor_dir = codex_cli_root / VENDOR_DIR_NAME
102118
vendor_dir.mkdir(parents=True, exist_ok=True)
103119

104-
components = args.components or ["codex", "rg"]
120+
components = args.components or [
121+
"codex",
122+
"codex-windows-sandbox-setup",
123+
"codex-command-runner",
124+
"rg",
125+
]
105126

106127
workflow_url = (args.workflow_url or DEFAULT_WORKFLOW_URL).strip()
107128
if not workflow_url:
@@ -116,8 +137,7 @@ def main() -> int:
116137
install_binary_components(
117138
artifacts_dir,
118139
vendor_dir,
119-
BINARY_TARGETS,
120-
[name for name in components if name in BINARY_COMPONENTS],
140+
[BINARY_COMPONENTS[name] for name in components if name in BINARY_COMPONENTS],
121141
)
122142

123143
if "rg" in components:
@@ -206,23 +226,19 @@ def _download_artifacts(workflow_id: str, dest_dir: Path) -> None:
206226
def install_binary_components(
207227
artifacts_dir: Path,
208228
vendor_dir: Path,
209-
targets: Iterable[str],
210-
component_names: Sequence[str],
229+
selected_components: Sequence[BinaryComponent],
211230
) -> None:
212-
selected_components = [BINARY_COMPONENTS[name] for name in component_names if name in BINARY_COMPONENTS]
213231
if not selected_components:
214232
return
215233

216-
targets = list(targets)
217-
if not targets:
218-
return
219-
220234
for component in selected_components:
235+
component_targets = list(component.targets or BINARY_TARGETS)
236+
221237
print(
222238
f"Installing {component.binary_basename} binaries for targets: "
223-
+ ", ".join(targets)
239+
+ ", ".join(component_targets)
224240
)
225-
max_workers = min(len(targets), max(1, (os.cpu_count() or 1)))
241+
max_workers = min(len(component_targets), max(1, (os.cpu_count() or 1)))
226242
with ThreadPoolExecutor(max_workers=max_workers) as executor:
227243
futures = {
228244
executor.submit(
@@ -232,7 +248,7 @@ def install_binary_components(
232248
target,
233249
component,
234250
): target
235-
for target in targets
251+
for target in component_targets
236252
}
237253
for future in as_completed(futures):
238254
installed_path = future.result()

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL