codexmu 0.2.1 → 0.2.3

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.
package/README.ko.md CHANGED
@@ -8,6 +8,8 @@ Codex의 여러 ChatGPT 계정을 저장하고, 사용 한도에 도달하면
8
8
 
9
9
  ## 설치
10
10
 
11
+ 터미널 모드는 macOS / Linux, 데스크톱 앱 실행은 macOS에서 지원합니다. 공식 Codex는 `--remote unix://...`를 지원해야 하며, 기존 검증 버전은 CLI 0.153.4입니다.
12
+
11
13
  ### npm
12
14
 
13
15
  Node.js **24 이상**과 공식 Codex가 필요합니다. npm 패키지는 macOS / Linux의 ARM64·x64 실행 파일을 포함하며, 설치 시 Rust 빌드나 별도 바이너리 다운로드를 하지 않습니다.
@@ -26,7 +28,7 @@ codexmu
26
28
  npm run build
27
29
  mkdir -p dist
28
30
  npm pack --pack-destination dist
29
- npm install -g ./dist/codexmu-0.1.0.tgz
31
+ npm install -g ./dist/codexmu-0.2.3.tgz
30
32
  codexmu --version
31
33
  ```
32
34
 
@@ -34,7 +36,7 @@ codexmu --version
34
36
 
35
37
  ### Cargo
36
38
 
37
- Rust 1.89 이상과 공식 Codex가 필요합니다. 터미널 모드는 macOS / Linux, 데스크톱 앱 실행은 macOS에서 지원합니다. 공식 Codex는 `--remote unix://...`를 지원해야 하며, 기존 검증 버전은 CLI 0.153.4입니다.
39
+ Rust 1.89 이상과 공식 Codex가 필요합니다.
38
40
 
39
41
  소스를 내려받은 프로젝트 디렉터리에서 실행하세요.
40
42
 
@@ -58,7 +60,9 @@ codexmu list --live
58
60
  codexmu
59
61
  ```
60
62
 
61
- 등록된 모든 계정이 자동 전환 후보가 됩니다. 예를 들어 `personal`과 `work`가 차례로 한도에 걸리면 사용 가능한 `extra`로 전환해 같은 대화를 이어갑니다. 전환 순서는 등록 순서가 아니라 남은 사용량에 따라 결정합니다. 특정 계정을 먼저 쓰려면 `codexmu priority NAME 1`로 높은 등급을 주세요. 사용량은 같은 등급 안에서만 비교하며, 위 등급의 계정이 모두 사용 불가능할 때만 아래 등급을 사용합니다. `codexmu priority personal -1`은 `personal`을 예비 계정으로 남깁니다. 등급은 전환할 때 목적지를 정할 뿐이며, 활성 계정에 여유가 남아 있는 동안 상위 등급으로 되돌아가지는 않습니다.
63
+ 등록된 모든 계정이 자동 전환 후보가 됩니다. 예를 들어 `personal`과 `work`가 차례로 한도에 걸리면 사용 가능한 `extra`로 전환해 같은 대화를 이어갑니다. 전환 순서는 등록 순서가 아니라 우선순위와 남은 사용량에 따라 결정합니다.
64
+
65
+ 계정의 기본 우선순위는 `0`입니다. `codexmu priority work 1`로 먼저 사용할 계정에 높은 등급을 주거나, `codexmu priority personal -1`로 `personal`을 예비 계정으로 남길 수 있습니다. 먼저 `--switch-at` 미만인 계정 중 가장 높은 등급을 고르고, 같은 등급에서는 사용률이 가장 낮은 계정을 선택합니다. 한도에 도달했는데 기준 미만인 계정이 없으면 사용 가능한 한도가 남은 다른 계정에 같은 순위를 적용합니다. 우선순위 변경만으로 계정을 전환하지는 않습니다.
62
66
 
63
67
  `login`은 임시 `CODEX_HOME`에서 공식 `codex login`을 실행합니다. 로그인 취소·실패 시 기존 활성 계정은 그대로 유지됩니다. 브라우저 로그인을 쓰려면 `--device-auth`를 생략하세요. 키체인에만 저장되어 `auth.json`이 없다면 `add` 대신 `login`을 사용하세요.
64
68
 
@@ -86,7 +90,7 @@ codexmu remove unused
86
90
  codexmu │ gpt-5.1 medium │ …/codexmu │ main +2 │ 5h 85% · 0h42m │ user@example.com (plus) Context 100% left · Fast off · 5h 85% · weekly 58% · 0.153.4
87
91
  ```
