codex-to-im 1.0.22 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
 
9
9
  配套技术设计见:
10
10
 
11
- - [D:/codex/Claude-to-IM-skill/docs/codex-to-im-shared-thread-design.md](D:/codex/Claude-to-IM-skill/docs/codex-to-im-shared-thread-design.md)
11
+ - [codex-to-im-shared-thread-design.md](./codex-to-im-shared-thread-design.md)
12
12
 
13
13
  ## 2. 产品定位
14
14
 
@@ -137,15 +137,15 @@ flowchart LR
137
137
 
138
138
  当前代码中已经存在可复用的基础能力:
139
139
 
140
- - [D:/codex/Claude-to-IM-skill/src/codex-provider.ts](D:/codex/Claude-to-IM-skill/src/codex-provider.ts)
140
+ - [src/codex-provider.ts](../src/codex-provider.ts)
141
141
  - 已具备 `sdkSessionId` 复用逻辑
142
142
  - 已使用 `startThread()` / `resumeThread()`
143
- - [D:/codex/Claude-to-IM-skill/src/store.ts](D:/codex/Claude-to-IM-skill/src/store.ts)
143
+ - [src/store.ts](../src/store.ts)
144
144
  - 已能持久化 session、binding、message、lock
145
145
  - binding 已保存 `sdkSessionId`
146
- - [D:/codex/Claude-to-IM-skill/src/lib/bridge/channel-router.ts](D:/codex/Claude-to-IM-skill/src/lib/bridge/channel-router.ts)
146
+ - [src/lib/bridge/channel-router.ts](../src/lib/bridge/channel-router.ts)
147
147
  - 已支持 chat 到 session 的自动解析与绑定
148
- - [D:/codex/Claude-to-IM-skill/src/lib/bridge/bridge-manager.ts](D:/codex/Claude-to-IM-skill/src/lib/bridge/bridge-manager.ts)
148
+ - [src/lib/bridge/bridge-manager.ts](../src/lib/bridge/bridge-manager.ts)
149
149
  - 已支持 `/new`、`/thread`、`/status`、`/sessions`、`/stop`
150
150
 
151
151
  当前缺失的不是桥接基础设施,而是“桌面真实会话接管”的这一层:
@@ -558,10 +558,10 @@ sequenceDiagram
558
558
 
559
559
  ### 本地依据
560
560
 
561
- - [D:/codex/Claude-to-IM-skill/node_modules/@openai/codex-sdk/README.md](D:/codex/Claude-to-IM-skill/node_modules/@openai/codex-sdk/README.md)
562
- - [D:/codex/Claude-to-IM-skill/src/codex-provider.ts](D:/codex/Claude-to-IM-skill/src/codex-provider.ts)
563
- - [D:/codex/Claude-to-IM-skill/src/store.ts](D:/codex/Claude-to-IM-skill/src/store.ts)
564
- - [D:/codex/Claude-to-IM-skill/src/lib/bridge/channel-router.ts](D:/codex/Claude-to-IM-skill/src/lib/bridge/channel-router.ts)
561
+ - [node_modules/@openai/codex-sdk/README.md](../node_modules/@openai/codex-sdk/README.md)
562
+ - [src/codex-provider.ts](../src/codex-provider.ts)
563
+ - [src/store.ts](../src/store.ts)
564
+ - [src/lib/bridge/channel-router.ts](../src/lib/bridge/channel-router.ts)
565
565
  - `%USERPROFILE%/.codex/sessions/**/*.jsonl` 的本地实测样本
566
566
 
567
567
  ### 官方资料
@@ -4,10 +4,7 @@
4
4
 
5
5
  `codex-to-im` 当前采用的是 **单 npm 包 + 本地 Web 工作台 + 本地后台 bridge** 的部署方案。
6
6
 
7
- 补充说明:当前版本不是从零开始的新工程,而是在以下两个已有项目基础上整理和改造而来:
8
-
9
- - `Claude-to-IM`
10
- - `Claude-to-IM-skill`
7
+ 补充说明:当前版本不是从零开始的新工程,而是在旧桥接原型基础上整理和演进而来。
11
8
 
12
9
  核心形态如下:
13
10
 
@@ -19,7 +16,6 @@
19
16
  - `dist/daemon.mjs` 负责 bridge
20
17
  - 运行方式:本地 Node.js detached 子进程,不依赖当前命令窗口常驻
21
18
  - 配置目录:`%USERPROFILE%\\.codex-to-im\\`
