cc-safety-net 2.0.6 → 2.0.7

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.0.6",
5
+ "version": "2.0.7",
6
6
  "activation": {
7
7
  "onStartup": true
8
8
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safety-net",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
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{a as j}from"../chunks/index-25nh5wqs.js";import{M as y,N as Y,O as F,P as G,Q as U,_ as L,ib as R,ja as b,jb as K,la as h,mb as S,na as O,ta as B}from"../chunks/index-3a1zwkma.js";var P="cc-safety-net",N="Manage CC Safety Net rulebooks",w="Help me configure CC Safety Net.";function f(H){H.registerCommand(P,{description:N,handler:async(z,q)=>{H.sendUserMessage(A(z),q.isIdle()?void 0:{deliverAs:"followUp"})}})}function A(H){return`${j.slice(j.indexOf("## Workflow")).trimEnd()}
1
+ import{a as $}from"../chunks/index-25nh5wqs.js";import{M as Q,N as W,O as f,P as k,Q as y,_ as Y,jb as L,ka as F,kb as b,ma as G,nb as I,oa as U,ua as j}from"../chunks/index-4pw6zr4t.js";var R="cc-safety-net",w="Manage CC Safety Net rulebooks",S="Help me configure CC Safety Net.";function B(z){z.registerCommand(R,{description:w,handler:async(H,q)=>{z.sendUserMessage(D(H),q.isIdle()?void 0:{deliverAs:"followUp"})}})}function D(z){return`${$.slice($.indexOf("## Workflow")).trimEnd()}
2
2
 
3
3
  ## User request
4
4
 
5
- ${H.trim()||w}`}var I=new Map([["bash",{commandField:"command",shell:"posix"}],["Shell",{commandField:"command",cwdField:"working_directory",shell:"auto"}]]);function D(H){H.on("tool_call",_)}var _=g();function g(H={}){return(z,q)=>v(z,q,H)}function v(H,z,q){let V=T(H,z);if(!V)return;if("malformed"in V)return y(V.denial,()=>z.sessionManager.getSessionId(),{agent:"pi",toolName:V.denial.toolName,cwd:V.cwd}),M(V.denial);try{let J=S(V,{guard:{auditAllowed:h(),policyOptions:q.policyOptions,dependencies:q.guardDependencies},audit:{agent:"pi",getSessionId:()=>z.sessionManager.getSessionId()}});return k(J,J.stage!=="config-state")}catch(J){if(!(J instanceof R))throw J;if(O(b.debug))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${U(J.cause)}`);return k(J.evaluation,V.route.kind==="command")}}function T(H,z){if(!H||typeof H!=="object")return;let q=H;if(q.type!==void 0&&q.type!=="tool_call")return;if(typeof q.toolName!=="string"||q.toolName.trim()==="")return Z(z);if(!(typeof z.cwd==="string"&&z.cwd.trim()!==""?K(".",[z.cwd]):void 0))return Z(z,q.toolName);let J=I.get(q.toolName);if(!q.input||typeof q.input!=="object")return J?Z(z,q.toolName):void 0;if(!J)return B(q.toolName,q.input,{kind:L(q.toolName)},{configCwd:z.cwd,executionCwd:z.cwd},null);let $=q.input[J.commandField];if(typeof $!=="string"||$.trim()==="")return Z(z,q.toolName);let Q=J.cwdField!==void 0&&Object.hasOwn(q.input,J.cwdField)&&q.input[J.cwdField]!==void 0,X=J.cwdField&&Q?q.input[J.cwdField]:void 0;if(Q&&(typeof X!=="string"||X.trim()===""))return Z(z,q.toolName,$);let W=typeof X==="string"?K(X,[z.cwd]):z.cwd;if(!W)return Z(z,q.toolName,$,typeof X==="string"?X:void 0);return B(q.toolName,q.input,{kind:"command",shell:J.shell},{configCwd:z.cwd,executionCwd:W},$)}function Z(H,z,q,V){return{malformed:!0,denial:F({command:q,segment:V,toolName:z}),cwd:typeof H.cwd==="string"&&H.cwd.trim()?H.cwd:null}}function k(H,z){let q=Y(H,{includeEvidence:z});return q?M(q):void 0}function M(H){return{block:!0,reason:G(H)}}function E(H){D(H),f(H)}export{E as default};
5
+ ${z.trim()||S}`}var M=new Map([["bash","posix"]]);function h(z){z.on("tool_call",P)}var P=N();function N(z={}){return(H,q)=>g(H,q,z)}function g(z,H,q){let J=A(z,H);if(!J)return;if("malformed"in J)return Q(J.denial,()=>H.sessionManager.getSessionId(),{agent:"pi",toolName:J.denial.toolName,cwd:J.cwd}),O(J.denial);try{let V=I(J,{guard:{auditAllowed:G(),policyOptions:q.policyOptions,dependencies:q.guardDependencies},audit:{agent:"pi",getSessionId:()=>H.sessionManager.getSessionId()}});return K(V,V.stage!=="config-state")}catch(V){if(!(V instanceof L))throw V;if(U(F.debug))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${y(V.cause)}`);return K(V.evaluation,J.route.kind==="command")}}function A(z,H){if(!z||typeof z!=="object")return;let q=z;if(q.type!==void 0&&q.type!=="tool_call")return;if(typeof q.toolName!=="string"||q.toolName.trim()==="")return X(H);let J=typeof H.cwd==="string"&&H.cwd.trim()!==""?b(".",[H.cwd]):void 0;if(!J)return X(H,q.toolName);let V=M.get(q.toolName);if(!q.input||typeof q.input!=="object")return V?X(H,q.toolName):void 0;if(!V)return j(q.toolName,q.input,{kind:Y(q.toolName)},{configCwd:J,executionCwd:J},null);let Z=q.input.command;if(typeof Z!=="string"||Z.trim()==="")return X(H,q.toolName);return j(q.toolName,q.input,{kind:"command",shell:V},{configCwd:J,executionCwd:J},Z)}function X(z,H){return{malformed:!0,denial:f({toolName:H}),cwd:typeof z.cwd==="string"&&z.cwd.trim()?z.cwd:null}}function K(z,H){let q=W(z,{includeEvidence:H});return q?O(q):void 0}function O(z){return{block:!0,reason:k(z)}}function _(z){h(z),B(z)}export{_ as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safety-net",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
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",
@@ -25,7 +25,6 @@
25
25
  "build": "bun run clean && bun run scripts/build.ts",
26
26
  "build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --declaration",
27
27
  "build:schema": "bun run scripts/build-schema.ts",
28
- "verify:build": "bun run scripts/verify-deterministic-build.ts",
29
28
  "verify:package": "bun run scripts/verify-package.ts",
30
29
  "verify:repository-plugin": "bun run scripts/verify-repository-plugin.ts",
31
30
  "verify:coverage": "bun run scripts/verify-coverage.ts",
@@ -104,5 +103,5 @@
104
103
  "cursor",
105
104
  "amp"
106
105
  ],
107
- "gitHead": "2583b8d9b9fce4264d0e1aa09b40c62f7632d9d9"
106
+ "gitHead": "5c5eace87adc0db41ba762018a1cf7d1506e589c"
108
107
  }