@carjms/codexswitch 0.6.2 → 0.6.4
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 +59 -2
package/README.ko.md
CHANGED
|
@@ -219,6 +219,7 @@ cxs list # 계정별 5h/week 사용량 % 확인
|
|
|
219
219
|
| `cxs model [모델명]` | `run`/`exec`에 자동 적용할 기본 모델 설정 (`default`로 초기화) |
|
|
220
220
|
| `cxs threshold [5h%] [주간%]` | 사용량이 이 퍼센트에 도달하면 다음 계정으로 전환 (기본 95, 값 하나면 둘 다) |
|
|
221
221
|
| `cxs reasoning <show\|concise\|hide>` | 실행 중 모델 추론("생각") 출력량 조절 — `hide`는 완전 숨김, `concise`는 한 줄 요약 |
|
|
222
|
+
| `cxs sandbox <read-only\|write\|write+net\|full>` | exec/chat의 파일 접근 권한 — `write`는 작업 폴더 수정, `write+net`은 ssh/curl 등 네트워크까지 허용, `full`은 샌드박스 해제 |
|
|
222
223
|
| `cxs patterns [add/remove]` | 한도 감지에 쓸 커스텀 정규식 패턴 추가/삭제 |
|
|
223
224
|
| `cxs export <파일>` | 전체 계정·설정 백업 (⚠️ 토큰 포함 — 비밀번호처럼 취급) |
|
|
224
225
|
| `cxs restore <파일>` | 백업 파일에서 계정 복원 (다른 PC 이전용) |
|
package/README.md
CHANGED
|
@@ -221,6 +221,7 @@ cxs list # per-account 5h/week usage columns
|
|
|
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
223
|
| `cxs reasoning <show\|concise\|hide>` | How much model reasoning ("thinking") to print during runs — `hide` for clean output, `concise` for one-line summaries |
|
|
224
|
+
| `cxs sandbox <read-only\|write\|write+net\|full>` | File access for exec/chat — `write` edits files in cwd, `write+net` also allows ssh/curl/network, `full` disables the sandbox |
|
|
224
225
|
| `cxs patterns [add/remove]` | Custom regex patterns treated as rate-limit errors |
|
|
225
226
|
| `cxs export <file>` | Back up all accounts + settings (⚠️ contains tokens — treat like a password) |
|
|
226
227
|
| `cxs restore <file>` | Restore accounts from a backup (for moving machines) |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -53,6 +53,9 @@ Settings
|
|
|
53
53
|
model [name|default] show/set the default model injected into run/exec
|
|
54
54
|
reasoning [mode] how much model reasoning to print during runs:
|
|
55
55
|
show (codex default) | concise | hide
|
|
56
|
+
sandbox [mode] file access for exec/chat: read-only (codex default)
|
|
57
|
+
| write (edit files in cwd) | write+net (also allow
|
|
58
|
+
ssh/curl/network) | full (no sandbox)
|
|
56
59
|
threshold [5h%] [wk%] rotate early when recorded usage reaches these percents
|
|
57
60
|
of the 5-hour / weekly window (default 95, one value = both)
|
|
58
61
|
cooldown [minutes] show/set rate-limit cooldown (default 60)
|
|
@@ -644,7 +647,7 @@ function cmdNames() {
|
|
|
644
647
|
|
|
645
648
|
const COMMANDS =
|
|
646
649
|
'login import add-key list usage watch probe log chat server use current next run exec order model remove rename ' +
|
|
647
|
-
'enable disable priority clear-limit cooldown threshold reasoning patterns export restore sync completion help';
|
|
650
|
+
'enable disable priority clear-limit cooldown threshold reasoning sandbox patterns export restore sync completion help';
|
|
648
651
|
|
|
649
652
|
function cmdCompletion(args) {
|
|
650
653
|
const shell = args[0];
|
|
@@ -684,10 +687,60 @@ function injectExecFlags(rest, meta) {
|
|
|
684
687
|
if (!args.includes('--skip-git-repo-check')) args.unshift('--skip-git-repo-check');
|
|
685
688
|
const hasModel = args.some((a) => a === '-m' || a === '--model' || a.startsWith('--model='));
|
|
686
689
|
if (meta.model && !hasModel) args.unshift('-m', meta.model);
|
|
690
|
+
const hasSandbox = args.some(
|
|
691
|
+
(a) =>
|
|
692
|
+
a === '--sandbox' ||
|
|
693
|
+
a.startsWith('--sandbox=') ||
|
|
694
|
+
a === '--full-auto' ||
|
|
695
|
+
a === '--dangerously-bypass-approvals-and-sandbox'
|
|
696
|
+
);
|
|
697
|
+
if (meta.sandbox && !hasSandbox) {
|
|
698
|
+
if (meta.sandbox === 'workspace-write+net') {
|
|
699
|
+
// workspace-write plus outbound network (ssh, curl, npm install...)
|
|
700
|
+
args.unshift('--sandbox', 'workspace-write', '-c', 'sandbox_workspace_write.network_access=true');
|
|
701
|
+
} else {
|
|
702
|
+
args.unshift('--sandbox', meta.sandbox);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
687
705
|
args.unshift(...reasoningFlags(meta, args));
|
|
688
706
|
return args;
|
|
689
707
|
}
|
|
690
708
|
|
|
709
|
+
const SANDBOX_MODES = {
|
|
710
|
+
'read-only': 'read-only',
|
|
711
|
+
write: 'workspace-write',
|
|
712
|
+
'workspace-write': 'workspace-write',
|
|
713
|
+
'write+net': 'workspace-write+net',
|
|
714
|
+
net: 'workspace-write+net',
|
|
715
|
+
full: 'danger-full-access',
|
|
716
|
+
'danger-full-access': 'danger-full-access',
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// codex exec defaults to a read-only sandbox; this setting lets it write.
|
|
720
|
+
function cmdSandbox(args) {
|
|
721
|
+
const meta = store.loadMeta();
|
|
722
|
+
if (args[0] == null) {
|
|
723
|
+
out(`sandbox: ${meta.sandbox || 'read-only (codex exec default)'} ${ui.dim('(read-only | write | full)')}`);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (args[0] === 'read-only' || args[0] === 'default') {
|
|
727
|
+
delete meta.sandbox;
|
|
728
|
+
store.saveMeta(meta);
|
|
729
|
+
out(ui.ok('sandbox back to codex default (read-only in exec)'));
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
const mode = SANDBOX_MODES[args[0]];
|
|
733
|
+
if (!mode) throw new Error('usage: codexswitch sandbox <read-only|write|write+net|full>');
|
|
734
|
+
meta.sandbox = mode;
|
|
735
|
+
store.saveMeta(meta);
|
|
736
|
+
const messages = {
|
|
737
|
+
'workspace-write': ui.ok('sandbox set to workspace-write — codex can edit files in the working directory'),
|
|
738
|
+
'workspace-write+net': ui.ok('sandbox set to workspace-write + network — codex can also use ssh/curl/npm'),
|
|
739
|
+
'danger-full-access': ui.warn('sandbox set to danger-full-access — codex can touch anything, use with care'),
|
|
740
|
+
};
|
|
741
|
+
out(messages[mode]);
|
|
742
|
+
}
|
|
743
|
+
|
|
691
744
|
// -c overrides implementing "cxs reasoning hide|concise|show".
|
|
692
745
|
function reasoningFlags(meta, existing = []) {
|
|
693
746
|
if (!meta.reasoning || meta.reasoning === 'show') return [];
|
|
@@ -929,12 +982,14 @@ async function cmdChat() {
|
|
|
929
982
|
try {
|
|
930
983
|
if (cmd === 'quit' || cmd === 'exit' || cmd === 'q') break;
|
|
931
984
|
else if (cmd === 'help')
|
|
932
|
-
out(ui.dim('/usage /list /use <name> /next /model [m] /new (fresh session) /quit'));
|
|
985
|
+
out(ui.dim('/usage /list /use <name> /next /model [m] /sandbox [mode] /reasoning [mode] /new (fresh session) /quit'));
|
|
933
986
|
else if (cmd === 'usage') cmdUsage([]);
|
|
934
987
|
else if (cmd === 'list') cmdList();
|
|
935
988
|
else if (cmd === 'use') cmdUse(rest);
|
|
936
989
|
else if (cmd === 'next') cmdNext();
|
|
937
990
|
else if (cmd === 'model') cmdModel(rest);
|
|
991
|
+
else if (cmd === 'sandbox') cmdSandbox(rest);
|
|
992
|
+
else if (cmd === 'reasoning') cmdReasoning(rest);
|
|
938
993
|
else if (cmd === 'new') {
|
|
939
994
|
inSession = false;
|
|
940
995
|
out(ui.ok('starting a fresh session on the next prompt'));
|
|
@@ -1029,6 +1084,8 @@ async function main(argv) {
|
|
|
1029
1084
|
return cmdModel(args), 0;
|
|
1030
1085
|
case 'reasoning':
|
|
1031
1086
|
return cmdReasoning(args), 0;
|
|
1087
|
+
case 'sandbox':
|
|
1088
|
+
return cmdSandbox(args), 0;
|
|
1032
1089
|
case 'add-key':
|
|
1033
1090
|
case 'apikey':
|
|
1034
1091
|
return cmdAddKey(args), 0;
|