@@ -19,40 +19,56 @@ import { extract } from "tar";
1919const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
2020const DEST_DIR = join ( __dirname , ".." , "resources" , "codex-acp" ) ;
2121
22+ const CODEX_VERSION = "0.144.0" ;
23+
24+ function nativeTarget ( ) {
25+ const { platform, arch } = process ;
26+ const targets = {
27+ darwin : { arm64 : "aarch64-apple-darwin" , x64 : "x86_64-apple-darwin" } ,
28+ linux : {
29+ arm64 : "aarch64-unknown-linux-musl" ,
30+ x64 : "x86_64-unknown-linux-musl" ,
31+ } ,
32+ win32 : {
33+ arm64 : "aarch64-pc-windows-msvc" ,
34+ x64 : "x86_64-pc-windows-msvc" ,
35+ } ,
36+ } ;
37+ const target = targets [ platform ] ?. [ arch ] ;
38+ if ( ! target ) throw new Error ( `Unsupported platform: ${ platform } /${ arch } ` ) ;
39+ return target ;
40+ }
41+
42+ function codexReleaseUrl ( binary , version , target ) {
43+ const suffix = target . includes ( "windows" ) ? ".exe.zip" : ".tar.gz" ;
44+ return `https://github.com/openai/codex/releases/download/rust-v${ version } /${ binary } -${ target } ${ suffix } ` ;
45+ }
46+
47+ // Codex release archives contain a target-suffixed binary
48+ // (e.g. `codex-aarch64-apple-darwin`); rename it after extract.
49+ const codexArchiveBinaryName = ( binary ) => ( target ) =>
50+ process . platform === "win32"
51+ ? `${ binary } -${ target } .exe`
52+ : `${ binary } -${ target } ` ;
53+
2254const BINARIES = [
2355 {
2456 name : "codex" ,
25- version : "0.144.0" ,
26- getUrl : ( version , target ) => {
27- if ( target . includes ( "windows" ) ) {
28- return `https://github.com/openai/codex/releases/download/rust-v${ version } /codex-${ target } .exe.zip` ;
29- }
30- return `https://github.com/openai/codex/releases/download/rust-v${ version } /codex-${ target } .tar.gz` ;
31- } ,
32- getTarget : ( ) => {
33- const { platform, arch } = process ;
34- const targets = {
35- darwin : { arm64 : "aarch64-apple-darwin" , x64 : "x86_64-apple-darwin" } ,
36- linux : {
37- arm64 : "aarch64-unknown-linux-musl" ,
38- x64 : "x86_64-unknown-linux-musl" ,
39- } ,
40- win32 : {
41- arm64 : "aarch64-pc-windows-msvc" ,
42- x64 : "x86_64-pc-windows-msvc" ,
43- } ,
44- } ;
45- const platformTargets = targets [ platform ] ;
46- if ( ! platformTargets )
47- throw new Error ( `Unsupported platform: ${ platform } ` ) ;
48- const target = platformTargets [ arch ] ;
49- if ( ! target ) throw new Error ( `Unsupported arch: ${ arch } ` ) ;
50- return target ;
51- } ,
52- // The codex release archive contains a target-suffixed binary
53- // (e.g. `codex-aarch64-apple-darwin`); rename it to `codex` after extract.
54- archiveBinaryName : ( target ) =>
55- process . platform === "win32" ? `codex-${ target } .exe` : `codex-${ target } ` ,
57+ version : CODEX_VERSION ,
58+ getUrl : ( version , target ) => codexReleaseUrl ( "codex" , version , target ) ,
59+ getTarget : nativeTarget ,
60+ archiveBinaryName : codexArchiveBinaryName ( "codex" ) ,
61+ } ,
62+ {
63+ // codex resolves this host as a sibling of its own executable and routes
64+ // all command execution through it for code-mode models (gpt-5.6+). It is
65+ // released per codex version, so it must stay in lockstep with `codex`.
66+ name : "codex-code-mode-host" ,
67+ version : CODEX_VERSION ,
68+ getUrl : ( version , target ) =>
69+ codexReleaseUrl ( "codex-code-mode-host" , version , target ) ,
70+ getTarget : nativeTarget ,
71+ archiveBinaryName : codexArchiveBinaryName ( "codex-code-mode-host" ) ,
5672 } ,
5773 {
5874 name : "rg" ,
@@ -61,26 +77,7 @@ const BINARIES = [
6177 const ext = target . includes ( "windows" ) ? "zip" : "tar.gz" ;
6278 return `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${ version } /ripgrep-v${ version } -${ target } .${ ext } ` ;
6379 } ,
64- getTarget : ( ) => {
65- const { platform, arch } = process ;
66- const targets = {
67- darwin : { arm64 : "aarch64-apple-darwin" , x64 : "x86_64-apple-darwin" } ,
68- linux : {
69- arm64 : "aarch64-unknown-linux-musl" ,
70- x64 : "x86_64-unknown-linux-musl" ,
71- } ,
72- win32 : {
73- arm64 : "aarch64-pc-windows-msvc" ,
74- x64 : "x86_64-pc-windows-msvc" ,
75- } ,
76- } ;
77- const platformTargets = targets [ platform ] ;
78- if ( ! platformTargets )
79- throw new Error ( `Unsupported platform: ${ platform } ` ) ;
80- const target = platformTargets [ arch ] ;
81- if ( ! target ) throw new Error ( `Unsupported arch: ${ arch } ` ) ;
82- return target ;
83- } ,
80+ getTarget : nativeTarget ,
8481 } ,
8582] ;
8683
0 commit comments