lobstah 0.8.1 → 0.8.2

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/runner.js CHANGED
@@ -1470,15 +1470,25 @@ function cacheDirectories(root, patterns) {
1470
1470
 
1471
1471
  // packages/core/dist/config.js
1472
1472
  var TRAP_PERMISSION_MODES = ["auto", "bypass", "bypassPermissions", "default", "acceptEdits", "plan", "dontAsk"];
1473
- function parseHarness(raw, where) {
1473
+ function parsePermissionDefaults(raw, where) {
1474
1474
  if (raw === void 0)
1475
1475
  return void 0;
1476
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
1477
+ throw new Error(`${where} must be a table`);
1476
1478
  const h = raw;
1477
- if (h.permissionMode !== void 0 && !TRAP_PERMISSION_MODES.includes(String(h.permissionMode))) {
1479
+ if (h.permissionMode !== void 0 && (typeof h.permissionMode !== "string" || !TRAP_PERMISSION_MODES.includes(h.permissionMode))) {
1478
1480
  throw new Error(`${where}.permissionMode must be one of ${TRAP_PERMISSION_MODES.join(", ")}`);
1479
1481
  }
1480
1482
  return h;
1481
1483
  }
1484
+ function parseHarness(raw, where) {
1485
+ const defaults = parsePermissionDefaults(raw, where);
1486
+ if (defaults)
1487
+ for (const harness of ["claude", "codex"]) {
1488
+ parsePermissionDefaults(defaults[harness], `${where.slice(0, -1)}.${harness}]`);
1489
+ }
1490
+ return defaults;
1491
+ }
1482
1492
  var POOL_NAME = /^[A-Za-z0-9_-]+$/;
1483
1493
  function parsePools(raw, repos) {
1484
1494
  const out = {};
@@ -4364,9 +4374,36 @@ async function recoverWorktree(repo, id) {
4364
4374
  }
4365
4375
  throw new Error(`unrecorded worktree at ${dir} for ${id} \u2014 ownership not proven (expected lobstah/${id} in ${repo.path}); inspect and preserve it, then relocate the conflicting checkout before retrying`);
4366
4376
  }
4377
+ function setupEnv(repo) {
4378
+ return { ...process.env, npm_config_confirm_modules_purge: "false", ...repo.env ?? {} };
4379
+ }
4380
+ var SetupCommandError = class extends Error {
4381
+ command;
4382
+ exitCode;
4383
+ outputTail;
4384
+ constructor(command, exitCode, outputTail2) {
4385
+ super(`setup command \`${command}\` failed${exitCode !== void 0 ? ` (exit ${exitCode})` : ""}${outputTail2 ? `: ${outputTail2}` : ""}`);
4386
+ this.command = command;
4387
+ this.exitCode = exitCode;
4388
+ this.outputTail = outputTail2;
4389
+ this.name = "SetupCommandError";
4390
+ }
4391
+ };
4392
+ function outputTail(stdout, stderr) {
4393
+ const last = (text) => text.split(/\r?\n/).map((l) => l.trim()).filter(Boolean).slice(-3);
4394
+ const tail = [...last(stdout), ...last(stderr)].join(" / ");
4395
+ return tail.length > 600 ? `\u2026${tail.slice(-600)}` : tail;
4396
+ }
4367
4397
  async function runSetup(repo, dir) {
4368
4398
  for (const cmd of repo.setup ?? []) {
4369
- await shell(cmd, { cwd: dir, env: { ...process.env, ...repo.env ?? {} } });
4399
+ const child = shell(cmd, { cwd: dir, env: setupEnv(repo) });
4400
+ child.child.stdin?.end();
4401
+ try {
4402
+ await child;
4403
+ } catch (err) {
4404
+ const e = err;
4405
+ throw new SetupCommandError(cmd, typeof e.code === "number" ? e.code : void 0, outputTail(e.stdout ?? "", e.stderr ?? ""));
4406
+ }
4370
4407
  }
4371
4408
  recordSetup(repo, dir);
4372
4409
  }
@@ -39,20 +39,35 @@ The descriptor's `repo` field resolves here; the key is what dispatchers name.
39
39
  `[repos.<key>.harness]` — per-repo harness defaults: `default` (`claude` \|
40
40
  `codex`), `model`, `effort`, `permissionMode`.
41
41
 
42
- `permissionMode` is the mode a thrown trap of the repo starts in, cold,
43
- resumed, or fresh: `auto` (the default when unset), `bypass` (also
44
- `bypassPermissions`), or another Claude Code mode (`default`, `acceptEdits`,
45
- `plan`, `dontAsk`). Auto is Claude Code `--permission-mode auto` and Codex
46
- `--approve-for-me`; bypass is Claude Code `--dangerously-skip-permissions` and
47
- Codex `--dangerously-bypass-approvals-and-sandbox`. A trap's roster profile
48
- and `man throw --bypass` come first. Any other value is a config error.
42
+ `permissionMode` is the mode a thrown trap starts in, cold, resumed, or
43
+ fresh: `auto` (the default when unset), `bypass` (also `bypassPermissions`),
44
+ or another Claude Code mode (`default`, `acceptEdits`, `plan`, `dontAsk`).
45
+ Set it in `[harness]` or `[repos.<key>.harness]` for either harness, or in
46
+ `[harness.codex]`, `[harness.claude]`, `[repos.<key>.harness.codex]` or
47
+ `[repos.<key>.harness.claude]` for one harness. Precedence, highest first:
48
+ `man throw --bypass`, roster profile `permissionMode`, repo + harness, repo,
49
+ global + harness, global, then `auto`. A roster harness override selects
50
+ that harness's defaults. Auto is Claude Code `--permission-mode auto` and
51
+ Codex `--approve-for-me`; bypass is Claude Code
52
+ `--dangerously-skip-permissions` and Codex
53
+ `--dangerously-bypass-approvals-and-sandbox`. Any other value is a config
54
+ error, including in a harness-specific table.
49
55
 
50
56
  ```toml
51
57
  [harness]
52
- permissionMode = "bypass" # every repo's traps start with no permission checks
58
+ permissionMode = "auto" # fallback for every repo and harness
59
+
60
+ [harness.codex]
61
+ permissionMode = "bypass"
62
+
63
+ [harness.claude]
64
+ permissionMode = "auto"
53
65
 
54
66
  [repos.web.harness]
55
- permissionMode = "auto" # except web's
67
+ permissionMode = "default" # web overrides both global harness defaults
68
+
69
+ [repos.web.harness.codex]
70
+ permissionMode = "auto" # web's Codex traps override the repo default
56
71
  ```
57
72
 
58
73
  `effort` reaches both harnesses: Claude as its effort level (`low`, `medium`,
@@ -479,6 +494,24 @@ entries. `lobstah doctor` reports whether the profile is applied and current.
479
494
  There is one Claude Code user settings file, so there is one `[permissions]`
480
495
  table rather than one per grounds.
481
496
 
497
+ ### Propose a permission change
498
+
499
+ The claimed helm can propose narrow allow-list changes without applying them:
500
+
501
+ ```sh
502
+ lobstah permissions propose --reason "Routine review updates" --codex-allow 'gh pr edit' --claude-allow 'Bash(pnpm exec eslint *)'
503
+ ```
504
+
505
+ Repeat either allow flag for more rules; `--codex-remove` and `--claude-remove`
506
+ remove existing allow rules. Codex prefixes also accept JSON argv arrays.
507
+ Forbidden commands, shell/environment wrappers and broad runner prefixes are
508
+ refused before a card is filed; existing duplicate rules are skipped.
509
+ The card shows the reason, exact diff and destination files. Approve applies
510
+ with backups, Reject changes nothing, and Edit lets you untick rules and
511
+ review the resulting diff. Changed settings require a fresh proposal.
512
+ Only the dedicated glass action can approve; CLI and ordinary decision
513
+ answers cannot. `apply`, `remove` and grants remain person-only actions.
514
+
482
515
  ## Environment
483
516
 
484
517
  | Variable | Meaning |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lobstah",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Harness-agnostic, token-efficient supervision framework for coding agents",
5
5
  "license": "MIT",
6
6
  "author": "aequitas labs LLC",