88
92
 
89
- 표시되는 값은 현재 세션의 모델·추론 강도·작업 경로, Git 브랜치와 변경 수, 실제 조회한 남은 사용량, 활성 계정의 이메일·플랜입니다. 상태 줄의 시간은 한도 초기화까지 남은 시간입니다. 계정 전환이 서버에서 승인되면 상태 줄도 새 계정으로 바뀌고 전환 알림 구간을 잠시 표시합니다. 조회되지 않은 한도는 `—`로 표시하며, 좁은 창에서는 경로·Git 표시를 줄입니다. 마우스 휠과 PageUp/PageDown으로 Codex 출력만 스크롤되고 상태 줄은 그대로 남으며, 다른 키를 누르면 현재 화면으로 돌아옵니다. codexmu는 마우스를 가로채지 않으므로 텍스트 선택·복사·Cmd+클릭은 터미널 기본 동작 그대로입니다(휠 스크롤은 Terminal.app, iTerm2, kitty, Ghostty, WezTerm이 기본으로 켜 두는 alternate scroll 동작을 이용합니다). 배경·글꼴은 사용하는 터미널 설정을 따릅니다.
93
+ 표시되는 값은 현재 세션의 모델·추론 강도·작업 경로, Git 브랜치와 변경 수, 남은 사용량, 활성 계정의 이메일·플랜입니다. 모델·추론 강도는 공식 Codex의 상태 줄에서 가져오므로 다음 턴을 기다리지 않고 선택한 대화와 `/model` 변경을 따라갑니다. 사용량은 계정 조회와 해당 세션의 Codex 서버가 보내는 실시간 한도 알림을 함께 반영하므로 턴 실행 중에도 갱신되며, 두 한도 표시는 같은 계정 데이터를 사용합니다. 상태 줄의 시간은 한도 초기화까지 남은 시간입니다. 계정 전환이 서버에서 승인되면 상태 줄도 새 계정으로 바뀌고 전환 알림 구간을 잠시 표시합니다. 조회되지 않은 한도는 `—`로 표시하며, 좁은 창에서는 경로·Git·공식 상태 줄의 세부 정보를 줄이거나 숨깁니다. 마우스 휠과 PageUp/PageDown으로 Codex 출력만 스크롤되고 상태 줄은 그대로 남으며, 다른 키를 누르면 현재 화면으로 돌아옵니다. codexmu는 마우스를 가로채지 않으므로 텍스트 선택·복사·Cmd+클릭은 터미널 기본 동작 그대로입니다(휠 스크롤은 Terminal.app, iTerm2, kitty, Ghostty, WezTerm이 기본으로 켜 두는 alternate scroll 동작을 이용합니다). 배경·글꼴은 사용하는 터미널 설정을 따릅니다.
90
94
 
