@lesscap/baton-cli 0.7.8 → 0.7.10
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 +17 -5
- package/package.json +15 -13
- package/scripts/postinstall.mjs +18 -1
- package/LICENSE +0 -21
package/dist/baton.mjs
CHANGED
|
@@ -7908,8 +7908,7 @@ var claudeEffort = (raw) => {
|
|
|
7908
7908
|
return void 0;
|
|
7909
7909
|
};
|
|
7910
7910
|
var codexEffort = (raw) => {
|
|
7911
|
-
if (raw === "
|
|
7912
|
-
if (raw === "minimal" || raw === "low" || raw === "medium" || raw === "high" || raw === "xhigh")
|
|
7911
|
+
if (raw === "minimal" || raw === "low" || raw === "medium" || raw === "high" || raw === "xhigh" || raw === "max")
|
|
7913
7912
|
return raw;
|
|
7914
7913
|
return void 0;
|
|
7915
7914
|
};
|
|
@@ -9809,10 +9808,23 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
9809
9808
|
|
|
9810
9809
|
// src/worker/pty.ts
|
|
9811
9810
|
import { existsSync as existsSync8, readdirSync as readdirSync2 } from "node:fs";
|
|
9811
|
+
import { createRequire as createModuleRequire } from "node:module";
|
|
9812
9812
|
import { homedir as homedir3 } from "node:os";
|
|
9813
9813
|
import { join as join12 } from "node:path";
|
|
9814
9814
|
var MAX_TERMINALS = 10;
|
|
9815
|
-
var
|
|
9815
|
+
var claudePtyCommand = (agentSessionId, hasJsonl, env = process.env) => ({
|
|
9816
|
+
file: env.BATON_CLAUDE_BIN?.trim() || "claude",
|
|
9817
|
+
args: hasJsonl ? ["--resume", agentSessionId] : ["--session-id", agentSessionId]
|
|
9818
|
+
});
|
|
9819
|
+
var moduleRequire = createModuleRequire(import.meta.url);
|
|
9820
|
+
var codexPtyCommand = (agentSessionId, env = process.env) => {
|
|
9821
|
+
const args = ["resume", "--include-non-interactive", agentSessionId];
|
|
9822
|
+
const override = env.BATON_CODEX_BIN?.trim();
|
|
9823
|
+
return override ? { file: override, args } : {
|
|
9824
|
+
file: process.execPath,
|
|
9825
|
+
args: [moduleRequire.resolve("@openai/codex/bin/codex.js"), ...args]
|
|
9826
|
+
};
|
|
9827
|
+
};
|
|
9816
9828
|
var hasSessionJsonl = (agentSessionId) => {
|
|
9817
9829
|
const root = join12(homedir3(), ".claude", "projects");
|
|
9818
9830
|
if (!existsSync8(root)) return false;
|
|
@@ -9839,8 +9851,8 @@ var createTerminalManager = (deps) => {
|
|
|
9839
9851
|
log(`terminal #${sessionId}: worktree preparation failed: ${String(error)}`);
|
|
9840
9852
|
return;
|
|
9841
9853
|
}
|
|
9842
|
-
const
|
|
9843
|
-
const term = spawn4(
|
|
9854
|
+
const command = cfg.agentKind === "codex" ? codexPtyCommand(agentSessionId) : claudePtyCommand(agentSessionId, hasSessionJsonl(agentSessionId));
|
|
9855
|
+
const term = spawn4(command.file, command.args, {
|
|
9844
9856
|
name: "xterm-color",
|
|
9845
9857
|
cols: 80,
|
|
9846
9858
|
rows: 24,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesscap/baton-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,28 +15,30 @@
|
|
|
15
15
|
"scripts",
|
|
16
16
|
"skills"
|
|
17
17
|
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"baton": "tsx src/index.ts",
|
|
20
|
+
"build": "node build.mjs && chmod +x dist/baton.mjs",
|
|
21
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
22
|
+
"prepublishOnly": "pnpm build",
|
|
23
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
24
|
+
"test": "tsx --test 'src/**/*.test.ts'"
|
|
25
|
+
},
|
|
18
26
|
"devDependencies": {
|
|
27
|
+
"@baton/shared": "workspace:*",
|
|
19
28
|
"@types/node": "^25.9.1",
|
|
20
29
|
"@types/ws": "^8.18.1",
|
|
21
30
|
"citty": "^0.2.2",
|
|
22
31
|
"esbuild": "^0.28.0",
|
|
23
32
|
"eventsource": "^4.1.0",
|
|
24
33
|
"tsx": "^4.22.4",
|
|
25
|
-
"typescript": "^6.0.3"
|
|
26
|
-
"@baton/shared": "0.0.0"
|
|
34
|
+
"typescript": "^6.0.3"
|
|
27
35
|
},
|
|
28
36
|
"dependencies": {
|
|
29
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
30
|
-
"@openai/codex
|
|
37
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.263",
|
|
38
|
+
"@openai/codex": "0.153.4",
|
|
39
|
+
"@openai/codex-sdk": "0.153.4",
|
|
31
40
|
"mime": "^4.1.0",
|
|
32
41
|
"node-pty": "^1.1.0",
|
|
33
42
|
"ws": "^8.21.0"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"baton": "tsx src/index.ts",
|
|
37
|
-
"build": "node build.mjs && chmod +x dist/baton.mjs",
|
|
38
|
-
"postinstall": "node scripts/postinstall.mjs",
|
|
39
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
40
|
-
"test": "tsx --test 'src/**/*.test.ts'"
|
|
41
43
|
}
|
|
42
|
-
}
|
|
44
|
+
}
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -5,14 +5,31 @@
|
|
|
5
5
|
// python3 + a C++ toolchain). Non-fatal: a host that can't build it just loses
|
|
6
6
|
// interactive terminals, while the headless relay keeps working.
|
|
7
7
|
import { execSync } from 'node:child_process'
|
|
8
|
+
import { chmodSync, existsSync } from 'node:fs'
|
|
8
9
|
import { createRequire } from 'node:module'
|
|
10
|
+
import { dirname, join } from 'node:path'
|
|
9
11
|
|
|
10
12
|
const require = createRequire(import.meta.url)
|
|
11
13
|
|
|
14
|
+
const ensureSpawnHelperExecutable = () => {
|
|
15
|
+
if (process.platform === 'win32') return
|
|
16
|
+
const helper = join(
|
|
17
|
+
dirname(require.resolve('node-pty')),
|
|
18
|
+
'..',
|
|
19
|
+
'prebuilds',
|
|
20
|
+
`${process.platform}-${process.arch}`,
|
|
21
|
+
'spawn-helper',
|
|
22
|
+
)
|
|
23
|
+
if (existsSync(helper)) chmodSync(helper, 0o755)
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
const works = () => {
|
|
13
27
|
try {
|
|
28
|
+
ensureSpawnHelperExecutable()
|
|
14
29
|
const pty = require('node-pty')
|
|
15
|
-
pty
|
|
30
|
+
pty
|
|
31
|
+
.spawn(process.platform === 'win32' ? 'cmd.exe' : '/bin/sh', [], { cols: 80, rows: 24 })
|
|
32
|
+
.kill()
|
|
16
33
|
return true
|
|
17
34
|
} catch {
|
|
18
35
|
return false
|
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.
|