@lesscap/baton-cli 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/dist/baton.mjs +30 -3
  2. package/package.json +1 -1
package/dist/baton.mjs CHANGED
@@ -6411,6 +6411,26 @@ var additionalDirs = () => {
6411
6411
  const dirs = raw.split(":").map((s) => s.trim()).filter((s) => s !== "" && isAbsolute(s) && existsSync3(s));
6412
6412
  return dirs.length > 0 ? dirs : void 0;
6413
6413
  };
6414
+ var truthy = (value) => {
6415
+ if (value === void 0) return void 0;
6416
+ const normalized = value.trim().toLowerCase();
6417
+ if (["1", "true", "yes", "on"].includes(normalized)) return true;
6418
+ if (["0", "false", "no", "off"].includes(normalized)) return false;
6419
+ return void 0;
6420
+ };
6421
+ var codexNetworkAccess = () => truthy(process.env.BATON_CODEX_NETWORK_ACCESS);
6422
+ var codexSandboxMode = (planMode) => {
6423
+ if (planMode) return "read-only";
6424
+ const raw = process.env.BATON_CODEX_SANDBOX_MODE;
6425
+ if (raw === "read-only" || raw === "workspace-write" || raw === "danger-full-access") return raw;
6426
+ return "workspace-write";
6427
+ };
6428
+ var codexApprovalPolicy = () => {
6429
+ const raw = process.env.BATON_CODEX_APPROVAL_POLICY;
6430
+ if (raw === "never" || raw === "on-request" || raw === "on-failure" || raw === "untrusted")
6431
+ return raw;
6432
+ return "never";
6433
+ };
6414
6434
 
6415
6435
  // src/session/runner/transcript.ts
6416
6436
  import { readdirSync, readFileSync as readFileSync4, statSync } from "node:fs";
@@ -6651,13 +6671,20 @@ async function* startCodexEvents(config, input, worker2, opts) {
6651
6671
  const codex = new Codex(env ? { env } : void 0);
6652
6672
  const resuming = !config.agentSessionId.startsWith("pending:");
6653
6673
  const addDirs = additionalDirs();
6674
+ const sandboxMode = codexSandboxMode(opts.planMode ?? false);
6675
+ const approvalPolicy = codexApprovalPolicy();
6676
+ const networkAccessEnabled = codexNetworkAccess();
6677
+ opts.log(
6678
+ `[codex] sandbox=${sandboxMode} approval=${approvalPolicy}${networkAccessEnabled === void 0 ? "" : ` network=${networkAccessEnabled}`}`
6679
+ );
6654
6680
  const threadOptions = {
6655
6681
  workingDirectory: config.worktreePath,
6656
6682
  skipGitRepoCheck: true,
6657
- sandboxMode: opts.planMode ? "read-only" : "workspace-write",
6658
- approvalPolicy: "never",
6683
+ sandboxMode,
6684
+ approvalPolicy,
6659
6685
  ...opts.model ? { model: opts.model } : {},
6660
- ...addDirs ? { additionalDirectories: addDirs } : {}
6686
+ ...addDirs ? { additionalDirectories: addDirs } : {},
6687
+ ...networkAccessEnabled === void 0 ? {} : { networkAccessEnabled }
6661
6688
  };
6662
6689
  const thread = resuming ? codex.resumeThread(config.agentSessionId, threadOptions) : codex.startThread(threadOptions);
6663
6690
  const runInput = opts.planMode ? withPlanPrefix(input) : input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lesscap/baton-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"