91
95
  ```sh
92
96
  codexmu
@@ -100,7 +104,7 @@ codexmu --plain
100
104
 
101
105
  **같은 `CODEX_HOME`에서 여러 `codexmu` 창을 동시에 실행할 수 있습니다.** 각 터미널에서 `codexmu`를 실행하면 됩니다. 계정 목록과 기본 활성 계정은 공유하고, 대화·승인·실행 중인 인증은 각 창의 공식 Codex 서버가 관리합니다. 다른 창에서 계정이 바뀌면 각 창은 실행 중인 턴이 끝난 뒤 사용량 확인 시 새 계정을 적용합니다. 한도 오류가 난 창은 바로 전환을 시도합니다.
102
106
 
103
- 계정 저장소 접근·사용량 조회·OAuth 갱신은 저장소 잠금으로 직렬화합니다. 여러 창이 같은 토큰을 갱신하려고 하면 먼저 갱신된 토큰을 재사용하며, 다른 계정으로 작업 중인 창의 인증을 덮어쓰지 않습니다. 잠금은 세션 전체를 점유하지 않습니다.
107
+ 계정 저장소 접근·사용량 조회·OAuth 갱신은 저장소 잠금으로 직렬화합니다. 여러 창이 같은 토큰을 갱신하려고 하면 먼저 갱신된 토큰을 재사용하며, 다른 계정으로 작업 중인 창의 인증을 덮어쓰지 않습니다. 인증 파일의 부가정보만 바뀐 경우에는 토큰이 갱신된 것으로 판단하지 않으며, 새로 갱신한 토큰도 정상적으로 저장합니다. 잠금은 세션 전체를 점유하지 않습니다.
104
108
 
105
109
  새 홈에서 공식 Codex의 SQLite 초기화가 충돌하지 않도록 서버 시작부터 초기화 응답까지는 별도 시작 잠금으로 순서를 맞춥니다. 초기화 응답을 받으면 즉시 해제하여 여러 세션이 함께 작업할 수 있습니다.
106
110
 
@@ -128,10 +132,10 @@ codexmu --codex-bin /absolute/path/to/codex app
128
132
 
129
133
  - 기본 60초마다 **턴이 실행 중이지 않을 때** 사용량을 조회합니다.
130
134
  - `usageLimitExceeded`로 턴이 끝나면 다음 주기를 기다리지 않고 다른 계정을 찾습니다.
131
- - 가장 높은 우선순위 등급의 사용 가능한 계정 응답에 포함된 사용량 창의 최대 사용률이 가장 낮은 계정을 선택합니다.
135
+ - `--switch-at` 미만인 계정을 먼저 고려하고, 우선순위 등급이 높은 순서로 선택합니다. 같은 등급에서는 응답에 포함된 사용량 창의 최대 사용률이 가장 낮은 계정을 고릅니다. 한도에 도달했는데 기준 미만인 계정이 없으면 사용 가능한 한도가 남은 다른 계정을 선택합니다.
132
136
  - `--switch-at 80`을 주면 활성 계정이 80%에 도달하고 80% 미만인 계정이 있을 때 턴 사이에 미리 전환합니다. 선제 전환은 제외 시간을 두지 않고 계속 진행 턴도 보내지 않습니다.
133
137
  - 새 인증은 `account/login/start`로 실행 중인 공식 app-server에 전달합니다. 파일만 교체하고 끝내지 않습니다.
134
- - 기본적으로 같은 스레드에 계속 진행하라는 새 턴을 보냅니다. 원래 프롬프트나 실행한 도구 호출을 재전송하지 않습니다.
138
+ - `usageLimitExceeded` 오류로 계정을 전환한 뒤에는 기본적으로 같은 스레드에 계속 진행하라는 새 턴을 보냅니다. 원래 프롬프트나 실행한 도구 호출을 재전송하지 않습니다.
135
139
  - 다른 턴이 실행 중이면 전환을 미룹니다. 전환 중 들어온 새 턴은 잠시 대기하고, 승인 응답은 계속 전달합니다. 취소된 대기 턴은 실행하지 않습니다.
136
140
 
137
141
  자동 재개 없이 계정만 전환하려면:
@@ -182,12 +186,16 @@ $CODEX_HOME/codexmu/terminal-<PID>.log 세션별 공식 서버 진단 로
182
186
  | `--interval` | `CODEXMU_INTERVAL` | 60초, 최소 5초 |
183
187
  | `--no-resume` | `CODEXMU_NO_RESUME` | false |
184
188
  | `--switch-at` | `CODEXMU_SWITCH_AT` | 100 (한도 도달 시에만 전환); 1–100 |
189
+ | `--plain` | — | false (codexmu 상태 줄 표시) |
185
190
 
186
- 사용량 요청 실패·유효한 사용량 창이 없는 응답·이미 지난 리셋 시각을 여유 계정의 증거로 사용하지 않습니다. 한도에 도달한 계정은 최소 60초 동안, `usageLimitExceeded` 오류를 받은 계정은 사용량 보고에 여유가 있어 보여도 다음 리셋 시각까지 후보에서 제외됩니다. `--dry-run`은 계정 전환을 하지 않지만 정상 인증 유지에 필요한 OAuth 갱신은 할 수 있습니다.
191
+ 사용량 요청 실패·유효한 사용량 창이 없는 응답·이미 지난 리셋 시각을 여유 계정의 증거로 사용하지 않습니다. 한도에 도달한 계정은 최소 60초 동안 후보에서 제외됩니다. `usageLimitExceeded` 오류를 받은 계정은 사용량 보고가 한도 도달을 확인해 주면 다음 리셋 시각까지 제외되고, 보고에 아직 여유가 있으면(예: 전환 뒤에도 이전 계정의 인증을 계속 쓰던 Codex 스레드에서 온 오류) 최소 제외 시간만 적용한 뒤 다시 확인합니다. `--dry-run`은 계정 전환을 하지 않지만 정상 인증 유지에 필요한 OAuth 갱신은 할 수 있습니다.
187
192
 
188
193
  ## 검증
189
194
 
195
+ npm 검증에는 Node.js 24 이상을 사용하세요. `npm run build`로 네이티브 바이너리를 빌드하고 패키지에 포함할 위치에 복사한 뒤 패키지를 테스트합니다.
196
+
190
197
  ```sh
