@lesscap/baton-cli 0.5.1 → 0.6.0
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/dist/baton.mjs +25 -3
- package/package.json +12 -11
- package/LICENSE +0 -21
package/dist/baton.mjs
CHANGED
|
@@ -6431,6 +6431,18 @@ var codexApprovalPolicy = () => {
|
|
|
6431
6431
|
return raw;
|
|
6432
6432
|
return "never";
|
|
6433
6433
|
};
|
|
6434
|
+
var claudeEffort = (raw) => {
|
|
6435
|
+
if (raw === "minimal") return "low";
|
|
6436
|
+
if (raw === "low" || raw === "medium" || raw === "high" || raw === "xhigh" || raw === "max")
|
|
6437
|
+
return raw;
|
|
6438
|
+
return void 0;
|
|
6439
|
+
};
|
|
6440
|
+
var codexEffort = (raw) => {
|
|
6441
|
+
if (raw === "max") return "xhigh";
|
|
6442
|
+
if (raw === "minimal" || raw === "low" || raw === "medium" || raw === "high" || raw === "xhigh")
|
|
6443
|
+
return raw;
|
|
6444
|
+
return void 0;
|
|
6445
|
+
};
|
|
6434
6446
|
|
|
6435
6447
|
// src/session/runner/transcript.ts
|
|
6436
6448
|
import { readdirSync, readFileSync as readFileSync4, statSync } from "node:fs";
|
|
@@ -6674,15 +6686,19 @@ async function* startCodexEvents(config, input, worker2, opts) {
|
|
|
6674
6686
|
const sandboxMode = codexSandboxMode(opts.planMode ?? false);
|
|
6675
6687
|
const approvalPolicy = codexApprovalPolicy();
|
|
6676
6688
|
const networkAccessEnabled = codexNetworkAccess();
|
|
6689
|
+
const reasoningEffort = codexEffort(opts.effort);
|
|
6677
6690
|
opts.log(
|
|
6678
6691
|
`[codex] sandbox=${sandboxMode} approval=${approvalPolicy}${networkAccessEnabled === void 0 ? "" : ` network=${networkAccessEnabled}`}`
|
|
6679
6692
|
);
|
|
6693
|
+
if (opts.model) opts.log(`[model] ${opts.model}`);
|
|
6694
|
+
if (reasoningEffort) opts.log(`[effort] ${reasoningEffort}`);
|
|
6680
6695
|
const threadOptions = {
|
|
6681
6696
|
workingDirectory: config.worktreePath,
|
|
6682
6697
|
skipGitRepoCheck: true,
|
|
6683
6698
|
sandboxMode,
|
|
6684
6699
|
approvalPolicy,
|
|
6685
6700
|
...opts.model ? { model: opts.model } : {},
|
|
6701
|
+
...reasoningEffort ? { modelReasoningEffort: reasoningEffort } : {},
|
|
6686
6702
|
...addDirs ? { additionalDirectories: addDirs } : {},
|
|
6687
6703
|
...networkAccessEnabled === void 0 ? {} : { networkAccessEnabled }
|
|
6688
6704
|
};
|
|
@@ -6706,13 +6722,15 @@ async function* startCodexEvents(config, input, worker2, opts) {
|
|
|
6706
6722
|
}
|
|
6707
6723
|
|
|
6708
6724
|
// src/session/runner/query.ts
|
|
6709
|
-
var startQuery = (config, text, resuming, queryFn, abortController, log, { envOverlay, planMode = false, model } = {}) => {
|
|
6725
|
+
var startQuery = (config, text, resuming, queryFn, abortController, log, { envOverlay, planMode = false, model, effort } = {}) => {
|
|
6710
6726
|
const env = buildSdkEnv(envOverlay);
|
|
6711
6727
|
const exe = claudeExecutable();
|
|
6712
6728
|
const addDirs = additionalDirs();
|
|
6729
|
+
const level = claudeEffort(effort);
|
|
6713
6730
|
if (addDirs) log(`[add-dir] ${addDirs.join(", ")}`);
|
|
6714
6731
|
if (planMode) log("[plan] read-only planning turn");
|
|
6715
6732
|
if (model) log(`[model] ${model}`);
|
|
6733
|
+
if (level) log(`[effort] ${level}`);
|
|
6716
6734
|
const options = {
|
|
6717
6735
|
cwd: config.worktreePath,
|
|
6718
6736
|
permissionMode: planMode ? "plan" : "bypassPermissions",
|
|
@@ -6727,7 +6745,8 @@ var startQuery = (config, text, resuming, queryFn, abortController, log, { envOv
|
|
|
6727
6745
|
...env ? { env } : {},
|
|
6728
6746
|
...exe ? { pathToClaudeCodeExecutable: exe } : {},
|
|
6729
6747
|
...addDirs ? { additionalDirectories: addDirs } : {},
|
|
6730
|
-
...model ? { model } : {}
|
|
6748
|
+
...model ? { model } : {},
|
|
6749
|
+
...level ? { effort: level } : {}
|
|
6731
6750
|
};
|
|
6732
6751
|
return queryFn({ prompt: text, options });
|
|
6733
6752
|
};
|
|
@@ -6997,6 +7016,7 @@ var runTurn = async (config, worker2, msg, resuming, queryFn, log = (m) => conso
|
|
|
6997
7016
|
const attachments = Array.isArray(payload?.attachments) ? payload.attachments : [];
|
|
6998
7017
|
const planMode = payload?.planMode === true;
|
|
6999
7018
|
const model = typeof payload?.model === "string" ? payload.model : void 0;
|
|
7019
|
+
const effort = typeof payload?.effort === "string" ? payload.effort : void 0;
|
|
7000
7020
|
if (rawText.length === 0 && attachments.length === 0) {
|
|
7001
7021
|
await worker2.emitEvent("turn_error", { message: "user_message missing text and attachments" });
|
|
7002
7022
|
return -1;
|
|
@@ -7029,6 +7049,7 @@ var runTurn = async (config, worker2, msg, resuming, queryFn, log = (m) => conso
|
|
|
7029
7049
|
envOverlay,
|
|
7030
7050
|
planMode,
|
|
7031
7051
|
model,
|
|
7052
|
+
effort,
|
|
7032
7053
|
signal: abort.signal,
|
|
7033
7054
|
log
|
|
7034
7055
|
}),
|
|
@@ -7037,7 +7058,8 @@ var runTurn = async (config, worker2, msg, resuming, queryFn, log = (m) => conso
|
|
|
7037
7058
|
startQuery(config, built.text, resuming, queryFn, abort, log, {
|
|
7038
7059
|
envOverlay,
|
|
7039
7060
|
planMode,
|
|
7040
|
-
model
|
|
7061
|
+
model,
|
|
7062
|
+
effort
|
|
7041
7063
|
}),
|
|
7042
7064
|
worker2
|
|
7043
7065
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesscap/baton-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,27 +14,28 @@
|
|
|
14
14
|
"dist",
|
|
15
15
|
"scripts"
|
|
16
16
|
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"baton": "tsx src/index.ts",
|
|
19
|
+
"build": "node build.mjs && chmod +x dist/baton.mjs",
|
|
20
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
21
|
+
"prepublishOnly": "pnpm build",
|
|
22
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
23
|
+
"test": "tsx --test 'src/**/*.test.ts'"
|
|
24
|
+
},
|
|
17
25
|
"devDependencies": {
|
|
26
|
+
"@baton/shared": "workspace:*",
|
|
18
27
|
"@types/node": "^25.9.1",
|
|
19
28
|
"@types/ws": "^8.18.1",
|
|
20
29
|
"citty": "^0.2.2",
|
|
21
30
|
"esbuild": "^0.28.0",
|
|
22
31
|
"eventsource": "^4.1.0",
|
|
23
32
|
"tsx": "^4.22.4",
|
|
24
|
-
"typescript": "^6.0.3"
|
|
25
|
-
"@baton/shared": "0.0.0"
|
|
33
|
+
"typescript": "^6.0.3"
|
|
26
34
|
},
|
|
27
35
|
"dependencies": {
|
|
28
36
|
"@anthropic-ai/claude-agent-sdk": "^0.3.161",
|
|
29
37
|
"@openai/codex-sdk": "^0.142.5",
|
|
30
38
|
"node-pty": "^1.1.0",
|
|
31
39
|
"ws": "^8.21.0"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"baton": "tsx src/index.ts",
|
|
35
|
-
"build": "node build.mjs && chmod +x dist/baton.mjs",
|
|
36
|
-
"postinstall": "node scripts/postinstall.mjs",
|
|
37
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
38
|
-
"test": "tsx --test 'src/**/*.test.ts'"
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 bencode
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|