22
- - 兼容目录:如果机器上已有旧数据,会回落到 `%USERPROFILE%\\.claude-to-im\\`
23
19
 
24
20
  这意味着当前推荐的部署方式不是“clone 仓库后让用户手动跑脚本”,而是:
25
21
 
@@ -278,15 +274,15 @@ Web 工作台现在只展示自动启动状态;真正的启用和关闭请使
278
274
  - `runtime\status.json`
279
275
  - `runtime\ui-server.json`
280
276
 
281
- ### 7.2 旧目录兼容
277
+ ### 7.2 排查提示
282
278
 
283
- 如果目标机上已经存在旧安装数据,程序会自动回落到:
279
+ 当前版本只读取:
284
280
 
285
281
  ```text
286
- %USERPROFILE%\.claude-to-im\
282
+ %USERPROFILE%\.codex-to-im\
287
283
  ```
288
284
 
289
- 所以安装或排查时,需要先确认当前实际使用的是哪一个 home 目录。
285
+ 如果机器上仍然存在旧版本遗留的 home 目录,那只是历史残留,不再被当前版本读取。
290
286
 
291
287
  ## 8. 安装给别的主机时的建议
292
288
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-to-im",
3
- "version": "1.0.22",
3
+ "version": "1.0.26",
4
4
  "description": "Installable Codex-to-IM bridge with local setup UI and background service",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/zhangle1987/codex-to-im#readme",
@@ -36,7 +36,7 @@
36
36
 
37
37
  **Steps**:
38
38
 
39
- 1. Check `~/.codex-to-im/logs/bridge.log` or `~/.claude-to-im/logs/bridge.log`
39
+ 1. Check `~/.codex-to-im/logs/bridge.log`
40
40
  2. Look for Feishu error `99991672`
41
41
  3. If the error mentions `cardkit:card:write`, add and publish the missing Feishu permissions:
42
42
  - `cardkit:card:write`
package/scripts/daemon.sh CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
- CTI_HOME="${CTI_HOME:-$HOME/.claude-to-im}"
3
+ CTI_HOME="${CTI_HOME:-$HOME/.codex-to-im}"
4
4
  SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)"
5
5
  PID_FILE="$CTI_HOME/runtime/bridge.pid"
6
6
  STATUS_FILE="$CTI_HOME/runtime/status.json"