198
+ npm run build
191
199
  npm test
192
200
  cargo fmt --check
193
201
  cargo clippy --all-targets -- -D warnings
@@ -199,7 +207,7 @@ python3 tests/check.py
199
207
  python3 tests/check.py --native "$(command -v codex)"
200
208
 
201
209
  # 실제 공식 Codex 터미널: 입력 → A 한도 → B 응답 → /quit → 터미널 복구
202
- python3 tests/terminal.py --codex-bin "$(command -v codex)" --resize
210
+ python3 tests/terminal.py --codex-bin "$(command -v codex)" --model-change --usage-change --resize
203
211
  python3 tests/terminal.py --codex-bin "$(command -v codex)" --plain
204
212
  python3 tests/terminal.py --codex-bin "$(command -v codex)" --sessions 3 --resize
205
213
  ```
package/README.md CHANGED
@@ -8,6 +8,8 @@ A Rust program that stores multiple ChatGPT accounts for Codex and automatically
8
8
 
9
9
  ## Installation
10
10
 
11
+ Terminal mode supports macOS / Linux; desktop app launching supports macOS. Official Codex must support `--remote unix://...`; the previously tested CLI version is 0.153.4.
12
+
11
13
  ### npm
12
14
 
13
15
  Requires **Node.js 24 or later** and official Codex. The release package bundles macOS / Linux binaries for ARM64 and x64, without a Rust build or separate binary download during installation.
@@ -26,7 +28,7 @@ You can install a locally built package immediately. Local builds include only t
26
28
  npm run build
27
29
  mkdir -p dist
28
30
  npm pack --pack-destination dist
29
- npm install -g ./dist/codexmu-0.1.0.tgz
31
+ npm install -g ./dist/codexmu-0.2.3.tgz
30
32
  codexmu --version
31
33
  ```
32
34
 
@@ -34,7 +36,7 @@ If you already installed through Cargo, use `command -v codexmu` to check which
34
36
 
35
37
  ### Cargo
36
38
 
37
- Requires Rust 1.89 or later and official Codex. Terminal mode supports macOS / Linux; desktop app launching supports macOS. Codex must support `--remote unix://...`; the previously tested CLI version is 0.153.4.
39
+ Requires Rust 1.89 or later and official Codex.
38
40
 
39
41
  Run from the project directory after downloading the source:
40
42
 
@@ -58,7 +60,9 @@ codexmu list --live
58
60
  codexmu
