@nexrall/code-core 1.4.69 → 1.4.70

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.
@@ -24,7 +24,11 @@ export interface DestructiveMatch {
24
24
  category: string;
25
25
  /** Short human-readable reason shown in the confirmation prompt. */
26
26
  reason: string;
27
- /** Contained harm — `auto` mode may skip the confirmation (see TokenMatch.lowRisk). */
27
+ /**
28
+ * Contained harm (e.g. a scratch-file truncation — see TokenMatch.lowRisk). The gate
29
+ * confirms it exactly like any other destructive command; the flag exists so a soft hit
30
+ * never masks a real one later in the chain (see classify()).
31
+ */
28
32
  lowRisk?: boolean;
29
33
  }
30
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"destructive.d.ts","sourceRoot":"","sources":["../../src/permissions/destructive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAGnF;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAQvG"}
1
+ {"version":3,"file":"destructive.d.ts","sourceRoot":"","sources":["../../src/permissions/destructive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAGnF;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAQvG"}
@@ -24,7 +24,8 @@ export interface TokenMatch {
24
24
  reason: string;
25
25
  /**
26
26
  * True when the harm is contained (e.g. truncating a scratch file under /tmp or a
27
- * relative path). `auto` mode may run these without asking; every other mode still does.
27
+ * relative path). Classification only — the gate confirms these like any other
28
+ * destructive command; it exists so a soft hit never masks a real one later in the chain.
28
29
  */
29
30
  lowRisk?: boolean;
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"destructiveTokens.d.ts","sourceRoot":"","sources":["../../src/permissions/destructiveTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAID,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CA2BhD;AAgQD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,EAC/C,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,GAC7C,UAAU,GAAG,IAAI,CA8DnB"}
1
+ {"version":3,"file":"destructiveTokens.d.ts","sourceRoot":"","sources":["../../src/permissions/destructiveTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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,GAAG,cAAc,CA6DvD;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAOzD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAGtD"}
@@ -84,13 +84,16 @@ function decide(req) {
84
84
  return 'allow';
85
85
  if (exports.BASH_TOOLS.has(tool) && isReadOnlyBash(command) && !req.destructive)
86
86
  return 'allow';
87
- // 2. Irreversible actions ALWAYS need an explicit human "yes".
87
+ // 2. Irreversible actions ALWAYS need an explicit human "yes", in EVERY mode.
88
88
  // Before bypass, before mode. `rm -rf`, `git push --force`, `DROP TABLE` are not
89
89
  // things any mode should silently perform, and the strong confirm treatment (type
90
90
  // the word "yes", no "approve all") is what makes it a real speed bump.
91
- // EXCEPT `auto`: the user chose "run everything on your own", so it does not stop here
92
- // (hard-blocked commands such as `rm -rf /` are still denied by the executor).
93
- if (req.destructive && mode !== 'auto')
91
+ // `auto` included, deliberately: it is the DEFAULT mode, and it was briefly exempt
92
+ // (2026-10-02, reverted 2026-10-03) — which left every default session one prompt
93
+ // short of this guard. `auto` means "run the routine things on your own", never
94
+ // "skip the dialog for the unrecoverable ones" (hard-blocked commands such as
95
+ // `rm -rf /` are still denied outright by the executor).
96
+ if (req.destructive)
94
97
  return 'confirm';
95
98
  // 3. Plan mode: refuse every remaining (i.e. mutating) tool outright.
96
99
  // A refusal, not a prompt — the guarantee is "nothing changes until I approve the
@@ -138,7 +141,7 @@ function describeMode(mode) {
138
141
  case 'plan': return 'plan — read-only, produces a plan for approval';
139
142
  case 'ask': return 'ask — approves reads; asks before edits and commands';
140
143
  case 'edit': return 'edit — edits files freely; asks before shell commands';
141
- case 'auto': return 'auto — runs every tool on its own, including irreversible commands';
144
+ case 'auto': return 'auto — runs every tool on its own; still confirms irreversible actions';
142
145
  }
143
146
  }
144
147
  /** Normalise arbitrary input to a known mode, defaulting to the safe middle. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexrall/code-core",
3
- "version": "1.4.69",
3
+ "version": "1.4.70",
4
4
  "description": "Core agent loop, tools, and extension primitives for Nexrall Code — embed an AI coding agent in any Node.js application.",
5
5
  "license": "MIT",
6
6
  "author": "Nexrall <support@nexrall.com> (https://nexrall.com)",