Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Codex Remote Control Suite

手机远程控制 Windows 电脑上的 Codex AI 编程助手 — 三套方案,全面覆盖。

方案总览

方案 使用方式 体验 能力
SSH + CLI Termux sshcodex exec 终端 完整文件/命令/代码控制
远程桌面 Microsoft 远程桌面 App 图形桌面 完整 Windows 桌面
Telegram Bot Telegram 聊天 即时通讯 对话式 AI 编程
Web 界面 手机浏览器 网页 简洁聊天窗

项目结构

halou/
├── work/
│   ├── server.js          # Web 聊天服务器 (端口 3456)
│   ├── tg_bot.js           # Telegram Bot
│   ├── public/
│   │   └── index.html      # 手机 Web 聊天界面
│   ├── test_spawn.js       # Codex 进程测试
│   └── test_api.js         # API 连通性测试
├── outputs/
│   └── Codex远程控制指南.md  # 完整配置指南
└── .gitignore

环境依赖

  • Windows 10/11 专业版
  • Codex (Windows Store 版,API Key 登录)
  • DeepSeek v4 Pro 模型(通过本地代理 127.0.0.1:57321
  • Node.js (Codex 内置)
  • PowerShell 管理员权限(安装 SSH 时需要)

快速开始

方案一:SSH + CLI

# 管理员 PowerShell — 一次性安装
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
New-NetFirewallRule -Name 'OpenSSH-Server' -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

手机 Termux:

ssh 用户名@电脑IP
codex exec "你的任务"

方案二:远程桌面

系统自带,设置 → 远程桌面 → 开启。手机装 Microsoft 远程桌面 App 连接。

方案三:Telegram Bot

# 设置环境变量
$env:TG_BOT_TOKEN = "你的Bot Token"

# 启动
cd work
node tg_bot.js

方案四:Web 界面

cd work
node server.js
# 手机浏览器打开 http://电脑IP:3456

关键发现

  1. 提取 Codex CLI:Windows Store 沙箱封住了 codex.exe,但通过 .NET ReadAllBytes 成功提取出 259MB 的 CLI 二进制
  2. stdin 管道问题:Node.js spawn codex exec 时需用 - 参数 + proc.stdin.end() 正确传递 prompt
  3. 管理员 SSH 密钥:管理员账户的 authorized_keys 需放在 C:\ProgramData\ssh\administrators_authorized_keys
  4. SIGTERM 问题:HTTP Server 回调中 spawn 进程被自动 kill,通过 setImmediate 延迟解决

架构

手机 (Telegram/浏览器/SSH)
        ↓
  Windows 主机
        ↓
  Node.js 服务 / SSH Server
        ↓
  codex-cli.exe --json
        ↓
  本地代理 :57321 → DeepSeek v4 Pro

技术栈

  • Node.js (HTTP Server, HTTPS Client)
  • SSE / JSONL 流式响应
  • Windows OpenSSH Server
  • Telegram Bot API (Long Polling)
  • Codex CLI (JSON mode)
  • PowerShell 自动化

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages