nexrall-code 0.5.170 → 0.5.171
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/index.js +18 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104947,7 +104947,7 @@ var require_modePolicy = __commonJS({
|
|
|
104947
104947
|
return "allow";
|
|
104948
104948
|
if (exports2.BASH_TOOLS.has(tool) && isReadOnlyBash4(command) && !req.destructive)
|
|
104949
104949
|
return "allow";
|
|
104950
|
-
if (req.destructive)
|
|
104950
|
+
if (req.destructive && mode !== "auto")
|
|
104951
104951
|
return "confirm";
|
|
104952
104952
|
if (mode === "plan")
|
|
104953
104953
|
return "deny";
|
|
@@ -104970,7 +104970,7 @@ var require_modePolicy = __commonJS({
|
|
|
104970
104970
|
case "edit":
|
|
104971
104971
|
return "edit \u2014 edits files freely; asks before shell commands";
|
|
104972
104972
|
case "auto":
|
|
104973
|
-
return "auto \u2014 runs every tool on its own
|
|
104973
|
+
return "auto \u2014 runs every tool on its own, including irreversible commands";
|
|
104974
104974
|
}
|
|
104975
104975
|
}
|
|
104976
104976
|
function parseMode3(raw) {
|
|
@@ -105387,9 +105387,13 @@ var require_destructiveTokens = __commonJS({
|
|
|
105387
105387
|
const r2 = /^>(?![>&])/.test(t2[0]) ? t2 : (t2[0] === ":" || t2[0] === "true") && /^>(?![>&])/.test(t2[1] ?? "") ? t2.slice(1) : null;
|
|
105388
105388
|
if (r2) {
|
|
105389
105389
|
const target = r2[0].length > 1 ? r2[0].slice(1) : r2[1] ?? "";
|
|
105390
|
-
if (
|
|
105391
|
-
return
|
|
105392
|
-
|
|
105390
|
+
if (target.startsWith("/dev/"))
|
|
105391
|
+
return null;
|
|
105392
|
+
const m2 = hit("filesystem", "a bare `>` redirect truncates the file (contents lost)");
|
|
105393
|
+
const scratch = target !== "" && !/[$`~]|(^|\/)\.\.(\/|$)/.test(target) && (!target.startsWith("/") || /^\/(?:private\/)?(?:tmp|var\/folders)\//.test(target));
|
|
105394
|
+
if (scratch)
|
|
105395
|
+
m2.lowRisk = true;
|
|
105396
|
+
return m2;
|
|
105393
105397
|
}
|
|
105394
105398
|
}
|
|
105395
105399
|
const bin = base(t2[0]);
|
|
@@ -105670,12 +105674,15 @@ var require_destructive = __commonJS({
|
|
|
105670
105674
|
const viaRegex = classifyRegex(command);
|
|
105671
105675
|
if (viaRegex)
|
|
105672
105676
|
return viaRegex;
|
|
105677
|
+
let soft = null;
|
|
105673
105678
|
for (const tokens of (0, destructiveTokens_1.tokenize)(stripHeredocs(command))) {
|
|
105674
105679
|
const m2 = (0, destructiveTokens_1.classifyTokens)(tokens, (inner) => classify2(inner, depth + 1), classifyRawSql);
|
|
105675
|
-
if (m2)
|
|
105680
|
+
if (m2 && !m2.lowRisk)
|
|
105676
105681
|
return m2;
|
|
105682
|
+
if (m2 && !soft)
|
|
105683
|
+
soft = m2;
|
|
105677
105684
|
}
|
|
105678
|
-
return
|
|
105685
|
+
return soft;
|
|
105679
105686
|
}
|
|
105680
105687
|
function classifyDestructiveCommand(command) {
|
|
105681
105688
|
if (!command || typeof command !== "string")
|
|
@@ -153193,7 +153200,7 @@ async function requestPermissionInner(req) {
|
|
|
153193
153200
|
return false;
|
|
153194
153201
|
}
|
|
153195
153202
|
const destructive = (0, import_code_core6.isDestructiveBash)(tool, input);
|
|
153196
|
-
if (destructive && process.env.NEXRALL_ALLOW_DESTRUCTIVE !== "1") {
|
|
153203
|
+
if (destructive && process.env.NEXRALL_ALLOW_DESTRUCTIVE !== "1" && _mode !== "auto") {
|
|
153197
153204
|
return serialisePrompt(async () => {
|
|
153198
153205
|
announceAgent(req);
|
|
153199
153206
|
const command = input.command ?? input.cmd ?? "";
|
|
@@ -154422,7 +154429,7 @@ async function runDoctor(p) {
|
|
|
154422
154429
|
detail: `${p.workDir}${repo.inRepo ? ` (git${repo.branch ? `: ${repo.branch}` : ""})` : " (not a git repo)"}${proj.instructions ? ", has nexrall.md" : ", no nexrall.md"}`
|
|
154423
154430
|
});
|
|
154424
154431
|
if (p.yolo) {
|
|
154425
|
-
out.push({ id: "permissions", label: "Permissions", status: "warn", detail: "yolo \u2014 every tool call is auto-approved", fix: "Restart without --yolo/`/yolo`; use `--mode auto`
|
|
154432
|
+
out.push({ id: "permissions", label: "Permissions", status: "warn", detail: "yolo \u2014 every tool call is auto-approved", fix: "Restart without --yolo/`/yolo`; use `--mode auto` instead." });
|
|
154426
154433
|
} else if (p.modeLocked) {
|
|
154427
154434
|
out.push({ id: "permissions", label: "Permissions", status: "ok", detail: "read-only (--readonly), locked" });
|
|
154428
154435
|
} else {
|
|
@@ -169100,7 +169107,7 @@ function explainAction(rules, mode, workDir, action, opts = {}) {
|
|
|
169100
169107
|
const rule = (0, import_code_core16.evaluatePermission)(rules, action.tool, action.input, workDir);
|
|
169101
169108
|
if (rule === "deny")
|
|
169102
169109
|
return { mark: "\u2717", reason: "denied by a permission rule" };
|
|
169103
|
-
if ((0, import_code_core16.isDestructiveBash)(action.tool, action.input) && !opts.allowDestructive) {
|
|
169110
|
+
if ((0, import_code_core16.isDestructiveBash)(action.tool, action.input) && !opts.allowDestructive && mode !== "auto") {
|
|
169104
169111
|
return { mark: "\u26A0", reason: 'irreversible \u2014 always asks (type "yes")' };
|
|
169105
169112
|
}
|
|
169106
169113
|
if (rule === "allow")
|
|
@@ -171190,7 +171197,7 @@ async function runTurnHeadless(messages, modelAlias, workDir, _abortSignal, env4
|
|
|
171190
171197
|
emit({ type: "permission_denied", tool, reason: "tools" });
|
|
171191
171198
|
return false;
|
|
171192
171199
|
}
|
|
171193
|
-
const d = (0, import_code_core17.isDestructiveBash)(tool, input);
|
|
171200
|
+
const d = (0, import_code_core19.parseMode)(mode) === "auto" ? null : (0, import_code_core17.isDestructiveBash)(tool, input);
|
|
171194
171201
|
const policy = (0, import_code_core18.decide)({ tool, input, mode: (0, import_code_core19.parseMode)(mode), bypass: isYoloMode(), destructive: !!d });
|
|
171195
171202
|
const v = headlessVerdict({
|
|
171196
171203
|
rule: (0, import_code_core19.evaluatePermission)((0, import_code_core19.loadSettings)(workDir).permissions, tool, input, workDir),
|