@carjms/codexswitch 0.6.1 → 0.6.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 +1 -0
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/cli.js +83 -4
package/README.ko.md
CHANGED
|
@@ -218,6 +218,7 @@ cxs list # 계정별 5h/week 사용량 % 확인
|
|
|
218
218
|
| `cxs order [이름들...]` | 로테이션 순서 고정(pin); 나열하지 않은 계정은 **주간 리셋이 빠른 순**으로 자동 소진 (use-or-lose) |
|
|
219
219
|
| `cxs model [모델명]` | `run`/`exec`에 자동 적용할 기본 모델 설정 (`default`로 초기화) |
|
|
220
220
|
| `cxs threshold [5h%] [주간%]` | 사용량이 이 퍼센트에 도달하면 다음 계정으로 전환 (기본 95, 값 하나면 둘 다) |
|
|
221
|
+
| `cxs reasoning <show\|concise\|hide>` | 실행 중 모델 추론("생각") 출력량 조절 — `hide`는 완전 숨김, `concise`는 한 줄 요약 |
|
|
221
222
|
| `cxs patterns [add/remove]` | 한도 감지에 쓸 커스텀 정규식 패턴 추가/삭제 |
|
|
222
223
|
| `cxs export <파일>` | 전체 계정·설정 백업 (⚠️ 토큰 포함 — 비밀번호처럼 취급) |
|
|
223
224
|
| `cxs restore <파일>` | 백업 파일에서 계정 복원 (다른 PC 이전용) |
|
package/README.md
CHANGED
|
@@ -220,6 +220,7 @@ cxs list # per-account 5h/week usage columns
|
|
|
220
220
|
| `cxs order [names...]` | Pin the rotation order; unlisted accounts rotate by **soonest weekly reset** (use-or-lose) |
|
|
221
221
|
| `cxs model [name]` | Set the default model injected into `run`/`exec` (`default` to reset) |
|
|
222
222
|
| `cxs threshold [5h%] [wk%]` | Rotate to the next account when usage reaches these percents (default 95; one value sets both) |
|
|
223
|
+
| `cxs reasoning <show\|concise\|hide>` | How much model reasoning ("thinking") to print during runs — `hide` for clean output, `concise` for one-line summaries |
|
|
223
224
|
| `cxs patterns [add/remove]` | Custom regex patterns treated as rate-limit errors |
|
|
224
225
|
| `cxs export <file>` | Back up all accounts + settings (⚠️ contains tokens — treat like a password) |
|
|
225
226
|
| `cxs restore <file>` | Restore accounts from a backup (for moving machines) |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -51,6 +51,10 @@ Running codex
|
|
|
51
51
|
|
|
52
52
|
Settings
|
|
53
53
|
model [name|default] show/set the default model injected into run/exec
|
|
54
|
+
reasoning [mode] how much model reasoning to print during runs:
|
|
55
|
+
show (codex default) | concise | hide
|
|
56
|
+
sandbox [mode] file access for exec/chat: read-only (codex default)
|
|
57
|
+
| write (edit files in cwd) | full (no sandbox)
|
|
54
58
|
threshold [5h%] [wk%] rotate early when recorded usage reaches these percents
|
|
55
59
|
of the 5-hour / weekly window (default 95, one value = both)
|
|
56
60
|
cooldown [minutes] show/set rate-limit cooldown (default 60)
|
|
@@ -642,7 +646,7 @@ function cmdNames() {
|
|
|
642
646
|
|
|
643
647
|
const COMMANDS =
|
|
644
648
|
'login import add-key list usage watch probe log chat server use current next run exec order model remove rename ' +
|
|
645
|
-
'enable disable priority clear-limit cooldown threshold patterns export restore sync completion help';
|
|
649
|
+
'enable disable priority clear-limit cooldown threshold reasoning sandbox patterns export restore sync completion help';
|
|
646
650
|
|
|
647
651
|
function cmdCompletion(args) {
|
|
648
652
|
const shell = args[0];
|
|
@@ -682,9 +686,76 @@ function injectExecFlags(rest, meta) {
|
|
|
682
686
|
if (!args.includes('--skip-git-repo-check')) args.unshift('--skip-git-repo-check');
|
|
683
687
|
const hasModel = args.some((a) => a === '-m' || a === '--model' || a.startsWith('--model='));
|
|
684
688
|
if (meta.model && !hasModel) args.unshift('-m', meta.model);
|
|
689
|
+
const hasSandbox = args.some(
|
|
690
|
+
(a) =>
|
|
691
|
+
a === '--sandbox' ||
|
|
692
|
+
a.startsWith('--sandbox=') ||
|
|
693
|
+
a === '--full-auto' ||
|
|
694
|
+
a === '--dangerously-bypass-approvals-and-sandbox'
|
|
695
|
+
);
|
|
696
|
+
if (meta.sandbox && !hasSandbox) args.unshift('--sandbox', meta.sandbox);
|
|
697
|
+
args.unshift(...reasoningFlags(meta, args));
|
|
685
698
|
return args;
|
|
686
699
|
}
|
|
687
700
|
|
|
701
|
+
const SANDBOX_MODES = { 'read-only': 'read-only', write: 'workspace-write', 'workspace-write': 'workspace-write', full: 'danger-full-access', 'danger-full-access': 'danger-full-access' };
|
|
702
|
+
|
|
703
|
+
// codex exec defaults to a read-only sandbox; this setting lets it write.
|
|
704
|
+
function cmdSandbox(args) {
|
|
705
|
+
const meta = store.loadMeta();
|
|
706
|
+
if (args[0] == null) {
|
|
707
|
+
out(`sandbox: ${meta.sandbox || 'read-only (codex exec default)'} ${ui.dim('(read-only | write | full)')}`);
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
if (args[0] === 'read-only' || args[0] === 'default') {
|
|
711
|
+
delete meta.sandbox;
|
|
712
|
+
store.saveMeta(meta);
|
|
713
|
+
out(ui.ok('sandbox back to codex default (read-only in exec)'));
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
const mode = SANDBOX_MODES[args[0]];
|
|
717
|
+
if (!mode) throw new Error('usage: codexswitch sandbox <read-only|write|full>');
|
|
718
|
+
meta.sandbox = mode;
|
|
719
|
+
store.saveMeta(meta);
|
|
720
|
+
out(
|
|
721
|
+
mode === 'workspace-write'
|
|
722
|
+
? ui.ok('sandbox set to workspace-write — codex can edit files in the working directory')
|
|
723
|
+
: ui.warn('sandbox set to danger-full-access — codex can touch anything, use with care')
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// -c overrides implementing "cxs reasoning hide|concise|show".
|
|
728
|
+
function reasoningFlags(meta, existing = []) {
|
|
729
|
+
if (!meta.reasoning || meta.reasoning === 'show') return [];
|
|
730
|
+
if (existing.some((a) => /hide_agent_reasoning|model_reasoning_summary/.test(a))) return [];
|
|
731
|
+
if (meta.reasoning === 'hide') return ['-c', 'hide_agent_reasoning=true'];
|
|
732
|
+
return ['-c', 'model_reasoning_summary=concise']; // 'concise'
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function cmdReasoning(args) {
|
|
736
|
+
const meta = store.loadMeta();
|
|
737
|
+
if (args[0] == null) {
|
|
738
|
+
out(`reasoning: ${meta.reasoning || 'show'} ${ui.dim('(show | concise | hide)')}`);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
const value = args[0];
|
|
742
|
+
if (!['show', 'concise', 'hide'].includes(value)) {
|
|
743
|
+
throw new Error('usage: codexswitch reasoning <show|concise|hide>');
|
|
744
|
+
}
|
|
745
|
+
if (value === 'show') delete meta.reasoning;
|
|
746
|
+
else meta.reasoning = value;
|
|
747
|
+
store.saveMeta(meta);
|
|
748
|
+
out(
|
|
749
|
+
ui.ok(
|
|
750
|
+
value === 'hide'
|
|
751
|
+
? 'reasoning output hidden (hide_agent_reasoning=true)'
|
|
752
|
+
: value === 'concise'
|
|
753
|
+
? 'reasoning output shortened (model_reasoning_summary=concise)'
|
|
754
|
+
: 'reasoning output back to codex default'
|
|
755
|
+
)
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
|
|
688
759
|
// EXPERIMENTAL: foreground proxy server for per-request rotation.
|
|
689
760
|
async function cmdServer(args) {
|
|
690
761
|
const proxy = require('./proxy.js');
|
|
@@ -744,8 +815,10 @@ async function cmdRun(args) {
|
|
|
744
815
|
const meta = store.loadMeta();
|
|
745
816
|
if (rest[0] === 'exec') {
|
|
746
817
|
rest = ['exec', ...buildExecArgs(rest.slice(1), meta)];
|
|
747
|
-
} else if (
|
|
748
|
-
|
|
818
|
+
} else if (rest.length === 0) {
|
|
819
|
+
// interactive TUI launch — apply the same defaults
|
|
820
|
+
if (meta.model) rest = ['-m', meta.model];
|
|
821
|
+
rest = [...reasoningFlags(meta), ...rest];
|
|
749
822
|
}
|
|
750
823
|
out(ui.info(`running codex as ${ui.bold(`"${name}"`)}${proxyPort ? ui.dim(` via proxy :${proxyPort}`) : ''}`));
|
|
751
824
|
const startTs = Date.now();
|
|
@@ -892,12 +965,14 @@ async function cmdChat() {
|
|
|
892
965
|
try {
|
|
893
966
|
if (cmd === 'quit' || cmd === 'exit' || cmd === 'q') break;
|
|
894
967
|
else if (cmd === 'help')
|
|
895
|
-
out(ui.dim('/usage /list /use <name> /next /model [m] /new (fresh session) /quit'));
|
|
968
|
+
out(ui.dim('/usage /list /use <name> /next /model [m] /sandbox [mode] /reasoning [mode] /new (fresh session) /quit'));
|
|
896
969
|
else if (cmd === 'usage') cmdUsage([]);
|
|
897
970
|
else if (cmd === 'list') cmdList();
|
|
898
971
|
else if (cmd === 'use') cmdUse(rest);
|
|
899
972
|
else if (cmd === 'next') cmdNext();
|
|
900
973
|
else if (cmd === 'model') cmdModel(rest);
|
|
974
|
+
else if (cmd === 'sandbox') cmdSandbox(rest);
|
|
975
|
+
else if (cmd === 'reasoning') cmdReasoning(rest);
|
|
901
976
|
else if (cmd === 'new') {
|
|
902
977
|
inSession = false;
|
|
903
978
|
out(ui.ok('starting a fresh session on the next prompt'));
|
|
@@ -990,6 +1065,10 @@ async function main(argv) {
|
|
|
990
1065
|
return cmdOrder(args), 0;
|
|
991
1066
|
case 'model':
|
|
992
1067
|
return cmdModel(args), 0;
|
|
1068
|
+
case 'reasoning':
|
|
1069
|
+
return cmdReasoning(args), 0;
|
|
1070
|
+
case 'sandbox':
|
|
1071
|
+
return cmdSandbox(args), 0;
|
|
993
1072
|
case 'add-key':
|
|
994
1073
|
case 'apikey':
|
|
995
1074
|
return cmdAddKey(args), 0;
|