cc-safety-net 2.0.11 → 2.1.0
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 +47 -2
- package/dist/amp/cc-safety-net/index.ts +6 -6
- package/dist/api.d.ts +18 -0
- package/dist/api.js +1 -0
- package/dist/bin/cc-safety-net.js +84 -84
- package/dist/chunks/index-4g6x1r63.js +46 -0
- package/dist/chunks/index-znwvxg7d.js +18 -0
- package/dist/index.js +1 -1
- package/dist/openclaw/cc-safety-net/index.js +6 -6
- package/dist/openclaw/cc-safety-net/openclaw.plugin.json +1 -1
- package/dist/openclaw/cc-safety-net/package.json +1 -1
- package/dist/pi/index.js +2 -2
- package/package.json +6 -2
- package/dist/chunks/index-9dxxkq16.js +0 -62
package/dist/pi/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a}from"../chunks/index-25nh5wqs.js";import{
|
|
1
|
+
import{a}from"../chunks/index-25nh5wqs.js";import{k as u,l as c,m as f,n as C,o as g,p as E}from"../chunks/index-znwvxg7d.js";import{Fa as d,Y as p,ja as P,ub as v,va as y,xa as T,za as w}from"../chunks/index-4g6x1r63.js";var D="cc-safety-net",I="Manage CC Safety Net rulebooks",M="Help me configure CC Safety Net.";function s(e){e.registerCommand(D,{description:I,handler:async(n,o)=>{e.sendUserMessage(S(n),o.isIdle()?void 0:{deliverAs:"followUp"})}})}function S(e){return`${a.slice(a.indexOf("## Workflow")).trimEnd()}
|
|
2
2
|
|
|
3
3
|
## User request
|
|
4
4
|
|
|
5
|
-
${e.trim()||M}`}var h=new Map([["bash","posix"]]);function N(e){e.on("tool_call",x)}var x=_();function _(e={}){return(n,o)=>k(n,o,e)}function k(e,n,o){let t=O(e,n);if(!t)return;if("malformed"in t)return u(t.denial,()=>n.sessionManager.getSessionId(),{agent:"pi",toolName:t.denial.toolName,cwd:t.cwd}),A(t.denial);try{let i=E(t,{guard:{auditAllowed:
|
|
5
|
+
${e.trim()||M}`}var h=new Map([["bash","posix"]]);function N(e){e.on("tool_call",x)}var x=_();function _(e={}){return(n,o)=>k(n,o,e)}function k(e,n,o){let t=O(e,n);if(!t)return;if("malformed"in t)return u(t.denial,()=>n.sessionManager.getSessionId(),{agent:"pi",toolName:t.denial.toolName,cwd:t.cwd}),A(t.denial);try{let i=E(t,{guard:{auditAllowed:T(),policyOptions:o.policyOptions,dependencies:o.guardDependencies},audit:{agent:"pi",getSessionId:()=>n.sessionManager.getSessionId()}});return m(i,!0)}catch(i){if(!(i instanceof v))throw i;if(w(y.debug))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${g(i.cause)}`);return m(i.evaluation,t.route.kind==="command")}}function O(e,n){if(!e||typeof e!=="object")return;let o=e;if(o.type!==void 0&&o.type!=="tool_call")return;if(typeof o.toolName!=="string"||o.toolName.trim()==="")return l(n);let t=typeof n.cwd==="string"&&n.cwd.trim()!==""?p(".",[n.cwd]):void 0;if(!t)return l(n,o.toolName);let i=h.get(o.toolName);if(!o.input||typeof o.input!=="object")return i?l(n,o.toolName):void 0;if(!i)return d(o.toolName,o.input,{kind:P(o.toolName)},{configCwd:t,executionCwd:t},null);let r=o.input.command;if(typeof r!=="string"||r.trim()==="")return l(n,o.toolName);return d(o.toolName,o.input,{kind:"command",shell:i},{configCwd:t,executionCwd:t},r)}function l(e,n){return{malformed:!0,denial:f({toolName:n}),cwd:typeof e.cwd==="string"&&e.cwd.trim()?e.cwd:null}}function m(e,n){let o=c(e,{includeEvidence:n});return o?A(o):void 0}function A(e){return{block:!0,reason:C(e)}}function b(e){N(e),s(e)}export{b as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safety-net",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A coding agent CLI hook - block destructive commands and secret file access",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./api": {
|
|
14
|
+
"types": "./dist/api.d.ts",
|
|
15
|
+
"import": "./dist/api.js"
|
|
16
|
+
},
|
|
13
17
|
"./package.json": "./package.json"
|
|
14
18
|
},
|
|
15
19
|
"bin": {
|
|
@@ -103,5 +107,5 @@
|
|
|
103
107
|
"cursor",
|
|
104
108
|
"amp"
|
|
105
109
|
],
|
|
106
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "26d5803abf011ec7f674c27bdc97991bd1e627bf"
|
|
107
111
|
}
|