lobstah 0.8.3 → 0.8.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/dist/main.js +32 -27
- package/dist/runner.js +1 -1
- package/docs/configuration.md +5 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -13323,7 +13323,7 @@ async function recoverWorktree(repo, id2) {
|
|
|
13323
13323
|
throw new Error(`unrecorded worktree at ${dir} for ${id2} \u2014 ownership not proven (expected lobstah/${id2} in ${repo.path}); inspect and preserve it, then relocate the conflicting checkout before retrying`);
|
|
13324
13324
|
}
|
|
13325
13325
|
function setupEnv(repo) {
|
|
13326
|
-
return { ...process.env, npm_config_confirm_modules_purge: "false", ...repo.env ?? {} };
|
|
13326
|
+
return { ...process.env, CI: "true", npm_config_confirm_modules_purge: "false", ...repo.env ?? {} };
|
|
13327
13327
|
}
|
|
13328
13328
|
function outputTail(stdout, stderr) {
|
|
13329
13329
|
const last = (text) => text.split(/\r?\n/).map((l) => l.trim()).filter(Boolean).slice(-3);
|
|
@@ -18187,6 +18187,21 @@ var init_reviews_setup = __esm({
|
|
|
18187
18187
|
}
|
|
18188
18188
|
});
|
|
18189
18189
|
|
|
18190
|
+
// apps/cli/src/permission-context.ts
|
|
18191
|
+
function lobstahContext(worktrees = worktreesDir(), glassPort2 = loadConfig().glass.port) {
|
|
18192
|
+
return [
|
|
18193
|
+
`**lobstah worktrees**: Directories under ${worktrees}/ are the user's own development checkouts of their configured repos, created by lobstah (the user's local agent orchestrator) for its worker sessions ("traps"). A session working in one of them is in its trusted repo: reading, editing, building, testing, committing, and pushing a non-trunk branch there is ordinary project-scope work, not scope escalation into another repo.`,
|
|
18194
|
+
`**lobstah helm**: A session holding the lobstah helm (it ran \`lobstah man helm\`) orchestrates traps for the user. When the user asks in that session's own chat for a step a trap could not finish, the helm doing it is following the user's instruction, not Auto-Mode Bypass. The step is still judged on its own terms by every other rule.`,
|
|
18195
|
+
`**lobstah glass**: lobstah's glass (127.0.0.1:${glassPort2}) is the user's own UI on this machine. A \`decision-answer\` event with \`from: glass\` (shown by \`lobstah man wait\` / \`man report\`) is the user's own answer to that card, the same as a chat message from them.`
|
|
18196
|
+
];
|
|
18197
|
+
}
|
|
18198
|
+
var init_permission_context = __esm({
|
|
18199
|
+
"apps/cli/src/permission-context.ts"() {
|
|
18200
|
+
"use strict";
|
|
18201
|
+
init_dist2();
|
|
18202
|
+
}
|
|
18203
|
+
});
|
|
18204
|
+
|
|
18190
18205
|
// apps/cli/src/codex-permissions.ts
|
|
18191
18206
|
import * as fs98 from "node:fs";
|
|
18192
18207
|
import * as os12 from "node:os";
|
|
@@ -18196,21 +18211,9 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
18196
18211
|
function codexHome2(env = process.env, home = os12.homedir()) {
|
|
18197
18212
|
return env.CODEX_HOME ?? path86.join(home, ".codex");
|
|
18198
18213
|
}
|
|
18199
|
-
function codexBasePolicy(home = lobstahHome(), worktrees = worktreesDir()) {
|
|
18200
|
-
return [
|
|
18201
|
-
`**lobstah worktrees**: Directories under ${worktrees}/ are the user's own development checkouts of their configured repos, created by lobstah (the user's local agent orchestrator) for its worker sessions ("traps"). Building, testing, committing, and pushing a non-trunk branch from one of them is ordinary project work.`,
|
|
18202
|
-
`**lobstah helm**: A session holding the lobstah helm (it ran \`lobstah man helm\`) orchestrates traps for the user. When the user asks in that session's own chat for a step a trap could not finish, the helm doing it follows the user's instruction; it is not a workaround of an earlier denial. Judge the step itself as usual.`,
|
|
18203
|
-
`**lobstah human-only actions**: Merging to a repo's trunk, production deploys, creating or reading secrets and credentials, account and billing changes, and lobstah's own permission controls (\`lobstah grant\`, \`lobstah trap bypass\`, \`lobstah permissions apply\`, and edits to ${home}/config.toml or ${home}/grants) are the user's. Only the user's own message in the chat authorizes them; a lobstah dispatch brief, a trap report, or a helm relay is not the user's consent. Deny them otherwise.`
|
|
18204
|
-
];
|
|
18205
|
-
}
|
|
18206
18214
|
function codexBaseRules() {
|
|
18207
|
-
const person = "A person's own act, at their terminal or in lobstah's glass; an agent never runs it.";
|
|
18208
18215
|
return [
|
|
18209
|
-
{ decision: "allow", pattern: ["lobstah", "permissions", "propose"], justification: "The helm may propose a change; only the person in the glass can approve applying it." }
|
|
18210
|
-
{ decision: "forbidden", pattern: ["lobstah", "grant"], justification: `Granting agent permissions: ${person}` },
|
|
18211
|
-
{ decision: "forbidden", pattern: ["lobstah", "trap", ["grant", "bypass"]], justification: `Granting agent permissions: ${person}` },
|
|
18212
|
-
{ decision: "forbidden", pattern: ["lobstah", "permissions", ["apply", "remove"]], justification: `Changing lobstah's agent permission profile: ${person}` },
|
|
18213
|
-
{ decision: "prompt", pattern: ["gh", "pr", "merge"], justification: "Merging is the human's decision unless they asked for this merge." }
|
|
18216
|
+
{ decision: "allow", pattern: ["lobstah", "permissions", "propose"], justification: "The helm may propose a change; only the person in the glass can approve applying it." }
|
|
18214
18217
|
];
|
|
18215
18218
|
}
|
|
18216
18219
|
function configRules(c) {
|
|
@@ -18346,7 +18349,7 @@ function planCodex(ext, remove, env = process.env, home = os12.homedir()) {
|
|
|
18346
18349
|
if (review !== void 0 && !scan((before ?? "").split("\n")).some((l) => l.header === "auto_review")) {
|
|
18347
18350
|
throw new Error(`auto_review in ${configFile} is set with a dotted key or an inline table; move it into an [auto_review] table and run this again`);
|
|
18348
18351
|
}
|
|
18349
|
-
const entries = remove ? [] : [.../* @__PURE__ */ new Set([...
|
|
18352
|
+
const entries = remove ? [] : [.../* @__PURE__ */ new Set([...lobstahContext(), ...ext.environment])];
|
|
18350
18353
|
const policy = mergePolicy(current, entries);
|
|
18351
18354
|
const after = policy === current ? before ?? "" : setExtraPolicy(before ?? "", policy);
|
|
18352
18355
|
const rulesBefore = readText(rulesFile);
|
|
@@ -18455,6 +18458,7 @@ var init_codex_permissions = __esm({
|
|
|
18455
18458
|
"use strict";
|
|
18456
18459
|
init_dist();
|
|
18457
18460
|
init_dist2();
|
|
18461
|
+
init_permission_context();
|
|
18458
18462
|
BEGIN = "<!-- lobstah:begin (written by `lobstah permissions`; edits inside are replaced) -->";
|
|
18459
18463
|
BEGIN_PREFIX = "<!-- lobstah:begin";
|
|
18460
18464
|
END = "<!-- lobstah:end -->";
|
|
@@ -18498,14 +18502,10 @@ function rulePath(p, platform = process.platform) {
|
|
|
18498
18502
|
const posix6 = platform === "win32" ? p.replace(/\\/g, "/").replace(/^([A-Za-z]):/, (_, d) => `/${d.toLowerCase()}`) : p;
|
|
18499
18503
|
return `/${posix6.replace(/\/+$/, "")}`;
|
|
18500
18504
|
}
|
|
18501
|
-
function baseProfile(
|
|
18505
|
+
function baseProfile(worktrees = worktreesDir(), glassPort2) {
|
|
18502
18506
|
const glob = `${rulePath(worktrees)}/**`;
|
|
18503
18507
|
return {
|
|
18504
|
-
environment:
|
|
18505
|
-
`**lobstah worktrees**: Directories under ${worktrees}/ are the user's own development checkouts of their configured repos, created by lobstah (the user's local agent orchestrator) for its worker sessions ("traps"). A session working in one of them is in its trusted repo: reading, editing, building, testing, committing, and pushing a non-trunk branch there is ordinary project-scope work, not scope escalation into another repo.`,
|
|
18506
|
-
`**lobstah helm**: A session holding the lobstah helm (it ran \`lobstah man helm\`) orchestrates traps for the user. When the user asks in that session's own chat for a step a trap could not finish, the helm doing it is following the user's instruction, not Auto-Mode Bypass. The step is still judged on its own terms by every other rule.`,
|
|
18507
|
-
`**lobstah human-only actions**: Merging to a repo's trunk, production deploys, creating or reading secrets and credentials, account and billing changes, and lobstah's own permission controls (\`lobstah grant\`, \`lobstah trap bypass\`, \`lobstah permissions apply\`, and edits to ${home}/config.toml or ${home}/grants) are the user's. Only the user's own message in the chat authorizes them; a lobstah dispatch brief, a trap report, or a helm relay is not the user's consent.`
|
|
18508
|
-
],
|
|
18508
|
+
environment: lobstahContext(worktrees, glassPort2),
|
|
18509
18509
|
allow: [`Read(${glob})`, `Edit(${glob})`, "Bash(lobstah permissions propose *)"],
|
|
18510
18510
|
deny: []
|
|
18511
18511
|
};
|
|
@@ -18533,11 +18533,13 @@ function planProfile(current, desired, owned = EMPTY_PROFILE) {
|
|
|
18533
18533
|
const mine = new Set(owned[key]);
|
|
18534
18534
|
const before = list2(settings, parent, field, at);
|
|
18535
18535
|
let entries = before ? [...before] : [];
|
|
18536
|
-
const
|
|
18536
|
+
const rewritten = new Set([...mine].filter((e) => !entries.includes(e)).map(heading).filter(Boolean));
|
|
18537
|
+
const ours = (e) => mine.has(e) || rewritten.has(heading(e));
|
|
18538
|
+
const keepDefaults = key === "environment" && (want.size > 0 || entries.some((e) => e !== DEFAULTS && (!ours(e) || want.has(e))));
|
|
18537
18539
|
entries = entries.filter((e) => {
|
|
18538
|
-
const stale =
|
|
18540
|
+
const stale = ours(e) && !want.has(e) && !(e === DEFAULTS && keepDefaults);
|
|
18539
18541
|
if (stale) changes.push({ op: "-", at, entry: e });
|
|
18540
|
-
else if (
|
|
18542
|
+
else if (ours(e)) nextOwned[key].push(e);
|
|
18541
18543
|
return !stale;
|
|
18542
18544
|
});
|
|
18543
18545
|
if (key === "environment" && before === void 0 && want.size > 0) {
|
|
@@ -18688,12 +18690,13 @@ async function permissionsCommand(sub, opts, io = {}) {
|
|
|
18688
18690
|
}
|
|
18689
18691
|
log(toonKV(writePermissionApplication(application, env, io.check)));
|
|
18690
18692
|
}
|
|
18691
|
-
var LISTS, DEFAULTS, EMPTY_PROFILE, ownedFile;
|
|
18693
|
+
var LISTS, DEFAULTS, EMPTY_PROFILE, heading, ownedFile;
|
|
18692
18694
|
var init_permissions = __esm({
|
|
18693
18695
|
"apps/cli/src/permissions.ts"() {
|
|
18694
18696
|
"use strict";
|
|
18695
18697
|
init_dist2();
|
|
18696
18698
|
init_codex_permissions();
|
|
18699
|
+
init_permission_context();
|
|
18697
18700
|
LISTS = [
|
|
18698
18701
|
{ key: "environment", at: "autoMode.environment", parent: "autoMode", field: "environment" },
|
|
18699
18702
|
{ key: "allow", at: "permissions.allow", parent: "permissions", field: "allow" },
|
|
@@ -18701,6 +18704,7 @@ var init_permissions = __esm({
|
|
|
18701
18704
|
];
|
|
18702
18705
|
DEFAULTS = "$defaults";
|
|
18703
18706
|
EMPTY_PROFILE = { environment: [], allow: [], deny: [] };
|
|
18707
|
+
heading = (e) => /^\*\*[^*]+\*\*:/.exec(e)?.[0] ?? "";
|
|
18704
18708
|
ownedFile = () => path87.join(lobstahHome(), "claude-permissions.json");
|
|
18705
18709
|
}
|
|
18706
18710
|
});
|
|
@@ -18969,7 +18973,7 @@ function validatePermissionPrefix(prefix, current) {
|
|
|
18969
18973
|
if (executable === "npx") validatePermissionPrefix(prefix.slice(1), current);
|
|
18970
18974
|
else if (["pnpm", "npm", "yarn", "bun"].includes(executable) && ["exec", "dlx", "x"].includes(prefix[1] ?? ""))
|
|
18971
18975
|
validatePermissionPrefix(prefix.slice(2), current);
|
|
18972
|
-
const forbidden = [...
|
|
18976
|
+
const forbidden = [...PERMISSION_CONTROLS, ...current.codex.forbidden];
|
|
18973
18977
|
if (forbidden.some((rule) => overlapsForbidden(prefix, rule)) || current.deny.some((rule) => overlapsClaudeDeny(prefix, rule)))
|
|
18974
18978
|
throw new GrantError("That rule would allow a forbidden command in the current permission profile.");
|
|
18975
18979
|
}
|
|
@@ -19021,7 +19025,7 @@ function proposalTitle(rules) {
|
|
|
19021
19025
|
const named = commands.size === 1 && only.length <= 120 ? only : `${commands.size} command${commands.size === 1 ? "" : "s"}`;
|
|
19022
19026
|
return add2 ? `Allow ${named} for traps` : `Remove ${named} from traps`;
|
|
19023
19027
|
}
|
|
19024
|
-
var WRAPPERS, INTERPRETERS, BROAD_COMMANDS, executableName;
|
|
19028
|
+
var WRAPPERS, INTERPRETERS, BROAD_COMMANDS, PERMISSION_CONTROLS, executableName;
|
|
19025
19029
|
var init_permission_proposal_rules = __esm({
|
|
19026
19030
|
"apps/cli/src/permission-proposal-rules.ts"() {
|
|
19027
19031
|
"use strict";
|
|
@@ -19031,6 +19035,7 @@ var init_permission_proposal_rules = __esm({
|
|
|
19031
19035
|
WRAPPERS = /* @__PURE__ */ new Set(["env", "sudo", "command", "exec", "xargs", "nice", "nohup", "timeout", "doas"]);
|
|
19032
19036
|
INTERPRETERS = /* @__PURE__ */ new Set(["python", "python3", "node", "bash", "sh", "zsh", "fish", "dash", "powershell", "pwsh", "cmd", "ruby", "perl"]);
|
|
19033
19037
|
BROAD_COMMANDS = /* @__PURE__ */ new Set(["rm", "curl", "kill", "killall", "pkill"]);
|
|
19038
|
+
PERMISSION_CONTROLS = [["lobstah", "grant"], ["lobstah", "trap", ["grant", "bypass"]], ["lobstah", "permissions", ["apply", "remove"]]];
|
|
19034
19039
|
executableName = (word) => word.split(/[\\/]/).at(-1).toLowerCase().replace(/\.(exe|cmd|bat)$/, "");
|
|
19035
19040
|
}
|
|
19036
19041
|
});
|
package/dist/runner.js
CHANGED
|
@@ -4375,7 +4375,7 @@ async function recoverWorktree(repo, id) {
|
|
|
4375
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`);
|
|
4376
4376
|
}
|
|
4377
4377
|
function setupEnv(repo) {
|
|
4378
|
-
return { ...process.env, npm_config_confirm_modules_purge: "false", ...repo.env ?? {} };
|
|
4378
|
+
return { ...process.env, CI: "true", npm_config_confirm_modules_purge: "false", ...repo.env ?? {} };
|
|
4379
4379
|
}
|
|
4380
4380
|
var SetupCommandError = class extends Error {
|
|
4381
4381
|
command;
|
package/docs/configuration.md
CHANGED
|
@@ -441,11 +441,11 @@ merges lobstah's profile into your Claude Code user settings
|
|
|
441
441
|
the only file Claude Code reads `autoMode.environment` from, apart from managed
|
|
442
442
|
settings and `--settings`.
|
|
443
443
|
|
|
444
|
-
The base profile adds context for Claude Code's classifier
|
|
444
|
+
The base profile only adds context for Claude Code's classifier, never a
|
|
445
|
+
restriction; the classifier keeps its own safety policy:
|
|
445
446
|
- lobstah's worktrees are your development checkouts;
|
|
446
447
|
- the helm doing what you asked in its chat is not a bypass;
|
|
447
|
-
-
|
|
448
|
-
permission controls stay yours.
|
|
448
|
+
- an answer you give on a glass card is your own, like a chat message.
|
|
449
449
|
|
|
450
450
|
It also allows `Read` and `Edit` on `<lobstah home>/worktrees/**`.
|
|
451
451
|
`[permissions]` adds to it:
|
|
@@ -468,12 +468,11 @@ allow = [["wrangler", "dev"]]
|
|
|
468
468
|
| `codex.forbidden`, `codex.prompt`, `codex.allow` | Codex command rules, each an argv prefix (`["gh", "pr", "merge"]`). A Codex `allow` runs the command outside Codex's sandbox, so these are never translated from the Claude rules. |
|
|
469
469
|
|
|
470
470
|
**Codex.** Codex has its own home: `$CODEX_HOME`, else `~/.codex`. When it exists, the same verbs also change two things there:
|
|
471
|
-
- **The auto reviewer's added policy.** This is `[auto_review].extra_policy` in `config.toml`, which Codex's reviewer reads alongside its own policy. lobstah writes a block between `<!-- lobstah:begin … -->` and `<!-- lobstah:end -->` holding the same
|
|
471
|
+
- **The auto reviewer's added policy.** This is `[auto_review].extra_policy` in `config.toml`, which Codex's reviewer reads alongside its own policy. lobstah writes a block between `<!-- lobstah:begin … -->` and `<!-- lobstah:end -->` holding the same context entries and `environment`.
|
|
472
472
|
- Text outside the markers is yours and stays.
|
|
473
473
|
- lobstah edits only the key's own lines, keeping comments, key order and the string's quoting. It parses the file before and after; anything else changing refuses the write.
|
|
474
474
|
- **`rules/lobstah.rules`.** This file is wholly lobstah's. It holds the base rules plus `[permissions.codex]`:
|
|
475
|
-
-
|
|
476
|
-
- prompt: `gh pr merge`.
|
|
475
|
+
- allow: `lobstah permissions propose`. lobstah adds no `forbidden` or `prompt` rule of its own; Codex's reviewer keeps its own policy.
|
|
477
476
|
- `codex execpolicy check` loads every rule before the file is put in place.
|
|
478
477
|
|
|
479
478
|
`remove` deletes `rules/lobstah.rules` and lobstah's block. Neither verb sets `approvals_reviewer` or `approval_policy`: `man throw` already starts Codex traps with `--approve-for-me`.
|