59
61
  ```
60
62
 
61
- All registered accounts are candidates for automatic switching. For example, if `personal` and then `work` reach their limits, codexmu can switch to an available `extra` account and continue the same conversation. Selection depends on remaining usage, not registration order. To prefer some accounts, give them a higher tier with `codexmu priority NAME 1`; usage decides only within a tier, and lower tiers are used once every account above them is unavailable. `codexmu priority personal -1` keeps `personal` as the reserve. Tiers decide where a switch goes; codexmu does not move back to a higher tier while the active account still has headroom.
63
+ All registered accounts are candidates for automatic switching. For example, if `personal` and then `work` reach their limits, codexmu can switch to an available `extra` account and continue the same conversation. Selection depends on priority and remaining usage, not registration order.
64
+
65
+ Accounts start at priority `0`. Give a preferred account a higher tier with `codexmu priority work 1`, or keep `personal` as a reserve with `codexmu priority personal -1`. codexmu first considers accounts below `--switch-at`, choosing the highest tier and then the lowest usage within that tier. At a usage limit, if none are below the threshold, it applies the same ranking to the remaining accounts with available quota. Changing priority alone does not trigger a switch.
62
66
 
63
67
  `login` runs official `codex login` in a temporary `CODEX_HOME`. Cancelling or failing login preserves the existing active account. Omit `--device-auth` for browser login. If your credentials exist only in the keychain and there is no `auth.json`, use `login` instead of `add`.
64
68
 
@@ -86,7 +90,7 @@ The image is a Terminal.app capture of a local fake-account run.
86
90
  codexmu │ gpt-5.1 medium │ …/codexmu │ main +2 │ 5h 85% · 0h42m │ user@example.com (plus) Context 100% left · Fast off · 5h 85% · weekly 58% · 0.153.4
87
91
  ```
88
92
 
89
- The status line shows the session model, reasoning effort, working directory, Git branch and change count, queried remaining usage, and active account email and plan. The time is the countdown to the usage reset. Once the server acknowledges an account switch, the status line updates and briefly shows a switch notice segment. Unavailable quota data appears as `—`; narrow windows shorten or hide path, Git, and native details. The mouse wheel and PageUp/PageDown scroll the Codex output while the status line stays in place; any other key jumps back to the live view. codexmu never captures the mouse, so selecting text, copying, and Cmd+click keep working exactly as in your terminal (wheel scrolling relies on the alternate-scroll behavior that Terminal.app, iTerm2, kitty, Ghostty, and WezTerm enable by default). Your terminal controls the background and font.
93
+ The status line shows the session model, reasoning effort, working directory, Git branch and change count, remaining usage, and active account email and plan. Model and effort come from the native Codex status line, so they follow the selected conversation and `/model` changes without waiting for another turn. Usage combines account queries with live quota updates from that session’s Codex server, including during active turns; both quota displays use the same account data. The time is the countdown to the usage reset. Once the server acknowledges an account switch, the status line updates and briefly shows a switch notice segment. Unavailable quota data appears as `—`; narrow windows shorten or hide path, Git, and native details. The mouse wheel and PageUp/PageDown scroll the Codex output while the status line stays in place; any other key jumps back to the live view. codexmu never captures the mouse, so selecting text, copying, and Cmd+click keep working exactly as in your terminal (wheel scrolling relies on the alternate-scroll behavior that Terminal.app, iTerm2, kitty, Ghostty, and WezTerm enable by default). Your terminal controls the background and font.
90
94
 
