cc-safety-net 2.3.4 → 2.4.1

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.
@@ -2,7 +2,7 @@
2
2
  "id": "cc-safety-net",
3
3
  "name": "CC Safety Net",
4
4
  "description": "Block destructive commands and secret-file access before OpenClaw runs a tool.",
5
- "version": "2.3.4",
5
+ "version": "2.4.1",
6
6
  "activation": {
7
7
  "onStartup": true
8
8
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safety-net",
3
- "version": "2.3.4",
3
+ "version": "2.4.1",
4
4
  "description": "Block destructive commands and secret-file access before OpenClaw runs a tool.",
5
5
  "type": "module",
6
6
  "openclaw": {
package/dist/pi/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{O,ie,r,se,P,c,d}from"../chunks/index-e7vaxtyk.js";import{ce}from"../chunks/index-68v9n663.js";import{ee,K,T,te,_e,j}from"../chunks/index-zqqsva7r.js";var f="cc-safety-net",C="Operate CC Safety Net: explain blocks, rules, integrations, diagnostics",g="Help me with CC Safety Net.";function s(o){o.registerCommand(f,{description:C,handler:async(n,e)=>{o.sendUserMessage(y(n),e.isIdle()?void 0:{deliverAs:"followUp"})}})}function y(o){return`${ce.slice(ce.indexOf("# CC Safety Net")).trimEnd()}
1
+ import{Ce,j,Se,it,l,i,xe,_,ce,at,u,p}from"../chunks/index-chc1n91k.js";import{te}from"../chunks/index-n0tze7vr.js";import{we,F}from"../chunks/index-31w7hfwv.js";var g="cc-safety-net",P="Operate CC Safety Net: explain blocks, rules, integrations, diagnostics",y="Help me with CC Safety Net.";function c(e){e.registerCommand(g,{description:P,handler:async(n,r)=>{e.sendUserMessage(T(n),r.isIdle()?void 0:{deliverAs:"followUp"})}})}function T(e){return`${te.slice(te.indexOf("# CC Safety Net")).trimEnd()}
2
2
 
3
3
  ## User request
4
4
 
5
- ${o.trim()||g}`}var w=new Map([["bash","posix"]]);function u(o){o.on("tool_call",v)}var v=N();function N(o={}){return(n,e)=>E(n,e,o)}function E(o,n,e){let t=A(o,n);if(!t)return;if("malformed"in t)return ee(t.denial,()=>n.sessionManager.getSessionId(),{agent:"pi",toolName:t.denial.toolName,cwd:t.cwd}),p(t.denial);try{let i=j(t,{guard:{auditAllowed:se(),policyOptions:e.policyOptions,dependencies:e.guardDependencies},audit:{agent:"pi",getSessionId:()=>n.sessionManager.getSessionId()}});return m(i,!0)}catch(i){if(!(i instanceof d))throw i;if(P(r.debug))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${_e(i.cause)}`);return m(i.evaluation,t.route.kind==="command")}}function A(o,n){if(!o||typeof o!=="object")return;let e=o;if(e.type!==void 0&&e.type!=="tool_call")return;if(typeof e.toolName!=="string"||e.toolName.trim()==="")return l(n);let t=typeof n.cwd==="string"&&n.cwd.trim()!==""?O(".",[n.cwd]):void 0;if(!t)return l(n,e.toolName);let i=w.get(e.toolName);if(!e.input||typeof e.input!=="object")return i?l(n,e.toolName):void 0;if(!i)return c(e.toolName,e.input,{kind:ie(e.toolName)},{configCwd:t,executionCwd:t},null);let a=e.input.command;if(typeof a!=="string"||a.trim()==="")return l(n,e.toolName);return c(e.toolName,e.input,{kind:"command",shell:i},{configCwd:t,executionCwd:t},a)}function l(o,n){return{malformed:!0,denial:T({toolName:n}),cwd:typeof o.cwd==="string"&&o.cwd.trim()?o.cwd:null}}function m(o,n){let e=K(o,{includeEvidence:n});return e?p(e):void 0}function p(o){return{block:!0,reason:te(o)}}function D(o){u(o),s(o)}export{D as default};
5
+ ${e.trim()||y}`}var v=new Map([["bash","posix"]]);function C(e){e.on("tool_call",w)}var w=N();function N(e={}){return(n,r)=>{try{return E(n,r,e)}catch(o){return console.error("CC Safety Net error:",o),m(j())}}}function E(e,n,r){let o=l(),t=h(e,n,o.paths);if(!t)return;if("malformed"in t)return we(o,t.denial,()=>n.sessionManager.getSessionId(),{agent:"pi",toolName:t.denial.toolName,cwd:t.cwd}),m(t.denial);try{let a=F(o,t,{guard:{auditAllowed:xe(o.env),policyOptions:r.policyOptions,dependencies:r.guardDependencies},audit:{agent:"pi",getSessionId:()=>n.sessionManager.getSessionId()}});return f(a,!0)}catch(a){if(!(a instanceof p))throw a;if(_(i.debug,o.env))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${it(a.cause)}`);return f(a.evaluation,t.route.kind==="command")}}function h(e,n,r){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 d(n);let t=typeof n.cwd==="string"&&n.cwd.trim()!==""?at(".",[n.cwd],r):void 0;if(!t)return d(n,o.toolName);let a=v.get(o.toolName);if(!o.input||typeof o.input!=="object")return a?d(n,o.toolName):void 0;if(!a)return u(o.toolName,o.input,{kind:ce(o.toolName)},{configCwd:t,executionCwd:t},null);let s=o.input.command;if(typeof s!=="string"||s.trim()==="")return d(n,o.toolName);return u(o.toolName,o.input,{kind:"command",shell:a},{configCwd:t,executionCwd:t},s)}function d(e,n){return{malformed:!0,denial:j({toolName:n}),cwd:typeof e.cwd==="string"&&e.cwd.trim()?e.cwd:null}}function f(e,n){let r=Ce(e,{includeEvidence:n});return r?m(r):void 0}function m(e){return{block:!0,reason:Se(e)}}function A(e){C(e),c(e)}export{A as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safety-net",
3
- "version": "2.3.4",
3
+ "version": "2.4.1",
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",
@@ -21,31 +21,31 @@
21
21
  "ccsn": "dist/bin/cc-safety-net.js"
22
22
  },
