@nexrall/code-core 1.4.65 → 1.4.66
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/README.md +2 -2
- package/dist/agent/agentTypes.d.ts +2 -2
- package/dist/agent/agentTypes.d.ts.map +1 -1
- package/dist/agent/agentTypes.js +7 -143
- package/dist/agent/loop.d.ts +1 -1
- package/dist/agent/loop.js +6 -6
- package/dist/agent/memory.d.ts +11 -0
- package/dist/agent/memory.d.ts.map +1 -1
- package/dist/agent/memory.js +23 -3
- package/dist/agent/planMode.d.ts +14 -0
- package/dist/agent/planMode.d.ts.map +1 -1
- package/dist/agent/planMode.js +145 -17
- package/dist/agent/securityLint.js +2 -2
- package/dist/api/client.d.ts +1 -1
- package/dist/permissions/destructive.d.ts +9 -7
- package/dist/permissions/destructive.d.ts.map +1 -1
- package/dist/permissions/destructive.js +55 -8
- package/dist/permissions/destructiveTokens.d.ts +29 -0
- package/dist/permissions/destructiveTokens.d.ts.map +1 -0
- package/dist/permissions/destructiveTokens.js +469 -0
- package/dist/permissions/modePolicy.d.ts +12 -8
- package/dist/permissions/modePolicy.d.ts.map +1 -1
- package/dist/permissions/modePolicy.js +14 -10
- package/dist/types.d.ts +2 -2
- package/package.json +8 -7
|
@@ -37,16 +37,20 @@ export declare const FILE_MUTATE_TOOLS: Set<string>;
|
|
|
37
37
|
/** Tools that run a shell command. */
|
|
38
38
|
export declare const BASH_TOOLS: Set<string>;
|
|
39
39
|
/**
|
|
40
|
-
* Is this bash command read-only?
|
|
40
|
+
* Is this bash command read-only — i.e. safe to run WITHOUT asking?
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* (
|
|
45
|
-
*
|
|
42
|
+
* History: this used to be `!bashNeedsRepoLock(command)`. That classifier answers a
|
|
43
|
+
* different question — "does this need the repo-state LOCK?" — by listing the ~30
|
|
44
|
+
* build/VCS verbs that take one (git, npm, make …). Everything NOT on that list was
|
|
45
|
+
* therefore "read-only", so `rm file`, `mv`, `echo x > f`, `sed -i`, `kill` and
|
|
46
|
+
* `curl … | sh` all ran with no prompt in `ask` and `edit` mode. Measured through the
|
|
47
|
+
* real `requestPermission`: prompted=0 for each. A denylist of mutators can never be
|
|
48
|
+
* complete; the gate needs an ALLOWLIST of readers, which plan mode already had.
|
|
46
49
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
+
* It now delegates to `isReadOnlyPipeline` (agent/planMode.ts), the same "provably
|
|
51
|
+
* read-only" classifier the plan-mode lock uses, so "read-only" means one thing in
|
|
52
|
+
* both places. `bashNeedsRepoLock` is unchanged and still correct for what it is for:
|
|
53
|
+
* deciding which calls must not run concurrently.
|
|
50
54
|
*/
|
|
51
55
|
export declare function isReadOnlyBash(command: string): boolean;
|
|
52
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modePolicy.d.ts","sourceRoot":"","sources":["../../src/permissions/modePolicy.ts"],"names":[],"mappings":"AAsBA,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D,kDAAkD;AAClD,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,KAAK,GACL,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,aAW1B,CAAC;AAEH,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB,aAG3B,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,aAE5B,CAAC;AAEH,sCAAsC;AACtC,eAAO,MAAM,UAAU,aAAsD,CAAC;AAE9E
|
|
1
|
+
{"version":3,"file":"modePolicy.d.ts","sourceRoot":"","sources":["../../src/permissions/modePolicy.ts"],"names":[],"mappings":"AAsBA,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D,kDAAkD;AAClD,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,KAAK,GACL,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,aAW1B,CAAC;AAEH,0CAA0C;AAC1C,eAAO,MAAM,gBAAgB,aAG3B,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,aAE5B,CAAC;AAEH,sCAAsC;AACtC,eAAO,MAAM,UAAU,aAAsD,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,cAAc,CAwDvD;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAOzD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAGtD"}
|
|
@@ -5,7 +5,7 @@ exports.isReadOnlyBash = isReadOnlyBash;
|
|
|
5
5
|
exports.decide = decide;
|
|
6
6
|
exports.describeMode = describeMode;
|
|
7
7
|
exports.parseMode = parseMode;
|
|
8
|
-
const
|
|
8
|
+
const planMode_1 = require("../agent/planMode");
|
|
9
9
|
/**
|
|
10
10
|
* Tools that only ever READ. Always allowed, in every mode including plan.
|
|
11
11
|
*
|
|
@@ -48,19 +48,23 @@ exports.FILE_MUTATE_TOOLS = new Set([
|
|
|
48
48
|
/** Tools that run a shell command. */
|
|
49
49
|
exports.BASH_TOOLS = new Set(['bash', 'run_command', 'execute_command']);
|
|
50
50
|
/**
|
|
51
|
-
* Is this bash command read-only?
|
|
51
|
+
* Is this bash command read-only — i.e. safe to run WITHOUT asking?
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* (
|
|
56
|
-
*
|
|
53
|
+
* History: this used to be `!bashNeedsRepoLock(command)`. That classifier answers a
|
|
54
|
+
* different question — "does this need the repo-state LOCK?" — by listing the ~30
|
|
55
|
+
* build/VCS verbs that take one (git, npm, make …). Everything NOT on that list was
|
|
56
|
+
* therefore "read-only", so `rm file`, `mv`, `echo x > f`, `sed -i`, `kill` and
|
|
57
|
+
* `curl … | sh` all ran with no prompt in `ask` and `edit` mode. Measured through the
|
|
58
|
+
* real `requestPermission`: prompted=0 for each. A denylist of mutators can never be
|
|
59
|
+
* complete; the gate needs an ALLOWLIST of readers, which plan mode already had.
|
|
57
60
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
+
* It now delegates to `isReadOnlyPipeline` (agent/planMode.ts), the same "provably
|
|
62
|
+
* read-only" classifier the plan-mode lock uses, so "read-only" means one thing in
|
|
63
|
+
* both places. `bashNeedsRepoLock` is unchanged and still correct for what it is for:
|
|
64
|
+
* deciding which calls must not run concurrently.
|
|
61
65
|
*/
|
|
62
66
|
function isReadOnlyBash(command) {
|
|
63
|
-
return
|
|
67
|
+
return (0, planMode_1.isReadOnlyPipeline)(command);
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* The single source of truth for "should we prompt?".
|
package/dist/types.d.ts
CHANGED
|
@@ -566,7 +566,7 @@ export interface AgentLoopOptions {
|
|
|
566
566
|
*
|
|
567
567
|
* Separate from _allowedTools because it restricts WHICH PATHS a granted write tool may
|
|
568
568
|
* touch, not which tools exist — intersecting tool names cannot express it. It must be
|
|
569
|
-
* inherited, or nesting defeats it:
|
|
569
|
+
* inherited, or nesting defeats it: a test-only agent may only write tests, but delegating to
|
|
570
570
|
* any agent without that flag would write production source on its behalf.
|
|
571
571
|
*/
|
|
572
572
|
_testFilesOnly?: boolean;
|
|
@@ -584,7 +584,7 @@ export interface AgentLoopOptions {
|
|
|
584
584
|
/** As `_extraAgentTypes`, for `@nexrall/agent`'s `registerSkills()`. */
|
|
585
585
|
_extraSkills?: import('./agent/skills').Skill[];
|
|
586
586
|
/**
|
|
587
|
-
* Internal: the sub-agent TYPE name this run is executing as (e.g. '
|
|
587
|
+
* Internal: the sub-agent TYPE name this run is executing as (e.g. 'explorer'),
|
|
588
588
|
* or undefined for the main agent.
|
|
589
589
|
*
|
|
590
590
|
* Carried for the audit trail: `_agentScope` identifies the run instance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrall/code-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.66",
|
|
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)",
|
|
@@ -79,6 +79,12 @@
|
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=18.0.0"
|
|
81
81
|
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "tsc",
|
|
84
|
+
"dev": "tsc --watch",
|
|
85
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
86
|
+
"prepublishOnly": "npm run build && npm test"
|
|
87
|
+
},
|
|
82
88
|
"dependencies": {
|
|
83
89
|
"eventsource-parser": "^1.1.2",
|
|
84
90
|
"node-fetch": "^3.3.2",
|
|
@@ -89,10 +95,5 @@
|
|
|
89
95
|
"devDependencies": {
|
|
90
96
|
"@types/node": "^26.0.1",
|
|
91
97
|
"typescript": "^6.0.3"
|
|
92
|
-
},
|
|
93
|
-
"scripts": {
|
|
94
|
-
"build": "tsc",
|
|
95
|
-
"dev": "tsc --watch",
|
|
96
|
-
"test": "npm run build && node --test test/*.test.mjs"
|
|
97
98
|
}
|
|
98
|
-
}
|
|
99
|
+
}
|