Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codex-session-grid",
"version": "0.1.0-beta.1",
"description": "Beta: a Codex-styled 2x2 and 3x3 workspace with live session sync, voice input, guided prompts, and model controls.",
"version": "0.2.0-beta.1+codex.20260717125754",
"description": "Beta: a cross-platform Codex-styled 2x2 and 3x3 workspace with live session sync and native single-send bridges.",
"author": {
"name": "\u8def\u706f\u540c\u5b66\u521b\u4e1a\u7b14\u8bb0",
"url": "https://github.com/streetlightstartupnotes"
Expand All @@ -13,13 +13,14 @@
"codex",
"multi-session",
"dashboard",
"macos"
"macos",
"windows"
],
"skills": "./skills/",
"interface": {
"displayName": "Codex \u591a\u4efb\u52a1\u5bab\u683c",
"shortDescription": "Codex \u539f\u751f\u98ce\u683c\u7684\u591a\u4efb\u52a1\u5bab\u683c\u4e0e\u6a21\u578b\u63a7\u5236\u53f0\u3002",
"longDescription": "\u542f\u52a8\u4e00\u4e2a\u4ec5\u76d1\u542c\u672c\u673a\u7684 Codex \u98ce\u683c\u591a\u4efb\u52a1\u5de5\u4f5c\u53f0\uff0c\u4ee5 2x2 \u6216 3x3 \u7f51\u683c\u67e5\u770b\u771f\u5b9e Session\uff0c\u5e76\u63d0\u4f9b\u8bed\u97f3\u8f93\u5165\u3001\u5f15\u5bfc\u6307\u4ee4\u3001\u6a21\u578b\u3001\u54cd\u5e94\u901f\u5ea6\u548c\u63a8\u7406\u5f3a\u5ea6\u63a7\u5236\u3002",
"longDescription": "\u542f\u52a8\u4e00\u4e2a\u4ec5\u76d1\u542c\u672c\u673a\u7684 Codex \u98ce\u683c\u591a\u4efb\u52a1\u5de5\u4f5c\u53f0\uff0c\u4ee5 2x2 \u6216 3x3 \u7f51\u683c\u67e5\u770b\u771f\u5b9e Session\uff0c\u5e76\u901a\u8fc7 macOS \u6216 Windows \u539f\u751f\u6865\u63a5\u53ea\u53d1\u9001\u4e00\u6b21\uff1b\u540c\u65f6\u63d0\u4f9b\u8bed\u97f3\u8f93\u5165\u3001\u5f15\u5bfc\u6307\u4ee4\u548c\u6a21\u578b\u63a7\u4ef6\u3002",
"developerName": "\u8def\u706f\u540c\u5b66\u521b\u4e1a\u7b14\u8bb0",
"websiteURL": "https://github.com/streetlightstartupnotes",
"category": "Productivity",
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/cross-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Cross-platform checks

on:
push:
pull_request:

jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Check JavaScript and shell scripts
run: |
node --check scripts/server.mjs
node --check public/app.js
sh -n scripts/start.sh scripts/stop.sh
- name: Type-check macOS bridge
run: swiftc -typecheck scripts/native-bridge.swift

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Check JavaScript
run: |
node --check scripts/server.mjs
node --check public/app.js
- name: Parse PowerShell scripts
shell: powershell
run: |
$failed = $false
foreach ($path in @(
"scripts/start.ps1",
"scripts/stop.ps1",
"scripts/diagnose-windows.ps1",
"scripts/native-bridge-windows.ps1"
)) {
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile($path, [ref]$tokens, [ref]$errors) | Out-Null
if ($errors.Count -gt 0) {
$failed = $true
$errors | ForEach-Object { Write-Error "$path`: $($_.Message)" }
}
}
if ($failed) { throw "PowerShell parsing failed" }
- name: Compile and probe Windows UI Automation bridge
shell: powershell
run: |
$json = & powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts/native-bridge-windows.ps1 -Action probe
$status = $json | ConvertFrom-Json
if (-not $status.ok) { throw $status.error }
if (-not $status.supported -or $status.platform -ne "windows") { throw "Unexpected Windows bridge status" }
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

本项目采用 [Semantic Versioning](https://semver.org/) 记录版本。

## [0.2.0-beta.1] - Unreleased

macOS / Windows 同步兼容测试版。macOS 主流程保持不变,Windows 原生交互等待真实设备验证。

### 新增

- 服务端按 `process.platform` 自动选择 macOS Swift 或 Windows C# UI Automation 桥。
- Windows PowerShell 启动、停止与脱敏诊断脚本。
- Windows 路径缩写、平台状态提示和权限等级引导。
- GitHub Actions 的 macOS/Windows 跨平台静态检查与 Windows 桥编译探针。

### 保持不变

- 网页发送仍只允许原生桥接提交一次,不增加 Sidecar `turn/start` 降级路径。
- macOS Accessibility 单次发送、Session 轮询与工具活动同步逻辑继续保留。

## [0.1.0-beta.1] - 2026-07-17

首个公开测试版,已在作者本机 macOS + Codex Desktop 环境完成主要流程验证。
Expand Down
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

请说明:

- macOS、Codex Desktop、Node.js 与浏览器版本。
- 操作系统、Codex Desktop、Node.js 与浏览器版本。
- 使用四宫格还是九宫格,以及可复现的操作步骤。
- 预期结果和实际结果。
- 是否已授予 Codex 辅助功能权限、浏览器麦克风权限
- macOS 是否已授予辅助功能权限;Windows 是否保持相同权限等级;浏览器是否有麦克风权限

请勿上传未脱敏的 Session 内容、账号信息、访问令牌或完整本机路径。

Expand All @@ -24,6 +24,13 @@ sh -n scripts/start.sh scripts/stop.sh
swiftc -typecheck scripts/native-bridge.swift
```

Windows 修改还要在 Windows PowerShell 中解析全部 `.ps1`,并运行:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/native-bridge-windows.ps1 -Action probe
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/diagnose-windows.ps1
```

涉及发送流程的修改还必须验证:网页只触发一次原生发送、Codex App 只出现一条用户消息、网页从同一 Session 同步回复。不要增加 Sidecar `turn/start` 作为降级发送方式。

## Pull Request
Expand Down
68 changes: 54 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Codex Session Grid

> **Beta 测试版 · v0.1.0-beta.1**
> **跨平台 Beta 测试版 · v0.2.0-beta.1**
>
> 已在作者本机的 macOS + Codex Desktop 环境跑通。当前版本用于公开测试,不建议用于关键生产任务
> macOS 主流程已在作者本机跑通;Windows 兼容层已经完成,等待真实 Windows 11 + Codex Desktop 环境验证。当前版本不建议用于关键生产任务

一个保持 Codex 视觉风格的多任务工作台,可用四宫格或九宫格同时查看、发送和跟踪多个真实 Codex Session。它是独立开发的本地辅助工具,并非 OpenAI 官方产品。

Expand All @@ -12,7 +12,7 @@

- 四宫格、九宫格展示多个 Codex 任务,支持筛选、折叠、拖拽换位和单任务跳回 Codex App。
- 同步用户消息、Assistant 回复、工具调用、已查看图像、已读取文件等 Session 动态。
- 网页发出的消息由 macOS 原生桥接提交到对应 Codex App 任务,再从同一个 Session 同步回来。
- 网页发出的消息在 macOS 走 Swift Accessibility,在 Windows 走 C# UI Automation,再从同一个 Session 同步回来。
- 运行中的任务显示绿色状态点;消息区按 Markdown 自动排版。
- 支持浏览器语音输入、引导提示词、模型、速度和推理强度控件。
- 服务只监听 `127.0.0.1`,复用本机已有的 Codex 登录,不需要填写 API Key。
Expand All @@ -25,7 +25,7 @@
flowchart LR
A["浏览器宫格"] -->|"读取任务与进度"| B["本机 Sidecar"]
B --> C["Codex Session / app-server"]
A -->|"发送一条消息"| D["macOS 原生桥接"]
A -->|"发送一条消息"| D["macOS / Windows 原生桥接"]
D --> E["Codex App 对应任务输入框"]
E -->|"只发送一次"| C
C -->|"同一 Session 的消息、回复、工具状态"| A
Expand All @@ -35,19 +35,33 @@ flowchart LR

## 环境要求

- macOS 与已登录的 Codex Desktop App。
- Node.js,建议使用当前 LTS 版本。
- Xcode Command Line Tools 提供的 `swiftc`,用于首次编译原生单次发送桥接。
- 原生发送需要在“系统设置 → 隐私与安全性 → 辅助功能”中允许 Codex。
- 语音输入需要浏览器支持 Web Speech API,并允许麦克风权限;Codex 内置浏览器不支持时,请改用 Chrome 或 Safari。
两端都需要已登录的 Codex Desktop App 和 Node.js(建议当前 LTS)。语音输入需要浏览器支持 Web Speech API,并允许麦克风权限。

macOS 还需要:

- Xcode Command Line Tools 提供的 `swiftc`。
- 在“系统设置 → 隐私与安全性 → 辅助功能”中允许 Codex。

Windows 还需要:

- Windows 11、Windows PowerShell 5.1 和 Windows 原生 Codex/ChatGPT Desktop App。
- 工作台与 Codex App 使用相同权限等级;如果 App 以管理员身份运行,也要从管理员 PowerShell 启动工作台。
- 推荐使用 Edge 或 Chrome 进行语音输入。

> 安装或更新插件后,建议新建一个 Codex 任务,让更新后的插件技能完整生效。

## 本地运行

先克隆仓库:

```bash
git clone https://github.com/streetlightstartupnotes/codex-session-grid.git
cd codex-session-grid
```

macOS:

```bash
bash scripts/start.sh
```

Expand All @@ -64,24 +78,45 @@ CODEX_SESSION_GRID_PORT=4318 bash scripts/start.sh
CODEX_SESSION_GRID_PORT=4318 bash scripts/stop.sh
```

Windows PowerShell:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/start.ps1
```

停止服务:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/stop.ps1
```

更换端口可以传入 `-Port 4318`。Windows 首次测试建议同时运行诊断脚本:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/diagnose-windows.ps1
```

完整 Windows 验证步骤见 [docs/WINDOWS_TESTING.md](docs/WINDOWS_TESTING.md)。

仓库当前按单插件源码结构发布,可直接用上面的脚本运行。Codex marketplace 一键安装结构将在后续版本补充;本机已有个人 marketplace 的开发者也可以把该目录登记为本地插件。

## 首次使用

1. 先打开 Codex App,并确认目标任务正常存在。
2. 按上面的命令启动工作台并打开本机地址。
3. macOS 首次询问辅助功能权限时允许 Codex,然后重新启动工作台
3. macOS 首次询问辅助功能权限时允许 Codex;Windows 确认 App 与 PowerShell 权限等级相同
4. 如需语音输入,在浏览器地址栏或系统设置中允许麦克风权限。
5. 在任意卡片底部输入消息并发送;网页会显示发送状态并同步 App 中同一 Session 的后续回复。

## 当前限制

- 当前重点测试平台是 macOS;原生单次发送依赖 Accessibility API,其他系统尚不支持这一发送方式
- macOS 主流程已实机验证;Windows UI Automation 桥已实现并加入 CI 编译探针,但仍需要真实 Codex 窗口验证输入框和发送按钮识别
- Codex app-server 接口属于实验能力,Codex 更新后可能需要跟随调整。
- 网页的模型、速度和推理强度控件目前可以完整显示并保存选择,但原生单次发送仍以 Codex App 当前输入框的设置为准。需要精确控制时,请先在 App 中调整;网页直控会在后续版本完善。
- Session 更新采用高频轮询,体验接近实时,但并非严格的推送协议。
- 浏览器语音识别能力和稳定性由 Web Speech API、浏览器及网络环境决定。
- 原生桥接会短暂定位目标任务并恢复原窗口,恢复过程属于尽力而为。
- Windows 原生模式与 WSL 默认使用不同的 Codex 主目录;混用时要确保工作台和 App 指向同一个 `CODEX_HOME`。

## 安全与隐私

Expand All @@ -100,8 +135,11 @@ CODEX_SESSION_GRID_PORT=4318 bash scripts/stop.sh
├── public/ # 宫格 Web UI
├── scripts/server.mjs # localhost Sidecar 与 Session 同步
├── scripts/native-bridge.swift # macOS 原生单次发送桥接
├── scripts/start.sh # 启动脚本
├── scripts/stop.sh # 停止脚本
├── scripts/native-bridge-windows.cs # Windows UI Automation 桥接
├── scripts/native-bridge-windows.ps1 # Windows 桥接加载器
├── scripts/start.sh / stop.sh # macOS 启停脚本
├── scripts/start.ps1 / stop.ps1 # Windows 启停脚本
├── scripts/diagnose-windows.ps1 # Windows 脱敏诊断
└── skills/codex-session-grid/ # Codex 技能与引导配置
```

Expand All @@ -114,14 +152,16 @@ sh -n scripts/start.sh scripts/stop.sh
swiftc -typecheck scripts/native-bridge.swift
```

Windows 的 PowerShell 语法、C# UI Automation 编译和无 App 探针由 `.github/workflows/cross-platform.yml` 在 `windows-latest` 上检查。真实发送仍必须在交互式 Windows 桌面验证。

发布记录见 [CHANGELOG.md](CHANGELOG.md),参与开发前请阅读 [CONTRIBUTING.md](CONTRIBUTING.md)。

## 路线图

- 让网页模型、速度和推理强度直接、安全地控制原生发送设置。
- 降低对实验性 app-server 协议的耦合。
- 增强语音识别错误诊断和浏览器兼容提示。
- 完善安装器、自动更新和更多 macOS 版本测试
- 完成 Windows 11 实机矩阵、安装器和自动更新

## 作者

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

## 本地边界

Codex Session Grid 设计为仅监听 `127.0.0.1` 的本机工具。不要将服务绑定到 `0.0.0.0`、局域网或公网,也不要通过反向代理公开。原生发送依赖 macOS Accessibility 权限;只应向可信的 Codex 安装授予该权限
Codex Session Grid 设计为仅监听 `127.0.0.1` 的本机工具。不要将服务绑定到 `0.0.0.0`、局域网或公网,也不要通过反向代理公开。macOS 原生发送依赖 Accessibility 权限;Windows 原生发送依赖 UI Automation 和进程权限等级。只应向可信的 Codex 安装授予相关权限,不要为了发送功能长期以管理员身份运行整个工作流
86 changes: 86 additions & 0 deletions docs/WINDOWS_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Windows 11 验证指南

Windows 兼容层已经实现,但 Codex 输入框和发送按钮必须在真实的交互式 Windows 桌面验证。请不要只在 WSL 或无桌面的 CI 环境判断发送功能是否可用。

## 1. 准备环境

- Windows 11。
- 已登录并能正常打开任务的 Windows Codex/ChatGPT Desktop App。
- Node.js LTS 与可用的 `codex` 命令。
- Windows PowerShell 5.1。
- Edge 或 Chrome(如需测试语音)。

如果 Codex App 以管理员身份运行,请同时以管理员身份打开 PowerShell;否则两端都使用普通权限。

Windows 兼容层尚未合并到 `main` 时,请检出测试分支:

```powershell
git fetch origin
git switch codex/windows-cross-platform
```

## 2. 启动

在项目目录运行:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/start.ps1
```

浏览器应打开 [http://127.0.0.1:4317](http://127.0.0.1:4317),顶部显示“Win 原生单次发送”。

## 3. 运行脱敏诊断

保持 Codex App 打开,并进入一个可发送消息的任务,然后运行:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/diagnose-windows.ps1
```

重点检查:

- `health.ok` 为 `true`。
- `health.platform` 为 `windows`。
- `nativeBridge.ok`、`supported`、`trusted` 为 `true`。
- `nativeBridge.appRunning` 为 `true`。
- `nativeBridge.composerFound` 为 `true`。

诊断只输出工具版本、进程名、元素数量和输入框元数据,不应包含 Session 消息或待发送内容。反馈前仍请删除本机用户名和路径。

## 4. 单次发送验证

1. 在 Codex App 中打开一个专门用于测试的任务。
2. 在网页对应卡片输入:`Windows 单次同步测试:你好`。
3. 只点击一次发送。
4. 确认 Codex App 中只出现一条用户消息。
5. 确认网页立即显示“已发送 · 等待回复”。
6. 等 Codex 回复后,确认 App 和网页内容一致。
7. 确认没有出现第二个 Turn,也没有两份回复。

再分别测试:

- 中文、英文、Emoji。
- 包含一行换行的消息。
- 让 Codex 读取一个文件,检查工具状态与绿色运行点。
- 在 Edge/Chrome 中授权麦克风并测试语音输入。
- 四宫格与九宫格拖拽、折叠和控制区显示。

## 5. 常见问题

### 显示“Windows 原生桥待连接”

先打开 Codex App 和一个任务,再运行诊断脚本。若 `trusted` 为 `false`,通常是 PowerShell 与 App 权限等级不同。

### `appRunning=true`,但 `composerFound=false`

说明已经找到桌面 App,但当前版本的输入框 UI Automation 属性与候选规则不匹配。请提供脱敏后的 `nativeBridge.candidates`、`candidateCount` 和界面截图;不要发送对话内容。候选诊断不会主动输出控件文字,但仍请在反馈前检查一遍。

### 使用 WSL 后任务列表不同

Windows App 默认使用 `%USERPROFILE%\.codex`,WSL 默认使用 Linux 的 `~/.codex`。优先用 Windows 原生 Codex 运行本工作台;如果必须混用,请让两边指向同一个 `CODEX_HOME`,并做好目录备份。

## 6. 停止

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/stop.ps1
```
Loading
Loading