@@ -21,11 +21,11 @@ ensure_built() {
21
21
  if [ -n "$newest_src" ]; then
22
22
  need_build=1
23
23
  fi
24
- # Also check if node_modules/claude-to-im was updated (npm update)
25
- # — its code is bundled into dist, so changes require a rebuild
26
- if [ "$need_build" = "0" ] && [ -d "$SKILL_DIR/node_modules/claude-to-im/src" ]; then
27
- local newest_dep
28
- newest_dep=$(find "$SKILL_DIR/node_modules/claude-to-im/src" -name '*.ts' -newer "$SKILL_DIR/dist/daemon.mjs" 2>/dev/null | head -1)
24
+ # Also check if node_modules/codex-to-im was updated (npm update)
25
+ # — its code is bundled into dist, so changes require a rebuild
26
+ if [ "$need_build" = "0" ] && [ -d "$SKILL_DIR/node_modules/codex-to-im/src" ]; then
27
+ local newest_dep
28
+ newest_dep=$(find "$SKILL_DIR/node_modules/codex-to-im/src" -name '*.ts' -newer "$SKILL_DIR/dist/daemon.mjs" 2>/dev/null | head -1)
29
29
  if [ -n "$newest_dep" ]; then
30
30
  need_build=1
31
31
  fi
package/scripts/doctor.sh CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
- CTI_HOME="$HOME/.claude-to-im"
3
+ CTI_HOME="$HOME/.codex-to-im"
4
4
  CONFIG_FILE="$CTI_HOME/config.env"
5
5
  PID_FILE="$CTI_HOME/runtime/bridge.pid"
6
6
  LOG_FILE="$CTI_HOME/logs/bridge.log"
@@ -167,7 +167,7 @@ if [ "$CTI_RUNTIME" = "claude" ] || [ "$CTI_RUNTIME" = "auto" ]; then
167
167
  if [ "$HAS_ANTHROPIC_CONFIG" = "true" ]; then
168
168
  check "ANTHROPIC_* vars in config.env (third-party API provider)" 0
169
169
 
170
- PLIST_FILE="$HOME/Library/LaunchAgents/com.claude-to-im.bridge.plist"
170
+ PLIST_FILE="$HOME/Library/LaunchAgents/com.codex-to-im.bridge.plist"
171
171
 
172
172
  # On macOS, verify the launchd plist also has the vars
173
173
  if [ "$(uname -s)" = "Darwin" ] && [ -f "$PLIST_FILE" ]; then
@@ -2,7 +2,7 @@
2
2
  # macOS supervisor — launchd-based process management.
3
3
  # Sourced by daemon.sh; expects CTI_HOME, SKILL_DIR, PID_FILE, STATUS_FILE, LOG_FILE.
4
4
 
5
- LAUNCHD_LABEL="com.claude-to-im.bridge"
5
+ LAUNCHD_LABEL="com.codex-to-im.bridge"
6
6
  PLIST_DIR="$HOME/Library/LaunchAgents"
7
7
  PLIST_FILE="$PLIST_DIR/$LAUNCHD_LABEL.plist"
8
8
 
@@ -1,6 +1,6 @@
1
1
  <#
2
2
  .SYNOPSIS
3
- Windows daemon manager for claude-to-im bridge.
3
+ Windows daemon manager for codex-to-im bridge.
4
4
 
5
5
  .DESCRIPTION
6
6
  Manages the bridge process on Windows.
@@ -28,7 +28,7 @@ param(
28
28
  $ErrorActionPreference = 'Stop'
29
29
 
30
30
  # ── Paths ──
31
- $CtiHome = if ($env:CTI_HOME) { $env:CTI_HOME } else { Join-Path $env:USERPROFILE '.claude-to-im' }
31
+ $CtiHome = if ($env:CTI_HOME) { $env:CTI_HOME } else { Join-Path $env:USERPROFILE '.codex-to-im' }
32
32
  $SkillDir = Split-Path -Parent (Split-Path -Parent $PSCommandPath)
33
33
  $RuntimeDir = Join-Path $CtiHome 'runtime'
34
34
  $PidFile = Join-Path $RuntimeDir 'bridge.pid'
@@ -38,7 +38,7 @@ $ErrLogFile = Join-Path (Join-Path $CtiHome 'logs') 'bridge.stderr.log'
38
38
  $DaemonMjs = Join-Path (Join-Path $SkillDir 'dist') 'daemon.mjs'
39
39
  $ConfigFile = Join-Path $CtiHome 'config.env'
40
40
 
41
- $ServiceName = 'ClaudeToIMBridge'
41
+ $ServiceName = 'CodexToIMBridge'
42
42
 
43
43
  # ── Helpers ──
44
44
 
@@ -169,7 +169,7 @@ function Install-WinSWService {
169
169
  $xmlPath = Join-Path $SkillDir "$ServiceName.xml"
170
170
  $configEnv = Get-ConfigEnvironment
171
171
 
172
- # Run as current user so the service can access ~/.claude-to-im and Codex login state
172
+ # Run as current user so the service can access ~/.codex-to-im and Codex login state
173
173
  $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
174
174
  Write-Host "Service will run as: $currentUser"
175
175
  $cred = Get-Credential -UserName $currentUser -Message "Enter password for '$currentUser' (required for Windows Service logon)"
@@ -179,8 +179,8 @@ function Install-WinSWService {
179
179
  $xml = @"
180
180
  <service>
181
181
  <id>$ServiceName</id>
182
- <name>Claude-to-IM Bridge</name>
183
- <description>Claude-to-IM bridge daemon</description>
182
+ <name>Codex-to-IM Bridge</name>
183
+ <description>codex-to-im bridge daemon</description>
184
184
  <executable>$nodePath</executable>
185
185
  <arguments>$DaemonMjs</arguments>
186
186
  <workingdirectory>$SkillDir</workingdirectory>
@@ -229,7 +229,7 @@ function Install-NSSMService {
229
229
  $nodePath = Get-NodePath
230
230
  $configEnv = Get-ConfigEnvironment
231
231
 
232
- # Run as current user so the service can access ~/.claude-to-im and Codex login state
232
+ # Run as current user so the service can access ~/.codex-to-im and Codex login state
233
233
  $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
234
234
  Write-Host "Service will run as: $currentUser"
235
235
  $cred = Get-Credential -UserName $currentUser -Message "Enter password for '$currentUser' (required for Windows Service logon)"
@@ -242,7 +242,7 @@ function Install-NSSMService {
242
242
  & $NSSMPath set $ServiceName AppStderr $LogFile
243
243
  & $NSSMPath set $ServiceName AppStdoutCreationDisposition 4
244
244
  & $NSSMPath set $ServiceName AppStderrCreationDisposition 4
245
- & $NSSMPath set $ServiceName Description "Claude-to-IM bridge daemon"
245
+ & $NSSMPath set $ServiceName Description "codex-to-im bridge daemon"
246
246
  & $NSSMPath set $ServiceName AppRestartDelay 10000
247
247
  $envArgs = @(
248
248
  "USERPROFILE=$env:USERPROFILE",
@@ -1,138 +0,0 @@
1
- # Codex-to-IM legacy env snapshot / migration reference
2
- # The primary runtime config is now ~/.codex-to-im/config.v2.json and is
3
- # normally managed from the Web workbench.
4
- # This file is kept only for:
5
- # 1. migrating old single-instance setups to v2
6
- # 2. compatibility snapshots / old tooling fallback
7
- # It no longer fully represents multi-instance channel configuration.
8
-
9
- # Runtime backend: claude | codex | auto
10
- # claude — uses Claude Code CLI + @anthropic-ai/claude-agent-sdk
11
- # codex (default) — uses @openai/codex-sdk (auth: codex auth login, or OPENAI_API_KEY)
12
- # auto — tries Claude first, falls back to Codex if CLI not found
13
- CTI_RUNTIME=codex
14
-
15
- # Legacy provider enable list (still used by non-v2 providers such as
16
- # telegram / discord / qq; Feishu and Weixin are now configured as channel
17
- # instances in config.v2.json).
18
- CTI_ENABLED_CHANNELS=feishu
19
-
20
- # Default workspace root for `/new proj1` style project creation.
21
- # When unset, codex-to-im falls back to `~/cx2im`
22
- # and expands it per OS (Windows/macOS/Linux).
23
- # CTI_DEFAULT_WORKSPACE_ROOT=/path/to/your/workspace
24
-
25
- # Default model (optional — inherits from runtime's own default if not set)
26
- # CTI_DEFAULT_MODEL=
27
-
28
- # Default mode (code, plan, ask)
29
- CTI_DEFAULT_MODE=code
30
-
31
- # Number of recent messages returned by /history
32
- # CTI_HISTORY_MESSAGE_LIMIT=8
33
-
34
- # ── Claude CLI path (optional) ──
35
- # Override if you have multiple `claude` versions in PATH, or the daemon
36
- # picks the wrong one (e.g. an npm-installed 1.x instead of the native 2.x).
37
- # CTI_CLAUDE_CODE_EXECUTABLE=/path/to/claude
38
-
39
- # ── Third-party API provider (optional) ──
40
- # If you use Claude through a third-party API provider (not the default
41
- # Anthropic API), set these so the daemon forwards them to the CLI subprocess.
42
- # They are automatically passed through in both inherit and strict env modes.
43
- # All ANTHROPIC_* vars in this file are forwarded to the launchd/setsid daemon.
44
- # ANTHROPIC_API_KEY=your-third-party-api-key
45
- # ANTHROPIC_BASE_URL=https://your-api-provider.com/v1
46
- # ANTHROPIC_AUTH_TOKEN=your-auth-token
47
-
48
- # ── Codex auth (optional — only if not using `codex auth login`) ──
49
- # Priority: CTI_CODEX_API_KEY > CODEX_API_KEY > OPENAI_API_KEY
50
- # CTI_CODEX_API_KEY=
51
- # CTI_CODEX_BASE_URL=
52
- # Allow Codex to run when the selected project directory is not inside a trusted Git repo.
53
- # This project defaults it to true so first-time setup works more smoothly.
54
- CTI_CODEX_SKIP_GIT_REPO_CHECK=true
55
- # Default filesystem permission mode for Codex threads created by codex-to-im.
56
- # Options: read-only | workspace-write | danger-full-access
57
- CTI_CODEX_SANDBOX_MODE=workspace-write
58
- # Default reasoning effort for Codex.
59
- # Official SDK/runtime levels: minimal | low | medium | high | xhigh
60
- # IM aliases also support: 1=minimal, 2=low, 3=medium, 4=high, 5=xhigh
61
- CTI_CODEX_REASONING_EFFORT=medium
62
-
63
- # ── Web 控制台访问 ──
64
- # 默认仅允许本机访问本地工作台。开启后,局域网设备访问时需要先输入 token。
65
- # 可以在 Web 工作台里直接勾选并自动生成 token。
66
- # CTI_UI_ALLOW_LAN=false
67
- # CTI_UI_ACCESS_TOKEN=your-random-access-token
68
-
69
- # ── Telegram ──
70
- CTI_TG_BOT_TOKEN=your-telegram-bot-token
71
- # Chat ID for authorization (at least one of CHAT_ID or ALLOWED_USERS is required)
72
- # Get it: send a message to the bot, then visit https://api.telegram.org/botYOUR_TOKEN/getUpdates
73
- CTI_TG_CHAT_ID=your-chat-id
74
- # CTI_TG_ALLOWED_USERS=user_id_1,user_id_2
75
-
76
- # ── Discord ──
77
- # CTI_DISCORD_BOT_TOKEN=your-discord-bot-token
78
- # CTI_DISCORD_ALLOWED_USERS=user_id_1,user_id_2
79
- # CTI_DISCORD_ALLOWED_CHANNELS=channel_id_1
80
- # CTI_DISCORD_ALLOWED_GUILDS=guild_id_1
81
-
82
- # ── Feishu / Lark (legacy single-instance migration fields) ──
83
- # For new setups, add Feishu/Lark channel instances in the Web workbench and
84
- # choose the site there. These env vars are only used when migrating an old
85
- # single-instance setup into config.v2.json.
86
- # CTI_FEISHU_APP_ID=your-app-id
87
- # CTI_FEISHU_APP_SECRET=your-app-secret
88
- # CTI_FEISHU_SITE=feishu
89
- # CTI_FEISHU_ALLOWED_USERS=user_id_1,user_id_2
90
- # Enable streaming response cards in Feishu (default true).
91
- # Requires published Feishu permissions such as:
92
- # - cardkit:card:write
93
- # - cardkit:card:read
94
- # - im:message:update
95
- # Current Codex runtime note: thinking/progress can update live, but
96
- # assistant body text may still arrive only at completion.
97
- # CTI_FEISHU_STREAMING_ENABLED=true
98
- # Use Markdown for text sent through the bridge, including normal replies,
99
- # shared-thread mirror messages, and system feedback such as /h or /status.
100
- # CTI_FEISHU_COMMAND_MARKDOWN_ENABLED=true
101
-
102
- # ── QQ ──
103
- # Required: obtain from https://q.qq.com/qqbot/openclaw
104
- # CTI_QQ_APP_ID=your-qq-app-id
105
- # CTI_QQ_APP_SECRET=your-qq-app-secret
106
- # Allowed users — comma-separated user_openid values (NOT QQ numbers)
107
- # CTI_QQ_ALLOWED_USERS=openid_1,openid_2
108
- # Image input — set to false if the underlying provider doesn't support image input
109
- # CTI_QQ_IMAGE_ENABLED=true
110
- # Max image size in MB (default 20)
111
- # CTI_QQ_MAX_IMAGE_SIZE=20
112
-
113
- # ── WeChat / 微信 (legacy single-instance migration fields) ──
114
- # For new setups, add Weixin channel instances in the Web workbench. These env
115
- # vars are only used when migrating an old single-instance setup into
116
- # config.v2.json.
117
- # No static token is required here. Use the QR login helper to add accounts:
118
- # npm run weixin:login
119
- # Optional protocol overrides (normally leave unset)
120
- # CTI_WEIXIN_BASE_URL=https://ilinkai.weixin.qq.com
121
- # CTI_WEIXIN_CDN_BASE_URL=https://novac2c.cdn.weixin.qq.com/c2c
122
- # Enable inbound media download/processing for image/file/video messages.
123
- # Voice messages do not use raw audio download/transcription here: the bridge
124
- # only accepts WeChat-provided speech-to-text text and otherwise returns an error.
125
- # (default false for safety in CLI setups)
126
- # CTI_WEIXIN_MEDIA_ENABLED=false
127
- # Use Markdown for text sent through the bridge, including normal replies,
128
- # shared-thread mirror messages, and system feedback such as /h or /status.
129
- # Default is false for WeChat.
130
- # CTI_WEIXIN_COMMAND_MARKDOWN_ENABLED=false
131
-
132
- # ── Permission ──
133
- # Auto-approve all tool permission requests without user confirmation.
134
- # Useful for channels that lack interactive permission UI (e.g. Feishu
135
- # WebSocket long-connection mode, where there is no HTTP webhook to
136
- # render clickable approve/deny buttons).
137
- # ⚠️ Only enable this in trusted, access-controlled environments.
138
- # CTI_AUTO_APPROVE=true