@seanmozeik/tripwire 0.7.1 → 0.7.2

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,4 +1,6 @@
1
- import{spawn as S}from"node:child_process";import{once as A}from"node:events";import{realpathSync as I}from"node:fs";import{fileURLToPath as U,pathToFileURL as O}from"node:url";import{accessSync as E,constants as P,realpathSync as g}from"node:fs";import{createRequire as b}from"node:module";import f from"node:path";import{fileURLToPath as x}from"node:url";var m=(e)=>{let n=e?.trim();return n===void 0||n.length===0?void 0:n},p=()=>({bunExecutable:m(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:m(process.env.TRIPWIRE_PACKAGE_DIST)});var k=["@seanmozeik","tripwire-darwin-arm64"].join("/"),v=(e)=>{try{return E(e,P.X_OK),g(e)}catch{return}},C=(e,n)=>{try{let t=n?.()??b(e).resolve(k);return v(t)}catch{return}},_=(e)=>{let n=x(e),t=n;try{t=g(n)}catch{}return f.join(f.dirname(t),"tripwire.js")},y=(e={})=>{let n=e.moduleUrl??import.meta.url,t=e.platform??process.platform,r=e.architecture??process.arch,o=p();if(!o.forcePortable&&t==="darwin"&&r==="arm64"){let i=C(n,e.nativeResolver);if(i!==void 0)return{arguments:[],executable:i,kind:"native"}}return{arguments:[e.portableExecutable??_(n)],executable:e.bunExecutable??o.bunExecutable??"bun",kind:"portable"}};var w=60000,N=(e=import.meta.url)=>{let n=U(e),t=n;try{t=I(n)}catch{}return y({moduleUrl:O(t)})},D=N(),u=(e,n,t)=>{for(let r of n){let o=e[r];if(typeof o==="string")return o}throw Error(`Pi ${t} is missing`)},L=(e,n)=>{let t=e[n];return Array.isArray(t)?t.filter((r)=>typeof r==="string"):[]},F=(e)=>{let{edits:n}=e;if(Array.isArray(n)){let t=[],r=[];for(let o of n){if(!c(o))continue;let i=a(o,"oldText")??a(o,"old_string"),s=a(o,"newText")??a(o,"new_string");if(i!==void 0)t.push(i);if(s!==void 0)r.push(s)}return{old_string:t.join(`
2
- `),new_string:r.join(`
3
- `)}}return{old_string:a(e,"oldText")??a(e,"old_string")??"",new_string:a(e,"newText")??a(e,"new_string")??a(e,"input")??a(e,"_input")??""}},j=(e)=>{let{input:n,toolName:t}=e;if(t==="bash"||t==="powershell")return[{command:u(n,["command"],`${t} command`)}];if(t==="read")return[{file_path:u(n,["path","file_path"],"read path")}];if(t==="write")return[{content:u(n,["content"],"write content"),file_path:u(n,["path","file_path"],"write path")}];if(t==="edit"){let r=a(n,"path")??a(n,"file_path"),i=L(n,"paths");if(i.length===0&&r!==void 0)i=[r];if(i.length===0)throw Error("Pi edit path is missing");let s=F(n),d=[];for(let l of i)d.push({file_path:l,...s});return d}return[n]},z=(e)=>{if(typeof e==="string")return e;if(!Array.isArray(e))return"";let n=[];for(let t of e)if(c(t)&&t.type==="text"&&typeof t.text==="string")n.push(t.text);return n.join(`
4
- `)},H=(e)=>{let n=z(e.content);if(e.toolName==="bash"||e.toolName==="powershell")return{stdout:n,stderr:e.isError?n:"",interrupted:e.isError};if(e.toolName==="read")return{content:n};return{content:n,details:e.details,isError:e.isError}},h=(e,n,t)=>{let r={cwd:t,hook_event_name:n,tool_name:e.toolName,tool_use_id:e.toolCallId};if("content"in e)return[{...r,tool_input:e.input,tool_response:H(e)}];let o=[];for(let i of j(e))o.push({...r,tool_input:i});return o},R=async(e)=>{e.setEncoding("utf8");let n="";for await(let t of e)n+=String(t);return n},J=async(e,n)=>{let t=S(e.executable,[...e.arguments,"--tripwire-hook"],{stdio:["pipe","pipe","pipe"]}),r={timedOut:!1},o=setTimeout(()=>{r.timedOut=!0,t.kill("SIGKILL")},w);t.stdin.end(JSON.stringify(n));try{let[i,s,d]=await Promise.all([A(t,"close"),R(t.stdout),R(t.stderr)]);if(r.timedOut)throw Error(`Tripwire exceeded its ${w}ms timeout`);return{exitCode:typeof i[0]==="number"?i[0]:1,stderr:d,stdout:s}}finally{clearTimeout(o)}},c=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),a=(e,n)=>{let t=e[n];return typeof t==="string"?t:void 0},T=(e)=>{if(e.exitCode!==0)return e.stderr.trim()||`Tripwire exited ${e.exitCode}`;if(e.stdout.trim().length===0)return"Tripwire returned no decision";try{let n=JSON.parse(e.stdout);if(!c(n))return"Tripwire returned invalid JSON";let t=c(n.hookSpecificOutput)?n.hookSpecificOutput:void 0,r=(t===void 0?void 0:a(t,"permissionDecision"))??a(n,"permissionDecision")??a(n,"permission"),o=(t===void 0?void 0:a(t,"permissionDecisionReason"))??a(n,"permissionDecisionReason")??a(n,"reason")??"Blocked by Tripwire";if(r==="deny"||r==="ask")return o;if(a(n,"decision")==="block"||n.continue===!1)return o;return n.continue===!0||r==="allow"?void 0:"Tripwire returned an unrecognized response"}catch{return"Tripwire returned invalid JSON"}},K=(e,n=J)=>{let t=typeof e==="string"?{arguments:[],executable:e,kind:"native"}:e;return(r)=>{r.on("tool_call",async(o,i)=>{try{let s=h(o,"PreToolUse",i.cwd),d=s.length===1?s[0]:s;if(d===void 0)throw Error("Tripwire could not normalize the Pi tool call");let l=T(await n(t,d));if(l!==void 0)return{block:!0,reason:l};return{}}catch(s){return{block:!0,reason:`Tripwire failed closed: ${s instanceof Error?s.message:String(s)}`}}}),r.on("tool_result",async(o,i)=>{try{let[s]=h(o,"PostToolUse",i.cwd);if(s===void 0)throw Error("Tripwire could not normalize the Pi tool result");let d=T(await n(t,s));if(d!==void 0)i.ui.notify(`Tripwire stopped the session: ${d}`,"error"),i.abort()}catch(s){i.ui.notify(`Tripwire failed closed after tool use: ${s instanceof Error?s.message:String(s)}`,"error"),i.abort()}})}},te=K(D);export{K as createTripwirePiExtension,te as default,h as hookInputs,N as resolveShippedHookCommand,T as tripwirePiDenialReason};
1
+ import{spawn as F}from"node:child_process";import{once as H}from"node:events";import{realpathSync as z}from"node:fs";import{fileURLToPath as W,pathToFileURL as K}from"node:url";import{accessSync as A,constants as L,realpathSync as E}from"node:fs";import{createRequire as U}from"node:module";import T from"node:path";import{fileURLToPath as O}from"node:url";var R=(e)=>{let n=e?.trim();return n===void 0||n.length===0?void 0:n},P=()=>({bunExecutable:R(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:R(process.env.TRIPWIRE_PACKAGE_DIST)});var N=["@seanmozeik","tripwire-darwin-arm64"].join("/"),D=(e)=>{try{return A(e,L.X_OK),E(e)}catch{return}},M=(e,n)=>{try{let t=n?.()??U(e).resolve(N);return D(t)}catch{return}},j=(e)=>{let n=O(e),t=n;try{t=E(n)}catch{}return T.join(T.dirname(t),"tripwire.js")},x=(e={})=>{let n=e.moduleUrl??import.meta.url,t=e.platform??process.platform,o=e.architecture??process.arch,r=P();if(!r.forcePortable&&t==="darwin"&&o==="arm64"){let s=M(n,e.nativeResolver);if(s!==void 0)return{arguments:[],executable:s,kind:"native"}}return{arguments:[e.portableExecutable??j(n)],executable:e.bunExecutable??r.bunExecutable??"bun",kind:"portable"}};var b=60000,B=(e=import.meta.url)=>{let n=W(e),t=n;try{t=z(n)}catch{}return x({moduleUrl:K(t)})},J=B(),m=(e,n,t)=>{for(let o of n){let r=e[o];if(typeof r==="string")return r}throw Error(`Pi ${t} is missing`)},G=(e,n)=>{let t=e[n];return Array.isArray(t)?t.filter((o)=>typeof o==="string"):[]},q=(e)=>{let{edits:n}=e;if(Array.isArray(n)){let t=[],o=[];for(let r of n){if(!f(r))continue;let s=a(r,"oldText")??a(r,"old_string"),i=a(r,"newText")??a(r,"new_string");if(s!==void 0)t.push(s);if(i!==void 0)o.push(i)}return{old_string:t.join(`
2
+ `),new_string:o.join(`
3
+ `)}}return{old_string:a(e,"oldText")??a(e,"old_string")??"",new_string:a(e,"newText")??a(e,"new_string")??a(e,"input")??a(e,"_input")??""}},V=(e)=>{let n=/^\*{3}\s+(?:Add|Update|Delete)\s+File\s*:\s*(?<path>\S.*?)\s*$/,t=/^\*{3}\s+Move\s+to\s*:\s*(?<path>\S.*?)\s*$/,o=new Map,r=[],s="*** Begin Patch",i="*** End Patch",l=e.split(/\r?\n/),u=l.findIndex((d)=>d.trim()===s);if(u===-1)return[];let c=l.slice(u+1),C=[...c,i].findIndex((d)=>d.trim()===i),I=c.slice(0,C),w=(d)=>{if(r.push(d),!o.has(d))o.set(d,{newLines:[],oldLines:[]})};for(let d of I){let h=n.exec(d)?.groups?.path?.trim();if(h!==void 0&&h.length>0){r=[],w(h);continue}if(r.length===0)continue;let y=t.exec(d)?.groups?.path?.trim();if(y!==void 0&&y.length>0){w(y);continue}let p;if(d.startsWith("+"))p="newLines";else if(d.startsWith("-"))p="oldLines";if(p!==void 0)for(let S of r)o.get(S)?.[p].push(d.slice(1))}return[...o].map(([d,g])=>({file_path:d,new_string:g.newLines.join(`
4
+ `),old_string:g.oldLines.join(`
5
+ `)}))},X=(e)=>{let{input:n,toolName:t}=e;if(t==="bash"||t==="powershell")return[{command:m(n,["command"],`${t} command`)}];if(t==="read")return[{file_path:m(n,["path","file_path"],"read path")}];if(t==="write")return[{content:m(n,["content"],"write content"),file_path:m(n,["path","file_path"],"write path")}];if(t==="edit"){let o=V(a(n,"input")??"");if(o.length>0)return o;let r=a(n,"path")??a(n,"file_path"),i=G(n,"paths");if(i.length===0&&r!==void 0)i=[r];if(i.length===0)throw Error("Pi edit path is missing");let l=q(n),u=[];for(let c of i)u.push({file_path:c,...l});return u}return[n]},Q=(e)=>{if(typeof e==="string")return e;if(!Array.isArray(e))return"";let n=[];for(let t of e)if(f(t)&&t.type==="text"&&typeof t.text==="string")n.push(t.text);return n.join(`
6
+ `)},Y=(e)=>{let n=Q(e.content);if(e.toolName==="bash"||e.toolName==="powershell")return{stdout:n,stderr:e.isError?n:"",interrupted:e.isError};if(e.toolName==="read")return{content:n};return{content:n,details:e.details,isError:e.isError}},k=(e,n,t)=>{let o={cwd:t,hook_event_name:n,tool_name:e.toolName,tool_use_id:e.toolCallId};if("content"in e)return[{...o,tool_input:e.input,tool_response:Y(e)}];let r=[];for(let s of X(e))r.push({...o,tool_input:s});return r},v=async(e)=>{e.setEncoding("utf8");let n="";for await(let t of e)n+=String(t);return n},Z=async(e,n)=>{let t=F(e.executable,[...e.arguments,"--tripwire-hook"],{stdio:["pipe","pipe","pipe"]}),o={timedOut:!1},r=setTimeout(()=>{o.timedOut=!0,t.kill("SIGKILL")},b);t.stdin.end(JSON.stringify(n));try{let[s,i,l]=await Promise.all([H(t,"close"),v(t.stdout),v(t.stderr)]);if(o.timedOut)throw Error(`Tripwire exceeded its ${b}ms timeout`);return{exitCode:typeof s[0]==="number"?s[0]:1,stderr:l,stdout:i}}finally{clearTimeout(r)}},f=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),a=(e,n)=>{let t=e[n];return typeof t==="string"?t:void 0},_=(e)=>{if(e.exitCode!==0)return e.stderr.trim()||`Tripwire exited ${e.exitCode}`;if(e.stdout.trim().length===0)return"Tripwire returned no decision";try{let n=JSON.parse(e.stdout);if(!f(n))return"Tripwire returned invalid JSON";let t=f(n.hookSpecificOutput)?n.hookSpecificOutput:void 0,o=(t===void 0?void 0:a(t,"permissionDecision"))??a(n,"permissionDecision")??a(n,"permission"),r=(t===void 0?void 0:a(t,"permissionDecisionReason"))??a(n,"permissionDecisionReason")??a(n,"reason")??"Blocked by Tripwire";if(o==="deny"||o==="ask")return r;if(a(n,"decision")==="block"||n.continue===!1)return r;return n.continue===!0||o==="allow"?void 0:"Tripwire returned an unrecognized response"}catch{return"Tripwire returned invalid JSON"}},ee=(e,n=Z)=>{let t=typeof e==="string"?{arguments:[],executable:e,kind:"native"}:e;return(o)=>{o.on("tool_call",async(r,s)=>{try{let i=k(r,"PreToolUse",s.cwd),l=i.length===1?i[0]:i;if(l===void 0)throw Error("Tripwire could not normalize the Pi tool call");let u=_(await n(t,l));if(u!==void 0)return{block:!0,reason:u};return{}}catch(i){return{block:!0,reason:`Tripwire failed closed: ${i instanceof Error?i.message:String(i)}`}}}),o.on("tool_result",async(r,s)=>{try{let[i]=k(r,"PostToolUse",s.cwd);if(i===void 0)throw Error("Tripwire could not normalize the Pi tool result");let l=_(await n(t,i));if(l!==void 0)s.ui.notify(`Tripwire stopped the session: ${l}`,"error"),s.abort()}catch(i){s.ui.notify(`Tripwire failed closed after tool use: ${i instanceof Error?i.message:String(i)}`,"error"),s.abort()}})}},fe=ee(J);export{ee as createTripwirePiExtension,fe as default,k as hookInputs,B as resolveShippedHookCommand,_ as tripwirePiDenialReason};
package/dist/tripwire.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Pq=Object.defineProperty;var U0=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fq=(e)=>e;function Mq(e,t){this[e]=Fq.bind(null,t)}var Un=(e,t)=>{for(var n in t)Pq(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Mq.bind(t,n)})};var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cp;var ky=w(()=>{Cp={name:"@seanmozeik/tripwire",version:"0.7.1",description:"Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",keywords:["ai-agents","bun","claude-code","codex","cursor","hooks","safety"],homepage:"https://github.com/seanmozeik/tripwire#readme",bugs:{url:"https://github.com/seanmozeik/tripwire/issues"},license:"MIT",author:"Sean Mozeik",repository:{type:"git",url:"git+https://github.com/seanmozeik/tripwire.git"},bin:{tripwire:"./dist/tripwire-cli.js","tripwire-hook":"./dist/tripwire-hook.js"},workspaces:["packages/*"],files:["dist","LICENSE","package.json","README.md"],type:"module",types:"./dist/types/index.d.ts",exports:{".":{types:"./dist/types/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"}},publishConfig:{access:"public"},scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun run verify",check:"bun run format && bun run lint:fix && bun run typecheck",format:"oxfmt --write .","format:check":"oxfmt --check .",lint:"oxlint .","lint:fix":"oxlint --format agent --fix .",prepare:"bunx effect-tsgo patch",test:"bun test",typecheck:"tsc --noEmit",verify:"bun run format:check && bun run lint && bun run typecheck && bun test && bun run build"},dependencies:{"shell-quote":"1.10.0"},devDependencies:{"@effect/platform-bun":"4.0.0-rc.112","@effect/tsgo":"0.38.0","@seanmozeik/de-clank":"0.1.7","bun-types":"1.4.0",effect:"4.0.0-rc.112",oxfmt:"0.65.0",oxlint:"1.80.0","oxlint-tsgolint":"7.0.2001",typescript:"7.0.2"},peerDependencies:{"@effect/platform-bun":"4.0.0-rc.112",effect:"4.0.0-rc.112"},optionalDependencies:{"@seanmozeik/tripwire-darwin-arm64":"0.7.1"},engines:{bun:">=1.4"}}});var le=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},Dq,Gi;var Qe=w(()=>{Dq={pipe(){return le(this,arguments)}},Gi=function(){function e(){}return e.prototype=Dq,e}()});function zr(e,...t){return le(e,t)}function L0(e,t,n,r,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}return}function Qt(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function Ji(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var p=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,r){if(arguments.length>=2)return t(n,r);return function(o){return t(o,n)}};case 3:return function(n,r,o){if(arguments.length>=3)return t(n,r,o);return function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}},D=(e)=>e,gt=(e)=>()=>e,nr,Sl,Tp,qr,Vo;var X=w(()=>{Qe();nr=gt(!0),Sl=gt(!1),Tp=gt(null),qr=gt(void 0),Vo=qr});var El=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),r=n;while(r!==null&&r!==Object.prototype){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},wc;var Iy=w(()=>{wc=new WeakSet});function Wr(e){return typeof e==="string"}function bl(e){return typeof e==="number"}function Op(e){return typeof e==="boolean"}function j0(e){return typeof e==="bigint"}function Cy(e){return typeof e==="symbol"}function Ap(e){return Wr(e)||bl(e)||Cy(e)}function ln(e){return typeof e==="function"}function Gs(e){return e===void 0}function Le(e){return e!==void 0}function wl(e){return e!==null}function B0(e){return e===null||e===void 0}function _p(e){return e!=null}function H0(e){return!1}function Ty(e){return!0}function fn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function vl(e){return typeof e==="object"&&e!==null||ln(e)}function q0(e){return e instanceof Error}function go(e){return M(e,Symbol.iterator)||Wr(e)}var M,br;var he=w(()=>{X();M=p(2,(e,t)=>vl(e)&&(t in e)),br=p(2,(e,t)=>M(e,"_tag")&&e._tag===t)});function jq(e,t){if(_y.has(e))return qe("[Circular]");_y.add(e);let n=t();return _y.delete(e),n}var Ie="~effect/interfaces/Hash",re=(e)=>{switch(typeof e){case"number":return Ln(e);case"bigint":return qe(e.toString(10));case"boolean":return qe(String(e));case"symbol":return qe(String(e));case"string":return qe(e);case"undefined":return qe("undefined");case"function":case"object":if(e===null)return qe("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return qe("Invalid Date");return qe(e.toISOString())}else if(e instanceof RegExp)return qe(e.toString());else{if(wc.has(e))return Rp(e);if(Ay.has(e))return Ay.get(e);let t=jq(e,()=>{if($q(e))return e[Ie]();else if(typeof e==="function")return Rp(e);else if(e instanceof DataView)return vc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return vc(e);else if(e instanceof Map)return Uq(e);else if(e instanceof Set)return Lq(e);return Py(e)});return Ay.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Rp=(e)=>{if(!Oy.has(e))Oy.set(e,Ln(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return Oy.get(e)},xt,Js=(e)=>e&3221225471|e>>>1&1073741824,$q=(e)=>M(e,Ie),Ln=(e)=>{if(e!==e)return qe("NaN");if(e===1/0)return qe("Infinity");if(e===-1/0)return qe("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return Js(t)},qe=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return Js(t)},Ry=(e,t)=>{let n=12289;for(let r of t)n^=xt(re(r),re(e[r]));return Js(n)},Py=(e)=>Ry(e,El(e)),Fy=(e,t)=>(n)=>{let r=e;for(let o of n)r^=t(o);return Js(r)},vc,Uq,Lq,Oy,Ay,_y;var Xt=w(()=>{X();Iy();he();xt=p(2,(e,t)=>e*53^t),vc=Fy(6151,re),Uq=Fy(qe("Map"),([e,t])=>xt(re(e),re(t))),Lq=Fy(qe("Set"),re),Oy=new WeakMap,Ay=new WeakMap,_y=new WeakSet});function Y(){if(arguments.length===1)return(e)=>Zi(e,arguments[0]);return Zi(arguments[0],arguments[1])}function Zi(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(wc.has(e)||wc.has(t))return!1;return qq(e,t,Hq)}function Bq(e,t,n){let r=My.has(e),o=Ny.has(t);if(r&&o)return!0;if(r||o)return!1;My.add(e),Ny.add(t);let s=n();return My.delete(e),Ny.delete(t),s}function Hq(e,t){if(re(e)!==re(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=W0(e),r=W0(t);if(n!==r)return!1;let o=n&&r;if(typeof e==="function"&&!o)return!1;return Bq(e,t,()=>{if(o)return e[Ce](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return zq(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return z0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return z0(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return Kq(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return Vq(e,t)}return Wq(e,t)})}function qq(e,t,n){let r=Pp.get(e);if(!r)r=new WeakMap,Pp.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=Pp.get(t);if(!s)s=new WeakMap,Pp.set(t,s);return s.set(e,o),o}function zq(e,t){for(let n=0;n<e.length;n++)if(!Zi(e[n],t[n]))return!1;return!0}function z0(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wq(e,t){let n=El(e),r=El(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!Zi(e[o],t[o]))return!1;return!0}function Fp(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[l,f]=s[u];if(e(i,l)&&t(a,f)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}function Mp(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var Ce="~effect/interfaces/Equal",My,Ny,Pp,Kq,Vq,W0=(e)=>M(e,Ce),Dy=()=>Y,$y=(e)=>(wc.add(e),e);var yt=w(()=>{Xt();Iy();he();My=new WeakSet,Ny=new WeakSet;Pp=new WeakMap;Kq=Fp(Zi,Zi);Vq=Mp(Zi)});function kc(e){if(Gq(e))return Uy(e);return e}function Uy(e){return e[kl](globalThis[Ic]?.context??Jq)}var kl,Gq=(e)=>M(e,kl),Ic="~effect/Fiber/currentFiber",K0,Jq;var Np=w(()=>{Qe();he();kl=Symbol.for("~effect/Redactable");K0=new Map,Jq={"~effect/Context":{},base:K0,depth:0,mapUnsafe:K0,pipe(){return le(this,arguments)}}});function B(e,t){let n=t?.space??0,r=new WeakSet,o=!n?"":typeof n==="number"?" ".repeat(n):n,s=(u)=>o.repeat(u),i=(u,l)=>{let f=u?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${l})`:l},a=(u)=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){if(typeof u==="string")return JSON.stringify(u);if(typeof u==="number"||u==null||typeof u==="boolean"||typeof u==="symbol")return String(u);if(typeof u==="bigint")return String(u)+"n";if(typeof u==="object"||typeof u==="function"){if(r.has(u))return Zq;r.add(u);let f;if(kl in u)f=c(Uy(u),l);else if(Array.isArray(u))f=!o||u.length<=1?`[${u.map((d)=>c(d,l)).join(",")}]`:`[
3
+ var Pq=Object.defineProperty;var U0=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fq=(e)=>e;function Mq(e,t){this[e]=Fq.bind(null,t)}var Un=(e,t)=>{for(var n in t)Pq(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Mq.bind(t,n)})};var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cp;var ky=w(()=>{Cp={name:"@seanmozeik/tripwire",version:"0.7.2",description:"Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",keywords:["ai-agents","bun","claude-code","codex","cursor","hooks","safety"],homepage:"https://github.com/seanmozeik/tripwire#readme",bugs:{url:"https://github.com/seanmozeik/tripwire/issues"},license:"MIT",author:"Sean Mozeik",repository:{type:"git",url:"git+https://github.com/seanmozeik/tripwire.git"},bin:{tripwire:"./dist/tripwire-cli.js","tripwire-hook":"./dist/tripwire-hook.js"},workspaces:["packages/*"],files:["dist","LICENSE","package.json","README.md"],type:"module",types:"./dist/types/index.d.ts",exports:{".":{types:"./dist/types/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"}},publishConfig:{access:"public"},scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun run verify",check:"bun run format && bun run lint:fix && bun run typecheck",format:"oxfmt --write .","format:check":"oxfmt --check .",lint:"oxlint .","lint:fix":"oxlint --format agent --fix .",prepare:"bunx effect-tsgo patch",test:"bun test",typecheck:"tsc --noEmit",verify:"bun run format:check && bun run lint && bun run typecheck && bun test && bun run build"},dependencies:{"shell-quote":"1.10.0"},devDependencies:{"@effect/platform-bun":"4.0.0-rc.112","@effect/tsgo":"0.38.0","@seanmozeik/de-clank":"0.1.7","bun-types":"1.4.0",effect:"4.0.0-rc.112",oxfmt:"0.65.0",oxlint:"1.80.0","oxlint-tsgolint":"7.0.2001",typescript:"7.0.2"},peerDependencies:{"@effect/platform-bun":"4.0.0-rc.112",effect:"4.0.0-rc.112"},optionalDependencies:{"@seanmozeik/tripwire-darwin-arm64":"0.7.2"},engines:{bun:">=1.4"}}});var le=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},Dq,Gi;var Qe=w(()=>{Dq={pipe(){return le(this,arguments)}},Gi=function(){function e(){}return e.prototype=Dq,e}()});function zr(e,...t){return le(e,t)}function L0(e,t,n,r,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}return}function Qt(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function Ji(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var p=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,r){if(arguments.length>=2)return t(n,r);return function(o){return t(o,n)}};case 3:return function(n,r,o){if(arguments.length>=3)return t(n,r,o);return function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}},D=(e)=>e,gt=(e)=>()=>e,nr,Sl,Tp,qr,Vo;var X=w(()=>{Qe();nr=gt(!0),Sl=gt(!1),Tp=gt(null),qr=gt(void 0),Vo=qr});var El=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),r=n;while(r!==null&&r!==Object.prototype){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},wc;var Iy=w(()=>{wc=new WeakSet});function Wr(e){return typeof e==="string"}function bl(e){return typeof e==="number"}function Op(e){return typeof e==="boolean"}function j0(e){return typeof e==="bigint"}function Cy(e){return typeof e==="symbol"}function Ap(e){return Wr(e)||bl(e)||Cy(e)}function ln(e){return typeof e==="function"}function Gs(e){return e===void 0}function Le(e){return e!==void 0}function wl(e){return e!==null}function B0(e){return e===null||e===void 0}function _p(e){return e!=null}function H0(e){return!1}function Ty(e){return!0}function fn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function vl(e){return typeof e==="object"&&e!==null||ln(e)}function q0(e){return e instanceof Error}function go(e){return M(e,Symbol.iterator)||Wr(e)}var M,br;var he=w(()=>{X();M=p(2,(e,t)=>vl(e)&&(t in e)),br=p(2,(e,t)=>M(e,"_tag")&&e._tag===t)});function jq(e,t){if(_y.has(e))return qe("[Circular]");_y.add(e);let n=t();return _y.delete(e),n}var Ie="~effect/interfaces/Hash",re=(e)=>{switch(typeof e){case"number":return Ln(e);case"bigint":return qe(e.toString(10));case"boolean":return qe(String(e));case"symbol":return qe(String(e));case"string":return qe(e);case"undefined":return qe("undefined");case"function":case"object":if(e===null)return qe("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return qe("Invalid Date");return qe(e.toISOString())}else if(e instanceof RegExp)return qe(e.toString());else{if(wc.has(e))return Rp(e);if(Ay.has(e))return Ay.get(e);let t=jq(e,()=>{if($q(e))return e[Ie]();else if(typeof e==="function")return Rp(e);else if(e instanceof DataView)return vc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return vc(e);else if(e instanceof Map)return Uq(e);else if(e instanceof Set)return Lq(e);return Py(e)});return Ay.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Rp=(e)=>{if(!Oy.has(e))Oy.set(e,Ln(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return Oy.get(e)},xt,Js=(e)=>e&3221225471|e>>>1&1073741824,$q=(e)=>M(e,Ie),Ln=(e)=>{if(e!==e)return qe("NaN");if(e===1/0)return qe("Infinity");if(e===-1/0)return qe("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return Js(t)},qe=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return Js(t)},Ry=(e,t)=>{let n=12289;for(let r of t)n^=xt(re(r),re(e[r]));return Js(n)},Py=(e)=>Ry(e,El(e)),Fy=(e,t)=>(n)=>{let r=e;for(let o of n)r^=t(o);return Js(r)},vc,Uq,Lq,Oy,Ay,_y;var Xt=w(()=>{X();Iy();he();xt=p(2,(e,t)=>e*53^t),vc=Fy(6151,re),Uq=Fy(qe("Map"),([e,t])=>xt(re(e),re(t))),Lq=Fy(qe("Set"),re),Oy=new WeakMap,Ay=new WeakMap,_y=new WeakSet});function Y(){if(arguments.length===1)return(e)=>Zi(e,arguments[0]);return Zi(arguments[0],arguments[1])}function Zi(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(wc.has(e)||wc.has(t))return!1;return qq(e,t,Hq)}function Bq(e,t,n){let r=My.has(e),o=Ny.has(t);if(r&&o)return!0;if(r||o)return!1;My.add(e),Ny.add(t);let s=n();return My.delete(e),Ny.delete(t),s}function Hq(e,t){if(re(e)!==re(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=W0(e),r=W0(t);if(n!==r)return!1;let o=n&&r;if(typeof e==="function"&&!o)return!1;return Bq(e,t,()=>{if(o)return e[Ce](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return zq(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return z0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return z0(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return Kq(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return Vq(e,t)}return Wq(e,t)})}function qq(e,t,n){let r=Pp.get(e);if(!r)r=new WeakMap,Pp.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=Pp.get(t);if(!s)s=new WeakMap,Pp.set(t,s);return s.set(e,o),o}function zq(e,t){for(let n=0;n<e.length;n++)if(!Zi(e[n],t[n]))return!1;return!0}function z0(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wq(e,t){let n=El(e),r=El(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!Zi(e[o],t[o]))return!1;return!0}function Fp(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[l,f]=s[u];if(e(i,l)&&t(a,f)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}function Mp(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var Ce="~effect/interfaces/Equal",My,Ny,Pp,Kq,Vq,W0=(e)=>M(e,Ce),Dy=()=>Y,$y=(e)=>(wc.add(e),e);var yt=w(()=>{Xt();Iy();he();My=new WeakSet,Ny=new WeakSet;Pp=new WeakMap;Kq=Fp(Zi,Zi);Vq=Mp(Zi)});function kc(e){if(Gq(e))return Uy(e);return e}function Uy(e){return e[kl](globalThis[Ic]?.context??Jq)}var kl,Gq=(e)=>M(e,kl),Ic="~effect/Fiber/currentFiber",K0,Jq;var Np=w(()=>{Qe();he();kl=Symbol.for("~effect/Redactable");K0=new Map,Jq={"~effect/Context":{},base:K0,depth:0,mapUnsafe:K0,pipe(){return le(this,arguments)}}});function B(e,t){let n=t?.space??0,r=new WeakSet,o=!n?"":typeof n==="number"?" ".repeat(n):n,s=(u)=>o.repeat(u),i=(u,l)=>{let f=u?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${l})`:l},a=(u)=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){if(typeof u==="string")return JSON.stringify(u);if(typeof u==="number"||u==null||typeof u==="boolean"||typeof u==="symbol")return String(u);if(typeof u==="bigint")return String(u)+"n";if(typeof u==="object"||typeof u==="function"){if(r.has(u))return Zq;r.add(u);let f;if(kl in u)f=c(Uy(u),l);else if(Array.isArray(u))f=!o||u.length<=1?`[${u.map((d)=>c(d,l)).join(",")}]`:`[
4
4
  ${s(l+1)}${u.map((d)=>c(d,l+1)).join(`,
5
5
  `+s(l+1))}
6
6
  ${s(l)}]`;else if(u instanceof Date)f=Ly(u);else if(!t?.ignoreToString&&M(u,"toString")&&typeof u.toString==="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let d=Yq(u);f=u instanceof Error&&u.cause?`${d} (cause: ${c(u.cause,l)})`:d}else if(Symbol.iterator in u)f=`${u.constructor.name}(${c(Array.from(u),l)})`;else{let d=a(u);if(!o||d.length<=1){let m=`{${d.map((g)=>`${Go(g)}:${c(u[g],l)}`).join(",")}}`;f=i(u,m)}else{let m=`{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanmozeik/tripwire",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -78,7 +78,7 @@
78
78
  "effect": "4.0.0-rc.112"
79
79
  },
80
80
  "optionalDependencies": {
81
- "@seanmozeik/tripwire-darwin-arm64": "0.7.1"
81
+ "@seanmozeik/tripwire-darwin-arm64": "0.7.2"
82
82
  },
83
83
  "engines": {
84
84
  "bun": ">=1.4"