{"id":46493953,"url":"https://github.com/lusipad/unofficial-codex-app-offline","last_synced_at":"2026-06-28T00:00:55.139Z","repository":{"id":342439457,"uuid":"1173973231","full_name":"lusipad/unofficial-codex-app-offline","owner":"lusipad","description":"Unofficial offline / portable repackaging of the OpenAI Codex Windows app.","archived":false,"fork":false,"pushed_at":"2026-06-26T17:03:30.000Z","size":2945,"stargazers_count":57,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-26T18:10:29.281Z","etag":null,"topics":["codex","codex-app","codex-web","codex-windows","codexapp","offline"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lusipad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-06T00:03:49.000Z","updated_at":"2026-06-26T14:42:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lusipad/unofficial-codex-app-offline","commit_stats":null,"previous_names":["lusipad/unofficial-codex-app-offline"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/lusipad/unofficial-codex-app-offline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2Funofficial-codex-app-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2Funofficial-codex-app-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2Funofficial-codex-app-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2Funofficial-codex-app-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lusipad","download_url":"https://codeload.github.com/lusipad/unofficial-codex-app-offline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2Funofficial-codex-app-offline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34872279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codex","codex-app","codex-web","codex-windows","codexapp","offline"],"created_at":"2026-03-06T11:30:42.861Z","updated_at":"2026-06-28T00:00:54.995Z","avatar_url":"https://github.com/lusipad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codex App Offline\n\n[English](#english)\n\n---\n\n本项目提供两种使用 Codex 的方式，共享同一套离线技能 seed：\n\n| 模式 | 前端 | 后端 | 平台 |\n|------|------|------|------|\n| **桌面版** | Codex Electron 原生 UI | 内置 Codex CLI | Windows |\n| **浏览器版** | 浏览器打开 `http://127.0.0.1:3737` | 本机 Codex CLI | Windows / Linux / macOS |\n\n- **桌面版**：OpenAI Codex Windows 应用的**非官方离线便携重打包**——解压即用，无需 Store、无需登录 Microsoft 账户。\n- **浏览器版**（Web Gateway）：提供一个本地 Web 服务，在浏览器中使用 Codex 的全部功能。Gateway 负责渲染前端 UI 并将请求转发给本机安装的 `@openai/codex` CLI 执行。本质是 **\"Codex CLI 做后端，浏览器做前端\"** 的架构，因此跨平台通用。\n\n构建时自动拉取 [openai/skills](https://github.com/openai/skills)，离线 seed 打包；首次 Setup 仅安装基础 profile，其余技能留在包内按需同步。\n\n## 快速开始\n\n### Windows 完整包\n\n从 [Releases](../../releases) 下载 `*-portable.zip`，解压后：\n\n1. 首次运行双击 **`Setup Codex.cmd`**，按提示完成引导\n2. 日常使用桌面版：双击 **`Codex.cmd`**（无需 Node.js）\n3. 使用浏览器版：先装 [Node.js 18+](https://nodejs.org)，双击 **`Codex Web.cmd`**，浏览器打开 `http://127.0.0.1:3737`\n\n\u003e 完整包同时包含桌面版和浏览器版。桌面版开箱即用；浏览器版需要额外安装 Node.js。\n\n### 浏览器版独立包（Web-Only / Windows / Linux / macOS）\n\n```bash\n# Linux 一键安装\nwget https://raw.githubusercontent.com/lusipad/unofficial-codex-app-offline/main/scripts/setup-linux.sh\nbash setup-linux.sh\n```\n\n安装后同一个脚本也可以做管理入口：\n\n```bash\nbash setup-linux.sh start\nbash setup-linux.sh stop\nbash setup-linux.sh status\nbash setup-linux.sh restart\nbash setup-linux.sh update\n```\n\n如果安装时选择了 systemd 服务，这些命令会优先调用 `systemctl`；否则回落到包内的 `start.sh` / `stop.sh` / `status.sh`。\n\n**手动安装：**\n\n1. 安装 Node.js 18+ 和 Codex CLI\n   ```bash\n   npm install -g @openai/codex\n   ```\n2. 从 [Releases](../../releases) 下载 `*-web.zip` 并解压\n3. 首次安装依赖：Windows 双击 `install.bat` | Linux/macOS 执行 `bash install.sh`\n4. 启动：Windows 双击 `start.bat` | Linux/macOS 执行 `bash start.sh`\n5. 打开 `http://127.0.0.1:3737`\n\n停止和检查状态：\n\n```bash\nbash stop.sh\nbash status.sh\n```\n\n**公网部署：**\n\n```bash\n# 端口 80 需要 root 或 setcap\nsudo setcap 'cap_net_bind_service=+ep' $(which node)\n\n# 写入 .env 持久化配置\ncat \u003e .env \u003c\u003c EOF\nHOST=0.0.0.0\nPORT=80\nCODEX_WEB_PASSWORD=你的强密码\nEOF\nbash install.sh\nbash start.sh\n```\n\nLAN / 公网模式务必设密码。浏览器 UI 控制的是 gateway 所在机器的文件和进程，不要暴露到不受信网络。\n\n## 包内结构\n\n```\n便携包（*-portable.zip）\n├── Codex.cmd                 ← 桌面版启动器\n├── Codex Web.cmd             ← 浏览器版 gateway 启动器\n├── Setup Codex.cmd           ← 首次引导\n├── _internal/\n│   ├── app/                  ← Codex Desktop 应用（Electron）\n│   ├── web/                  ← Node.js gateway 运行时\n│   ├── chrome-extension/     ← 离线 Chrome 扩展\n│   ├── seed/                 ← 离线技能种子\n│   └── tools/                ← 修复/同步工具\n\n浏览器版独立包（*-web.zip）     ← 三平台通用\n├── install.bat / install.sh  ← 一次性安装 gateway 依赖\n├── start.bat / start.sh      ← 启动 gateway，不安装依赖\n├── stop.bat / stop.sh        ← 停止当前端口上的 gateway\n├── status.bat / status.sh    ← 检查 /api/health\n├── start-web.mjs             ← gateway 入口\n├── gateway/dist/             ← 编译后的 gateway\n├── cache/official-bundle/    ← 预提取 Codex 前端 UI\n└── web-shell/                ← 登录页 + Electron polyfill\n```\n\n## 构建\n\n```powershell\nnpm ci\nnpx playwright install chromium\npwsh -NoProfile -File ./scripts/build-offline-package.ps1\n```\n\n产物输出到 `dist/offline/\u003crelease-name\u003e/`。\n\n### 核心脚本\n\n| 脚本 | 用途 |\n|------|------|\n| `build-offline-package.ps1` | 主编排：拉取 Store 包 → 打补丁 → 打包 |\n| `resolve-store-bundle-url.mjs` | 解析 Microsoft Store CDN 下载链接 |\n| `patch-app-asar.mjs` | 给官方 app.asar 打兼容补丁 |\n| `setup-linux.sh` | Linux 安装与管理入口：install/start/stop/status/restart/update |\n| `build-cross-platform.sh` | 独立跨平台 Web 包构建 |\n\n### 构建流程\n\n1. 解析 Microsoft Store 上 `OpenAI.Codex` 最新 Retail 版 CDN 链接\n2. 下载 `.msixbundle`，提取 x64 应用载荷\n3. 给 `app.asar` 打补丁（脱离 MSIX、绕 feature gate、路径修复等）\n4. 拉取官方 skills、下载 primary runtime 插件、Chrome 扩展\n5. 编译 web-gateway TypeScript\n6. 打包：便携 ZIP + 跨平台 Web ZIP + 安装器 EXE\n\n### CI\n\n每天 UTC 3:15 自动检查 Store 版本，有新版则构建发布。`[force-rebuild]` 提交标记可强制重建。\n\n## 配置\n\n标准离线使用无需配置。高级场景下创建包根目录的 `skill-installer.env`（模板在 `_internal\\skill-installer.env.example`）：\n\n| 变量 | 说明 |\n|------|------|\n| `CODEX_HOME` | Codex 主目录（默认 `~/.codex`） |\n| `GITHUB_TOKEN` | 私有仓库或绕过速率限制 |\n| `CODEX_SKILL_SOURCE_DIR` | 本地技能目录（完全离线时使用） |\n\nWeb gateway 变量（`start.sh` 同级 `.env` 文件或环境变量）：\n\n| 变量 | 默认值 | 说明 |\n|------|--------|------|\n| `HOST` | `127.0.0.1` | 监听地址 |\n| `PORT` | `3737` | 监听端口 |\n| `CODEX_WEB_PASSWORD` | — | 公网必备 |\n| `CODEX_WEB_WORKSPACE_ROOTS` | — | 允许 Web UI 访问的本地目录 |\n\n## 风险与限制\n\n- `store.rg-adguard.net` 是第三方服务，可能失效\n- Store 包内部结构变化后解包逻辑可能需调整\n- Web gateway 需要 Node.js 18+ 和 `@openai/codex` CLI，当前包不捆绑这两者\n- Chrome 扩展仍需用户手动加载一次\n- 依赖第三方 OAuth 或在线 marketplace 的插件仍需网络\n\n---\n\n\u003ca id=\"english\"\u003e\u003c/a\u003e\n\n## English\n\nTwo ways to use Codex, sharing the same offline skill seed:\n\n| Mode | Frontend | Backend | Platform |\n|------|----------|---------|----------|\n| **Desktop** | Codex Electron native UI | Bundled Codex CLI | Windows |\n| **Browser** | Browser at `http://127.0.0.1:3737` | Local Codex CLI | Windows / Linux / macOS |\n\n- **Desktop**: Unofficial offline portable repack of the OpenAI Codex Windows app — extract and run, no Store or Microsoft account required.\n- **Browser** (Web Gateway): A local web server that lets you use Codex from any browser. The gateway serves the frontend UI and proxies requests to a locally installed `@openai/codex` CLI. Architecture is **\"Codex CLI as backend, browser as frontend\"** — hence cross-platform.\n\n### Quick Start\n\n**Windows full package:** Download `*-portable.zip` from [Releases](../../releases), extract, run `Setup Codex.cmd` once, then `Codex.cmd` for desktop mode. For browser mode: install Node.js 18+, then run `Codex Web.cmd` and open `http://127.0.0.1:3737`.\n\n**Browser mode (all platforms):** Install Node.js 18+ and `npm install -g @openai/codex`, download `*-web.zip`, run `install.bat` / `bash install.sh` once, then run `start.bat` / `bash start.sh`. Open `http://127.0.0.1:3737`. Stop with `stop.bat` / `bash stop.sh`; check status with `status.bat` / `bash status.sh`.\n\n**Linux guided setup:**\n\n```bash\nwget https://raw.githubusercontent.com/lusipad/unofficial-codex-app-offline/main/scripts/setup-linux.sh\nbash setup-linux.sh\nbash setup-linux.sh status\nbash setup-linux.sh update\n```\n\n### Building from Source\n\nWindows 10/11 x64, Node.js 18+, PowerShell 7+, optional Inno Setup 6.\n\n```powershell\nnpm ci\nnpx playwright install chromium\npwsh -NoProfile -File ./scripts/build-offline-package.ps1\n```\n\nArtifacts: `dist/offline/\u003crelease\u003e/` — portable zip, web zip, setup exe, SHA256SUMS.\n\n### Config\n\nSee `config/offline-package.json`. Key fields:\n\n| Field | Description |\n|-------|-------------|\n| `appSource.ring` | `Retail` / `Preview` / `Insider` |\n| `appSource.mode` | `rg_adguard` (download) or `installed_store` (local) |\n| `packaging.portableZip` | Generate portable ZIP |\n| `packaging.crossPlatformWeb` | Generate cross-platform web ZIP |\n| `packaging.setupExe` | Generate Inno Setup installer |\n\nCI runs daily at 3:15 UTC. Commits tagged `[force-rebuild]` trigger a rebuild even if the Store version hasn't changed.\n\n### Risks\n\n- Relies on third-party `store.rg-adguard.net`\n- Store package structure changes may break extraction\n- Web gateway requires Node.js 18+ and `@openai/codex` CLI (not bundled)\n- Chrome extension still needs manual install step\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusipad%2Funofficial-codex-app-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flusipad%2Funofficial-codex-app-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusipad%2Funofficial-codex-app-offline/lists"}