cc-safety-net 2.6.12 → 2.6.13

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.
@@ -1,2 +1,2 @@
1
- import{Z,x,St,l}from"./index-1wy9mq4k.js";import{j,fe,Re}from"./index-feqnsxd2.js";var Qe=new Map([["bash","posix"],["powershell","powershell"]]),u={agent:"pi",debugLabel:"pi tool_call",extract:(o,e,r)=>p(o,e,r),getSessionId:(o,e)=>e.sessionManager.getSessionId(),allow:void 0,block:(o)=>C(o),includeEvidenceOnError:(o)=>o.route.kind==="command"};function ht(o){o.on("tool_call",s)}var s=m();function m(o={}){return Re(u,o)}function p(o,e,r){if(!o||typeof o!=="object")return;let n=o;if(n.type!==void 0&&n.type!=="tool_call")return;if(typeof n.toolName!=="string"||n.toolName.trim()==="")return i(e);if(typeof e.cwd!=="string"||e.cwd.trim()==="")return i(e,n.toolName);let t=St(".",[e.cwd],r);if(!t)return fe({directory:"session",problem:"unusable",cwd:e.cwd},{toolName:n.toolName});let a=Qe.get(n.toolName);if(!n.input||typeof n.input!=="object")return a?i(e,n.toolName):void 0;if(!a)return l(n.toolName,n.input,{kind:x(n.toolName)},{configCwd:t,executionCwd:t},null);let d=n.input.command;if(typeof d!=="string"||d.trim()==="")return i(e,n.toolName);return l(n.toolName,n.input,{kind:"command",shell:a},{configCwd:t,executionCwd:t},d)}function i(o,e){return j(typeof o.cwd==="string"&&o.cwd.trim()?o.cwd:null,{toolName:e})}function C(o){return{block:!0,reason:Z(o)}}
1
+ import{Z,x,St,l}from"./index-rdxjms22.js";import{G,fe,Re}from"./index-q29jqk43.js";var Qe=new Map([["bash","posix"],["powershell","powershell"]]),u={agent:"pi",debugLabel:"pi tool_call",extract:(o,e,r)=>p(o,e,r),getSessionId:(o,e)=>e.sessionManager.getSessionId(),allow:void 0,block:(o)=>C(o),includeEvidenceOnError:(o)=>o.route.kind==="command"};function ht(o){o.on("tool_call",s)}var s=m();function m(o={}){return Re(u,o)}function p(o,e,r){if(!o||typeof o!=="object")return;let n=o;if(n.type!==void 0&&n.type!=="tool_call")return;if(typeof n.toolName!=="string"||n.toolName.trim()==="")return i(e);if(typeof e.cwd!=="string"||e.cwd.trim()==="")return i(e,n.toolName);let t=St(".",[e.cwd],r);if(!t)return fe({directory:"session",problem:"unusable",cwd:e.cwd},{toolName:n.toolName});let a=Qe.get(n.toolName);if(!n.input||typeof n.input!=="object")return a?i(e,n.toolName):void 0;if(!a)return l(n.toolName,n.input,{kind:x(n.toolName)},{configCwd:t,executionCwd:t},null);let d=n.input.command;if(typeof d!=="string"||d.trim()==="")return i(e,n.toolName);return l(n.toolName,n.input,{kind:"command",shell:a},{configCwd:t,executionCwd:t},d)}function i(o,e){return G(typeof o.cwd==="string"&&o.cwd.trim()?o.cwd:null,{toolName:e})}function C(o){return{block:!0,reason:Z(o)}}
2
2
  export{Qe,ht};
@@ -1,2 +1,2 @@
1
- import{_e,L,_,xt,c,n,Pe,S,f}from"./index-1wy9mq4k.js";import{Te,H}from"./index-hcky80cs.js";function j(t,o={}){return{malformed:!0,denial:L(o),cwd:t}}function fe(t,o){return{malformed:!0,denial:_(t,o),cwd:t.cwd}}function Re(t,o={}){return(e,i)=>{try{return m(e,i,t,o)}catch(a){return console.error("CC Safety Net error:",a),t.block(L())}}}function m(t,o,e,i){let a=c();if(e.cancelled?.(o))return e.block(L());let l=e.extract(t,o,a.paths);if(!l)return e.allow;let d=()=>e.getSessionId(t,o);if("malformed"in l)return Te(a,l.denial,d,{agent:e.agent,toolName:l.denial.toolName,cwd:l.cwd}),e.block(l.denial);let u=(r,p)=>{let s=_e(r,{includeEvidence:p});return s?e.block(s):e.allow};try{let r=H(a,l,{guard:{auditAllowed:Pe(a.env),policyOptions:i.policyOptions,dependencies:i.guardDependencies},audit:{agent:e.agent,getSessionId:d}});return u(r,!0)}catch(r){if(!(r instanceof f))throw r;if(S(n.debug,a.env))console.error(`CC Safety Net debug: ${e.debugLabel} analysis failed: ${xt(r.cause)}`);return u(r.evaluation,e.includeEvidenceOnError(l))}}
2
- export{j,fe,Re};
1
+ import{_e,L,_,xt,c,n,Pe,S,f}from"./index-rdxjms22.js";import{Te,W}from"./index-x95aj0ja.js";function G(t,o={}){return{malformed:!0,denial:L(o),cwd:t}}function fe(t,o){return{malformed:!0,denial:_(t,o),cwd:t.cwd}}function Re(t,o={}){return(e,i)=>{try{return m(e,i,t,o)}catch(a){return console.error("CC Safety Net error:",a),t.block(L())}}}function m(t,o,e,i){let a=c();if(e.cancelled?.(o))return e.block(L());let l=e.extract(t,o,a.paths);if(!l)return e.allow;let d=()=>e.getSessionId(t,o);if("malformed"in l)return Te(a,l.denial,d,{agent:e.agent,toolName:l.denial.toolName,cwd:l.cwd}),e.block(l.denial);let u=(r,p)=>{let s=_e(r,{includeEvidence:p});return s?e.block(s):e.allow};try{let r=W(a,l,{guard:{auditAllowed:Pe(a.env),policyOptions:i.policyOptions,dependencies:i.guardDependencies},audit:{agent:e.agent,getSessionId:d}});return u(r,!0)}catch(r){if(!(r instanceof f))throw r;if(S(n.debug,a.env))console.error(`CC Safety Net debug: ${e.debugLabel} analysis failed: ${xt(r.cause)}`);return u(r.evaluation,e.includeEvidenceOnError(l))}}
2
+ export{G,fe,Re};