cc-safety-net 2.3.2 → 2.3.4
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/dist/amp/cc-safety-net/index.ts +42 -42
- package/dist/api.js +1 -1
- package/dist/bin/cc-safety-net.js +144 -120
- package/dist/chunks/index-68v9n663.js +2 -0
- package/dist/chunks/index-e7vaxtyk.js +46 -0
- package/dist/chunks/index-zqqsva7r.js +18 -0
- package/dist/index.js +1 -1
- package/dist/openclaw/cc-safety-net/index.js +42 -42
- 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/dist/vendor/zod.cjs +14 -14
- package/package.json +4 -4
- package/dist/chunks/index-6fvz7zfr.js +0 -46
- package/dist/chunks/index-jnb1nckj.js +0 -18
- package/dist/chunks/index-y9vmf6ts.js +0 -2
package/dist/pi/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
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()}
|
|
2
2
|
|
|
3
3
|
## User request
|
|
4
4
|
|
|
5
|
-
${o.trim()||
|
|
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};
|