@systemfsoftware/omp-claude-compat 1.3.0 → 1.4.1
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/{dist-DbemdM50.js → dist-C2rAHz9c.js} +4 -2
- package/dist/{hook-dispatcher.executor-D42T74H2.js → hook-dispatcher.executor-ve2Ynf0r.js} +6 -6
- package/dist/index.js +2 -2
- package/dist/{inject-instructions.executor-CpsBw0g8.js → inject-instructions.executor-Bvgs3Fc8.js} +1 -1
- package/dist/{runtime-CC04dRZJ.js → runtime-CmfegZ0F.js} +1 -1
- package/package.json +4 -4
|
@@ -14,6 +14,8 @@ import{$ as e,A as t,An as n,B as r,D as i,Dt as a,E as o,En as s,Et as c,F as l
|
|
|
14
14
|
`)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),B(t.join(``))}const Mt=/(?:true|false)\b/y;function Nt(e){e.skipWhitespaces();let t=e.match(Mt);if(!t)return V();let n=t[0];return e.next(n.length),B(n===`true`)}const Pt=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),Ft=/[+-]?inf\b/y;function It(e){e.skipWhitespaces();let t=e.match(Ft);if(!t)return V();let n=t[0];return e.next(n.length),B(Pt.get(n))}const Lt=/[+-]?nan\b/y;function Rt(e){e.skipWhitespaces();let t=e.match(Lt);if(!t)return V();let n=t[0];return e.next(n.length),B(NaN)}const q=xt(W([Et,Ot,kt]),`.`),zt=/0b[01]+(?:_[01]+)*\b/y;function Bt(e){e.skipWhitespaces();let t=e.match(zt)?.[0];if(!t)return V();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?V():B(r)}const Vt=/0o[0-7]+(?:_[0-7]+)*\b/y;function Ht(e){e.skipWhitespaces();let t=e.match(Vt)?.[0];if(!t)return V();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?V():B(r)}const Ut=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Wt(e){e.skipWhitespaces();let t=e.match(Ut)?.[0];if(!t)return V();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?V():B(r)}const Gt=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Kt(e){e.skipWhitespaces();let t=e.match(Gt)?.[0];if(!t)return V();e.next(t.length);let n=t.replaceAll(`_`,``);return B(parseInt(n,10))}const qt=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function Jt(e){e.skipWhitespaces();let t=e.match(qt)?.[0];if(!t)return V();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?V():B(r)}const Yt=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function Xt(e){e.skipWhitespaces();let t=e.match(Yt);if(!t)return V();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!mt(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return B(i)}const Zt=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function Qt(e){e.skipWhitespaces();let t=e.match(Zt)?.[0];return t?(e.next(t.length),B(t)):V()}function $t(e){if(e.skipWhitespaces(),e.char()!==`[`)return V();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=tn(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),B(t)}function en(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),B({__proto__:null});let t=G(`{`,bt(nn,`,`),`}`)(e);if(!t.ok)return V();let n={__proto__:null};for(let e of t.body)n=z(n,e);return B(n)}const tn=W([At,jt,Ot,kt,Nt,It,Rt,Xt,Qt,Bt,Ht,Wt,Jt,Kt,$t,en]),nn=St(q,`=`,tn);function J(e){e.nextUntilChar();let t=Ct(wt(nn))(e);return t.ok?B({type:`Block`,value:t.body}):V()}const rn=G(`[`,q,`]`);function an(e){e.nextUntilChar();let t=rn(e);if(!t.ok)return V();e.nextUntilChar();let n=J(e);return B({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const on=G(`[[`,q,`]]`);function sn(e){e.nextUntilChar();let t=on(e);if(!t.ok)return V();e.nextUntilChar();let n=J(e);return B({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function cn(e){let t=wt(W([J,sn,an]))(e);return t.ok?B(t.body.reduce(U,{__proto__:null})):B({__proto__:null})}function Y(e,t){let n=e.source.slice(0,e.position).split(`
|
|
15
15
|
`);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function ln(e){return t=>{let n=new ht(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(Y(n,r))}catch(e){throw e instanceof Error?SyntaxError(Y(n,e.message)):SyntaxError(Y(n,`Invalid error type caught`))}}}function un(e){return ln(cn)(e)}const dn={ctx_execute:!0,ctx_batch_execute:!0};function fn(e,t){return dn[e]?e!==`ctx_execute`||t.language===`shell`:!1}function pn(e,t){if(fn(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e?e.command:``).filter(e=>typeof e==`string`).join(`
|
|
16
16
|
`)}}const mn=/#[0-9a-fA-F]{4}$/u,hn=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,gn=/^\*\*\* Move to:\s*(.+)$/,_n={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function vn(e){let t=e.trim(),n=mn.exec(t)?.index,r=n===void 0?t:t.slice(0,n);if(r.length<2)return r;let i=r[0],a=r[r.length-1];return(i===`"`||i===`'`)&&i===a?r.slice(1,-1):r}function yn(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=vn(t.slice(1,n));return r.length>0?r:void 0}function bn(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
|
|
17
|
-
`)){let n=yn(e);if(n!==void 0){t.push(n),r=!0;continue}let i=hn.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=gn.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=vn(o.slice(3));e.length>0&&t.push(e)}}return t}function xn(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function Sn(e,t){if(_n[e]!==!0)return[];let n=t.input,r=typeof n==`string`?bn(n):[];if(r.length>0)return Array.from(new Set(r));let i=xn(t,`file_path`)??xn(t,`path`);return i===void 0?[]:[i]}const X=new Map;function Cn(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=X.get(n);if(r!==void 0)return r===!0||r.test(e);let i=wn(n);return X.size>=256&&X.clear(),X.set(n,i),i===!0||i.test(e)}function wn(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const Tn=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,En=/\$\(|`|\$\{?\w/,Dn=/\$\(([^()]*)\)|`([^`]*)`/g,On=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,kn=/&&|\|\||[;|]/,An=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function jn(e,t,n,r){let i=Tn.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?Mn(o,n.command):In(o,n.file_path,r)}function Mn(e,t){if(typeof t!=`string`)return!0;let n=Nn(t);return n.length===0||n.some(t=>Fn(e,t))?!0:Pn(e)&&En.test(t)}function Nn(e){let t=[...e.matchAll(Dn)].map(e=>e[1]??e[2]??``);return[e.replace(Dn,` `),...t].flatMap(e=>e.split(kn)).map(e=>e.trim().replace(On,``)).filter(e=>e.length>0)}function Pn(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function Fn(e,t){return RegExp(`^${e.split(`*`).map(An).join(`.*`)}$`).test(t)}function In(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:Ln(r);return RegExp(`^${Rn(i)}$`).test(a)}const Ln=e=>e.slice(e.lastIndexOf(`/`)+1);function Rn(e){let t=zn(e);return e.endsWith(`/**`)?`(?:${zn(e.slice(0,-3))}|${t})`:t}function zn(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:An(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function Bn(e){return{session_id:e(),agent_id:null}}const Z=p({key:o,value:D(o)}).pipe(re(`TomlConfig`)),Vn=r(o,se(Z),{strict:!0,decode:e=>le({try:()=>un(e),catch:e=>new ue(e,`TOML parse error`)}).pipe(De(e=>oe(Z)(e))),encode:(e,t,n)=>je(new te(n,e,`TomlConfigFromText is decode-only`))}),Q=de(Z)({});var $=class extends m(`TomlLoader`)(){};const Hn=ve($,we(function*(){let e=yield*Ae(ke()),t=yield*F,n=yield*at;return $.of({load:a(`TomlLoader.load`)(function*(r){let i=Se(yield*_e(e),r);if(Ce(i))return i.value;let a=n.join(r,`systemfsoftware.toml`);if(!(yield*t.exists(a)))return yield*b(e,e=>(pe(e,r,Q),e)),Q;let o=yield*t.readFileString(a).pipe(c(ie(Vn)),he(()=>O(Q)));return yield*b(e,e=>(pe(e,r,o),e)),o})})})),Un={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},Wn={Edit:!0,MultiEdit:!0,Update:!0},Gn=S(D(i({old_text:d(_),new_text:d(_)}).pipe(l(e=>`old_text`in e||`new_text`in e))).pipe(ee(1)))
|
|
17
|
+
`)){let n=yn(e);if(n!==void 0){t.push(n),r=!0;continue}let i=hn.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=gn.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=vn(o.slice(3));e.length>0&&t.push(e)}}return t}function xn(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function Sn(e,t){if(_n[e]!==!0)return[];let n=t.input,r=typeof n==`string`?bn(n):[];if(r.length>0)return Array.from(new Set(r));let i=xn(t,`file_path`)??xn(t,`path`);return i===void 0?[]:[i]}const X=new Map;function Cn(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=X.get(n);if(r!==void 0)return r===!0||r.test(e);let i=wn(n);return X.size>=256&&X.clear(),X.set(n,i),i===!0||i.test(e)}function wn(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const Tn=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,En=/\$\(|`|\$\{?\w/,Dn=/\$\(([^()]*)\)|`([^`]*)`/g,On=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,kn=/&&|\|\||[;|]/,An=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function jn(e,t,n,r){let i=Tn.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?Mn(o,n.command):In(o,n.file_path,r)}function Mn(e,t){if(typeof t!=`string`)return!0;let n=Nn(t);return n.length===0||n.some(t=>Fn(e,t))?!0:Pn(e)&&En.test(t)}function Nn(e){let t=[...e.matchAll(Dn)].map(e=>e[1]??e[2]??``);return[e.replace(Dn,` `),...t].flatMap(e=>e.split(kn)).map(e=>e.trim().replace(On,``)).filter(e=>e.length>0)}function Pn(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function Fn(e,t){return RegExp(`^${e.split(`*`).map(An).join(`.*`)}$`).test(t)}function In(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:Ln(r);return RegExp(`^${Rn(i)}$`).test(a)}const Ln=e=>e.slice(e.lastIndexOf(`/`)+1);function Rn(e){let t=zn(e);return e.endsWith(`/**`)?`(?:${zn(e.slice(0,-3))}|${t})`:t}function zn(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:An(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function Bn(e){return{session_id:e(),agent_id:null}}const Z=p({key:o,value:D(o)}).pipe(re(`TomlConfig`)),Vn=r(o,se(Z),{strict:!0,decode:e=>le({try:()=>un(e),catch:e=>new ue(e,`TOML parse error`)}).pipe(De(e=>oe(Z)(e))),encode:(e,t,n)=>je(new te(n,e,`TomlConfigFromText is decode-only`))}),Q=de(Z)({});var $=class extends m(`TomlLoader`)(){};const Hn=ve($,we(function*(){let e=yield*Ae(ke()),t=yield*F,n=yield*at;return $.of({load:a(`TomlLoader.load`)(function*(r){let i=Se(yield*_e(e),r);if(Ce(i))return i.value;let a=n.join(r,`systemfsoftware.toml`);if(!(yield*t.exists(a)))return yield*b(e,e=>(pe(e,r,Q),e)),Q;let o=yield*t.readFileString(a).pipe(c(ie(Vn)),he(()=>O(Q)));return yield*b(e,e=>(pe(e,r,o),e)),o})})})),Un={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},Wn={Edit:!0,MultiEdit:!0,Update:!0},Gn=S(D(i({old_text:d(_),new_text:d(_)}).pipe(l(e=>`old_text`in e||`new_text`in e))).pipe(ee(1))),Kn=(e,t)=>{let n=e.split(`
|
|
18
|
+
`).filter(e=>e.startsWith(t));return n.length===0?void 0:n.map(e=>e.slice(t.length)).join(`
|
|
19
|
+
`)};function qn(e,t){let n=t;if(Un[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(Wn[e]===!0&&`edits`in n&&Gn(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
|
|
18
20
|
`),new_string:e.map(e=>e.new_string).join(`
|
|
19
|
-
`)}}return n}const
|
|
21
|
+
`)}}if(Wn[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=Kn(n.input,`+`),t=Kn(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const Jn=S(D(i({old_string:d(_),new_string:d(_)}).pipe(l(e=>`old_string`in e||`new_string`in e)))),Yn=e(p({key:o,value:_}));function Xn(e,t){let r=n(Yn(t));if(r===null)return{};let i=`file_path`in e||!(`path`in e)?`file_path`:`path`,a={};for(let[t,n]of Object.entries(r)){if(t===`file_path`){a[i]=n;continue}if(!((t===`old_string`||t===`new_string`)&&!(t in e))){if(t===`edits`&&Jn(n)&&Gn(e.edits)){a.edits=n.map(e=>({old_text:typeof e.old_string==`string`?e.old_string:``,new_text:typeof e.new_string==`string`?e.new_string:``}));continue}a[t]=n}}return a}const Zn={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function Qn(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=Zn[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{Ie as C,j as S,Ke as _,pn as a,We as b,qn as c,at as d,ot as f,ze as g,Ve as h,Sn as i,Qn as l,F as m,Hn as n,Cn as o,He as p,Xn as r,jn as s,$ as t,Bn as u,Ue as v,Be as x,Ge as y};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{$ as e,$t as t,A as n,B as r,Bn as i,C as a,D as o,Dt as s,E as c,Fn as l,G as u,H as d,In as f,J as p,K as m,L as h,Lt as ee,Mn as te,Mt as ne,Nn as g,O as _,Ot as v,P as y,Pn as re,Qt as ie,R as b,Rn as ae,S as x,T as S,U as C,Ut as oe,W as w,b as T,bt as se,et as ce,it as le,j as E,jn as ue,k as de,kn as D,kt as fe,r as pe,s as me,tt as he,w as ge,xt as _e,y as O,z as k,zn as A,zt as j}from"./esm-CeQhljd9.js";import{f as ve,l as ye,o as be,p as xe,s as Se,t as Ce,u as we}from"./CommandExecutor-WpnYtse1.js";import{a as Te,c as M,i as N,l as P,m as Ee,o as De,r as Oe,s as ke,u as F}from"./dist-DbemdM50.js";import{homedir as Ae}from"node:os";const I=[];function je(e){let t=e.trim();t.length!==0&&(I.length>=64&&I.shift(),I.push(t))}function Me(){return I.splice(0,I.length)}const Ne=`PreToolUse.PostToolUse.PostToolUseFailure.PostToolBatch.UserPromptSubmit.UserPromptExpansion.SessionStart.SessionEnd.Stop.StopFailure.PreCompact.PostCompact.PermissionRequest.PermissionDenied.SubagentStart.SubagentStop.MessageDisplay.Notification.Setup.TaskCreated.TaskCompleted.TeammateIdle.InstructionsLoaded.ConfigChange.CwdChanged.FileChanged.WorktreeCreate.WorktreeRemove.Elicitation.ElicitationResult`.split(`.`),Pe=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Fe={PermissionRequest:"OMP emits `tool_approval_requested`, but the event exists to allow or deny and OMP ignores the handler return. Express approval policy through OMP native approval configuration instead.",PermissionDenied:"OMP emits `tool_approval_resolved` with `approved: false`, which reports a manual decline by the user — the case Claude Code explicitly excludes, since this event fires only for auto-classifier denials.",SubagentStart:"OMP emits `agent_start`, but its payload carries no agent identity and it fires for the main agent turn loop too, so a bridge would fabricate subagent events that never happened.",SubagentStop:'OMP emits `agent_end` with the same identity gap, so a "subagent stopped" hook would fire on every main-agent turn end.',MessageDisplay:"The event exists to rewrite what Claude Code renders via `displayContent`; OMP `message_update` / `message_end` expose no equivalent control over rendering.",PostToolBatch:`OMP dispatches tool calls individually and exposes no end-of-batch signal.`,UserPromptExpansion:"OMP has no signal for a typed command expanding before it reaches the model; its `input` event fires after expansion would already have happened.",StopFailure:`OMP exposes no signal distinguishing a failed stop from an ordinary one.`,Notification:`Notifications are OMP-side UI; no extension event is emitted when one is raised.`,Setup:`OMP has no first-run setup lifecycle event.`,TaskCreated:`The OMP todo surface emits no per-task creation event to extensions.`,TaskCompleted:`The OMP todo surface emits no per-task completion event to extensions.`,TeammateIdle:`OMP has no teammate concept and emits no idle signal for one.`,InstructionsLoaded:`OMP loads instruction files without emitting an extension event.`,ConfigChange:`OMP does not notify extensions when its configuration changes.`,CwdChanged:`OMP exposes no working-directory change event.`,FileChanged:`OMP has no file-watch surface exposed to extensions.`,WorktreeCreate:`OMP emits no worktree lifecycle events.`,WorktreeRemove:`OMP emits no worktree lifecycle events.`,Elicitation:`MCP elicitation is not surfaced to OMP extensions.`,ElicitationResult:`MCP elicitation is not surfaced to OMP extensions.`},Ie=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],Le={PreCompact:"OMP `session_before_compact` does not say whether the compaction was manual or automatic, so a `trigger` matcher cannot be evaluated.",PostCompact:"OMP `session_compact` reports only whether an extension requested the compaction, not whether it was manual or automatic, so a `trigger` matcher cannot be evaluated.",SessionEnd:"OMP `session_shutdown` fires on process exit and carries no reason, so a `reason` matcher cannot be evaluated."},Re={SessionStart:{startup:{_tag:`Reachable`},compact:{_tag:`Reachable`},fork:{_tag:`Reachable`},resume:{_tag:`Partial`,reason:'covers a mid-session resume, which arrives as `session_switch` with `reason: "resume"`. A cold start under `--resume` never emits that signal — it reaches extensions through a bare `session_start` — so it presents as `startup` and a resume-scoped hook does not run there.'},clear:{_tag:`Unreachable`,reason:`OMP emits no signal when a session is cleared.`}}},ze=o({code:ge,stdout:c,stderr:c});var L=class extends _()(`Block`,{reason:c}){},R=class extends _()(`Allow`,{updatedInput:h(S({key:c,value:E}))}){},z=class extends _()(`Warning`,{message:c}){};n(L,R,z);var Be=class extends _()(`Blocked`,{reason:c}){},B=class extends _()(`Continue`,{warning:h(c),updatedInput:h(S({key:c,value:E}))}){};n(Be,B);const Ve=n(o({type:x(`command`),command:c,args:h(O(c)),async:h(T),asyncRewake:h(T),shell:h(x(`bash`,`powershell`)),timeout:h(ge),if:h(c),statusMessage:h(c),once:h(T)}),o({type:x(`http`,`mcp_tool`,`prompt`,`agent`)})),V=o({matcher:h(c),hooks:O(Ve)}),H=o({PreToolUse:b(O(V),{exact:!0,default:()=>[]}),PostToolUse:b(O(V),{exact:!0,default:()=>[]}),PostToolUseFailure:b(O(V),{exact:!0,default:()=>[]}),UserPromptSubmit:b(O(V),{exact:!0,default:()=>[]}),Stop:b(O(V),{exact:!0,default:()=>[]}),SessionStart:b(O(V),{exact:!0,default:()=>[]}),SessionEnd:b(O(V),{exact:!0,default:()=>[]}),PreCompact:b(O(V),{exact:!0,default:()=>[]}),PostCompact:b(O(V),{exact:!0,default:()=>[]})}),He=o({hooks:H,disableAllHooks:h(T)}),Ue=y(n(He,r(o({...H.fields,disableAllHooks:h(T),hooks:h(a)}),He,{strict:!0,decode:({disableAllHooks:e,...t})=>le(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e}),encode:(e,t,n)=>he(new p(n,e,`Decode-only`))}))),U=Pe,We=e(S({key:c,value:E})),Ge=[],Ke=e(O(o({matcher:h(c),hooks:b(O(o({type:h(c)})),{exact:!0,default:()=>[]})})));function qe(e){return te(We(e),e=>g(We(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const W=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Je={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},Ye=Ne,Xe=Fe,Ze=Le,Qe=Re,$e=e=>D(Ke(e),()=>Ge).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),et=e=>$e(e).length>0,tt=e=>u(e).pipe(w(`Reachable`,()=>re()),w(`Partial`,e=>l(e.reason)),w(`Unreachable`,e=>l(e.reason)),d);function nt(e){return g(qe(e),{onNone:()=>Je,onSome:({isWrapped:e,namespace:t,outer:n})=>{let r=[],i=[],a=[],o=[],s=[];for(let n of Object.keys(t)){if(!e&&n===`disableAllHooks`)continue;let s=Xe[n];if(s!==void 0){i.push({event:W(n),reason:s});continue}if(!Ye.includes(n)){r.push({event:W(n),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let c=Ze[n];c!==void 0&&et(t[n])&&a.push({event:W(n),reason:c});let l=Qe[n];l!==void 0&&o.push(...$e(t[n]).flatMap(e=>{let t=l[e];return t===void 0?[]:g(tt(t),{onNone:()=>[],onSome:t=>[{event:`${W(n)} (matcher "${W(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(n))Ye.includes(e)&&s.push({event:W(e),reason:"ignored: this file wraps its hooks under `hooks`, so a group repeated at the top level is never read"});return{unrecognized:r,notCarried:i,matcherNotEvaluable:a,matcherOutOfReach:o,shadowed:s,disabled:[]}}})}function rt(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${W(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>U.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function it(e){return g(qe(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let n of U){let r=D(Ke(e[n]),()=>Ge);for(let e of r)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(W(n.type))}return Array.from(t)}})}function at(e){let t={PreToolUse:[],PostToolUse:[],PostToolUseFailure:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[],PreCompact:[],PostCompact:[]};if(e.some(e=>e.managed&&e.settings.disableAllHooks===!0))return{hooks:t};let n=e.some(e=>!e.managed&&e.settings.disableAllHooks===!0);for(let r of e)if(!(n&&!r.managed))for(let e of U)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}const ot=y(k(o({decision:h(c),reason:h(c),hookSpecificOutput:h(o({permissionDecision:h(c),permissionDecisionReason:h(c),updatedInput:h(S({key:c,value:E}))}))}))),st=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var ct=class extends _()(`InterpretHookCommand`,{result:ze,event:c}){[st]=st};const lt=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var ut=class extends de()(`HookVerdictError`,{raw:c}){[lt]=lt};const G=Symbol.for(`@systemfsoftware/omp-claude-compat/ExitKind`);var dt=class extends _()(`ExitBlock`,{}){[G]=G},ft=class extends _()(`ExitDecisionJson`,{}){[G]=G},pt=class extends _()(`ExitNoDecision`,{}){[G]=G},mt=class extends _()(`ExitOther`,{}){[G]=G};n(dt,ft,pt,mt);const ht=e=>u(e.trim()).pipe(m(e=>e.startsWith(`{`),()=>new ft({})),C(()=>new pt({}))),gt=e=>u(e.code).pipe(m(2,()=>new dt({})),m(0,()=>ht(e.stdout)),C(()=>new mt({}))),_t=(e,t)=>u(e.trim()).pipe(m(``,()=>`Blocked by ${t} hook`),C(e=>e)),vt=(e,t)=>u(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(m(`deny`,()=>new L({reason:e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`})),m(`block`,()=>new L({reason:e.reason??`Blocked by ${t} hook`})),C(()=>new R({updatedInput:e.hookSpecificOutput?.updatedInput}))),yt=e=>u(e.trim()).pipe(m(``,()=>new R({})),C(e=>new z({message:e}))),bt=e=>u(gt(e.result)).pipe(w(`ExitBlock`,()=>i(new L({reason:_t(e.result.stderr,e.event)}))),w(`ExitNoDecision`,()=>i(new R({}))),w(`ExitDecisionJson`,()=>A(ot(e.result.stdout),{onLeft:()=>ae(new ut({raw:e.result.stdout})),onRight:t=>i(vt(t,e.event))})),w(`ExitOther`,()=>i(yt(e.result.stderr))),d),xt=Le,St=Ie,Ct=s(`loadSettingsFile`)(function*(e){let t=yield*(yield*Ee).readFileString(e).pipe(se(()=>j(``)));if(t===``)return null;let n=y(k(S({key:c,value:E})))(t);if(f(n))return null;let r=n.right,i=Ue(r);return f(i)?null:i.right}),K=`/etc/claude-code/managed-settings.json`,wt=e=>[`${Ae()}/.claude/settings.json`,`${e}/.claude/settings.json`,`${e}/.claude/settings.local.json`,K],Tt=s(`loadSettings`)(function*(e){return yield*Et(wt(e))}),Et=s(`loadSettingsWithPaths`)(function*(e,t=K){let n=[];for(let r of e){let e=yield*Ct(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:at(n)}),q=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),Dt=e=>[...e.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...e.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...e.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...e.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...e.shadowed.map(e=>` ${e.event}: ${e.reason}`),...e.disabled.map(e=>` ${e.event}: ${e.reason}`)],Ot=s(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*Ee,n=[],r=[],i=[],a=[],o=[],s=[],l=[],u=[];for(let d of e){let e=yield*t.readFileString(d).pipe(se(()=>j(``)));if(e===``)continue;let p=y(k(S({key:c,value:E})))(e);if(f(p)){u.push(d);continue}let m=nt(p.right);n.push(...m.unrecognized),r.push(...m.notCarried),i.push(...m.matcherNotEvaluable),a.push(...m.matcherOutOfReach),o.push(...m.shadowed),l.push(...it(p.right));let h=Ue(p.right);f(h)?u.push(d):s.push({settings:h.right,managed:d===K,label:d})}return{coverage:{unrecognized:q(n),notCarried:q(r),matcherNotEvaluable:q(i),matcherOutOfReach:q(a),shadowed:q(o),disabled:q(rt(s))},unsupportedHookTypes:Array.from(new Set(l)),malformedFiles:Array.from(new Set(u))}}),kt=s(`collectSettingsGaps`)(function*(e){return yield*Ot(wt(e))}),At={UserPromptSubmit:30},jt={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},J=s(`runHookScript`)(function*(e,t,n,r){let i=yield*Ce,a=(e.timeout??At[r]??600)*1e3,o=Nt(t),[s,c]=jt[e.shell??`sh`],l=(e.args===void 0?ye(s,c,e.command):ye(e.command,...e.args)).pipe(xe(n),be({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),Se(o),ve(`pipe`),we(`pipe`));return yield*ee(fe(function*(){let e=yield*i.start(l),t=yield*e.stdout.pipe(pe(),me),n=yield*e.stderr.pipe(pe(),me),r=yield*e.exitCode;return{code:typeof r==`number`?r:Number(r),stdout:t,stderr:n}})).pipe(oe(a),_e(`TimeoutException`,()=>j({code:-1,stdout:``,stderr:`timeout after ${a}ms`})))}),Y={},Mt=S({key:c,value:E}),X=e(Mt),Nt=ce(k(Mt)),Z=(e,n,r)=>e.pipe(ne({onSuccess:e=>je(e.stdout),onFailure:e=>{ie(e)||n.ui.notify(`Background hook failed: ${r}: ${t(e).split(`
|
|
2
|
-
|
|
3
|
-
`),
|
|
1
|
+
import{$ as e,$t as t,A as n,B as r,Bn as i,C as a,D as o,Dt as s,E as c,Fn as l,G as u,H as d,In as f,J as p,K as m,L as h,Lt as ee,Mn as te,Mt as ne,Nn as g,O as _,Ot as v,P as y,Pn as re,Qt as ie,R as b,Rn as ae,S as x,T as S,U as C,Ut as oe,W as w,b as T,bt as se,et as ce,it as le,j as E,jn as ue,k as de,kn as D,kt as fe,r as pe,s as me,tt as he,w as ge,xt as _e,y as O,z as k,zn as A,zt as j}from"./esm-CeQhljd9.js";import{f as ve,l as ye,o as be,p as xe,s as Se,t as Ce,u as we}from"./CommandExecutor-WpnYtse1.js";import{a as Te,c as M,i as N,l as P,m as Ee,o as De,r as Oe,s as ke,u as F}from"./dist-C2rAHz9c.js";import{homedir as Ae}from"node:os";const I=[];function je(e){let t=e.trim();t.length!==0&&(I.length>=64&&I.shift(),I.push(t))}function Me(){return I.splice(0,I.length)}const Ne=`PreToolUse.PostToolUse.PostToolUseFailure.PostToolBatch.UserPromptSubmit.UserPromptExpansion.SessionStart.SessionEnd.Stop.StopFailure.PreCompact.PostCompact.PermissionRequest.PermissionDenied.SubagentStart.SubagentStop.MessageDisplay.Notification.Setup.TaskCreated.TaskCompleted.TeammateIdle.InstructionsLoaded.ConfigChange.CwdChanged.FileChanged.WorktreeCreate.WorktreeRemove.Elicitation.ElicitationResult`.split(`.`),Pe=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Fe={PermissionRequest:"OMP emits `tool_approval_requested`, but the event exists to allow or deny and OMP ignores the handler return. Express approval policy through OMP native approval configuration instead.",PermissionDenied:"OMP emits `tool_approval_resolved` with `approved: false`, which reports a manual decline by the user — the case Claude Code explicitly excludes, since this event fires only for auto-classifier denials.",SubagentStart:"OMP emits `agent_start`, but its payload carries no agent identity and it fires for the main agent turn loop too, so a bridge would fabricate subagent events that never happened.",SubagentStop:'OMP emits `agent_end` with the same identity gap, so a "subagent stopped" hook would fire on every main-agent turn end.',MessageDisplay:"The event exists to rewrite what Claude Code renders via `displayContent`; OMP `message_update` / `message_end` expose no equivalent control over rendering.",PostToolBatch:`OMP dispatches tool calls individually and exposes no end-of-batch signal.`,UserPromptExpansion:"OMP has no signal for a typed command expanding before it reaches the model; its `input` event fires after expansion would already have happened.",StopFailure:`OMP exposes no signal distinguishing a failed stop from an ordinary one.`,Notification:`Notifications are OMP-side UI; no extension event is emitted when one is raised.`,Setup:`OMP has no first-run setup lifecycle event.`,TaskCreated:`The OMP todo surface emits no per-task creation event to extensions.`,TaskCompleted:`The OMP todo surface emits no per-task completion event to extensions.`,TeammateIdle:`OMP has no teammate concept and emits no idle signal for one.`,InstructionsLoaded:`OMP loads instruction files without emitting an extension event.`,ConfigChange:`OMP does not notify extensions when its configuration changes.`,CwdChanged:`OMP exposes no working-directory change event.`,FileChanged:`OMP has no file-watch surface exposed to extensions.`,WorktreeCreate:`OMP emits no worktree lifecycle events.`,WorktreeRemove:`OMP emits no worktree lifecycle events.`,Elicitation:`MCP elicitation is not surfaced to OMP extensions.`,ElicitationResult:`MCP elicitation is not surfaced to OMP extensions.`},Ie=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],Le={PreCompact:"OMP `session_before_compact` does not say whether the compaction was manual or automatic, so a `trigger` matcher cannot be evaluated.",PostCompact:"OMP `session_compact` reports only whether an extension requested the compaction, not whether it was manual or automatic, so a `trigger` matcher cannot be evaluated.",SessionEnd:"OMP `session_shutdown` fires on process exit and carries no reason, so a `reason` matcher cannot be evaluated."},Re={SessionStart:{startup:{_tag:`Reachable`},compact:{_tag:`Reachable`},fork:{_tag:`Reachable`},resume:{_tag:`Partial`,reason:'covers a mid-session resume, which arrives as `session_switch` with `reason: "resume"`. A cold start under `--resume` never emits that signal — it reaches extensions through a bare `session_start` — so it presents as `startup` and a resume-scoped hook does not run there.'},clear:{_tag:`Unreachable`,reason:`OMP emits no signal when a session is cleared.`}}},ze=o({code:ge,stdout:c,stderr:c});var L=class extends _()(`Block`,{reason:c}){},R=class extends _()(`Allow`,{updatedInput:h(S({key:c,value:E}))}){},z=class extends _()(`Warning`,{message:c}){};n(L,R,z);var Be=class extends _()(`Blocked`,{reason:c}){},B=class extends _()(`Continue`,{warning:h(c),updatedInput:h(S({key:c,value:E}))}){};n(Be,B);const Ve=n(o({type:x(`command`),command:c,args:h(O(c)),async:h(T),asyncRewake:h(T),shell:h(x(`bash`,`powershell`)),timeout:h(ge),if:h(c),statusMessage:h(c),once:h(T)}),o({type:x(`http`,`mcp_tool`,`prompt`,`agent`)})),V=o({matcher:h(c),hooks:O(Ve)}),He=o({PreToolUse:b(O(V),{exact:!0,default:()=>[]}),PostToolUse:b(O(V),{exact:!0,default:()=>[]}),PostToolUseFailure:b(O(V),{exact:!0,default:()=>[]}),UserPromptSubmit:b(O(V),{exact:!0,default:()=>[]}),Stop:b(O(V),{exact:!0,default:()=>[]}),SessionStart:b(O(V),{exact:!0,default:()=>[]}),SessionEnd:b(O(V),{exact:!0,default:()=>[]}),PreCompact:b(O(V),{exact:!0,default:()=>[]}),PostCompact:b(O(V),{exact:!0,default:()=>[]})}),Ue=o({hooks:He,disableAllHooks:h(T)}),We=y(n(Ue,r(o({...He.fields,disableAllHooks:h(T),hooks:h(a)}),Ue,{strict:!0,decode:({disableAllHooks:e,...t})=>le(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e}),encode:(e,t,n)=>he(new p(n,e,`Decode-only`))}))),H=Pe,U=e(S({key:c,value:E})),Ge=[],Ke=e(O(o({matcher:h(c),hooks:b(O(o({type:h(c)})),{exact:!0,default:()=>[]})})));function qe(e){return te(U(e),e=>g(U(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const W=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Je={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},Ye=Ne,Xe=Fe,Ze=Le,Qe=Re,$e=e=>D(Ke(e),()=>Ge).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),et=e=>$e(e).length>0,tt=e=>u(e).pipe(w(`Reachable`,()=>re()),w(`Partial`,e=>l(e.reason)),w(`Unreachable`,e=>l(e.reason)),d);function nt(e){return g(qe(e),{onNone:()=>Je,onSome:({isWrapped:e,namespace:t,outer:n})=>{let r=[],i=[],a=[],o=[],s=[];for(let n of Object.keys(t)){if(!e&&n===`disableAllHooks`)continue;let s=Xe[n];if(s!==void 0){i.push({event:W(n),reason:s});continue}if(!Ye.includes(n)){r.push({event:W(n),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let c=Ze[n];c!==void 0&&et(t[n])&&a.push({event:W(n),reason:c});let l=Qe[n];l!==void 0&&o.push(...$e(t[n]).flatMap(e=>{let t=l[e];return t===void 0?[]:g(tt(t),{onNone:()=>[],onSome:t=>[{event:`${W(n)} (matcher "${W(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(n))Ye.includes(e)&&s.push({event:W(e),reason:"ignored: this file wraps its hooks under `hooks`, so a group repeated at the top level is never read"});return{unrecognized:r,notCarried:i,matcherNotEvaluable:a,matcherOutOfReach:o,shadowed:s,disabled:[]}}})}function rt(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${W(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>H.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function it(e){return g(qe(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let n of H){let r=D(Ke(e[n]),()=>Ge);for(let e of r)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(W(n.type))}return Array.from(t)}})}function at(e){let t={PreToolUse:[],PostToolUse:[],PostToolUseFailure:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[],PreCompact:[],PostCompact:[]};if(e.some(e=>e.managed&&e.settings.disableAllHooks===!0))return{hooks:t};let n=e.some(e=>!e.managed&&e.settings.disableAllHooks===!0);for(let r of e)if(!(n&&!r.managed))for(let e of H)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}const ot=y(k(o({decision:h(c),reason:h(c),hookSpecificOutput:h(o({permissionDecision:h(c),permissionDecisionReason:h(c),updatedInput:h(S({key:c,value:E}))}))}))),st=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var ct=class extends _()(`InterpretHookCommand`,{result:ze,event:c}){[st]=st};const lt=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var ut=class extends de()(`HookVerdictError`,{raw:c}){[lt]=lt};const G=Symbol.for(`@systemfsoftware/omp-claude-compat/ExitKind`);var dt=class extends _()(`ExitBlock`,{}){[G]=G},ft=class extends _()(`ExitDecisionJson`,{}){[G]=G},pt=class extends _()(`ExitNoDecision`,{}){[G]=G},mt=class extends _()(`ExitOther`,{}){[G]=G};n(dt,ft,pt,mt);const ht=e=>u(e.trim()).pipe(m(e=>e.startsWith(`{`),()=>new ft({})),C(()=>new pt({}))),gt=e=>u(e.code).pipe(m(2,()=>new dt({})),m(0,()=>ht(e.stdout)),C(()=>new mt({}))),_t=(e,t)=>u(e.trim()).pipe(m(``,()=>`Blocked by ${t} hook`),C(e=>e)),vt=(e,t)=>u(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(m(`deny`,()=>new L({reason:e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`})),m(`block`,()=>new L({reason:e.reason??`Blocked by ${t} hook`})),C(()=>new R({updatedInput:e.hookSpecificOutput?.updatedInput}))),yt=e=>u(e.trim()).pipe(m(``,()=>new R({})),C(e=>new z({message:e}))),bt=e=>u(gt(e.result)).pipe(w(`ExitBlock`,()=>i(new L({reason:_t(e.result.stderr,e.event)}))),w(`ExitNoDecision`,()=>i(new R({}))),w(`ExitDecisionJson`,()=>A(ot(e.result.stdout),{onLeft:()=>ae(new ut({raw:e.result.stdout})),onRight:t=>i(vt(t,e.event))})),w(`ExitOther`,()=>i(yt(e.result.stderr))),d),xt=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
|
|
2
|
+
`,`$\r`,`$$ `,`$$ `,`$$
|
|
3
|
+
`,`$$\r`],K=Symbol.for(`@systemfsoftware/omp-claude-compat/PromptDestination`);var St=class extends _()(`Model`,{}){[K]=K},Ct=class extends _()(`Host`,{}){[K]=K};n(St,Ct);const wt=Symbol.for(`@systemfsoftware/omp-claude-compat/ClassifyPromptCommand`);var Tt=class extends _()(`ClassifyPromptCommand`,{text:c}){[wt]=wt};const Et=e=>xt.some(t=>`${e.trimStart()} `.startsWith(t)),Dt=e=>u(e.text).pipe(m(Et,()=>new Ct({})),C(()=>new St({}))),Ot=Le,kt=Ie,At=s(`loadSettingsFile`)(function*(e){let t=yield*(yield*Ee).readFileString(e).pipe(se(()=>j(``)));if(t===``)return null;let n=y(k(S({key:c,value:E})))(t);if(f(n))return null;let r=n.right,i=We(r);return f(i)?null:i.right}),q=`/etc/claude-code/managed-settings.json`,jt=e=>[`${Ae()}/.claude/settings.json`,`${e}/.claude/settings.json`,`${e}/.claude/settings.local.json`,q],Mt=s(`loadSettings`)(function*(e){return yield*Nt(jt(e))}),Nt=s(`loadSettingsWithPaths`)(function*(e,t=q){let n=[];for(let r of e){let e=yield*At(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:at(n)}),J=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),Pt=e=>[...e.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...e.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...e.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...e.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...e.shadowed.map(e=>` ${e.event}: ${e.reason}`),...e.disabled.map(e=>` ${e.event}: ${e.reason}`)],Ft=s(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*Ee,n=[],r=[],i=[],a=[],o=[],s=[],l=[],u=[];for(let d of e){let e=yield*t.readFileString(d).pipe(se(()=>j(``)));if(e===``)continue;let p=y(k(S({key:c,value:E})))(e);if(f(p)){u.push(d);continue}let m=nt(p.right);n.push(...m.unrecognized),r.push(...m.notCarried),i.push(...m.matcherNotEvaluable),a.push(...m.matcherOutOfReach),o.push(...m.shadowed),l.push(...it(p.right));let h=We(p.right);f(h)?u.push(d):s.push({settings:h.right,managed:d===q,label:d})}return{coverage:{unrecognized:J(n),notCarried:J(r),matcherNotEvaluable:J(i),matcherOutOfReach:J(a),shadowed:J(o),disabled:J(rt(s))},unsupportedHookTypes:Array.from(new Set(l)),malformedFiles:Array.from(new Set(u))}}),It=s(`collectSettingsGaps`)(function*(e){return yield*Ft(jt(e))}),Lt={UserPromptSubmit:30},Rt={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Y=s(`runHookScript`)(function*(e,t,n,r){let i=yield*Ce,a=(e.timeout??Lt[r]??600)*1e3,o=Bt(t),[s,c]=Rt[e.shell??`sh`],l=(e.args===void 0?ye(s,c,e.command):ye(e.command,...e.args)).pipe(xe(n),be({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),Se(o),ve(`pipe`),we(`pipe`));return yield*ee(fe(function*(){let e=yield*i.start(l),t=yield*e.stdout.pipe(pe(),me),n=yield*e.stderr.pipe(pe(),me),r=yield*e.exitCode;return{code:typeof r==`number`?r:Number(r),stdout:t,stderr:n}})).pipe(oe(a),_e(`TimeoutException`,()=>j({code:-1,stdout:``,stderr:`timeout after ${a}ms`})))}),X={},zt=S({key:c,value:E}),Z=e(zt),Bt=ce(k(zt)),Q=(e,n,r)=>e.pipe(ne({onSuccess:e=>je(e.stdout),onFailure:e=>{ie(e)||n.ui.notify(`Background hook failed: ${r}: ${t(e).split(`
|
|
4
|
+
`)[0]}`,`error`)}})),$=s(`runHooksForEvent`)(function*(e,t,n,r,i){let a=r.cwd,o=D(Z(n.tool_input),()=>X),s,c=n,f=Ot[i]!==void 0;for(let n of e)if(!(f&&n.matcher!==void 0)&&De(t,n.matcher))for(let e of n.hooks){if(e.type!==`command`||e.if!==void 0&&(!kt.includes(i)||!ke(e.if,t,o,a)))continue;if(e.async===!0||e.asyncRewake===!0){yield*v(Q(Y(e,c,a,i),r,e.command));continue}let n=u(u(A(bt(new ct({result:yield*Y(e,c,a,i),event:i})),{onLeft:e=>u(e).pipe(w(`HookVerdictError`,e=>new z({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`})),d),onRight:e=>e})).pipe(w(`Block`,e=>new Be({reason:e.reason})),w(`Warning`,e=>new B({warning:e.message})),w(`Allow`,e=>new B({updatedInput:e.updatedInput})),d)).pipe(w(`Blocked`,e=>l({block:!0,reason:e.reason})),w(`Continue`,e=>(e.warning!==void 0&&s===void 0&&(s=e.warning),e.updatedInput!==void 0&&(c={...c,...e.updatedInput}),re())),d);if(ue(n))return n.value}return{...c===n?{}:{updatedInput:c},...s===void 0?{}:{warning:s}}}),Vt=s(`runPreToolUseHooks`)(function*(e,t,n){let r=P(t.toolName),i=F(()=>n.sessionManager.getSessionId()),a=D(Z(t.input),()=>X),o=M(r,a),s=Te(t.toolName,a);if(s!==void 0&&s.length>0){let r={...i,tool_name:`Bash`,tool_input:{command:s},tool_call_id:t.toolCallId},a=yield*$(e.hooks.PreToolUse,`Bash`,r,n,`PreToolUse`);if(a.block===!0)return a.reason===void 0?{block:!0}:{block:!0,reason:a.reason}}let c=N(r,o),l=c.length===0?[o]:c.map(e=>({...o,file_path:e})),u={};for(let a of l){let o={...i,tool_name:r,tool_input:a,tool_call_id:t.toolCallId},s=yield*$(e.hooks.PreToolUse,r,o,n,`PreToolUse`);if(s.block===!0)return s.reason===void 0?{block:!0}:{block:!0,reason:s.reason};u=s}let d=l.length===1?u.updatedInput?.tool_input:void 0;Object.assign(t.input,Oe(a,d))}),Ht=s(`runPostToolUseHooks`)(function*(e,t,n){let r=P(t.toolName),i=F(()=>n.sessionManager.getSessionId()),a=M(r,D(Z(t.input),()=>X)),o=N(r,a),s=o.length===0?[a]:o.map(e=>({...a,file_path:e})),c,l={};for(let a of s){let o={...i,tool_name:r,tool_input:a,tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1},s=yield*$(e.hooks.PostToolUse,r,o,n,`PostToolUse`);if(s.block===!0)return s;c===void 0&&(c=s.warning),l=s}return c===void 0?l:{...l,warning:c}}),Ut=e(O(o({text:h(c)}))),Wt=e(c),Gt=e=>g(Ut(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
|
|
5
|
+
`),onNone:()=>D(Wt(e),()=>``)}),Kt=s(`runPostToolUseFailureHooks`)(function*(e,t,n){let r=P(t.toolName),i=M(r,D(Z(t.input),()=>X)),a={...F(()=>n.sessionManager.getSessionId()),tool_name:r,tool_input:i,tool_use_id:t.toolCallId,error:Gt(t.content)},o=yield*$(e.hooks.PostToolUseFailure,r,a,n,`PostToolUseFailure`);return o.block===!0?o.reason===void 0?{}:{warning:o.reason}:o}),qt=s(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Kt(e,t,n):yield*Ht(e,t,n)}),Jt=s(`runPreCompactHooks`)(function*(e,t){let n={...F(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)}),Yt=s(`runUserPromptSubmitHooks`)(function*(e,t,n){let r=e.hooks.UserPromptSubmit,i=n.cwd,a=Dt(new Tt({text:t.text})),o=u(a).pipe(w(`Host`,()=>[]),w(`Model`,()=>Me()),d),s=[],c={...F(()=>n.sessionManager.getSessionId()),prompt:t.text,source:t.source};for(let e of r)for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0)continue;let e=yield*Y(t,c,i,`UserPromptSubmit`),r=A(bt(new ct({result:e,event:`UserPromptSubmit`})),{onLeft:()=>void 0,onRight:e=>u(e).pipe(w(`Block`,e=>e.reason),C(()=>void 0))});if(r!==void 0)return n.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${r}`,`error`),{handled:!0};if(e.code!==0)continue;let a=e.stdout.trim();a.length>0&&s.push(a)}return u(a).pipe(w(`Host`,()=>void 0),w(`Model`,()=>{let e=[...o,...s].join(`
|
|
4
6
|
|
|
5
|
-
`),
|
|
6
|
-
|
|
7
|
-
`:``)+s)}if(a.length===0)return;let s={text:`${a}\n\n${t.text}`};return t.images!==void 0&&(s.images=t.images),s}),$=s(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...F(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!De(t,e.matcher))){for(let t of e.hooks)if(t.type===`command`&&t.if===void 0){if(t.async===!0||t.asyncRewake===!0){yield*v(Z(J(t,a,i,`SessionStart`),n,t.command));continue}yield*J(t,a,i,`SessionStart`)}}}),Ut=s(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*$(e,t,n))}),Wt=s(`runLifecycleHooks`)(function*(e,t,n){if(e.length===0)return;let r=t.cwd,i={...F(()=>t.sessionManager.getSessionId())},a=xt[n]!==void 0;for(let o of e)if(!(a&&o.matcher!==void 0))for(let e of o.hooks)e.type===`command`&&e.if===void 0&&(e.async===!0||e.asyncRewake===!0?yield*v(Z(J(e,i,r,n),t,e.command)):yield*J(e,i,r,n))});export{kt as collectSettingsGaps,Dt as coverageReportLines,Tt as loadSettings,Wt as runLifecycleHooks,Vt as runPreCompactHooks,Pt as runPreToolUseHooks,$ as runSessionStartHooks,Ut as runSessionSwitchHooks,Bt as runToolResultHooks,Ht as runUserPromptSubmitHooks};
|
|
7
|
+
`);if(e.length===0)return;let n={text:`${e}\n\n${t.text}`};return t.images!==void 0&&(n.images=t.images),n}),d)}),Xt=s(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...F(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!De(t,e.matcher))){for(let t of e.hooks)if(t.type===`command`&&t.if===void 0){if(t.async===!0||t.asyncRewake===!0){yield*v(Q(Y(t,a,i,`SessionStart`),n,t.command));continue}yield*Y(t,a,i,`SessionStart`)}}}),Zt=s(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*Xt(e,t,n))}),Qt=s(`runLifecycleHooks`)(function*(e,t,n){if(e.length===0)return;let r=t.cwd,i={...F(()=>t.sessionManager.getSessionId())},a=Ot[n]!==void 0;for(let o of e)if(!(a&&o.matcher!==void 0))for(let e of o.hooks)e.type===`command`&&e.if===void 0&&(e.async===!0||e.asyncRewake===!0?yield*v(Q(Y(e,i,r,n),t,e.command)):yield*Y(e,i,r,n))});export{It as collectSettingsGaps,Pt as coverageReportLines,Mt as loadSettings,Qt as runLifecycleHooks,Jt as runPreCompactHooks,Vt as runPreToolUseHooks,Xt as runSessionStartHooks,Zt as runSessionSwitchHooks,qt as runToolResultHooks,Yt as runUserPromptSubmitHooks};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=(e,t)=>{e(e=>{e.setTimeout(()=>{t()},0)});let n=()=>{t().then(({default:e})=>e.dispose())};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)},t=e=>{let t=async e=>{let[t,n]=await Promise.all([import(`./runtime-
|
|
2
|
-
`)}`,`warning`),e.unsupportedHookTypes.length>0&&n.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${e.unsupportedHookTypes.join(`, `)}`,`warning`),e.malformedFiles.length>0&&n.ui.notify(`Hooks are NOT running from malformed settings file(s): ${e.malformedFiles.join(`, `)}`,`error`);let s=yield*a(n.cwd);s&&(yield*o(s,`startup`,n))}))}),e.on(`session_compact`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i,runSessionStartHooks:a}=await import(`./hook-dispatcher.executor-
|
|
1
|
+
const e=(e,t)=>{e(e=>{e.setTimeout(()=>{t()},0)});let n=()=>{t().then(({default:e})=>e.dispose())};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)},t=e=>{let t=async e=>{let[t,n]=await Promise.all([import(`./runtime-CmfegZ0F.js`).then(e=>e.default),import(`./esm-CeQhljd9.js`)]),{Cause:r,Effect:i,Exit:a}=n,o=e.pipe(i.exit),s=await t.runPromise(o);if(a.isFailure(s))throw r.squash(s.cause);return s.value};e.on(`tool_call`,async(e,n)=>{let{loadSettings:r,runPreToolUseHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`tool_result`,async(e,n)=>{let{loadSettings:r,runToolResultHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(!t)return;let a=yield*i(t,e,n);if(a.block===!0)return{isError:!0,content:[{type:`text`,text:a.reason??`Blocked by PostToolUse hook`}]};if(a.warning!==void 0)return{content:[...e.content,{type:`text`,text:a.warning}],isError:e.isError}}))}),e.on(`input`,async(e,n)=>{let{loadSettings:r,runUserPromptSubmitHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`session_start`,async(e,n)=>{let{collectSettingsGaps:r,coverageReportLines:i,loadSettings:a,runSessionStartHooks:o}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:s}=await import(`./esm-CeQhljd9.js`);return t(s.gen(function*(){let e=yield*r(n.cwd),t=i(e.coverage);t.length>0&&n.ui.notify(`Hook coverage — configured hooks this bridge will not run:\n${t.join(`
|
|
2
|
+
`)}`,`warning`),e.unsupportedHookTypes.length>0&&n.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${e.unsupportedHookTypes.join(`, `)}`,`warning`),e.malformedFiles.length>0&&n.ui.notify(`Hooks are NOT running from malformed settings file(s): ${e.malformedFiles.join(`, `)}`,`error`);let s=yield*a(n.cwd);s&&(yield*o(s,`startup`,n))}))}),e.on(`session_compact`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i,runSessionStartHooks:a}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:o}=await import(`./esm-CeQhljd9.js`);return t(o.gen(function*(){let e=yield*r(n.cwd);e&&(yield*a(e,`compact`,n),yield*i(e.hooks.PostCompact,n,`PostCompact`))}))}),e.on(`session_before_compact`,async(e,n)=>{let{loadSettings:r,runPreCompactHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);if(!e)return;let t=yield*i(e,n);if(t.block===!0)return n.ui.notify(`Compaction cancelled by a PreCompact hook: ${t.reason??`no reason given`}`,`warning`),{cancel:!0}}))}),e.on(`session_switch`,async(e,n)=>{let{loadSettings:r,runSessionSwitchHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);t&&(yield*i(t,e.reason,n))}))}),e.on(`session_shutdown`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e.hooks.SessionEnd,n,`SessionEnd`))}))}),e.on(`session_stop`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-ve2Ynf0r.js`),{Effect:a}=await import(`./esm-CeQhljd9.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e.hooks.Stop,n,`Stop`))}))})},n=e=>{e.on(`before_agent_start`,async(e,t)=>{let n=await import(`./runtime-CmfegZ0F.js`).then(e=>e.default),{loadReferencedContent:r}=await import(`./inject-instructions.executor-Bvgs3Fc8.js`),{Cause:i,Config:a,Effect:o,Exit:s}=await import(`./esm-CeQhljd9.js`),c=await n.runPromise(o.gen(function*(){let e=yield*a.string(`CLAUDE_PROJECT_DIR`).pipe(a.withDefault(process.cwd()));return yield*r(e)}).pipe(o.exit));if(s.isFailure(c))throw i.squash(c.cause);let l=c.value;if(l!==``)return{systemPrompt:[...e.systemPrompt,``,l]}})};function r(r){t(r),n(r),e(e=>r.on(`session_start`,(t,n)=>e(n)),()=>import(`./runtime-CmfegZ0F.js`))}export{r as default};
|
package/dist/{inject-instructions.executor-CpsBw0g8.js → inject-instructions.executor-Bvgs3Fc8.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as e,Ct as t,Dt as n,E as r,Fn as i,G as a,H as o,In as s,Ln as c,O as l,On as u,Pn as d,W as f,bt as p,jn as m,y as h,zt as g}from"./esm-CeQhljd9.js";import{d as _,m as v,t as y}from"./dist-
|
|
1
|
+
import{A as e,Ct as t,Dt as n,E as r,Fn as i,G as a,H as o,In as s,Ln as c,O as l,On as u,Pn as d,W as f,bt as p,jn as m,y as h,zt as g}from"./esm-CeQhljd9.js";import{d as _,m as v,t as y}from"./dist-C2rAHz9c.js";const b=[`AGENTS.md`],x=Symbol.for(`@systemfsoftware/omp-claude-compat/RefVerdict`);var S=class extends l()(`Inject`,{}){[x]=x},C=class extends l()(`Skip`,{matched:r}){[x]=x};e(S,C);const w=Symbol.for(`@systemfsoftware/omp-claude-compat/CheckRefInjectionCommand`);var T=class extends l()(`CheckRefInjectionCommand`,{relativePath:r,skipList:h(r)}){[w]=w};const E=e=>u(e.skipList.find(t=>t===e.relativePath)),D=e=>a(E(e)).pipe(f(`None`,()=>new S),f(`Some`,e=>new C({matched:e.value})),o),O=n(`extractRefs`)(function*(e,n,r){let i=yield*v,a=yield*_,o=[];for(let s of e.split(`
|
|
2
2
|
`)){let e=s.trim().replace(/^[-*+]\s+/,``);if(!e.startsWith(`@`))continue;let l=e.slice(1).trim();if(!l||l.includes(` `)||a.isAbsolute(l))continue;let u=a.resolve(n,l);if(u.startsWith(r+`/`)||u===r){let e=yield*t(i.exists(u));if(c(e)&&e.right){o.push({sourcePath:n,resolvedPath:u});continue}}let d=a.resolve(r,l);(d.startsWith(r+`/`)||d===r)&&d!==u&&o.push({sourcePath:r,resolvedPath:d})}return o}),k=n(`loadReferencedContent`)(function*(e){let n=yield*v,r=yield*_,l=yield*y,u=[r.resolve(e,`CLAUDE.md`),r.resolve(e,`.claude`,`CLAUDE.md`)],h=[];for(let i of u){let a=yield*t(n.readFileString(i,`utf-8`));if(c(a)){let t=yield*O(a.right,r.dirname(i),e);h.push(...t)}}let x=new Set,S=[];for(let e of h)x.has(e.resolvedPath)||(x.add(e.resolvedPath),S.push(e));let C=(yield*l.load(e).pipe(p(()=>g(void 0))))?.no_inject_refs??b,w=[];for(let r of S){let c=r.resolvedPath.slice(e.length+1);if(m(a(D(new T({relativePath:c,skipList:C}))).pipe(f(`Skip`,e=>i(e.matched)),f(`Inject`,()=>d()),o)))continue;let l=yield*t(n.readFileString(r.resolvedPath,`utf-8`));s(l)||w.push(`## ${c}\n${l.right}\n`)}return w.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...w].join(`
|
|
3
3
|
`)});export{k as loadReferencedContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{At as e,Bt as t,Cn as n,Dn as r,Et as i,Fn as a,Ft as o,Gt as s,Hn as c,Ht as l,It as u,Jt as d,Kt as f,Lt as p,Nn as ee,Nt as te,On as m,Ot as ne,Pn as re,Pt as ie,Rt as ae,St as oe,Tt as h,Un as se,Vt as g,Xt as _,Yt as v,_ as ce,_n as le,at as ue,c as de,cn as y,ct as fe,d as pe,dn as b,dt as me,f as he,fn as ge,ft as x,gt as S,ht as C,i as _e,identity as ve,jt as w,kn as T,ln as ye,lt as E,m as be,on as xe,ot as Se,p as D,pipe as O,pn as Ce,pt as k,q as we,qt as Te,sn as Ee,st as A,t as De,un as Oe,ut as ke,vt as Ae,wt as je,yt as j,zt as M}from"./esm-CeQhljd9.js";import{a as Me,c as N,d as P,i as F,n as Ne,r as Pe,t as Fe}from"./CommandExecutor-WpnYtse1.js";import{C as I,S as Ie,_ as Le,b as Re,f as ze,g as L,h as R,m as z,n as Be,p as Ve,v as He,x as Ue,y as We}from"./dist-DbemdM50.js";import*as Ge from"node:os";import*as Ke from"node:crypto";import*as B from"node:path";import*as V from"node:fs";import*as H from"node:child_process";const U=(e,t,n)=>(...r)=>j(i=>{try{e(...r,(e,n)=>{i(e?h(t?t(e,r):e):M(n))})}catch(e){i(n?h(n(e,r)):oe(e))}}),W=(e,t,n)=>_e(qe(e,t,n)),qe=(e,t,n)=>E(()=>Xe(e(),t,le(void 0),n)),Je=(e,t,{encoding:n,endOnDone:r=!0}={},i=C)=>{let a=Ye(e,n),o=r?j(t=>{`closed`in e&&e.closed?t(C):(e.once(`finish`,()=>t(C)),e.end())}):C;return{awaitRead:()=>C,emit:a,error:e=>_(o,t(e)),done:e=>_(o,i)}},Ye=(e,t)=>n=>n.length===0?C:j(r=>{let i=n[Symbol.iterator](),a=i.next();function o(){let n=a;a=i.next();let s=e.write(n.value,t);a.done?r(C):s?o():e.once(`drain`,o)}o()}),Xe=(e,t,r,i)=>{if(!e.readable)return ke;let a=Te(!1);function o(){a.unsafeOpen()}function s(e){r.current=xe(t(e)),a.unsafeOpen()}function c(){r.current=Ee,a.unsafeOpen()}e.on(`readable`,o),e.on(`error`,s),e.on(`end`,c);let l=i?.chunkSize?Number(i.chunkSize):void 0;return Se(E(function t(){let i=e.read(l);if(i===null)return r.current?fe(r.current):(a.unsafeClose(),A(a.await,t));let o=[i];for(;;){if(i=e.read(l),i===null)return A(me(n(o)),t);o.push(i)}}),g(()=>{e.off(`readable`,o),e.off(`error`,s),e.off(`end`,c),i?.closeOnDone!==!1&&`closed`in e&&!e.closed&&e.destroy()}))},Ze=(e,t,n)=>ce(Qe(e,t,n)),Qe=(e,t,n)=>A(v(g(()=>e()),ge()),([e,r])=>ue($e(e,r,t),Je(e,e=>Oe(r,e),n,ye(r,C)))),$e=(e,n,r)=>t(()=>{function t(e){Ce(n,h(r(e)))}return e.on(`error`,t),je(y(n),g(()=>{e.removeListener(`error`,t)}))}),G=(e,t)=>(n,[r])=>{let i=`Unknown`;switch(n.code){case`ENOENT`:i=`NotFound`;break;case`EACCES`:i=`PermissionDenied`;break;case`EEXIST`:i=`AlreadyExists`;break;case`EISDIR`:i=`BadResource`;break;case`ENOTDIR`:i=`BadResource`;break;case`EBUSY`:i=`Busy`;break;case`ELOOP`:i=`BadResource`;break}return new I({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},et=e=>typeof e==`string`?e:`pipe`,K=e=>typeof e==`string`?e:`pipe`,q=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),J=(e,t,n)=>{let r=N(n).reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return G(`Command`,e)(t,[r])},tt={[F]:F,...c,toJSON(){return{_id:`@effect/platform/CommandExecutor/Process`,pid:this.pid}}},Y=n=>r=>{switch(r._tag){case`StandardCommand`:{let a=i(ge(),e=>j(t=>{let n=H.spawn(r.command,r.args,{stdio:[et(r.stdin),K(r.stdout),K(r.stderr)],cwd:T(r.cwd,se),shell:r.shell,env:{...process.env,...Object.fromEntries(r.env)},detached:process.platform!==`win32`});return n.on(`error`,e=>{t(h(J(`spawn`,e,r)))}),n.on(`exit`,(...t)=>{Ce(e,M(t))}),n.on(`spawn`,()=>{t(M([n,e]))}),g(()=>{n.kill(`SIGTERM`)})})),o=process.platform===`win32`?(e,t)=>j(t=>{H.exec(`taskkill /pid ${e.pid} /T /F`,e=>{t(e?h(J(`kill`,q(e),r)):C)})}):(e,t)=>f({try:()=>process.kill(-e.pid,t),catch:e=>J(`kill`,q(e),r)}),s=(e,n)=>t(()=>e.kill(n)?C:h(J(`kill`,new globalThis.Error(`Failed to kill process`),r)));return O(ee(r.cwd,{onNone:()=>C,onSome:e=>n.access(e)}),_(S(a,([t,n])=>i(b(n),r=>r?i(y(n),([n])=>n!==0&&n!==null?o(t,`SIGTERM`).pipe(e):C):o(t,`SIGTERM`).pipe(u(()=>s(t,`SIGTERM`)),_(y(n)),e)))),w(([e,t])=>{let n=be;e.stdin!==null&&(n=Ze(()=>e.stdin,e=>J(`toWritable`,q(e),r)));let a=i(y(t),([e,t])=>e===null?h(J(`exitCode`,new globalThis.Error(`Process interrupted due to receipt of signal: ${t}`),r)):M(Ne(e))),c=ie(b(t)),l=(n=`SIGTERM`)=>o(e,n).pipe(u(()=>s(e,n)),_(Ae(y(t)))),d=Pe(e.pid),f=W(()=>e.stderr,e=>J(`fromReadable(stderr)`,q(e),r)),p=W(()=>e.stdout,e=>J(`fromReadable(stdout)`,q(e),r));return typeof r.stdout!=`string`&&(p=pe(p,r.stdout)),Object.assign(Object.create(tt),{pid:d,exitCode:a,isRunning:c,kill:l,stdin:n,stderr:f,stdout:p})}),typeof r.stdin==`string`?ve:l(e=>ne(de(r.stdin,e.stdin))))}case`PipedCommand`:{let e=N(r);if(e.length===1)return O(e[0],Y(n));let t=e[0],i=e.slice(1),a=i.slice(0,i.length-1),o=i[i.length-1];return O(P(o,a.reduce((e,t)=>O(P(t,e),Y(n),w(e=>e.stdout),D),O(Y(n)(t),w(e=>e.stdout),D))),Y(n))}}},nt=x(Fe,O(z,w(e=>Me(Y(e))))),X=e=>t=>new Ie({module:`FileSystem`,method:e,cause:t}),rt=(()=>{let e=U(V.access,G(`FileSystem`,`access`),X(`access`));return(t,n)=>{let r=V.constants.F_OK;return n?.readable&&(r|=V.constants.R_OK),n?.writable&&(r|=V.constants.W_OK),e(t,r)}})(),it=(()=>{let e=U(V.cp,G(`FileSystem`,`copy`),X(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),at=(()=>{let e=U(V.copyFile,G(`FileSystem`,`copyFile`),X(`copyFile`));return(t,n)=>e(t,n)})(),ot=(()=>{let e=U(V.chmod,G(`FileSystem`,`chmod`),X(`chmod`));return(t,n)=>e(t,n)})(),st=(()=>{let e=U(V.chown,G(`FileSystem`,`chown`),X(`chown`));return(t,n,r)=>e(t,n,r)})(),ct=(()=>{let e=U(V.link,G(`FileSystem`,`link`),X(`link`));return(t,n)=>e(t,n)})(),lt=(()=>{let e=U(V.mkdir,G(`FileSystem`,`makeDirectory`),X(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),Z=e=>{let n=U(V.mkdtemp,G(`FileSystem`,e),X(e));return e=>t(()=>{let t=e?.prefix??``,r=typeof e?.directory==`string`?B.join(e.directory,`.`):Ge.tmpdir();return n(t?B.join(r,t):r+`/`)})},ut=Z(`makeTempDirectory`),Q=e=>{let t=U(V.rm,G(`FileSystem`,e),X(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},dt=Q(`remove`),ft=(()=>{let e=Z(`makeTempDirectoryScoped`),t=Q(`makeTempDirectoryScoped`);return n=>S(e(n),e=>o(t(e,{recursive:!0})))})(),pt=e=>{let t=U(V.open,G(`FileSystem`,e),X(e)),n=U(V.close,G(`FileSystem`,e),X(e));return(e,r)=>O(S(t(e,r?.flag??`r`,r?.mode),e=>o(n(e))),w(e=>ht(Ve(e),r?.flag?.startsWith(`a`)??!1)))},mt=pt(`open`),ht=(()=>{let e=e=>U(V.read,G(`FileSystem`,e),X(e)),n=e(`read`),r=e(`readAlloc`),o=U(V.fstat,G(`FileSystem`,`stat`),X(`stat`)),s=U(V.ftruncate,G(`FileSystem`,`truncate`),X(`truncate`)),c=U(V.fsync,G(`FileSystem`,`sync`),X(`sync`)),l=e=>U(V.write,G(`FileSystem`,e),X(e)),u=l(`write`),f=l(`writeAll`);class p{fd;append;[R];semaphore=d(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[R]=R}get stat(){return w(o(this.fd),wt)}get sync(){return c(this.fd)}seek(e,t){let n=L(e);return this.semaphore.withPermits(1)(g(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(w(t(()=>n(this.fd,{buffer:e,position:this.position})),e=>{let t=L(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(i(g(()=>Buffer.allocUnsafeSlow(t)),e=>w(r(this.fd,{buffer:e,position:this.position}),n=>{if(n===0)return re();if(this.position+=BigInt(n),n===t)return a(e);let r=Buffer.allocUnsafeSlow(n);return e.copy(r,0,0,n),a(r)})))}truncate(e){return this.semaphore.withPermits(1)(w(s(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}}))}write(e){return this.semaphore.withPermits(1)(w(t(()=>u(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=L(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return i(t(()=>f(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?h(new I({module:`FileSystem`,method:`writeAll`,reason:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position+=BigInt(t)),t<e.length?this.writeAllChunk(e.subarray(t)):C))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new p(e,t)})(),gt=e=>{let t=Z(e),n=pt(e),r=e=>g(()=>Ke.randomBytes(e).toString(`hex`));return e=>O(v(t(e),r(6)),w(([t,n])=>B.join(t,n+(e?.suffix??``))),l(e=>p(n(e,{flag:`w+`}))))},_t=gt(`makeTempFile`),vt=(()=>{let e=gt(`makeTempFileScoped`),t=Q(`makeTempFileScoped`);return n=>S(e(n),e=>o(t(B.dirname(e),{recursive:!0})))})(),yt=(e,t)=>s({try:()=>V.promises.readdir(e,t),catch:t=>G(`FileSystem`,`readDirectory`)(t,[e])}),bt=e=>j((t,n)=>{try{V.readFile(e,{signal:n},(n,r)=>{t(n?h(G(`FileSystem`,`readFile`)(n,[e])):M(r))})}catch(e){t(h(X(`readFile`)(e)))}}),xt=(()=>{let e=U(V.readlink,G(`FileSystem`,`readLink`),X(`readLink`));return t=>e(t)})(),St=(()=>{let e=U(V.realpath,G(`FileSystem`,`realPath`),X(`realPath`));return t=>e(t)})(),Ct=(()=>{let e=U(V.rename,G(`FileSystem`,`rename`),X(`rename`));return(t,n)=>e(t,n)})(),wt=e=>({type:e.isFile()?`File`:e.isDirectory()?`Directory`:e.isSymbolicLink()?`SymbolicLink`:e.isBlockDevice()?`BlockDevice`:e.isCharacterDevice()?`CharacterDevice`:e.isFIFO()?`FIFO`:e.isSocket()?`Socket`:`Unknown`,mtime:m(e.mtime),atime:m(e.atime),birthtime:m(e.birthtime),dev:e.dev,rdev:m(e.rdev),ino:m(e.ino),mode:e.mode,nlink:m(e.nlink),uid:m(e.uid),gid:m(e.gid),size:L(e.size),blksize:m(L(e.blksize)),blocks:m(e.blocks)}),$=(()=>{let e=U(V.stat,G(`FileSystem`,`stat`),X(`stat`));return t=>w(e(t),wt)})(),Tt=(()=>{let e=U(V.symlink,G(`FileSystem`,`symlink`),X(`symlink`));return(t,n)=>e(t,n)})(),Et=(()=>{let e=U(V.truncate,G(`FileSystem`,`truncate`),X(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),Dt=(()=>{let e=U(V.utimes,G(`FileSystem`,`utime`),X(`utime`));return(t,n,r)=>e(t,n,r)})(),Ot=(e,t)=>De(n=>S(g(()=>{let r=V.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(te($(t),{onSuccess:e=>M(He({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?M(We({path:t})):h(e)}));return;case`change`:n.single(Re({path:t}));return}});return r.on(`error`,t=>{n.fail(new I({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>g(()=>e.close()))),kt=(e,t,n)=>$(t).pipe(w(i=>e.pipe(r(e=>e.register(t,i,n)),T(()=>Ot(t,n)))),he),At=(e,t,n)=>j((r,i)=>{try{V.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?h(G(`FileSystem`,`writeFile`)(t,[e])):C)})}catch(e){r(h(X(`writeFile`)(e)))}}),jt=x(z,w(ae(Le),e=>Ue({access:rt,chmod:ot,chown:st,copy:it,copyFile:at,link:ct,makeDirectory:lt,makeTempDirectory:ut,makeTempDirectoryScoped:ft,makeTempFile:_t,makeTempFileScoped:vt,open:mt,readDirectory:yt,readFile:bt,readLink:xt,realPath:St,remove:dt,rename:Ct,stat:$,symlink:Tt,truncate:Et,utimes:Dt,watch(t,n){return kt(e,t,n)},writeFile:At}))),Mt=nt.pipe(k(jt),k(ze)),Nt=we(Be.pipe(k(Mt)));export{Nt as default};
|
|
1
|
+
import{At as e,Bt as t,Cn as n,Dn as r,Et as i,Fn as a,Ft as o,Gt as s,Hn as c,Ht as l,It as u,Jt as d,Kt as f,Lt as p,Nn as ee,Nt as te,On as m,Ot as ne,Pn as re,Pt as ie,Rt as ae,St as oe,Tt as h,Un as se,Vt as g,Xt as _,Yt as v,_ as ce,_n as le,at as ue,c as de,cn as y,ct as fe,d as pe,dn as b,dt as me,f as he,fn as ge,ft as x,gt as S,ht as C,i as _e,identity as ve,jt as w,kn as T,ln as ye,lt as E,m as be,on as xe,ot as Se,p as D,pipe as O,pn as Ce,pt as k,q as we,qt as Te,sn as Ee,st as A,t as De,un as Oe,ut as ke,vt as Ae,wt as je,yt as j,zt as M}from"./esm-CeQhljd9.js";import{a as Me,c as N,d as P,i as F,n as Ne,r as Pe,t as Fe}from"./CommandExecutor-WpnYtse1.js";import{C as I,S as Ie,_ as Le,b as Re,f as ze,g as L,h as R,m as z,n as Be,p as Ve,v as He,x as Ue,y as We}from"./dist-C2rAHz9c.js";import*as Ge from"node:os";import*as Ke from"node:crypto";import*as B from"node:path";import*as V from"node:fs";import*as H from"node:child_process";const U=(e,t,n)=>(...r)=>j(i=>{try{e(...r,(e,n)=>{i(e?h(t?t(e,r):e):M(n))})}catch(e){i(n?h(n(e,r)):oe(e))}}),W=(e,t,n)=>_e(qe(e,t,n)),qe=(e,t,n)=>E(()=>Xe(e(),t,le(void 0),n)),Je=(e,t,{encoding:n,endOnDone:r=!0}={},i=C)=>{let a=Ye(e,n),o=r?j(t=>{`closed`in e&&e.closed?t(C):(e.once(`finish`,()=>t(C)),e.end())}):C;return{awaitRead:()=>C,emit:a,error:e=>_(o,t(e)),done:e=>_(o,i)}},Ye=(e,t)=>n=>n.length===0?C:j(r=>{let i=n[Symbol.iterator](),a=i.next();function o(){let n=a;a=i.next();let s=e.write(n.value,t);a.done?r(C):s?o():e.once(`drain`,o)}o()}),Xe=(e,t,r,i)=>{if(!e.readable)return ke;let a=Te(!1);function o(){a.unsafeOpen()}function s(e){r.current=xe(t(e)),a.unsafeOpen()}function c(){r.current=Ee,a.unsafeOpen()}e.on(`readable`,o),e.on(`error`,s),e.on(`end`,c);let l=i?.chunkSize?Number(i.chunkSize):void 0;return Se(E(function t(){let i=e.read(l);if(i===null)return r.current?fe(r.current):(a.unsafeClose(),A(a.await,t));let o=[i];for(;;){if(i=e.read(l),i===null)return A(me(n(o)),t);o.push(i)}}),g(()=>{e.off(`readable`,o),e.off(`error`,s),e.off(`end`,c),i?.closeOnDone!==!1&&`closed`in e&&!e.closed&&e.destroy()}))},Ze=(e,t,n)=>ce(Qe(e,t,n)),Qe=(e,t,n)=>A(v(g(()=>e()),ge()),([e,r])=>ue($e(e,r,t),Je(e,e=>Oe(r,e),n,ye(r,C)))),$e=(e,n,r)=>t(()=>{function t(e){Ce(n,h(r(e)))}return e.on(`error`,t),je(y(n),g(()=>{e.removeListener(`error`,t)}))}),G=(e,t)=>(n,[r])=>{let i=`Unknown`;switch(n.code){case`ENOENT`:i=`NotFound`;break;case`EACCES`:i=`PermissionDenied`;break;case`EEXIST`:i=`AlreadyExists`;break;case`EISDIR`:i=`BadResource`;break;case`ENOTDIR`:i=`BadResource`;break;case`EBUSY`:i=`Busy`;break;case`ELOOP`:i=`BadResource`;break}return new I({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},et=e=>typeof e==`string`?e:`pipe`,K=e=>typeof e==`string`?e:`pipe`,q=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),J=(e,t,n)=>{let r=N(n).reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return G(`Command`,e)(t,[r])},tt={[F]:F,...c,toJSON(){return{_id:`@effect/platform/CommandExecutor/Process`,pid:this.pid}}},Y=n=>r=>{switch(r._tag){case`StandardCommand`:{let a=i(ge(),e=>j(t=>{let n=H.spawn(r.command,r.args,{stdio:[et(r.stdin),K(r.stdout),K(r.stderr)],cwd:T(r.cwd,se),shell:r.shell,env:{...process.env,...Object.fromEntries(r.env)},detached:process.platform!==`win32`});return n.on(`error`,e=>{t(h(J(`spawn`,e,r)))}),n.on(`exit`,(...t)=>{Ce(e,M(t))}),n.on(`spawn`,()=>{t(M([n,e]))}),g(()=>{n.kill(`SIGTERM`)})})),o=process.platform===`win32`?(e,t)=>j(t=>{H.exec(`taskkill /pid ${e.pid} /T /F`,e=>{t(e?h(J(`kill`,q(e),r)):C)})}):(e,t)=>f({try:()=>process.kill(-e.pid,t),catch:e=>J(`kill`,q(e),r)}),s=(e,n)=>t(()=>e.kill(n)?C:h(J(`kill`,new globalThis.Error(`Failed to kill process`),r)));return O(ee(r.cwd,{onNone:()=>C,onSome:e=>n.access(e)}),_(S(a,([t,n])=>i(b(n),r=>r?i(y(n),([n])=>n!==0&&n!==null?o(t,`SIGTERM`).pipe(e):C):o(t,`SIGTERM`).pipe(u(()=>s(t,`SIGTERM`)),_(y(n)),e)))),w(([e,t])=>{let n=be;e.stdin!==null&&(n=Ze(()=>e.stdin,e=>J(`toWritable`,q(e),r)));let a=i(y(t),([e,t])=>e===null?h(J(`exitCode`,new globalThis.Error(`Process interrupted due to receipt of signal: ${t}`),r)):M(Ne(e))),c=ie(b(t)),l=(n=`SIGTERM`)=>o(e,n).pipe(u(()=>s(e,n)),_(Ae(y(t)))),d=Pe(e.pid),f=W(()=>e.stderr,e=>J(`fromReadable(stderr)`,q(e),r)),p=W(()=>e.stdout,e=>J(`fromReadable(stdout)`,q(e),r));return typeof r.stdout!=`string`&&(p=pe(p,r.stdout)),Object.assign(Object.create(tt),{pid:d,exitCode:a,isRunning:c,kill:l,stdin:n,stderr:f,stdout:p})}),typeof r.stdin==`string`?ve:l(e=>ne(de(r.stdin,e.stdin))))}case`PipedCommand`:{let e=N(r);if(e.length===1)return O(e[0],Y(n));let t=e[0],i=e.slice(1),a=i.slice(0,i.length-1),o=i[i.length-1];return O(P(o,a.reduce((e,t)=>O(P(t,e),Y(n),w(e=>e.stdout),D),O(Y(n)(t),w(e=>e.stdout),D))),Y(n))}}},nt=x(Fe,O(z,w(e=>Me(Y(e))))),X=e=>t=>new Ie({module:`FileSystem`,method:e,cause:t}),rt=(()=>{let e=U(V.access,G(`FileSystem`,`access`),X(`access`));return(t,n)=>{let r=V.constants.F_OK;return n?.readable&&(r|=V.constants.R_OK),n?.writable&&(r|=V.constants.W_OK),e(t,r)}})(),it=(()=>{let e=U(V.cp,G(`FileSystem`,`copy`),X(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),at=(()=>{let e=U(V.copyFile,G(`FileSystem`,`copyFile`),X(`copyFile`));return(t,n)=>e(t,n)})(),ot=(()=>{let e=U(V.chmod,G(`FileSystem`,`chmod`),X(`chmod`));return(t,n)=>e(t,n)})(),st=(()=>{let e=U(V.chown,G(`FileSystem`,`chown`),X(`chown`));return(t,n,r)=>e(t,n,r)})(),ct=(()=>{let e=U(V.link,G(`FileSystem`,`link`),X(`link`));return(t,n)=>e(t,n)})(),lt=(()=>{let e=U(V.mkdir,G(`FileSystem`,`makeDirectory`),X(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),Z=e=>{let n=U(V.mkdtemp,G(`FileSystem`,e),X(e));return e=>t(()=>{let t=e?.prefix??``,r=typeof e?.directory==`string`?B.join(e.directory,`.`):Ge.tmpdir();return n(t?B.join(r,t):r+`/`)})},ut=Z(`makeTempDirectory`),Q=e=>{let t=U(V.rm,G(`FileSystem`,e),X(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},dt=Q(`remove`),ft=(()=>{let e=Z(`makeTempDirectoryScoped`),t=Q(`makeTempDirectoryScoped`);return n=>S(e(n),e=>o(t(e,{recursive:!0})))})(),pt=e=>{let t=U(V.open,G(`FileSystem`,e),X(e)),n=U(V.close,G(`FileSystem`,e),X(e));return(e,r)=>O(S(t(e,r?.flag??`r`,r?.mode),e=>o(n(e))),w(e=>ht(Ve(e),r?.flag?.startsWith(`a`)??!1)))},mt=pt(`open`),ht=(()=>{let e=e=>U(V.read,G(`FileSystem`,e),X(e)),n=e(`read`),r=e(`readAlloc`),o=U(V.fstat,G(`FileSystem`,`stat`),X(`stat`)),s=U(V.ftruncate,G(`FileSystem`,`truncate`),X(`truncate`)),c=U(V.fsync,G(`FileSystem`,`sync`),X(`sync`)),l=e=>U(V.write,G(`FileSystem`,e),X(e)),u=l(`write`),f=l(`writeAll`);class p{fd;append;[R];semaphore=d(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[R]=R}get stat(){return w(o(this.fd),wt)}get sync(){return c(this.fd)}seek(e,t){let n=L(e);return this.semaphore.withPermits(1)(g(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(w(t(()=>n(this.fd,{buffer:e,position:this.position})),e=>{let t=L(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(i(g(()=>Buffer.allocUnsafeSlow(t)),e=>w(r(this.fd,{buffer:e,position:this.position}),n=>{if(n===0)return re();if(this.position+=BigInt(n),n===t)return a(e);let r=Buffer.allocUnsafeSlow(n);return e.copy(r,0,0,n),a(r)})))}truncate(e){return this.semaphore.withPermits(1)(w(s(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}}))}write(e){return this.semaphore.withPermits(1)(w(t(()=>u(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=L(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return i(t(()=>f(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?h(new I({module:`FileSystem`,method:`writeAll`,reason:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position+=BigInt(t)),t<e.length?this.writeAllChunk(e.subarray(t)):C))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new p(e,t)})(),gt=e=>{let t=Z(e),n=pt(e),r=e=>g(()=>Ke.randomBytes(e).toString(`hex`));return e=>O(v(t(e),r(6)),w(([t,n])=>B.join(t,n+(e?.suffix??``))),l(e=>p(n(e,{flag:`w+`}))))},_t=gt(`makeTempFile`),vt=(()=>{let e=gt(`makeTempFileScoped`),t=Q(`makeTempFileScoped`);return n=>S(e(n),e=>o(t(B.dirname(e),{recursive:!0})))})(),yt=(e,t)=>s({try:()=>V.promises.readdir(e,t),catch:t=>G(`FileSystem`,`readDirectory`)(t,[e])}),bt=e=>j((t,n)=>{try{V.readFile(e,{signal:n},(n,r)=>{t(n?h(G(`FileSystem`,`readFile`)(n,[e])):M(r))})}catch(e){t(h(X(`readFile`)(e)))}}),xt=(()=>{let e=U(V.readlink,G(`FileSystem`,`readLink`),X(`readLink`));return t=>e(t)})(),St=(()=>{let e=U(V.realpath,G(`FileSystem`,`realPath`),X(`realPath`));return t=>e(t)})(),Ct=(()=>{let e=U(V.rename,G(`FileSystem`,`rename`),X(`rename`));return(t,n)=>e(t,n)})(),wt=e=>({type:e.isFile()?`File`:e.isDirectory()?`Directory`:e.isSymbolicLink()?`SymbolicLink`:e.isBlockDevice()?`BlockDevice`:e.isCharacterDevice()?`CharacterDevice`:e.isFIFO()?`FIFO`:e.isSocket()?`Socket`:`Unknown`,mtime:m(e.mtime),atime:m(e.atime),birthtime:m(e.birthtime),dev:e.dev,rdev:m(e.rdev),ino:m(e.ino),mode:e.mode,nlink:m(e.nlink),uid:m(e.uid),gid:m(e.gid),size:L(e.size),blksize:m(L(e.blksize)),blocks:m(e.blocks)}),$=(()=>{let e=U(V.stat,G(`FileSystem`,`stat`),X(`stat`));return t=>w(e(t),wt)})(),Tt=(()=>{let e=U(V.symlink,G(`FileSystem`,`symlink`),X(`symlink`));return(t,n)=>e(t,n)})(),Et=(()=>{let e=U(V.truncate,G(`FileSystem`,`truncate`),X(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),Dt=(()=>{let e=U(V.utimes,G(`FileSystem`,`utime`),X(`utime`));return(t,n,r)=>e(t,n,r)})(),Ot=(e,t)=>De(n=>S(g(()=>{let r=V.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(te($(t),{onSuccess:e=>M(He({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?M(We({path:t})):h(e)}));return;case`change`:n.single(Re({path:t}));return}});return r.on(`error`,t=>{n.fail(new I({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>g(()=>e.close()))),kt=(e,t,n)=>$(t).pipe(w(i=>e.pipe(r(e=>e.register(t,i,n)),T(()=>Ot(t,n)))),he),At=(e,t,n)=>j((r,i)=>{try{V.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?h(G(`FileSystem`,`writeFile`)(t,[e])):C)})}catch(e){r(h(X(`writeFile`)(e)))}}),jt=x(z,w(ae(Le),e=>Ue({access:rt,chmod:ot,chown:st,copy:it,copyFile:at,link:ct,makeDirectory:lt,makeTempDirectory:ut,makeTempDirectoryScoped:ft,makeTempFile:_t,makeTempFileScoped:vt,open:mt,readDirectory:yt,readFile:bt,readLink:xt,realPath:St,remove:dt,rename:Ct,stat:$,symlink:Tt,truncate:Et,utimes:Dt,watch(t,n){return kt(e,t,n)},writeFile:At}))),Mt=nt.pipe(k(jt),k(ze)),Nt=we(Be.pipe(k(Mt)));export{Nt as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/omp-claude-compat",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"description": "OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references",
|
|
7
7
|
"type": "module",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"tsdown": "^0.22.9",
|
|
33
33
|
"typescript": "^7",
|
|
34
34
|
"vitest": "^4",
|
|
35
|
-
"@systemfsoftware/omp-utils": "^0.0.0",
|
|
36
|
-
"@systemfsoftware/effect-gherkin-spec": "^0.4.0",
|
|
37
|
-
"@systemfsoftware/stryker-js-core": "^1.1.6",
|
|
38
35
|
"@systemfsoftware/effect-memfs": "^1.0.8",
|
|
36
|
+
"@systemfsoftware/omp-utils": "^0.0.0",
|
|
39
37
|
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
38
|
+
"@systemfsoftware/stryker-js-core": "^1.1.6",
|
|
39
|
+
"@systemfsoftware/effect-gherkin-spec": "^0.4.1",
|
|
40
40
|
"@systemfsoftware/stryker-js-typescript-checker": "^1.1.6",
|
|
41
41
|
"@systemfsoftware/stryker-plugins": "^0.6.0",
|
|
42
42
|
"@systemfsoftware/tsconfig": "^1.2.6"
|