cc-safety-net 2.6.15 → 2.6.16
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 +2 -2
- package/dist/api.js +1 -1
- package/dist/bin/hook.js +1 -1
- package/dist/chunks/index-2r2nzahr.js +2 -0
- package/dist/chunks/{index-c58ybc95.js → index-3s2q5wht.js} +1 -1
- package/dist/chunks/index-90bkfxht.js +2 -0
- package/dist/chunks/{index-e3xkx678.js → index-gkf3ty4y.js} +4 -4
- package/dist/chunks/index-pzctbrv3.js +49 -0
- package/dist/chunks/{index-7s7deste.js → index-wshq0mgp.js} +2 -2
- package/dist/cli.js +1974 -630
- package/dist/deepseek-harness/index.js +1 -1
- package/dist/index.js +5 -5
- package/dist/openclaw/cc-safety-net/index.js +2 -2
- 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 +1 -1
- package/package.json +2 -2
- package/dist/chunks/index-n7t37q7p.js +0 -2
- package/dist/chunks/index-qzcqzqbd.js +0 -49
- package/dist/chunks/index-sxp3v148.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_e,L,
|
|
2
|
-
export{Le,Ye,
|
|
1
|
+
import{_e,L,P,Z,c,Ae,m,x,se,he,l,f}from"./index-pzctbrv3.js";import{oe}from"./index-wkjncmhg.js";import{Pe,B}from"./index-gkf3ty4y.js";import{join as T,resolve as y}from"node:path";function Le(){return{"cc-safety-net":{description:"Operate CC Safety Net: explain blocks, rules, integrations, diagnostics",template:oe.slice(oe.indexOf("# CC Safety Net"))}}}var O=new Set(["powershell","pwsh"]),k=new Set(["fish","nu"]),Ye="bash",Re="shell";function gt(n={}){return async({directory:t,homeDir:a})=>{let e=y(t),o;return{config:async(i)=>{o=i;let s=Le(),u=i.command??{};i.command={...s,...u}},"tool.execute.before":async(i,s)=>{Ze({configCwd:e,homeDir:a,tool:i.tool,sessionID:i.sessionID,toolInput:s.args,route:S(i.tool,Xe(o?.shell)),guardDependencies:n})}}}}function Ze({configCwd:n,homeDir:t,expandHomeWorkdir:a=!1,tool:e,sessionID:o,toolInput:i,route:s,guardDependencies:u={}}){let C=t===void 0?c():{...c(),home:t},d=(r,D,v=n)=>{Pe(C,r,()=>o,{agent:"opencode",toolName:D,cwd:v}),h(r)};if(typeof e!=="string"||e.trim()==="")d(L());let p;try{p=se(i)}catch(r){if(!(r instanceof m))throw r;d(L({toolName:e}),e)}if(!he(n)){d(P({directory:"session",problem:"unusable",cwd:n},{command:p,toolName:e}),e);return}let g=N(n,i,a?C.home:void 0);if(g===null){d(L({command:p,toolName:e}),e);return}if(typeof g!=="string"){d(P(g,{command:p,toolName:e}),e,g.cwd);return}let E=l(e,i,s,{configCwd:n,executionCwd:g},p??null);try{let r=B(C,E,{guard:{auditAllowed:Ae(C.env),dependencies:u},audit:{agent:"opencode",getSessionId:()=>o}});w(r)}catch(r){if(!(r instanceof f))throw r;if(r.stage==="policy-protection"||r.stage==="config-load"||r.stage==="secret-protection")throw r.cause;w(r.evaluation);return}}function Xe(n,t=process.platform,a=process.env.SHELL){let o=(typeof n==="string"?n:a)?.trim().split(/[\\/]/).at(-1)?.toLowerCase().replace(/\.exe$/,"");if(typeof n!=="string"&&t==="win32"&&(!o||k.has(o)))return"powershell";if(!o)return"auto";if(O.has(o))return"powershell";return o==="cmd"?"auto":"posix"}function S(n,t){if(n===Ye)return{kind:"command",shell:t};return{kind:x(n)}}function N(n,t,a){if(!t||typeof t!=="object"||Array.isArray(t))return n;if(!Object.hasOwn(t,"workdir"))return n;let e=t.workdir;if(typeof e!=="string"||e.trim()==="")return null;let o=process.platform==="win32"?_(e):e,i=o.startsWith("~/")||process.platform==="win32"&&o.startsWith("~\\"),s=a===void 0?o:o==="~"?a:i?T(a,o.slice(2)):o,u=y(n,s);return he(u)?u:{directory:"requested",problem:"unusable",cwd:e}}function _(n){return n.replace(/^\/([a-zA-Z]):(?:[\\/]|$)/,(a,e)=>`${e.toUpperCase()}:/`).replace(/^\/([a-zA-Z])(?:[\\/]|$)/,(a,e)=>`${e.toUpperCase()}:/`).replace(/^\/cygdrive\/([a-zA-Z])(?:[\\/]|$)/,(a,e)=>`${e.toUpperCase()}:/`).replace(/^\/mnt\/([a-zA-Z])(?:[\\/]|$)/,(a,e)=>`${e.toUpperCase()}:/`)}function w(n){let t=_e(n,{includeEvidence:!0});if(t)h(t)}function h(n){throw Error(Z(n))}
|
|
2
|
+
export{Le,Ye,Re,gt,Ze,Xe};
|