cc-safety-net 2.0.7 → 2.0.9
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 +100 -0
- package/dist/bin/cc-safety-net.js +175 -227
- package/dist/chunks/index-tdm5076r.js +62 -0
- package/dist/index.js +1 -1
- package/dist/openclaw/cc-safety-net/index.js +73 -75
- 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 +21 -21
- package/package.json +3 -3
- package/dist/amp/cc-safety-net.ts +0 -102
- package/dist/chunks/index-4pw6zr4t.js +0 -64
package/dist/pi/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"../chunks/index-25nh5wqs.js";import{M as u,N as p,O as c,P as f,Q as C,_ as g,jb as w,ka as P,kb as v,ma as y,nb as E,oa as T,ua as d}from"../chunks/index-tdm5076r.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
|
-
${
|
|
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:y(),policyOptions:o.policyOptions,dependencies:o.guardDependencies},audit:{agent:"pi",getSessionId:()=>n.sessionManager.getSessionId()}});return m(i,!0)}catch(i){if(!(i instanceof w))throw i;if(T(P.debug))console.error(`CC Safety Net debug: pi tool_call analysis failed: ${C(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()!==""?v(".",[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:g(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:c({toolName:n}),cwd:typeof e.cwd==="string"&&e.cwd.trim()?e.cwd:null}}function m(e,n){let o=p(e,{includeEvidence:n});return o?A(o):void 0}function A(e){return{block:!0,reason:f(e)}}function b(e){N(e),s(e)}export{b as default};
|