91
95
  ```sh
92
96
  codexmu
@@ -100,7 +104,7 @@ codexmu --plain
100
104
 
101
105
  **Multiple `codexmu` windows can run simultaneously with the same `CODEX_HOME`.** Run `codexmu` in each terminal. They share the account list and default active account; each window's official Codex server manages its own conversations, approvals, and live authentication. When another window switches accounts, each window applies the new account during a usage check after its current turn finishes. A window receiving a usage-limit error attempts a switch immediately.
102
106
 
103
- Account-store access, usage queries, and OAuth refresh are serialized by a store lock. Concurrent refreshes reuse tokens already refreshed by another window and do not overwrite the authentication of a window working with a different account. The lock is not held for the entire session.
107
+ Account-store access, usage queries, and OAuth refresh are serialized by a store lock. Concurrent refreshes reuse tokens already refreshed by another window and do not overwrite the authentication of a window working with a different account. Changes to auth-file metadata alone do not count as token rotation or prevent newly refreshed tokens from being saved. The lock is not held for the entire session.
104
108
 
105
109
  A separate startup lock serializes server startup through the initialization response to avoid official Codex SQLite initialization conflicts in a fresh home. It releases immediately after initialization so sessions can work concurrently.
106
110
 
@@ -128,10 +132,10 @@ Terminal and desktop modes share the same switching behavior:
128
132
 
129
133
  - Query usage every 60 seconds by default, **only when no turn is running**.
130
134
  - Look for another account immediately when a turn ends with `usageLimitExceeded`.
131
- - Among available accounts in the highest priority tier, select the one with the lowest maximum usage across the usage windows present in the response.
135
+ - Prefer accounts below `--switch-at`, then rank by priority tier and the lowest maximum usage across the usage windows present in the response. At a usage limit, fall back to other accounts with available quota if none are below the threshold.
132
136
  - With `--switch-at 80`, also switch between turns once the active account reaches 80% and an account below 80% exists. An early switch is not a cooldown and sends no continuation turn.
133
137
  - Send new credentials to the running official app-server through `account/login/start`, rather than only replacing a file.
134
- - By default, send a new continuation turn in the same thread. Do not replay the original prompt or executed tool calls.
138
+ - After switching in response to `usageLimitExceeded`, send a new continuation turn in the same thread by default. Do not replay the original prompt or executed tool calls.
135
139
  - Defer switching while another turn is running. Queue new turns during a switch while continuing to forward approval responses. Do not execute cancelled queued turns.
136
140
 
137
141
  To switch accounts without automatic continuation:
@@ -182,12 +186,16 @@ $CODEX_HOME/codexmu/terminal-<PID>.log Per-session official server diagno
182
186
  | `--interval` | `CODEXMU_INTERVAL` | 60 seconds; minimum 5 |
183
187
  | `--no-resume` | `CODEXMU_NO_RESUME` | false |
184
188
  | `--switch-at` | `CODEXMU_SWITCH_AT` | 100 (switch only at the limit); 1–100 |
189
+ | `--plain` | — | false (show the codexmu status line) |
185
190
 
186
- Failed usage requests, responses without a valid usage window, and past reset timestamps are not treated as evidence of available quota. Accounts that reach their limits are excluded from selection for at least 60 seconds, and after a `usageLimitExceeded` error until the next reported usage reset, even if the usage report still shows headroom. `--dry-run` does not switch accounts, but may refresh OAuth tokens to keep credentials valid.
191
+ Failed usage requests, responses without a valid usage window, and past reset timestamps are not treated as evidence of available quota. Accounts that reach their limits are excluded from selection for at least 60 seconds. After a `usageLimitExceeded` error, the exclusion lasts until the next reported usage reset when the usage report confirms the limit; if the report still shows headroom, for example because a Codex thread kept a previous account's credentials after a switch, only that minimum cooldown applies and the account is checked again afterwards. `--dry-run` does not switch accounts, but may refresh OAuth tokens to keep credentials valid.
187
192
 
188
193
  ## Validation
189
194
 
195
+ Use Node.js 24+ for npm checks; `npm run build` builds and stages the native binary before testing the package.
196
+
190
197
  ```sh
198
+ npm run build
191
199
  npm test
192
200
  cargo fmt --check
193
201
  cargo clippy --all-targets -- -D warnings
@@ -199,7 +207,7 @@ python3 tests/check.py
199
207
  python3 tests/check.py --native "$(command -v codex)"
200
208
 
201
209
  # Official Codex terminal: input → A hits limit → B responds → /quit → terminal restored
202
- python3 tests/terminal.py --codex-bin "$(command -v codex)" --resize
210
+ python3 tests/terminal.py --codex-bin "$(command -v codex)" --model-change --usage-change --resize
203
211
  python3 tests/terminal.py --codex-bin "$(command -v codex)" --plain
204
212
  python3 tests/terminal.py --codex-bin "$(command -v codex)" --sessions 3 --resize
205
213
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexmu",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Multi-account manager and automatic account switching for Codex",
5
5
  "license": "MIT",
6
6
  "type": "module",
Binary file
Binary file
Binary file
Binary file