23
23
  "files": [
24
- "dist",
25
- "THIRD_PARTY_LICENSES.txt"
24
+ "dist"
26
25
  ],
27
26
  "scripts": {
28
27
  "audit:dependencies": "bun audit",
29
28
  "build": "bun run clean && bun scripts/project-bun.ts scripts/build.ts",
30
29
  "build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --declaration",
31
- "build:schema": "bun run scripts/build-schema.ts",
32
30
  "verify:package": "bun run scripts/verify-package.ts",
33
31
  "verify:repository-plugin": "bun run scripts/verify-repository-plugin.ts",
34
32
  "verify:coverage": "bun run scripts/verify-coverage.ts",
35
33
  "clean": "rm -rf dist",
36
34
  "check": "bun run lint && bun run typecheck && bun run knip && bun run check-duplicates && bun run test:coverage && bun run verify:coverage",
37
35
  "check:ci": "bun run lint:ci && bun run typecheck && bun run knip && bun run check-duplicates && bun run test:coverage && bun run verify:coverage",
38
- "lint": "biome check --write",
39
- "lint:ci": "biome ci .",
36
+ "lint": "biome check --write --error-on-warnings",
37
+ "lint:ci": "biome ci --error-on-warnings .",
40
38
  "typecheck": "tsc --noEmit && tsc -p tsconfig.gui.json --noEmit",
41
39
  "knip": "knip-bun --production",
42
- "check-duplicates": "bunx jscpd src tests --no-tips --exit-code 1 --reporters ai --ignore '**/*.svg'",
40
+ "check-duplicates": "bunx jscpd src tests --no-tips --exit-code 1 --reporters ai --ignore '**/*.svg' --ignore 'src/gui/frontend/**' --ignore-pattern 'import\\s[\\s\\S]*?from\\s[^;]*;'",
43
41
  "test": "bun test",
44
42
  "test:e2e": "bun test tests/e2e",
45
43
  "test:e2e:stability": "bun test tests/e2e --randomize --rerun-each 3",
46
44
  "test:e2e:live": "CC_SAFETY_NET_E2E_LIVE=1 bun test tests/e2e-live",
47
45
  "test:coverage": "AGENT=1 bun test tests --path-ignore-patterns 'tests/e2e-live/**' --coverage --coverage-reporter=text --coverage-reporter=lcov",
48
- "cc-safety-net": "bun run src/cli/cc-safety-net.ts"
46
+ "cc-safety-net": "bun run src/entries/bin.ts",
47
+ "ccsn": "bun run src/entries/bin.ts",
48
+ "eval": "claude plugin eval . --ablation with-without --judge-model sonnet --allow-tools \"Bash(npx -y cc-safety-net:*)\" \"Bash(npx cc-safety-net:*)\""
49
49
  },
50
50
  "author": {
51
51
  "name": "J Liew",
@@ -83,9 +83,6 @@
83
83
  "./dist/pi/index.js"
84
84
  ]
85
85
  },
86
- "dependencies": {
87
- "zod": "4.3.5"
88
- },
89
86
  "overrides": {
90
87
  "js-yaml": "^4.3.1",
91
88
  "picomatch@^2.3.1": "2.3.2",
@@ -96,7 +93,7 @@
96
93
  "engines": {
97
94
  "node": ">=18"
98
95
  },
99
- "packageManager": "bun@1.4.1",
96
+ "packageManager": "bun@1.4.2",
100
97
  "keywords": [
101
98
  "claude-code",
102
99
  "opencode",
@@ -109,5 +106,5 @@
109
106
  "grok",
110
107
  "grok-build"
111
108
  ],
112
- "gitHead": "e34ca61f448664c5fe056dd0c0cc15264a8712d6"
109
+ "gitHead": "879ed64316014198ccbe54b9a9152432f596f969"
113
110
  }
@@ -1,23 +0,0 @@
1
- zod 4.3.5
2
-
3
- MIT License
4
-
5
- Copyright (c) 2025 Colin McDonnell
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.