@systemfsoftware/omp-claude-compat 1.6.2 → 2.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,86 @@
1
+ # @systemfsoftware/omp-claude-compat
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Collapse projection tags into the ports they projected
8
+
9
+ A `*ExecutorDeps` tag whose service type was indexed off other ports recorded which members
10
+ one operation happened to reach for. Exporting it turned internal composition into a surface
11
+ commitment: a consumer had to discover and provide an aggregator for each operation, where the
12
+ port it came from already served. The tags rode the `R` channel of exported signatures, so a
13
+ consumer met them only at their own call site.
14
+
15
+ Each was removed the way its evidence directed — no tag was renamed, and none was replaced:
16
+
17
+ - `AttwCliExecutorDeps`, `CheckPackageExecutorDeps` — deleted. Zero consumers, no Live layer;
18
+ callers already required the real capabilities directly.
19
+ - `HookDispatcherExecutorDeps` — was a 1:1 alias of `Scope.Scope`. Requiring `Scope` names the
20
+ same service.
21
+ - `InjectInstructionsExecutorDeps` — packed `FileSystem`, `Path` and `TomlLoader` with no logic.
22
+ Consumers require the three ports.
23
+ - `EffectVitestDeps` → `EffectVitestBindings`. Never a `Context.Tag`: a plain type alias already
24
+ passed as an ordinary parameter, so only the name misdescribed it. A stale api report that no
25
+ `api-extractor` regenerates was deleted with it.
26
+
27
+ A consumer providing a port instead of an aggregator provides no more than before, since a
28
+ service `{ a, b }` is assignable to a requirement `{ a }`.
29
+
30
+ ### Minor Changes
31
+
32
+ - cut over to effect v4 (4.0.0-rc.108): public surface derives from effect types; peers flip effect ^3→^4
33
+
34
+ - The Workflow brand: `make` is the only door to a decide slot.
35
+
36
+ `Workflow<C, D, E>` and `Cell.DecidePhase<P>` carry a phantom `WorkflowBrand` conjunct applied
37
+ solely by `Workflow.make` through the existing assertion narrowing — no runtime property, `make`
38
+ stays the identity it always was. The consumer's signature is the forcing function: a bare
39
+ function handed where a decide run is demanded is now a compile error naming the brand, so a
40
+ decision cannot reach production without passing through the constructor every gate keys on.
41
+
42
+ Breaking by design (`REPO-R1`): the two inline adapter sites (cli's admission adapter,
43
+ claude-compat's submit-hook adapter) become `make`-wrapped, and the cell-gen either-pass
44
+ fixture reshapes to one exhaustive path with the failure injection decided before the boundary.
45
+
46
+ ### Patch Changes
47
+
48
+ - New version is published through npm trusted publishing, so it carries a provenance attestation you can verify.
49
+
50
+ - Express each executor's sandwich as a `Cell` description.
51
+
52
+ Every call site that previously sequenced the phases by hand now builds one description and hands it to the interpreter, so the order these executors run in is carried by the phase types instead of by the order the statements happen to appear in. Behaviour is preserved and no public surface moves: the change is confined to `src/internal/*.executor.ts`, and each package's golden API report is unchanged.
53
+
54
+ One site needed a real fix rather than a translation. `supervisor-body.executor.ts` wrote before it could classify — it recorded a restart, then read the resulting rate — which is a read that depends on an earlier decision. Its read now gathers the restart record and the resulting rate as one product, which keeps that site a single layer, with the intensity tracker passed as the read's command rather than captured from the surrounding scope.
55
+
56
+ - `hook-verdict.workflow.ts` keeps its pure decisions in `hook-verdict.kernel.ts`.
57
+
58
+ A blank block reason now yields a stated fallback instead of an empty one. `parsed.reason ?? fallback` guards only nullish, so a hook emitting `"reason": ""` produced a block with no explanation at all. Blankness is decided on the trimmed value and a stated reason is returned verbatim, spacing included, so the hook's own words reach the user unchanged — the three existing workflow property tests pin exactly that and pass unchanged.
59
+
60
+ The relocation moved the decisions out of the mutation surface: `stryker.config.json` mutates `src/*.workflow.ts`, and the kernel's observer is a colocated K-law property test instead. Measured across the move, the killed-mutant count fell from 15 to 1 while the score stayed at 100 — a perfect score over one mutant. Seven K-laws now observe those decisions instead: exit classification is total, ignores stdout off the success path, and splits on the decision-object shape; a block always states a reason; the two stderr readers agree; the permission key shadows the legacy key; a parsed block reads the field its key implies. Five planted mutants were each caught by exactly the one law that governs them, with the other six staying green.
61
+
62
+ - Each of these packages now has a README, so its registry page says what the package is, how
63
+ to install it, and what to import or register — previously the page was blank. The lint
64
+ plugins show the configuration line that enables what they recommend.
65
+
66
+ `@systemfsoftware/stryker-js-mutation-report` also carries its licence text
67
+
68
+ - Produce every workflow through `Workflow.make`.
69
+
70
+ `decideRestart`, `interpretHookResult`, and `admitSurvivorsRun` are now built by the constructor rather
71
+ than annotated with `Workflow<Command, Decision, Error>`. Each decision is behaviourally identical —
72
+ `make` is the identity at runtime — but the channels are now inferred from the decider instead of
73
+ asserted by hand, so a total decision resolves to `UninhabitedError` and becomes uncallable rather than
74
+ compiling as a workflow that cannot fail.
75
+
76
+ `effect-daemon-spec` takes a minor bump because the change is consumer-visible beyond its own source:
77
+ `@systemfsoftware/effect-cell-types` moves from `devDependencies` to `dependencies`, so installing this
78
+ package now installs it. That reclassification is required, not incidental — `make` is a runtime call,
79
+ and `scripts/guards/check-runtime-deps.mjs` fails a runtime import declared only as a dev dependency.
80
+ `omp-claude-compat` gains the same dependency; `stryker-js-cli` already declared it.
81
+
82
+ `RestartDecisionWorkflow` survives as a type-only export: one in-repo consumer, its own property test,
83
+ references it through `ReturnType<…>`.
84
+
85
+ - Updated dependencies:
86
+ - @systemfsoftware/effect-cell-types@2.0.0
package/LICENSE CHANGED
@@ -1,21 +1,203 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Ryan Lee
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Copyright (c) 2026 Ryan Lee (systemfsoftware)
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright 2026 Ryan Lee (systemfsoftware)
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @systemfsoftware/omp-claude-compat
2
+
3
+ OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add @systemfsoftware/omp-claude-compat '@effect/platform-node@catalog:' '@oh-my-pi/pi-coding-agent@catalog:' 'effect@4.0.0-rc.108'
9
+ ```
10
+
11
+ Those are peer dependencies: this package declares them but does not install them, so one copy is shared with the rest of your project.
12
+
13
+ ## Entry points
14
+
15
+ - `@systemfsoftware/omp-claude-compat`
16
+
17
+ ## API
18
+
19
+ The public surface is generated from the source and versioned with the package: [`etc/omp-claude-compat.api.md`](./etc/omp-claude-compat.api.md).
20
+
21
+ ## License
22
+
23
+ Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware).
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$ as ee,$t as te,Ao as ne,Ar as re,Bn as ie,Co as ae,Dn as oe,En as se,Fn as ce,Fo as le,Gn as ue,Io as de,J as fe,K as pe,Ln as t,On as n,Oo as r,Pn as i,Po as a,Q as o,Qt as s,So as c,Tn as l,X as u,Y as d,Z as f,a as p,an as m,ao as h,bo as g,c as _,co as v,d as y,do as b,en as x,et as S,f as C,fo as w,io as T,jo as E,ko as D,l as O,n as k,nn as A,o as j,oo as M,po as N,q as P,s as F,so as I,t as L,tn as R,u as z,vo as B,wa as V,xo as me,yo as he,zn as ge}from"./effect-CczU2E3R.js";var _e=e({AsyncFiberError:()=>rt,AsyncFiberErrorTypeId:()=>tt,Done:()=>X,DoneTypeId:()=>Ke,ExceededCapacityError:()=>et,ExceededCapacityErrorTypeId:()=>$e,IllegalArgumentError:()=>Q,IllegalArgumentErrorTypeId:()=>Xe,InterruptorStackTrace:()=>ut,NoSuchElementError:()=>Ge,NoSuchElementErrorTypeId:()=>We,ReasonTypeId:()=>ve,StackTrace:()=>lt,TimeoutError:()=>Ye,TimeoutErrorTypeId:()=>qe,TypeId:()=>H,UnknownError:()=>$,UnknownErrorTypeId:()=>it,annotate:()=>ot,annotations:()=>ct,combine:()=>Ae,die:()=>Te,done:()=>Z,empty:()=>we,fail:()=>W,filterInterruptors:()=>Ve,findDefect:()=>Le,findDie:()=>Ie,findError:()=>q,findErrorOption:()=>Pe,findFail:()=>Ne,findInterrupt:()=>ze,fromReasons:()=>Ce,hasDies:()=>Fe,hasFails:()=>Me,hasInterrupts:()=>Re,hasInterruptsOnly:()=>G,interrupt:()=>Ee,interruptors:()=>Be,isAsyncFiberError:()=>nt,isCause:()=>ye,isDieReason:()=>xe,isDone:()=>Y,isExceededCapacityError:()=>Qe,isFailReason:()=>U,isIllegalArgumentError:()=>Ze,isInterruptReason:()=>Se,isNoSuchElementError:()=>Ue,isReason:()=>be,isTimeoutError:()=>Je,isUnknownError:()=>at,makeDieReason:()=>Oe,makeFailReason:()=>De,makeInterruptReason:()=>ke,map:()=>K,pretty:()=>J,prettyErrors:()=>He,reasonAnnotations:()=>st,squash:()=>je});const H=h,ve=T,ye=r,be=D,U=a,xe=ne,Se=le,Ce=c,we=g,W=me,Te=he,Ee=d,De=e=>new b(e),Oe=e=>new M(e),ke=ue,G=n,K=f,Ae=P,je=S,Me=se,Ne=A,q=x,Pe=R,Fe=l,Ie=te,Le=s,Re=oe,ze=m,Be=u,Ve=fe,He=ee,J=o,Ue=de,We=N,Ge=w,Y=E,Ke=v,X=I,Z=ae,qe=z,Je=ge,Ye=O,Xe=_,Ze=t,Q=F,Qe=ce,$e=j,et=p,tt=k,nt=i,rt=L,it=C,at=ie,$=y,ot=B,st=re,ct=pe;var lt=class extends V()(`effect/Cause/StackTrace`){},ut=class extends V()(`effect/Cause/InterruptorStackTrace`){};export{Z as a,G as c,K as d,J as f,$ as i,Y as l,X as n,W as o,Q as r,q as s,_e as t,U as u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$i as t,$n as n,$r as r,A as i,Aa as a,Ai as o,An as s,B as c,Bi as l,Bo as u,Br as ee,Bt as te,C as d,Ca as ne,Ci as re,Cn as ie,Cr as ae,D as oe,Da as se,Di as ce,Dr as le,E as ue,Ea as de,Ei as fe,Er as pe,F as me,Fi as he,Fr as ge,G as f,Gi as _e,Gr as ve,Gt as ye,H as be,Hi as xe,Hn as Se,Hr as Ce,Ht as we,I as Te,Ii as Ee,In as De,Ir as Oe,It as p,Ji as ke,Jn as Ae,Jr as je,Jt as Me,Ka as Ne,Ki as Pe,Kr as Fe,Kt as Ie,L as Le,Li as Re,Lo as ze,Lr as Be,Lt as Ve,M as m,Ma as He,Mi as Ue,Mn as We,Mo as h,Mr as Ge,N as Ke,Ni as qe,Nn as Je,Nr as Ye,O as Xe,Oi as Ze,Or as Qe,P as $e,Pi as g,Pr as et,Qi as tt,Qn as nt,Qr as rt,R as it,Ri as _,Rn as at,Rr as ot,Rt as st,S as ct,Sa as lt,Si as ut,Sn as dt,Sr as v,T as ft,Ta as pt,Ti as mt,Tr as ht,Ts as y,U as gt,Ui as _t,Un as vt,Ur as yt,V as bt,Vi as xt,Vr as St,W as Ct,Wi as wt,Wn as b,Wr as Tt,Xi as Et,Xn as Dt,Xr as Ot,Xt as kt,Yi as At,Yn as x,Yr as jt,Yt as Mt,Zi as Nt,Zn as Pt,Zr as Ft,Zt as It,_ as Lt,_a as Rt,_i as zt,_n as Bt,_r as Vt,_s as S,aa as Ht,ai as Ut,ar as Wt,at as Gt,b as Kt,bi as qt,bn as Jt,br as Yt,bs as C,ci as Xt,cn as Zt,cr as Qt,ct as $t,di as en,dn as tn,dr as nn,dt as rn,ea as an,ei as on,er as sn,fi as w,fn as cn,fr as T,ft as ln,g as un,gi as dn,gn as fn,gr as pn,gs as mn,h as hn,ha as gn,hi as _n,hn as vn,ho as yn,hr as bn,i as xn,ia as Sn,ii as Cn,in as wn,ir as Tn,it as En,j as Dn,ja as On,ji as kn,jn as An,jo as jn,jr as Mn,k as Nn,ka as Pn,ki as Fn,kn as In,kr as Ln,li as E,ln as Rn,lo as zn,lr as Bn,m as Vn,mi as Hn,mn as Un,mr as Wn,na as D,ni as Gn,nr as Kn,ns as qn,nt as Jn,oi as Yn,on as Xn,or as Zn,ot as Qn,p as $n,pi as O,pn as er,pr as tr,qa as nr,qi as rr,qn as ir,qr as ar,qt as or,r as sr,ra as cr,ri as lr,rn as ur,rr as dr,rt as fr,si as pr,sn as k,sr as mr,st as hr,ta as gr,ti as _r,tr as vr,tt as A,ui as yr,un as br,ur as xr,ut as Sr,v as Cr,vi as wr,vn as Tr,vr as Er,vs as j,w as Dr,wa as Or,wi as kr,wn as Ar,wo as jr,wr as M,x as Mr,xi as Nr,xn as Pr,xr as Fr,y as Ir,yi as Lr,yn as Rr,yr as zr,z as Br,zi as Vr,zo as Hr,zr as Ur,zt as Wr}from"./effect-CczU2E3R.js";import{a as Gr,l as Kr,s as qr}from"./Cause-BPRKNAWJ.js";import{a as Jr,r as Yr,s as Xr}from"./Exit-Dz81ekW_.js";const Zr={"~effect/Deferred":{_A:C,_E:C},pipe(){return y(this,arguments)}},Qr=()=>{let e=Object.create(Zr);return e.resumes=void 0,e.effect=void 0,e},$r=e=>m(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),O(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),ei=j(2,(e,t)=>O(()=>ri(e,t))),ti=e=>O(()=>ni(e)),ni=e=>e.effect!==void 0,ri=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},ii=tt,ai=t,oi=on,si=r,ci=ae,li=jt,N=rt,ui=Ft,di=`~effect/Layer/MemoMap`,fi=(e,t)=>(e.observers++,Ir(Ot(t,t=>e.finalizer(t)),e.effect)),pi={"~effect/Layer":{_ROut:C,_E:C,_RIn:C},pipe(){return y(this,arguments)}},mi=e=>{let t=Object.create(pi);return t.build=e,t},hi=e=>mi((t,n)=>{let r=N(n);return T(e(t,r),e=>e._tag===`Failure`?ui(r,e):_)}),gi=e=>{let t=hi((n,r)=>n.getOrElseMemoize(t,r,e));return t},_i=(e,t,n,r)=>{let i=si(),a=Qr(),o={observers:1,effect:$r(a),finalizer:n=>w(()=>(o.observers--,o.observers===0?(e.map.delete(t),ui(i,n)):_))};return e.map.set(t,o),Ot(n,o.finalizer).pipe(k(()=>r(e,i)),T(e=>(o.effect=e,ei(a,e))))};var vi=class{get[di](){return di}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?fi(n,t):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return w(()=>this.get(e,t)||_i(this,e,t,n))}};const yi=()=>new vi,bi=e=>new vi(e);var xi=class e extends Or()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=se(t,e);return n?bi(n):yi()}};const P=j(3,(e,t,n)=>M(x(e.build(t,n),pt(xi,t)),xi,t)),Si=j(2,(e,t)=>ze(n=>P(e,xi.forkOrCreate(n.context),t))),Ci=function(){return arguments.length===1?e=>wi(a(arguments[0],e)):wi(a(arguments[0],arguments[1]))},wi=e=>mi(S(E(e))),Ti=function(){return arguments.length===1?e=>Ei(arguments[0],e):Ei(arguments[0],arguments[1])},Ei=(e,t)=>Di(x(t,t=>a(e,t))),Di=e=>gi((t,n)=>ci(e,n)),Oi=(e,t,n)=>{let r=N(n,`parallel`);return Un(e,e=>e.build(t,N(r,`sequential`)),{concurrency:e.length}).pipe(x(e=>He(...e)))},ki=(...e)=>hi((t,n)=>Oi(e,t,n)),Ai=(e,t,n)=>hi((r,i)=>k(Array.isArray(t)?Oi(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(v(t),x(e=>n(e,t))))),ji=j(2,(e,t)=>Ai(e,t,(e,t)=>On(t,e))),Mi=ne(`effect/ExecutionPlan/CurrentMetadata`,{defaultValue:S({attempt:0,stepIndex:0})}),Ni=j(2,(e,t)=>$e(e,Li,e=>t(e))),Pi=e=>e.reasons.some(Fi),Fi=e=>e._tag===`Fail`&&Kr(e.error),Ii=gr(qr,e=>Kr(e)?lt(e):gn(e)),Li=gr(qr,e=>Kr(e)?lt(e.value):gn(e)),Ri=e=>{let t=Ii(e);return Rt(t)?Yr(t.failure):Xr(t.success.value)},zi=j(2,(e,t)=>Tn(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Ii(e);return Rt(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Bi=`~effect/Schedule`,F=ne(`effect/Schedule/CurrentMetadata`,{defaultValue:S({input:void 0,output:void 0,duration:Ht,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Vi={[Bi]:{_Out:C,_In:C,_Env:C},pipe(){return y(this,arguments)}},Hi=e=>qn(e,Bi),I=e=>{let t=Object.create(Vi);return t.step=e,t},L=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},Ui=e=>I(x(e,e=>{let t=L();return(n,r)=>e(t(n,r))})),R=e=>Ke(e.step,e=>E(()=>Ve(e))),z=e=>A(t=>x(R(e),e=>{let n=L();return r=>w(()=>{let i=t.currentTimeMillisUnsafe();return k(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,d(Yn(t),a)})})})),Wi=e=>I(x(R(e),e=>(t,n)=>zi(e(t,n),{onSuccess:e=>E([n,e[1]]),onFailure:Ve,onDone:()=>Gr(n)}))),Gi=e=>B(qi,({attempt:t})=>E(t<=e)),Ki=e=>{let t=D(e);return Ui(E(e=>E([e.attempt-1,t])))},B=j(2,(e,t)=>I(x(R(e),e=>{let n=L();return(r,i)=>k(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return k(h(s)?s:E(s),t=>t?E(e):Gr(a))})}))),qi=Ki(Ht),Ji=(e,t,n)=>Gn(r=>k(n?.local?P(t,yi(),r):Si(t,r),t=>v(e,t))),Yi=j(e=>h(e[0]),(e,t,n)=>Pn(t)?v(e,t):Ji(e,Array.isArray(t)?ki(...t):t,n)),Xi=j(3,(e,t,n)=>k(z(t),t=>{let r=F.defaultValue();return f(vn(Hn(k(w(()=>M(e,F,r)),t),e=>O(()=>{r=e})),{disableYield:!0}),e=>jn(e)?E(e.value):n(e,r.attempt===0?Ne():nr(r)))})),Zi=j(3,(e,t,n)=>k(z(t),t=>{let r=F.defaultValue(),i,a=f(w(()=>M(e,F,r)),e=>(i=e,k(t(e),e=>(r=e,a))));return Ni(a,e=>u(()=>n(i,e)))})),Qi=j(2,(e,t)=>{let n=typeof t==`function`?t(C):Hi(t)?t:H(t);return Xi(e,n,p)}),V=j(2,(e,t)=>{let n=typeof t==`function`?t(C):Hi(t)?t:H(t);return Zi(e,n,p)}),$i=j(3,(e,t,n)=>k(z(n),n=>{let r=F.defaultValue(),i=w(()=>M(e,F,r));return f(k(n(t),e=>{r=e;let t=S(k(i,n));return l({while:mn,body:t,step(e){r=e}})}),e=>jn(e)?E(e.value):p(e))})),ea=Wi(qi),H=e=>{let t=e.schedule?Wi(e.schedule):ea;return e.while&&(t=B(t,({input:t})=>{let n=e.while(t);return h(n)?n:E(n)})),e.until&&(t=B(t,({input:t})=>{let n=e.until(t);return h(n)?x(n,e=>!e):E(!n)})),e.times!==void 0&&(t=B(t,({attempt:t})=>E(t<=e.times))),t},ta=(e,t)=>{let n=-1,r=0,i=t=>s(e(t));return{begin:A(e=>w(()=>{let a=t();a.stepIndex!==n&&(n=a.stepIndex,r=0),r++;let o={attempt:a.attempt,stepAttempt:r,stepIndex:a.stepIndex,startNanos:e.monotonicTimeNanosUnsafe()};return d(i({_tag:`AttemptStart`,attempt:o.attempt,stepAttempt:o.stepAttempt,stepIndex:o.stepIndex}),o)})),end:(e,t)=>A(n=>{let r=cr(n.monotonicTimeNanosUnsafe()-e.startNanos);return i(t._tag===`Success`?{_tag:`AttemptSuccess`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r}:{_tag:`AttemptFailure`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r,cause:t.cause})})}},na=j(e=>h(e[0]),(e,t,n)=>w(()=>{let r=0,i={attempt:0,stepIndex:0},a=ht(Mi,O(()=>(i={attempt:i.attempt+1,stepIndex:r},i))),o=n?.onEvent===void 0?void 0:ta(n.onEvent,()=>i),s=o===void 0?C:e=>kn(t=>k(o.begin,n=>T(t(e),e=>o.end(n,e)))),c;return k(l({while:()=>r<t.steps.length&&(c===void 0||Rt(c)),body(){let n=t.steps[r],i=a(s(Yi(e,n.provide)));if(c){let e=!1,t=i;i=w(()=>e?t:(e=!0,dt(c))),i=V(i,ra(n,!1))}else{let e=ra(n,!0);i=e?V(i,e):i}return et(i)},step(e){c=e,r++}}),()=>dt(c))})),ra=(e,t)=>t?e.attempts===1||!(e.schedule||e.attempts)?void 0:H({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0}):H({schedule:e.schedule?e.schedule:e.attempts?void 0:ia,times:e.attempts,while:e.while}),ia=Gi(1);({...yn});const aa=e=>e,oa=j(2,(e,t)=>{let n=t=>m(n=>{let r=ca(t,e,n,Ar());return ua(t,r)});return h(t)?k(t,n):n(t)}),sa=(e,t)=>{let n=ca(t.resolver,e,t.onExit,{context:t.context,currentScheduler:de(t.context,an)});return()=>la(t.resolver,n)},U=[],W=new WeakMap,ca=(e,t,n,r)=>{let i=W.get(e);i||(i=new Map,W.set(e,i));let a,o=!1,s=aa({request:t,context:r.context,uninterruptible:!1,completeUnsafe(e){o||(o=!0,n(e),a?.entrySet.delete(s))}});if(e.preCheck!==void 0&&!e.preCheck(s))return s;let c=e.batchKey(s);if(a=i.get(c),!a){if(U.length>0)a=U.pop(),a.key=c,a.resolver=e,a.map=i;else{let t={key:c,resolver:e,map:i,entrySet:new Set,entries:new Set,delayEffect:k(w(()=>t.resolver.delay),e=>da(t)),run:T(w(()=>t.resolver.runAll(Array.from(t.entries),t.key)),e=>{for(let n of t.entrySet)n.completeUnsafe(e._tag===`Success`?jr(Error(`Effect.request: RequestResolver did not complete request`,{cause:n.request})):e);return t.entries.clear(),U.length<128&&(t.entrySet.clear(),t.key=void 0,t.fiber=void 0,t.resolver=void 0,t.map=void 0,U.push(t)),_})};a=t}i.set(c,a),a.fiber=ot(r.context)(a.delayEffect,{scheduler:r.currentScheduler})}return a.entrySet.add(s),a.entries.add(s),a.resolver.collectWhile(a.entries)?s:(a.fiber.interruptUnsafe(r.id),a.fiber=ot(r.context)(da(a),{scheduler:r.currentScheduler}),s)},la=(e,t)=>{if(t.uninterruptible)return;let n=W.get(e);if(!n)return;let r=e.batchKey(t),i=n.get(r);i&&(i.entries.delete(t),i.entrySet.delete(t),i.entries.size===0&&(n.delete(r),i.fiber?.interruptUnsafe()))},ua=(e,t)=>O(()=>la(e,t));function da(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):_}const G=j(2,(e,t)=>fr(n=>O(()=>e.updateUnsafe(t,n))));var fa=e({Do:()=>ja,Transaction:()=>$,TypeId:()=>pa,abortSignal:()=>qs,acquireDisposable:()=>Os,acquireRelease:()=>Ds,acquireUseRelease:()=>ks,addFinalizer:()=>As,all:()=>ma,andThen:()=>Ya,annotateCurrentSpan:()=>oc,annotateLogs:()=>Zc,annotateLogsScoped:()=>Qc,annotateSpans:()=>ac,as:()=>eo,asSome:()=>to,asVoid:()=>no,awaitAllChildren:()=>wc,bind:()=>Pa,bindTo:()=>Ma,cached:()=>Rs,cachedInvalidateWithTTL:()=>Bs,cachedWithTTL:()=>zs,callback:()=>J,catch:()=>oo,catchCause:()=>po,catchCauseFilter:()=>yo,catchCauseIf:()=>vo,catchDefect:()=>mo,catchEager:()=>yl,catchFilter:()=>go,catchIf:()=>ho,catchNoSuchElement:()=>_o,catchReason:()=>lo,catchReasons:()=>uo,catchTag:()=>so,catchTags:()=>co,clockWith:()=>Vc,context:()=>fs,contextWith:()=>ps,currentParentSpan:()=>cc,currentSpan:()=>sc,delay:()=>Ho,die:()=>za,effectify:()=>dl,ensuring:()=>js,eventually:()=>ko,exit:()=>Z,fail:()=>Y,failCause:()=>La,failCauseSync:()=>Ra,failSync:()=>Ia,fiber:()=>Tc,fiberId:()=>Ec,filter:()=>Yo,filterMap:()=>Xo,filterMapEffect:()=>Zo,filterMapOrElse:()=>$o,filterMapOrFail:()=>ts,filterOrElse:()=>Qo,filterOrFail:()=>es,findFirst:()=>va,findFirstFilter:()=>ya,firstSuccessOf:()=>Ro,flatMap:()=>X,flatMapEager:()=>vl,flatten:()=>Ja,flip:()=>ro,fn:()=>Bc,fnUntraced:()=>zc,fnUntracedEager:()=>bl,forEach:()=>ba,forever:()=>Js,forkChild:()=>bc,forkDetach:()=>Cc,forkIn:()=>xc,forkScoped:()=>Sc,fromNullishOr:()=>qa,fromOption:()=>Ga,fromResult:()=>Wa,gen:()=>Fa,ignore:()=>No,ignoreCause:()=>Po,interrupt:()=>Vs,interruptible:()=>Hs,interruptibleMask:()=>Ks,isEffect:()=>K,isFailure:()=>us,isSuccess:()=>ds,let:()=>Na,linkSpans:()=>dc,log:()=>Uc,logDebug:()=>Jc,logError:()=>Kc,logFatal:()=>Wc,logInfo:()=>qc,logTrace:()=>Yc,logWarning:()=>Gc,logWithLevel:()=>Hc,makeSpan:()=>fc,makeSpanScoped:()=>pc,map:()=>$a,mapBoth:()=>xo,mapBothEager:()=>_l,mapEager:()=>hl,mapError:()=>bo,mapErrorEager:()=>gl,match:()=>rs,matchCause:()=>as,matchCauseEager:()=>os,matchCauseEffect:()=>cs,matchCauseEffectEager:()=>ss,matchEager:()=>is,matchEffect:()=>ls,never:()=>Aa,onError:()=>Ms,onErrorFilter:()=>Ps,onErrorIf:()=>Ns,onExit:()=>Q,onExitFilter:()=>Ls,onExitIf:()=>Is,onExitPrimitive:()=>Fs,onInterrupt:()=>Us,option:()=>Qa,orDie:()=>So,orElseSucceed:()=>Lo,partition:()=>ha,promise:()=>Sa,provide:()=>ms,provideContext:()=>hs,provideService:()=>Ss,provideServiceEffect:()=>Cs,race:()=>qo,raceAll:()=>Go,raceAllFirst:()=>Ko,raceFirst:()=>Jo,reduce:()=>ga,repeat:()=>Ys,repeatOrElse:()=>Xs,replicate:()=>Zs,replicateEffect:()=>Qs,request:()=>vc,requestUnsafe:()=>yc,result:()=>Za,retry:()=>Ao,retryOrElse:()=>jo,runCallback:()=>Ac,runCallbackWith:()=>kc,runFork:()=>Dc,runForkWith:()=>Oc,runPromise:()=>jc,runPromiseExit:()=>Nc,runPromiseExitWith:()=>Pc,runPromiseWith:()=>Mc,runSync:()=>Fc,runSyncExit:()=>Lc,runSyncExitWith:()=>Rc,runSyncWith:()=>Ic,sandbox:()=>Mo,satisfiesErrorType:()=>pl,satisfiesServicesType:()=>ml,satisfiesSuccessType:()=>fl,schedule:()=>$s,scheduleFrom:()=>ec,scope:()=>ws,scoped:()=>Ts,scopedWith:()=>Es,service:()=>_s,serviceOption:()=>vs,setContext:()=>gs,sleep:()=>Uo,spanAnnotations:()=>lc,spanLinks:()=>uc,succeed:()=>wa,succeedNone:()=>Ta,succeedSome:()=>Ea,suspend:()=>Da,sync:()=>Oa,tap:()=>Xa,tapCause:()=>To,tapCauseFilter:()=>Do,tapCauseIf:()=>Eo,tapDefect:()=>Oo,tapError:()=>Co,tapErrorTag:()=>wo,timed:()=>Wo,timeout:()=>zo,timeoutOption:()=>Bo,timeoutOrElse:()=>Vo,tracer:()=>tc,track:()=>el,trackDefects:()=>rl,trackDuration:()=>il,trackErrors:()=>nl,trackSuccesses:()=>tl,transposeOption:()=>Ka,try:()=>Ba,tryPromise:()=>Ca,tx:()=>al,txRetry:()=>ul,undefined:()=>ka,uninterruptible:()=>Ws,uninterruptibleMask:()=>Gs,unwrapReason:()=>fo,updateContext:()=>ys,updateService:()=>bs,updateServiceScoped:()=>xs,useSpan:()=>mc,validate:()=>_a,void:()=>q,when:()=>ns,whileLoop:()=>xa,withErrorReporting:()=>Io,withExecutionPlan:()=>Fo,withFiber:()=>Ua,withLogSpan:()=>$c,withLogger:()=>Xc,withParentSpan:()=>_c,withSpan:()=>hc,withSpanScoped:()=>gc,withTracer:()=>nc,withTracerEnabled:()=>rc,withTracerTiming:()=>ic,yieldNow:()=>Va,yieldNowWith:()=>Ha,zip:()=>io,zipWith:()=>ao});const pa=zn,K=h,ma=Cr,ha=Yt,ga=Mn,_a=Re,va=ur,ya=wn,ba=Un,xa=l,Sa=Fr,Ca=ce,wa=E,Ta=yr,Ea=en,Da=w,Oa=O,q=_,ka=Fn,J=m,Aa=Qt,ja=xn,Ma=Xe,Na=Se,Pa=oe,Fa=ie,Y=p,Ia=Wr,La=Ve,Ra=st,za=$t,Ba=Ze,Va=ke,Ha=At,Ua=ze,Wa=dt,Ga=Pr,Ka=fe,qa=Jt,X=k,Ja=Rn,Ya=Ir,Xa=Hn,Za=et,Qa=Vt,Z=ln,$a=x,eo=d,to=Dr,no=ft,ro=br,io=Et,ao=Nt,oo=f,so=gt,co=Ct,lo=bt,uo=be,fo=Ue,po=Ke,mo=Te,ho=Br,go=it,_o=c,vo=me,yo=$e,bo=n,xo=Dt,So=Er,Co=Lr,wo=qt,To=_n,Eo=zt,Do=dn,Oo=wr,ko=rn,Ao=V,jo=Zi,Mo=ar,No=In,Po=s,Fo=na,Io=xt,Lo=zr,Ro=Xn,zo=ut,Bo=re,Vo=kr,Ho=hr,Uo=Yn,Wo=Nr,Go=le,Ko=Qe,qo=pe,Jo=Ln,Yo=ye,Xo=Ie,Zo=or,Qo=kt,$o=Me,es=It,ts=Mt,ns=Vr,rs=vr,is=Zn,as=Kn,os=dr,ss=Wt,cs=Tn,ls=mr,us=De,ds=at,fs=Jn,ps=fr,ms=Yi,hs=v,gs=Ut,_s=lr,vs=Cn,ys=qe,bs=g,xs=he,Ss=M,Cs=ht,ws=je,Ts=_r,Es=Gn,Ds=hn,Os=Vn,ks=un,As=Lt,js=Sr,Ms=Bn,Ns=nn,Ps=xr,Fs=bn,Q=T,Is=Wn,Ls=tr,Rs=Nn,zs=Dn,Bs=i,Vs=An,Hs=We,Us=pn,Ws=o,Gs=kn,Ks=Je,qs=$n,Js=vn,Ys=Qi,Xs=Xi,Zs=Ge,Qs=Ye,$s=j(2,(e,t)=>ec(e,void 0,t)),ec=$i,tc=mt,nc=_e,rc=Pe,ic=rr,ac=ct,oc=Kt,sc=Gt,cc=En,lc=pr,uc=Xt,dc=vt,fc=ir,pc=Ae,mc=Ee,hc=_t,gc=wt,_c=xe,vc=oa,yc=sa,bc=fn,xc=Tr,Sc=Rr,Cc=Bt,wc=ue,Tc=te,Ec=we,Dc=Be,Oc=ot,kc=Oe,Ac=ge,jc=Ur,Mc=Ce,Nc=ee,Pc=St,Fc=yt,Ic=Fe,Lc=Tt,Rc=ve,zc=cn,Bc=tn,Vc=A,Hc=b,Uc=b(),Wc=b(`Fatal`),Gc=b(`Warn`),Kc=b(`Error`),qc=b(`Info`),Jc=b(`Debug`),Yc=b(`Trace`),Xc=j(2,(e,t)=>g(e,sr,e=>new Set([...e,t]))),Zc=j(e=>K(e[0]),(e,...t)=>g(e,ii,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||Hr(n,t[0],t[1]),n})),Qc=Mr,$c=j(2,(e,t)=>k(Qn,n=>g(e,ai,e=>[[t,n],...e]))),el=j(e=>K(e[0]),(e,t,n)=>Q(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),tl=j(e=>K(e[0]),(e,t,n)=>Xa(e,e=>{let r=n===void 0?e:n(e);return G(t,r)})),nl=j(e=>K(e[0]),(e,t,n)=>Co(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),rl=j(e=>K(e[0]),(e,t,n)=>Oo(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),il=j(e=>K(e[0]),(e,t,n)=>Vc(r=>{let i=r.monotonicTimeNanosUnsafe();return Q(e,()=>{let e=r.monotonicTimeNanosUnsafe(),a=Sn(D(e),D(i)),o=n===void 0?a:u(()=>n(a));return G(t,o)})}));var $=class extends Or()(`effect/Effect/Transaction`){};const al=e=>Ua(t=>{if(t.context.mapUnsafe.has($.key))return e;let n={journal:new Map,retry:!1},r;return Gs(i=>X(xa({while:()=>!r,body:S(i(e).pipe(Ss($,n),To(()=>n.retry?i(sl(n)):q),Z)),step(e){if(n.retry||!ol(n))return ll(n);Jr(e)?cl(t,n):ll(n),r=e}}),()=>r))}),ol=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},sl=e=>Da(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let e of n)e.pending.delete(t)};return J(e=>{let i=()=>{r(),e(q)};for(let e of n)e.pending.set(t,i);return Oa(r)})});function cl(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version+=1,n.value=r);for(let t of n.pending.values())e.currentDispatcher.scheduleTask(t,0);n.pending.clear()}}function ll(e){e.retry=!1,e.journal.clear()}const ul=X($,e=>(e.retry=!0,Vs)),dl=(e,t,n)=>(...r)=>J(i=>{try{e(...r,(e,n)=>{i(e?Y(t?t(e,r):e):wa(n))})}catch(e){i(n?Y(n(e,r)):za(e))}}),fl=()=>e=>e,pl=()=>e=>e,ml=()=>e=>e,hl=nt,gl=sn,_l=Pt,vl=Zt,yl=Le,bl=er;export{Oc as $,Sc as A,zi as At,gl as B,N as Bt,Bc as C,Gs as Ct,Js as D,Ni as Dt,ba as E,Ua as Et,Gc as F,ji as Ft,So as G,ti as Gt,ls as H,ci as Ht,$a as I,Ci as It,Jo as J,Lo as K,Qr as Kt,_l as L,oi as Lt,Fa as M,Ti as Mt,No as N,yi as Nt,Cc as O,Ri as Ot,Hs as P,ki as Pt,Dc as Q,hl as R,li as Rt,Ja as S,Ba as St,bl as T,xa as Tt,Ms as U,$r as Ut,as as V,si as Vt,Q as W,ri as Wt,Ac as X,Za as Y,kc as Z,Y as _,To as _t,Ya as a,Lc as at,X as b,Vo as bt,J as c,ws as ct,yl as d,vs as dt,jc as et,so as f,wa as ft,Z as g,Xa as gt,dl as h,Oa as ht,ma as i,Fc as it,Wa as j,P as jt,xc as k,Pi as kt,po as l,Ts as lt,za as m,Da as mt,Ds as n,Pc as nt,eo as o,Rc as ot,oo as p,Ta as pt,hs as q,As as r,Mc as rt,no as s,Ic as st,fa as t,Nc as tt,mo as u,Es as ut,La as v,zo as vt,zc as w,q as wt,vl as x,Ca as xt,Ra as y,Bo as yt,bo as z,ui as zt};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{At as t,Ct as n,Do as r,Dt as ee,Eo as i,Et as a,Mt as o,No as s,Nt as c,Ot as l,Pt as u,St as d,To as f,Tt as p,_t as m,bt as h,gt as g,ht as _,jt as v,kt as y,mt as b,pt as x,vt as S,wo as C,wt as w,xt as T,yt as E}from"./effect-CczU2E3R.js";var D=e({asVoid:()=>X,asVoidAll:()=>Z,die:()=>M,fail:()=>j,failCause:()=>A,filterCause:()=>U,filterFailure:()=>H,filterSuccess:()=>B,filterValue:()=>V,findDefect:()=>G,findError:()=>W,findErrorOption:()=>te,getCause:()=>$,getSuccess:()=>Q,hasDies:()=>R,hasFails:()=>L,hasInterrupts:()=>z,interrupt:()=>N,isExit:()=>O,isFailure:()=>I,isSuccess:()=>F,map:()=>q,mapBoth:()=>Y,mapError:()=>J,match:()=>K,succeed:()=>k,void:()=>P});const O=s,k=r,A=i,j=f,M=C,N=ee,P=u,F=y,I=l,L=p,R=w,z=a,B=m,V=S,H=g,U=_,W=h,G=E,K=c,q=t,J=o,Y=v,X=x,Z=b,Q=n,$=d,te=T;export{F as a,P as c,I as i,j as n,K as o,A as r,k as s,D as t};
@@ -0,0 +1,2 @@
1
+ import{Ra as e,_a as t}from"./effect-CczU2E3R.js";import{M as n,Y as r,yt as i}from"./Effect-CYgXOp91.js";import{F as a,M as o,N as s,P as c,c as l,f as u,g as d,i as f,j as p,k as m,n as h,o as g,u as _}from"./RunUserPromptSubmitHooksExecutor-C-kpE1OB.js";import{homedir as v}from"node:os";const y=e=>n(function*(){return yield*a(e).pipe(c(`ToolCall`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(n)return yield*_(n,e,t)})),c(`ToolResult`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(!n)return;let r=yield*f(n,e,t);if(r.warning!==void 0)return{content:[...e.content,{type:`text`,text:r.warning}],isError:e.isError}})),c(`Prompt`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(n)return yield*h(n,e,t)})),c(`SessionStart`,({reason:e,ctx:t})=>n(function*(){let n=yield*p(o(v(),t.cwd)),r=[...n.coverage.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...n.coverage.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...n.coverage.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.shadowed.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.disabled.map(e=>` ${e.event}: ${e.reason}`)];r.length>0&&t.ui.notify(`Hook coverage — configured hooks this bridge will not run:\n${r.join(`
2
+ `)}`,`warning`),n.unsupportedHookTypes.length>0&&t.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${n.unsupportedHookTypes.join(`, `)}`,`warning`),n.malformedFiles.length>0&&t.ui.notify(`Hooks are NOT running from malformed settings file(s): ${n.malformedFiles.join(`, `)}`,`error`);let i=yield*m(o(v(),t.cwd));i&&(yield*l(i,e,t))})),c(`SessionCompact`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*l(t,`compact`,e),yield*d(t.hooks.PostCompact,e,`PostCompact`))})),c(`PreCompact`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));if(!t)return;let n=yield*u(t,e);if(n.block===!0)return e.ui.notify(`Compaction cancelled by a PreCompact hook: ${n.reason??`no reason given`}`,`warning`),{cancel:!0}})),c(`SessionSwitch`,({reason:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));n&&(yield*g(n,e,t))})),c(`SessionShutdown`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*d(t.hooks.SessionEnd,e,`SessionEnd`))})),c(`SessionStop`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*d(t.hooks.Stop,e,`Stop`))})),s)}),b=(a,o)=>{async function s(a){let s=n(function*(){let e=yield*r(y(a));if(t(e))throw e.failure;return e.success}).pipe(i(28e3));return e(await o.runSafe(s))}a.on(`tool_call`,(e,t)=>s({_tag:`ToolCall`,event:e,ctx:t})),a.on(`tool_result`,(e,t)=>s({_tag:`ToolResult`,event:e,ctx:t})),a.on(`input`,(e,t)=>s({_tag:`Prompt`,event:e,ctx:t})),a.on(`session_start`,(e,t)=>s({_tag:`SessionStart`,reason:`startup`,ctx:t})),a.on(`session_compact`,(e,t)=>s({_tag:`SessionCompact`,ctx:t})),a.on(`session_before_compact`,(e,t)=>s({_tag:`PreCompact`,ctx:t})),a.on(`session_switch`,(e,t)=>s({_tag:`SessionSwitch`,reason:e.reason,ctx:t})),a.on(`session_shutdown`,(e,t)=>s({_tag:`SessionShutdown`,ctx:t})),a.on(`session_stop`,(e,t)=>s({_tag:`SessionStop`,ctx:t}))};export{b as HookDispatcherTask};
@@ -0,0 +1 @@
1
+ import{Cs as e,Fa as t,Ia as n,Ka as r,Kn as i,Pa as a,bs as o,cs as s,ma as c,ms as l,os as u,qa as d}from"./effect-CczU2E3R.js";import{a as ee,i as te,n as f,o as ne}from"./Cause-BPRKNAWJ.js";import{c as re,n as p,s as ie}from"./Exit-Dz81ekW_.js";import{$ as ae,A as oe,Bt as se,D as m,Dt as h,E as g,Et as _,Ft as v,G as y,Gt as ce,H as le,I as b,It as ue,J as de,Kt as fe,Lt as pe,M as x,Mt as S,N as C,Nt as me,Pt as he,Q as w,Rt as ge,S as _e,St as T,Ut as E,Vt as ve,Wt as ye,X as be,Z as xe,_ as D,a as Se,at as Ce,b as O,bt as we,c as k,ct as A,dt as Te,et as j,ft as M,gt as Ee,h as N,ht as P,it as De,jt as Oe,m as ke,mt as F,n as I,nt as Ae,o as je,ot as Me,p as Ne,q as Pe,rt as Fe,s as Ie,st as Le,tt as Re,w as L,wt as R,xt as ze,zt as Be}from"./Effect-CYgXOp91.js";import{C as z,Ct as Ve,D as He,Dt as Ue,E as B,Et as We,F as Ge,I as V,L as Ke,M as H,N as qe,P as U,R as Je,St as Ye,Tt as Xe,_ as W,b as Ze,g as Qe,h as $e,k as et,m as tt,n as nt,v as G,w as rt,wt as it,x as at,xt as ot,y as st,z as ct}from"./dist-BkUkC5Q5.js";import{A as lt,C as ut,D as dt,E as ft,I as pt,L as mt,O as ht,S as gt,T as _t,_ as vt,a as yt,b as bt,d as xt,h as St,l as Ct,m as wt,p as Tt,r as Et,s as Dt,t as Ot,v as kt,w as At,x as jt,y as Mt}from"./RunUserPromptSubmitHooksExecutor-C-kpE1OB.js";import*as Nt from"node:os";import*as Pt from"node:child_process";import{PassThrough as Ft}from"node:stream";import*as It from"node:crypto";import*as K from"node:fs";import*as q from"node:path";import*as Lt from"node:url";const Rt=i,zt=`~effect/ManagedRuntime`,Bt=(e,t)=>{let n=t?.memoMap??me(),r=ve(`parallel`),i=se(r,`sequential`),a={onFiberStart:mt(r)},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=_(t=>(s||=w(Ee(Oe(e,n,i),e=>P(()=>{l.cachedContext=e})),{...a,scheduler:t.currentScheduler}),_e(pt(s)))),l={[zt]:zt,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?j(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return j(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:F(()=>(l.contextEffect=ke(`ManagedRuntime disposed`),l.cachedContext=void 0,Be(l.scope,re))),runFork(e,t){return l.cachedContext===void 0?w(J(l,e),o(t)):ae(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?be(J(l,e),o(t)):xe(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Ce(J(l,e)):Me(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?De(J(l,e)):Le(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Re(J(l,e),o(t)):Ae(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?j(J(l,e),o(t)):Fe(l.cachedContext)(e,o(t))}};return l};function J(e,t){return O(e.contextEffect,e=>Pe(t,e))}const Vt=(e,t,n)=>{let r=e.detached??n!==`win32`;return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}},Y=(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`}return ct({_tag:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})},Ht=e=>Ge(Ye(Ut(e),e=>[e])),Ut=e=>ot(t=>{let n=e.evaluate();return M(Wt({...e,writable:n,pull:t}))}),Wt=e=>e.pull.pipe(O(t=>{let n=0;return k(function r(i){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once(`drain`,()=>r(i));return}i(R)})}),m({disableYield:!0}),de(k(t=>{let n=n=>t(D(e.onError(n)));return e.writable.once(`error`,n),P(()=>{e.writable.off(`error`,n)})})),e.endOnDone===!1?o:h(t=>`closed`in e.writable&&e.writable.closed?ee(t):k(n=>{e.writable.once(`finish`,()=>n(ee(t))),e.writable.end()}))),Gt=e=>rt(Kt(e)),Kt=e=>ot((t,n)=>qt({scope:n,readable:e.evaluate(),onError:e.onError??Jt,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),qt=e=>{let t=e.readable,n=e.closeOnDone??!0,r=e.exit??Ue(void 0),i=Rt(!1);function a(){i.openUnsafe()}function o(t){r.current=p(e.onError(t)),i.openUnsafe()}function s(){r.current=p(f()),i.openUnsafe()}t.on(`readable`,a),t.once(`error`,o),t.once(`end`,s);let l=F(function n(){let a=e.readable.read(e.chunkSize);if(a===null)return r.current?r.current:t.readableEnded?D(f()):(i.closeUnsafe(),O(i.await,n));let o=c(a);for(;a=e.readable.read(e.chunkSize),a!==null;)o.push(a);return M(o)});return je(ge(e.scope,P(()=>{t.off(`readable`,a),t.off(`error`,o),t.off(`end`,s),n&&`closed`in e.readable&&!e.readable.closed&&e.readable.destroy()})),l)},Jt=e=>new te(e),X=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Z=(e,t,n)=>{let{commands:r}=Zt(n),i=r.reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return Y(`ChildProcess`,e)(t,[i])},Yt=(e,t=()=>{})=>Pt.execFile(`taskkill`,[`/pid`,String(e.pid),`/T`,`/F`],{windowsHide:!0},t),Xt=S(ut,x(function*(){let e=yield*Qe,t=yield*tt,n=L(function*(n){if(!l(n.cwd))return yield*e.access(n.cwd),t.resolve(n.cwd)}),r=e=>e.extendEnv?{...globalThis.process.env,...e.env}:e.env,i=e=>B(e)?`pipe`:e,a=e=>V(e)?`pipe`:e,o=e=>{let t={stream:`pipe`,encoding:`utf-8`,endOnDone:!0};return l(e.stdin)?t:typeof e.stdin==`string`||B(e.stdin)?{...t,stream:e.stdin}:{stream:e.stdin.stream,encoding:e.stdin.encoding??t.encoding,endOnDone:e.stdin.endOnDone??t.endOnDone}},c=(e,t)=>{let n=e[t];return l(n)?{stream:`pipe`}:typeof n==`string`||V(n)?{stream:n}:{stream:n.stream}},d=e=>{if(l(e.additionalFds))return[];let t=[];for(let[n,r]of Object.entries(e.additionalFds)){let e=gt(n);s(e)&&t.push({fd:e,config:r})}return t.sort((e,t)=>e.fd-t.fd)},ee=(e,t,n,r)=>{let o=[i(e.stream),a(t.stream),a(n.stream)];if(r.length===0)return o;let s=r.reduce((e,{fd:t})=>Math.max(e,t),2);for(let e=3;e<=s;e++)o[e]=`ignore`;for(let{fd:e}of r)o[e]=`pipe`;return o},te=L(function*(e,t,n){if(n.length===0)return{getInputFd:()=>U,getOutputFd:()=>z};let r=new Map,i=new Map;for(let{config:a,fd:o}of n){let n=t.stdio[o];switch(a.type){case`input`:{let t=U;n&&`write`in n&&(t=Ht({evaluate:()=>n,onError:t=>Z(`fromWritable(fd${o})`,X(t),e)})),a.stream&&(yield*oe(et(a.stream,t))),r.set(o,t);break}case`output`:{let t=z;if(n&&`read`in n){let r=new Ft;n.on(`error`,e=>r.destroy(e)),n.pipe(r),t=Gt({evaluate:()=>r,onError:t=>Z(`fromReadable(fd${o})`,X(t),e)})}a.sink&&(t=H(t,a.sink)),i.set(o,t);break}}}return{getInputFd:e=>r.get(e)??U,getOutputFd:e=>i.get(e)??z}}),f=(e,t,n)=>F(()=>{let r=U;return u(t.stdin)&&(r=Ht({evaluate:()=>t.stdin,onError:t=>Z(`fromWritable(stdin)`,X(t),e),endOnDone:n.endOnDone,encoding:n.encoding})),B(n.stream)?je(oe(et(n.stream,r)),r):M(r)}),ne=(e,t,n,r)=>{let i=t.stdout?(()=>{let n=new Ft;return t.stdout.on(`error`,e=>n.destroy(e)),t.stdout.pipe(n),Gt({evaluate:()=>n,onError:t=>Z(`fromReadable(stdout)`,X(t),e)})})():z,a=t.stderr?(()=>{let n=new Ft;return t.stderr.on(`error`,e=>n.destroy(e)),t.stderr.pipe(n),Gt({evaluate:()=>n,onError:t=>Z(`fromReadable(stderr)`,X(t),e)})})():z;V(n.stream)&&(i=H(i,n.stream)),V(r.stream)&&(a=H(a,r.stream));let o=He(i,a);return{stdout:i,stderr:a,all:o}},re=(e,t)=>k(n=>{let r=fe(),i=Pt.spawn(e.command,e.args,t);return i.on(`error`,t=>{n(D(Z(`spawn`,t,e)))}),i.on(`exit`,(...e)=>{ye(r,ie(e))}),i.on(`spawn`,()=>{n(M([i,r]))}),P(()=>{i.kill(`SIGTERM`)})}),p=(e,t,n)=>globalThis.process.platform===`win32`?k(n=>{Yt(t,t=>{n(t?D(Z(`kill`,X(t),e)):R)})}):T({try:()=>{globalThis.process.kill(-t.pid,n)},catch:t=>Z(`kill`,X(t),e)}),ae=(e,t)=>{if(globalThis.process.platform===`win32`){Yt(e);return}try{globalThis.process.kill(-e.pid,t)}catch{}},se=(e,t,n)=>F(()=>{if(!t.kill(n)){let t=new globalThis.Error(`Failed to kill child process`);return D(Z(`kill`,t,e))}return R}),m=(e,t,n)=>r=>{let i=n?.killSignal??`SIGTERM`;return l(n?.forceKillAfter)?r(t,e,i):we(r(t,e,i),{duration:n.forceKillAfter,orElse:()=>r(t,e,`SIGKILL`)})},h=(e,t)=>{let n=t??`stdout`;switch(n){case`stdout`:return e.stdout;case`stderr`:return e.stderr;case`all`:return e.all;default:{let t=gt(n);return s(t)?e.getOutputFd(t):e.stdout}}},_=L(function*(e){switch(e._tag){case`StandardCommand`:{let t=o(e.options),i=c(e.options,`stdout`),a=c(e.options,`stderr`),s=d(e.options),l=!0,ie=yield*n(e.options),oe=r(e.options),h=ee(t,i,a,s),[g,_]=yield*I(re(e,Vt(e.options,{cwd:ie,env:oe,stdio:h},process.platform)),L(function*([t,n]){let r=yield*ce(n),i=m(t,e,e.options);if(r){let[e]=yield*E(n);return e!==0&&u(e)?yield*C(i(p)):yield*R}return l?yield*i((e,t,r)=>p(e,t,r).pipe(Ne(()=>se(e,t,r)),Se(E(n)))).pipe(C):yield*R})),v=_t(g.pid);g.on(`exit`,t=>{t!==0&&u(t)&&ae(g,e.options.killSignal??`SIGTERM`)});let y=P(()=>{l||=(g.ref(),!0)}),le=P(()=>(l&&=(g.unref(),!1),y)),ue=yield*f(e,g,t),{all:de,stderr:fe,stdout:pe}=ne(e,g,i,a),{getInputFd:x,getOutputFd:S}=yield*te(e,g,s),me=b(ce(_),e=>!e),he=O(E(_),([t,n])=>{if(u(t))return M(At(t));let r=new globalThis.Error(`Process interrupted due to receipt of signal: '${n}'`);return D(Z(`exitCode`,r,e))});return dt({pid:v,exitCode:he,isRunning:me,kill:t=>m(g,e,t)((e,t,n)=>p(e,t,n).pipe(Ne(()=>se(e,t,n)),Se(E(_)))).pipe(Ie),stdin:ue,stdout:pe,stderr:fe,all:de,getInputFd:x,getOutputFd:S,unref:le})}case`PipedCommand`:{let{commands:t,pipeOptions:n}=Zt(e),[r,...i]=t,a=[yield*_(r)];for(let e=0;e<i.length;e++){let t=i[e],r=n[e]??{},c=o(t.options),l=qe(M(h(a[a.length-1],r.from))),u=r.to??`stdin`;if(u===`stdin`)a.push(yield*_(jt(t.command,t.args,{...t.options,stdin:{...c,stream:l}})));else{let e=gt(u);if(s(e)){let n=bt(e),r=t.options.additionalFds??{};a.push(yield*_(jt(t.command,t.args,{...t.options,additionalFds:{...r,[n]:{type:`input`,stream:l}}})))}else a.push(yield*_(jt(t.command,t.args,{...t.options,stdin:{...c,stream:l}})))}}let c=a[a.length-1],l=e=>g([...a].reverse(),t=>C(t.kill(e)),{discard:!0}),u=x(function*(){let e=[];for(let t of a)e.push(yield*t.unref);return g([...e].reverse(),e=>e,{discard:!0})});return dt({pid:c.pid,exitCode:c.exitCode,isRunning:c.isRunning,kill:l,stdin:c.stdin,stdout:c.stdout,stderr:c.stderr,all:c.all,getInputFd:c.getInputFd,getOutputFd:c.getOutputFd,unref:u})}}});return ft(_)})),Zt=e=>{let t=[],n=[],r=e=>{switch(e._tag){case`StandardCommand`:t.push(e);break;case`PipedCommand`:r(e.left),n.push(e.options),r(e.right)}};if(r(e),t.length===0)throw Error(`flattenCommand produced empty commands array`);let[i,...a]=t;return{commands:[i,...a],pipeOptions:n}},Q=e=>t=>Je({module:`FileSystem`,method:e,description:t.message??String(t)}),Qt=(()=>{let e=N(K.access,Y(`FileSystem`,`access`),Q(`access`));return(t,n)=>{let r=K.constants.F_OK;return n?.readable&&(r|=K.constants.R_OK),n?.writable&&(r|=K.constants.W_OK),e(t,r)}})(),$t=(()=>{let e=N(K.cp,Y(`FileSystem`,`copy`),Q(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),en=(()=>{let e=N(K.copyFile,Y(`FileSystem`,`copyFile`),Q(`copyFile`));return(t,n)=>e(t,n)})(),tn=(()=>{let e=N(K.chmod,Y(`FileSystem`,`chmod`),Q(`chmod`));return(t,n)=>e(t,n)})(),nn=(()=>{let e=N(K.chown,Y(`FileSystem`,`chown`),Q(`chown`));return(t,n,r)=>e(t,n,r)})(),rn=(()=>{let e=N(K.glob,Y(`FileSystem`,`glob`),Q(`glob`));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),an=(()=>{let e=N(K.link,Y(`FileSystem`,`link`),Q(`link`));return(t,n)=>e(t,n)})(),on=(()=>{let e=N(K.mkdir,Y(`FileSystem`,`makeDirectory`),Q(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),sn=e=>{let t=N(K.mkdtemp,Y(`FileSystem`,e),Q(e));return e=>F(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?q.join(e.directory,`.`):Nt.tmpdir();return t(n?q.join(r,n):r+`/`)})},cn=sn(`makeTempDirectory`),ln=e=>{let t=N(K.rm,Y(`FileSystem`,e),Q(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},un=ln(`remove`),dn=(()=>{let e=sn(`makeTempDirectoryScoped`),t=ln(`makeTempDirectoryScoped`);return n=>I(e(n),e=>y(t(e,{recursive:!0})))})(),fn=(t=>{let n=N(K.open,Y(`FileSystem`,t),Q(t)),r=N(K.close,Y(`FileSystem`,t),Q(t));return(t,i)=>e(I(n(t,i?.flag??`r`,i?.mode),e=>y(r(e))),b(e=>pn(e,i?.flag?.startsWith(`a`)??!1)))})(`open`),pn=(()=>{let e=e=>N(K.read,Y(`FileSystem`,e),Q(e)),t=e(`read`),n=e(`readAlloc`),i=N(K.fstat,Y(`FileSystem`,`stat`),Q(`stat`)),a=N(K.ftruncate,Y(`FileSystem`,`truncate`),Q(`truncate`)),o=N(K.fsync,Y(`FileSystem`,`sync`),Q(`sync`)),s=e=>N(K.write,Y(`FileSystem`,e),Q(e)),c=s(`write`),l=s(`writeAll`);class u{[W];fd;append;position=BigInt(0);constructor(e,t){this[W]=W,this.fd=e,this.append=t}get stat(){return b(i(this.fd),Sn)}get sync(){return o(this.fd)}seek(e,t){let n=G(e);return P(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),G(this.position)))}read(e){return F(()=>{let n=this.position;return b(t(this.fd,{buffer:e,position:n}),e=>{let t=G(e);return this.position=n+t,t})})}readAlloc(e){let t=Number(e);return F(()=>{let e=Buffer.allocUnsafeSlow(t),i=this.position;return b(n(this.fd,{buffer:e,position:i}),n=>{if(n===0)return r();if(this.position=i+BigInt(n),n===t)return d(e);let a=Buffer.allocUnsafeSlow(n);return e.copy(a,0,0,n),d(a)})})}truncate(e){return b(a(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}})}write(e){return F(()=>{let t=this.position;return b(c(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),e=>{let n=G(e);return this.append||(this.position=t+n),n})})}writeAllChunk(e){return F(()=>{let t=this.position;return O(l(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),n=>n===0?D(ct({module:`FileSystem`,method:`writeAll`,_tag:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position=t+BigInt(n)),n<e.length?this.writeAllChunk(e.subarray(n)):R))})}writeAll(e){return this.writeAllChunk(e)}}return(e,t)=>new u(e,t)})(),mn=e=>{let t=sn(e);return L(function*(e){let n=yield*t(e),r=It.randomBytes(6).toString(`hex`),i=q.join(n,e?.suffix?`${r}${e.suffix}`:r);return yield*kn(i,new Uint8Array),i})},hn=mn(`makeTempFile`),gn=(()=>{let e=mn(`makeTempFileScoped`),t=ln(`makeTempFileScoped`);return n=>I(e(n),e=>y(t(q.dirname(e),{recursive:!0})))})(),_n=(e,t)=>ze({try:()=>K.promises.readdir(e,t),catch:t=>Y(`FileSystem`,`readDirectory`)(t,[e])}),vn=e=>k((t,n)=>{try{K.readFile(e,{signal:n},(n,r)=>{t(n?D(Y(`FileSystem`,`readFile`)(n,[e])):M(r))})}catch(e){t(D(Q(`readFile`)(e)))}}),yn=(()=>{let e=N(K.readlink,Y(`FileSystem`,`readLink`),Q(`readLink`));return t=>e(t)})(),bn=(()=>{let e=N(K.realpath,Y(`FileSystem`,`realPath`),Q(`realPath`));return t=>e(t)})(),xn=(()=>{let e=N(K.rename,Y(`FileSystem`,`rename`),Q(`rename`));return(t,n)=>e(t,n)})(),Sn=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:t(e.mtime),atime:t(e.atime),birthtime:t(e.birthtime),dev:e.dev,rdev:t(e.rdev),ino:t(e.ino),mode:e.mode,nlink:t(e.nlink),uid:t(e.uid),gid:t(e.gid),size:G(e.size),blksize:e.blksize===void 0?r():d(G(e.blksize)),blocks:t(e.blocks)}),Cn=(()=>{let e=N(K.stat,Y(`FileSystem`,`stat`),Q(`stat`));return t=>b(e(t),Sn)})(),wn=(()=>{let e=N(K.symlink,Y(`FileSystem`,`symlink`),Q(`symlink`));return(t,n)=>e(t,n)})(),Tn=(()=>{let e=N(K.truncate,Y(`FileSystem`,`truncate`),Q(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),En=(()=>{let e=N(K.utimes,Y(`FileSystem`,`utime`),Q(`utime`));return(t,n,r)=>e(t,n,r)})(),Dn=(e,t)=>at(n=>I(P(()=>{let r=K.watch(e,{recursive:t?.recursive??!1},(e,t)=>{if(t)switch(e){case`rename`:w(le(Cn(t),{onSuccess:e=>Xe(n,{_tag:`Create`,path:t}),onFailure:e=>Xe(n,{_tag:`Remove`,path:t})}));return;case`change`:We(n,{_tag:`Update`,path:t});return}});return r.on(`error`,t=>{it(n,ne(ct({module:`FileSystem`,_tag:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t})))}),r.on(`close`,()=>{Ve(n)}),r}),e=>P(()=>e.close()))),On=(e,t,r)=>Cn(t).pipe(b(i=>e.pipe(a(e=>e.register(t,i,r)),n(()=>Dn(t,r)))),qe),kn=(e,t,n)=>k((r,i)=>{try{K.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?D(Y(`FileSystem`,`writeFile`)(t,[e])):R)})}catch(e){r(D(Q(`writeFile`)(e)))}}),An=b(Te(st),e=>Ze({access:Qt,chmod:tn,chown:nn,copy:$t,copyFile:en,glob:rn,link:an,makeDirectory:on,makeTempDirectory:cn,makeTempDirectoryScoped:dn,makeTempFile:hn,makeTempFileScoped:gn,open:fn,readDirectory:_n,readFile:vn,readLink:yn,realPath:bn,remove:un,rename:xn,stat:Cn,symlink:wn,truncate:Tn,utimes:En,watch(t,n){return On(e,t,n)},writeFile:kn})),jn=S(Qe)(An),$=e=>({fromFileUrl:t=>T({try:()=>Lt.fileURLToPath(t,{windows:e}),catch:e=>new Ke({module:`Path`,method:`fromFileUrl`,cause:e})}),toFileUrl:t=>T({try:()=>Lt.pathToFileURL(t,{windows:e}),catch:e=>new Ke({module:`Path`,method:`toFileUrl`,cause:e})})});({...q.posix,...$(!1)}),{...q.win32,...$(!0)};const Mn=ue(tt)({[$e]:$e,...q,...$(void 0)}),Nn=he(S(pe,A),S(ht,A),S(lt,A),S(Mt,A),S(vt,A),S(Ct,A),S(Tt,A),S(wt,A),S(Et,A),S(xt,A),S(Ot,A),S(Dt,A),S(yt,A),S(St,A),S(kt,A)),Pn=Xt.pipe(v(jn),v(Mn)),Fn=Bt(Nn.pipe(v(nt),v(Pn))),In=()=>{Fn.dispose()};process.once(`SIGINT`,In),process.once(`SIGTERM`,In);export{Fn as default};
@@ -0,0 +1,3 @@
1
+ import{Ca as e,_a as t,ga as n,mo as r,ps as i,ro as a,vs as o,xs as s,ya as c,ys as l,zo as u}from"./effect-CczU2E3R.js";import{B as d,C as f,G as p,K as ee,M as te,R as m,Y as h,_ as g,d as ne,ft as _,m as v,u as re,w as y,x as b}from"./Effect-CYgXOp91.js";import{At as ie,It as ae,Lt as oe,Mt as se,Ot as ce,Pt as le,Q as ue,Rt as de,Z as fe,bt as pe,g as x,gt as S,jt as C,kt as w,m as T,mt as E,t as D,yt as O}from"./dist-BkUkC5Q5.js";function k(e){return{_tag:`Value`,value:e}}function A(e,t){return{_tag:`Record`,keys:e,value:t}}function j(e,t){return{_tag:`Array`,length:e,value:t}}de(`SourceError`);const M=e(`effect/ConfigProvider`,{defaultValue:()=>B()}),N={...r,toJSON(){return{_id:`ConfigProvider`}}},P=e=>e;function F(e,t){let n=Object.create(N);return n.load=e,n.mapInput=t,n}function I(e,t){return F(n=>e(t(n)),n=>I(e,l(t,n)))}function L(e){return I(e,P)}function R(e,t){return e===``&&!t?void 0:e}function z(e,t){let n=t?.preserveEmptyStrings===!0,r=me(e);return L(t=>_(ge(r,e,t,n)))}function B(e){return z(e?.env??{...globalThis.process?.env,...import.meta.env},{preserveEmptyStrings:e?.preserveEmptyStrings})}function me(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e){let e=i.children??=Object.create(null);i=e[t]??={}}}return t}const he=/^(0|[1-9][0-9]*)$/;function ge(e,t,n,r){let i=n.map(String).join(`_`),a=R(Object.hasOwn(t,i)?t[i]:void 0,r),o=_e(e,n),s=o?.children?Object.keys(o.children):[];return s.length===0?a===void 0?void 0:k(a):s.every(e=>he.test(e))?j(Math.max(...s.map(e=>parseInt(e,10)))+1,a):A(new Set(s),a)}function _e(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}const V=`~effect/Config`;var H=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const ve={...a({label:`Config`,evaluate(e){return this.parse(e.getRef(M))}}),[V]:V,toJSON(){return{_id:`Config`}}};function U(e){let t=Object.create(ve);return t.evaluator=e,t.parse=t=>e(t,[]).pipe(d(e=>e.error),b(e=>e._tag===`Resolved`?_(e.value):g(e.error))),t}const ye=(e,t,n)=>e.evaluator(t,n),W=(e,t)=>({_tag:`Resolved`,value:e,hasInput:t}),be=e=>({_tag:`Absent`,error:e}),G=(e,t)=>({error:e,hasInput:t}),xe=e=>i(e,`SourceError`),K=(e,t)=>e.pipe(re(e=>xe(e)?g(G(new H(e),t)):v(e))),Se=o(2,(e,t)=>U((n,r)=>m(ye(e,n,r),e=>e._tag===`Absent`?W(t,!1):e))),Ce=()=>`<configuration>`,q=(e,t)=>e.load(t).pipe(p,m(n=>({provider:e,path:t,node:n,toString:Ce}))),J=(e,t)=>q(e.provider,[...e.path,t]),Y=e=>e?.value,X=(e,t)=>w(C,e,new se(ae(e=>t(e)),le())),Z=e=>{switch(e._tag){case`Union`:return e.types.every(Z);case`Objects`:case`Arrays`:case`Suspend`:return!1;default:return!0}},Q=(e,t)=>{switch(e._tag){case`Objects`:return t?._tag===`Record`;case`Arrays`:return t?._tag===`Array`;case`Union`:return e.types.some(e=>Q(e,t));case`Suspend`:return Q(e.thunk(),t);default:return Y(t)!==void 0}},$=s(e=>{let t=new WeakSet,n=ce(e=>{switch(t.add(e),e._tag){case`Objects`:{let t=e.indexSignatures.map(e=>O(e.parameter)),r=y(function*(n){if(n.node?._tag!==`Record`)return;let r=n.node,i=new Set;for(let t of e.propertySignatures)typeof t.name==`string`&&i.add(t.name);if(t.length>0)for(let e of r.keys)t.some(t=>t(e))&&i.add(e);let a={};for(let e of i){let t=yield*J(n,e);t.node!==void 0&&u(a,e,t)}return a});return X(e.recur(n,e=>e),r)}case`Arrays`:{let t=y(function*(e){if(e.node?._tag!==`Array`)return;let t=[];for(let n=0;n<e.node.length;n++)t.push(yield*J(e,n));return t});return X(e.recur(n),t)}case`Union`:for(let t of e.types)n(t);return Z(e)?X(e,e=>_(Y(e.node))):e.recur(n);case`Suspend`:{let r=e.thunk();return t.has(r)||n(r),e.recur(n)}case`Declaration`:case`Any`:throw new globalThis.Error(`Config.schema does not support opaque StringTree encodings`,{cause:e});default:return X(e,e=>_(Y(e.node)))}});return n(e)});function we(e,t){let n=S(e),r=ie(n.ast),i=pe(E($(n.ast))),a=typeof t==`string`?[t]:t??[];return U((e,t)=>{let n=[...t,...a];return K(q(e,n),!1).pipe(b(e=>{let t=Q(r,e.node);return K(i(e).pipe(m(e=>W(e,t)),ne(e=>{let r=new H(new fe(n.length>0?new oe(n,e):e));return t?g(G(r,!0)):_(be(r))})),t)}))})}function Te(e){return we(ue,e)}const Ee=[`AGENTS.md`],De=f(`extractRefs`)(function*(e,t,n){let r=yield*x,i=yield*T,a=[];for(let o of e.split(`
2
+ `)){let e=o.trim().replace(/^[-*+]\s+/,``);if(!e.startsWith(`@`))continue;let s=e.slice(1).trim();if(!s||s.includes(` `)||i.isAbsolute(s))continue;let l=i.resolve(t,s);if(l.startsWith(n+`/`)||l===n){let e=yield*h(r.exists(l));if(c(e)&&e.success){a.push({sourcePath:t,resolvedPath:l});continue}}let u=i.resolve(n,s);(u.startsWith(n+`/`)||u===n)&&u!==l&&a.push({sourcePath:n,resolvedPath:u})}return a}),Oe=f(`loadReferencedContent`)(function*(e){let n=yield*x,r=yield*T,i=yield*D,a=[r.resolve(e,`CLAUDE.md`),r.resolve(e,`.claude`,`CLAUDE.md`)],o=[];for(let t of a){let i=yield*h(n.readFileString(t,`utf-8`));if(c(i)){let n=yield*De(i.success,r.dirname(t),e);o.push(...n)}}let s=new Set,l=[];for(let e of o)s.has(e.resolvedPath)||(s.add(e.resolvedPath),l.push(e));let u=(yield*i.load(e).pipe(ee(()=>void 0)))?.no_inject_refs??Ee,d=[];for(let r of l){let i=r.resolvedPath.slice(e.length+1);if(u.includes(i))continue;let a=yield*h(n.readFileString(r.resolvedPath,`utf-8`));t(a)||d.push(`## ${i}\n${a.success}\n`)}return d.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...d].join(`
3
+ `)}),ke=(e,t)=>{e.on(`before_agent_start`,async(e,r)=>{let i=await t.runSafe(te(function*(){let e=yield*Te(`CLAUDE_PROJECT_DIR`).pipe(Se(process.cwd())),t=yield*h(Oe(e));return n(t)}));if(i!==``)return{systemPrompt:[...e.systemPrompt,``,i]}})};export{ke as InjectInstructionsTask};
@@ -0,0 +1,9 @@
1
+ import{Cs as e,Ga as t,Ia as n,Ka as r,Oa as i,Sa as a,Ts as o,Ut as s,Va as c,Vo as l,Vt as u,Wa as d,Wt as f,ba as p,bs as m,ca as ee,fa as te,ha as h,la as ne,qa as g,ro as re,va as ie,vs as ae,wa as _,xa as oe,ya as v}from"./effect-CczU2E3R.js";import{c as se,f as ce}from"./Cause-BPRKNAWJ.js";import{a as le,i as y,o as ue}from"./Exit-Dz81ekW_.js";import{C as b,Ct as de,E as fe,F as pe,I as me,K as he,M as ge,N as _e,O as ve,P as ye,V as be,_ as xe,_t as Se,b as Ce,f as we,ft as x,ht as Te,i as Ee,it as De,k as Oe,lt as ke,m as S,r as Ae,s as je,vt as Me,wt as Ne,yt as Pe,z as Fe}from"./Effect-CYgXOp91.js";import{$ as C,A as Ie,B as w,Ft as Le,G as Re,H as T,It as ze,J as Be,K as Ve,N as He,Nt as Ue,O as We,Q as E,S as Ge,T as Ke,U as qe,V as D,X as O,Y as Je,_t as Ye,a as Xe,at as Ze,c as Qe,ct as k,d as $e,dt as et,et as A,f as tt,ft as j,g as nt,ht as M,i as rt,it as N,j as it,l as at,lt as P,nt as F,o as ot,ot as st,p as ct,pt as lt,q as ut,r as dt,rt as I,s as ft,st as pt,tt as mt,u as L,ut as ht,vt as R}from"./dist-BkUkC5Q5.js";function gt(){return Object.assign(e=>e,{option:e=>g(e),result:e=>a(e),is:e=>!0})}const _t=u,vt=s,yt=f,bt={"~effect/match/Match/Matcher":{_input:m,_filters:m,_result:m,_return:m},_tag:`ValueMatcher`,add(e){return v(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?xt(this.provided,a(e.evaluate(this.provided))):this},pipe(){return o(this,arguments)}};function xt(e,t){let n=Object.create(bt);return n.provided=e,n.value=t,n}const St=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),Ct=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(Ct),n=t.length;return e=>{if(!Array.isArray(e))return!1;for(let r=0;r<n;r++)if(t[r](e[r])===!1)return!1;return!0}}if(typeof e==`object`&&e){let t=Reflect.ownKeys(e).map(t=>[t,Ct(e[t])]),n=t.length;return e=>{if(typeof e!=`object`||!e)return!1;for(let r=0;r<n;r++){let[n,i]=t[r];if(!(n in e)||i(e[n])===!1)return!1}return!0}}return t=>t===e},wt=e=>xt(e,h(e)),Tt=(e,t)=>n=>n.add(St(Ct(e),t)),Et=(e=>(...t)=>{let n=t[t.length-1],r=t.slice(0,-1),i=r.length===1?t=>t!=null&&t[e]===r[0]:t=>t!=null&&r.includes(t[e]);return e=>e.add(St(i,n))})(`_tag`),Dt=e=>t=>{let n=Ot(t);return ie(n)?n._tag===`Success`?n.success:e(n.failure):t=>{let r=n(t);return v(r)?r.success:e(r.failure)}},Ot=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return e=>t._tag===`When`&&t.guard(e)===!0||t._tag===`Not`&&t.guard(e)===!1?a(t.evaluate(e)):h(e)}return n=>{for(let r=0;r<t;r++){let t=e.cases[r];if(t._tag===`When`&&t.guard(n)===!0||t._tag===`Not`&&t.guard(n)===!1)return a(t.evaluate(n))}return h(n)}},kt=`effect/match/Match/exhaustive: absurd`,At=e=>{let t=Ot(e);if(ie(t)){if(v(t))return t.success;throw Error(kt)}return e=>{let n=t(e);if(v(n))return n.success;throw Error(kt)}},z=wt,B=Tt,V=Et,jt=Dt,H=At,Mt=`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(`.`),Nt=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Pt={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.`},Ft=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],It={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."},Lt={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.`}}},Rt=C({type:Re(`command`),command:E,args:M(D(E)),async:M(T),asyncRewake:M(T),shell:M(Ve([`bash`,`powershell`])),timeout:M(Be),if:M(E),statusMessage:M(E),once:M(T)}),zt=C({type:Ve([`http`,`mcp_tool`,`prompt`,`agent`])}),Bt=I([Rt,zt]),U=C({matcher:M(E),hooks:D(Bt)}),Vt=C({PreToolUse:D(U).pipe(R(x([]))),PostToolUse:D(U).pipe(R(x([]))),PostToolUseFailure:D(U).pipe(R(x([]))),UserPromptSubmit:D(U).pipe(R(x([]))),Stop:D(U).pipe(R(x([]))),SessionStart:D(U).pipe(R(x([]))),SessionEnd:D(U).pipe(R(x([]))),PreCompact:D(U).pipe(R(x([]))),PostCompact:D(U).pipe(R(x([])))}),Ht=C({hooks:Vt,disableAllHooks:M(T)}),W=C({event:E,reason:E}),Ut=C({unrecognized:D(W),notCarried:D(W),matcherNotEvaluable:D(W),matcherOutOfReach:D(W),shadowed:D(W),disabled:D(W)}),Wt=C({...Vt.fields,disableAllHooks:M(T),hooks:M(ut)}).pipe(st(Ye(Ht),{decode:ze(({disableAllHooks:e,...t})=>x(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e})),encode:Ue(()=>`Decode-only: settings are never encoded`)})),Gt=I([Ht,Wt]);I([F(`Merge`,{sources:w}),F(`Coverage`,{json:w}),F(`DisabledCoverage`,{sources:w}),F(`UnsupportedHookTypes`,{json:w}),F(`MatcherUnreadable`,{event:w}),F(`IfEvaluatingEvent`,{event:w})]);const Kt=k(Gt),qt=Nt,Jt=P(O(E,N)),Yt=[],Xt=P(D(C({matcher:M(E),hooks:D(C({type:M(E)})).pipe(R(x([])))})));function Zt(e){return d(Jt(e),e=>t(Jt(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const G=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Qt={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},$t=Mt,en=Pt,tn=It,nn=Ft,rn=Lt,an=e=>n(Xt(e),()=>Yt).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),on=e=>an(e).length>0,sn=e=>z(e).pipe(V(`Reachable`,()=>r()),V(`Partial`,e=>g(e.reason)),V(`Unreachable`,e=>g(e.reason)),H);function cn(e){return t(Zt(e),{onNone:()=>Qt,onSome:({isWrapped:e,namespace:n,outer:r})=>{let i=[],a=[],o=[],s=[],c=[];for(let r of Object.keys(n)){if(!e&&r===`disableAllHooks`)continue;let c=en[r];if(c!==void 0){a.push({event:G(r),reason:c});continue}if(!$t.includes(r)){i.push({event:G(r),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let l=tn[r];l!==void 0&&on(n[r])&&o.push({event:G(r),reason:l});let u=rn[r];u!==void 0&&s.push(...an(n[r]).flatMap(e=>{let n=u[e];return n===void 0?[]:t(sn(n),{onNone:()=>[],onSome:t=>[{event:`${G(r)} (matcher "${G(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(r))$t.includes(e)&&c.push({event:G(e),reason:"ignored: this file wraps its hooks under `hooks`, so a group repeated at the top level is never read"});return{unrecognized:i,notCarried:a,matcherNotEvaluable:o,matcherOutOfReach:s,shadowed:c,disabled:[]}}})}function ln(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${G(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>qt.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function un(e){return t(Zt(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let r of qt){let i=n(Xt(e[r]),()=>Yt);for(let e of i)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(G(n.type))}return Array.from(t)}})}function dn(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 qt)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}function fn(e){return z(e).pipe(V(`Merge`,({sources:e})=>dn(e)),V(`Coverage`,({json:e})=>cn(e)),V(`DisabledCoverage`,({sources:e})=>ln(e)),V(`UnsupportedHookTypes`,({json:e})=>un(e)),V(`MatcherUnreadable`,({event:e})=>tn[e]!==void 0),V(`IfEvaluatingEvent`,({event:e})=>nn.includes(e)),H)}function K(e,t){return ht(t)(fn(e))}const pn=`/etc/claude-code/managed-settings.json`,mn=(e,t)=>[`${e}/.claude/settings.json`,`${t}/.claude/settings.json`,`${t}/.claude/settings.local.json`,pn];var hn=class extends _()(`CollectSettingsGapsExecutorDeps`){};const q=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),gn=b(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*nt,n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=[];for(let u of e){let e=yield*t.readFileString(u).pipe(he(()=>``));if(e===``)continue;let d=k(j(O(E,N)))(e);if(y(d)){l.push(u);continue}let f=K({_tag:`Coverage`,json:d.value},Ut);n.push(...f.unrecognized),r.push(...f.notCarried),i.push(...f.matcherNotEvaluable),a.push(...f.matcherOutOfReach),o.push(...f.shadowed),c.push(...K({_tag:`UnsupportedHookTypes`,json:d.value},D(E)));let p=Kt(d.value);y(p)?l.push(u):s.push({settings:p.value,managed:u===pn,label:u})}return{coverage:{unrecognized:q(n),notCarried:q(r),matcherNotEvaluable:q(i),matcherOutOfReach:q(a),shadowed:q(o),disabled:q(K({_tag:`DisabledCoverage`,sources:s},D(W)))},unsupportedHookTypes:Array.from(new Set(c)),malformedFiles:Array.from(new Set(l))}});var _n=class extends _()(`LoadSettingsExecutorDeps`){};const vn=b(`loadSettingsFile`)(function*(e){let t=yield*(yield*nt).readFileString(e).pipe(he(()=>``));if(t===``)return null;let n=k(j(O(E,N)))(t);if(y(n))return null;let r=n.value,i=Kt(r);return y(i)?null:i.value}),yn=b(`loadSettingsWithPaths`)(function*(e,t=pn){let n=[];for(let r of e){let e=yield*vn(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:K({_tag:`Merge`,sources:n},Ht)}),bn=gt(),xn=gt(),Sn=`~effect/ChildProcessSpawner/ChildProcessHandle`,Cn={[Sn]:Sn,...l,toJSON(){return{_id:`ChildProcessHandle`,pid:this.pid}}},wn=e=>Object.setPrototypeOf({...e},Cn),Tn=e=>{let t=(t,n)=>e(t).pipe(me(e=>Ge(n?.includeStderr===!0?e.all:e.stdout)),He),n=(e,n)=>it(t(e,n));return J.of({spawn:e,exitCode:t=>ke(Ce(e(t),e=>e.exitCode)),streamString:t,streamLines:n,lines:(e,t)=>Ie(n(e,t)),string:(e,n)=>We(t(e,n))})};var J=class extends _()(`effect/process/ChildProcessSpawner`){};const En=`~effect/unstable/process/ChildProcess`,Dn={...re({label:`Command`,evaluate(e){return i(e.context,J).spawn(this)}}),[En]:En},Y=(e,t,n)=>Object.assign(Object.create(Dn),{_tag:`StandardCommand`,command:e,args:t,options:n}),On=function(...e){if(kn(e[0])){let[t,...n]=e,r=Mn(t,n);return Y(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!kn(e[0])){let t=e[0];return function(e,...n){let r=Mn(e,n);return Y(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return Y(t,[],n)}let[t,n=[],r={}]=e;return Y(t,n,r)},kn=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),An=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},jn=e=>`fd${e}`,Mn=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Nn(e,t,n,i,r);return n},Nn=(e,t,n,r,i)=>{let a=e.raw[i];if(a===void 0)throw Error(`Invalid backslash sequence: ${e.raw[i]}`);let{hasLeadingWhitespace:o,hasTrailingWhitespace:s,tokens:c}=Ln(r,a),l=Rn(n,c,o);if(i===t.length)return l;let u=t[i],d=Array.isArray(u)?u.map(e=>Pn(e)):[Pn(u)];return Rn(l,d,s)},Pn=e=>typeof e==`string`?e:String(e),Fn=new Set([` `,` `,`\r`,`
2
+ `]),In={x:3,u:5},Ln=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=Fn.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(Fn.has(o))i!==n&&r.push(e.slice(i,n)),i=n+1;else if(o===`\\`){let e=t[a+1];e===`
3
+ `?(--n,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=In[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},Rn=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)],zn=(e,t,r)=>Oe(e,t).pipe(Ce(e=>vt(e)),Pe(r.deadline),me(e=>n(e,r.onDeadline))),Bn=O(E,N),Vn={UserPromptSubmit:30},Hn=(e,t)=>(e??Vn[t]??600)*1e3,Un=24e3,Wn=(e,t,n)=>{let r=Hn(e,t);return!n||r<=Un?{timeoutMs:r,capNote:``}:{timeoutMs:Un,capNote:` (capped from ${r}ms by the extension handler budget)`}},Gn={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Kn=et(j(Bn));var qn=class extends _()(`RunHookScriptExecutorDeps`){};const X=b(`runHookScript`)(function*(e,t,n,r,i=!0){let a=yield*J,{timeoutMs:o,capNote:s}=Wn(e.timeout,r,i),c=Kn(t),[l,u]=Gn[e.shell??`sh`],d={cwd:n,env:{OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n},stdin:Ke([new TextEncoder().encode(c)]),stdout:`pipe`,stderr:`pipe`},f=e.args===void 0?On(l,[u,e.command],d):On(e.command,e.args,d),p=yield*qn,m=ke(de(e=>ge(function*(){let t=yield*a.spawn(f);yield*Ae(()=>ye(t.kill({killSignal:`SIGKILL`})).pipe(Me(2e3),_e));let[n,r,i]=yield*e(Ee([We(Ge(t.stdout)),We(Ge(t.stderr)),t.exitCode.pipe(me(Number),he(()=>-1))],{concurrency:`unbounded`}));return{code:i,stdout:n,stderr:r}}))).pipe(Se(t=>pe(`hook ${e.command} failed`,t)));return yield*zn(m,p,{deadline:o,onDeadline:()=>({code:-1,stdout:``,stderr:`timeout after ${o}ms${s}`})})});var Jn=Object.defineProperty,Yn=(e,t)=>{let n={};for(var r in e)Jn(n,r,{get:e[r],enumerable:!0});return t||Jn(n,Symbol.toStringTag,{value:`Module`}),n},Xn=Yn({make:()=>Zn});const Zn=e=>e,Qn=Zn(e=>a(void 0));var Z=Yn({DESCRIPTION_MODULE:()=>$n,IO_CELLS:()=>er,apply:()=>cr,canonical:()=>lr,decide:()=>rr,decode:()=>nr,encode:()=>ir,read:()=>tr,vocabulary:()=>dr,write:()=>ar});const $n=`@systemfsoftware/effect-cell-types`,er={cells:[`store`,`adapter`],sources:[`effect/Clock`,`effect/System`]},Q=(e,t)=>{let n=e.layers,r=n[n.length-1];return{module:e.module,ioCells:e.ioCells,layers:[...n.slice(0,-1),{...r,phases:[...r?.phases??[],t]}]}},tr=(e,t)=>({"call read(command) before decode(raw)":!0,module:$n,ioCells:er,layers:[...t?.layers??[],{phases:[{name:`read`,kind:`impure`,convention:`effect`,run:e}]}]}),nr=ae(2,(e,t)=>({"call decode(raw) before decide(decoded)":!0,...Q(e,{name:`decode`,kind:`pure`,convention:`either-fail`,run:t})})),rr=ae(2,(e,t)=>({"call decide(decoded) before encode(decision)":!0,...Q(e,{name:`decide`,kind:`pure`,convention:`either-pass`,run:t})})),ir=ae(2,(e,t)=>({"call encode(decision) before write(output)":!0,...Q(e,{name:`encode`,kind:`pure`,convention:`total`,run:t})})),ar=ae(2,(e,t)=>({"call write(output) before applying the description":!0,...Q(e,{name:`write`,kind:`impure`,convention:`effect`,run:t})})),or=e=>ie(e),sr=(e,t)=>ge(function*(){let n=e.phases,r=n[n.length-1];if(!r||r.name!==`write`)return yield*S(Error(`effect-cell-types: a layer reached the interpreter without a write phase closing it`));let i=t;for(let e of n.slice(0,-1))switch(e.convention){case`effect`:i=yield*e.run(i);break;case`either-fail`:i=yield*oe(e.run(i),{onFailure:xe,onSuccess:x});break;case`either-pass`:i=e.run(i);break;case`total`:if(!or(i))return yield*S(Error(`effect-cell-types: an encode phase received a value that is not the decide outcome`));i=e.run(i);break;default:return yield*S(Error(`effect-cell-types: unknown phase convention ${String(e)}`))}return yield*r.run(i)}),cr=(e,n)=>ge(function*(){let r=yield*fe(e.layers,e=>sr(e,n));return yield*t(te(r),{onNone:()=>S(Error(`effect-cell-types: a description reached the interpreter with no layers`)),onSome:x})}),lr=ar(ir(rr(nr(tr(()=>Ne),()=>a(void 0)),Qn),()=>void 0),()=>Ne),ur=ne(lr.layers,e=>e.phases.map(({convention:e,kind:t,name:n})=>({convention:e,kind:t,name:n}))),dr={module:lr.module,ioCells:lr.ioCells,phases:ur,byKind:{pure:ur.filter(e=>e.kind===`pure`).map(e=>e.name),impure:ur.filter(e=>e.kind===`impure`).map(e=>e.name)},applier:`apply`},fr=C({code:Be,stdout:E,stderr:E});var pr=class extends A()(`Blocked`,{reason:E}){},mr=class extends A()(`Continue`,{warning:M(E),updatedInput:M(O(E,N))}){};I([pr,mr]);const hr=C({decision:M(E),reason:M(E),hookSpecificOutput:M(C({permissionDecision:M(E),permissionDecisionReason:M(E),updatedInput:M(O(E,N)),additionalContext:M(E)}))}).pipe(Ze({toArbitrary:()=>e=>e.record({decision:e.string(),reason:e.string(),hookSpecificOutput:e.record({permissionDecision:e.string(),permissionDecisionReason:e.string(),updatedInput:e.dictionary(e.string(),e.jsonValue()),additionalContext:e.string()})})})),gr=E.pipe(st(Ye(hr),{decode:ze(e=>pt(j(Ye(hr)))(e).pipe(Fe(e=>lt(e)?e.issue:e))),encode:Le(e=>JSON.stringify(e))})),_r=k(gr),vr=(e,t)=>e===2?`ExitBlock`:e===0?t.trim().startsWith(`{`)?`ExitDecisionJson`:`ExitNoDecision`:`ExitOther`,yr=(e,t)=>{let n=e.trim();return n===``?`Blocked by ${t} hook`:n},br=e=>e.trim()===``?`allow`:`warning`,xr=e=>e.trim(),Sr=(e,t)=>{let n=e??t;return n===`deny`||n===`block`?`block`:`allow`},Cr=(e,t,n,r)=>{let i=e===`deny`?t:n;return i===void 0||i.trim()===``?`Blocked by ${r} hook`:i};var wr=class extends A()(`Block`,{reason:E}){},Tr=class extends A()(`Allow`,{updatedInput:M(O(E,N))}){},Er=class extends A()(`Warning`,{message:E}){};I([wr,Tr,Er]);const Dr=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var Or=class extends A()(`InterpretHookCommand`,{result:fr,event:E,parsed:Je(hr)}){[Dr]=Dr};const kr=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var Ar=class extends mt()(`HookVerdictError`,{raw:E}){[kr]=kr};const jr=e=>z(vr(e.result.code,e.result.stdout)).pipe(B(`ExitBlock`,()=>a(new wr({reason:yr(e.result.stderr,e.event)}))),B(`ExitNoDecision`,()=>a(new Tr({}))),B(`ExitDecisionJson`,()=>t(e.parsed,{onNone:()=>h(new Ar({raw:e.result.stdout})),onSome:t=>z(Sr(t.hookSpecificOutput?.permissionDecision,t.decision)).pipe(B(`block`,()=>a(new wr({reason:Cr(t.hookSpecificOutput?.permissionDecision,t.hookSpecificOutput?.permissionDecisionReason,t.reason,e.event)}))),B(`allow`,()=>a(new Tr({updatedInput:t.hookSpecificOutput?.updatedInput}))),H)})),B(`ExitOther`,()=>z(br(e.result.stderr)).pipe(B(`warning`,()=>a(new Er({message:xr(e.result.stderr)}))),B(`allow`,()=>a(new Tr({}))),H)),H),Mr=F(`SubmitHookVerdictError`,{error:Ar,code:qe,stdout:E}),Nr=Xn.make(({cmd:e,code:t,stdout:n})=>p(jr(e),{onFailure:e=>Mr.make({error:e,code:t,stdout:n}),onSuccess:e=>({verdict:e,code:t,stdout:n})})),Pr={},Fr=P(Bn),Ir=tt([]);_()(`@systemfsoftware/omp-claude-compat/AsyncHookContextState`);function Lr(e){let t=e.trim();t.length!==0&&De(ct(Ir,e=>e.length>=64?[...e.slice(1),t]:[...e,t]))}function Rr(){return De($e(Ir,[]))}var zr=class extends _()(`SuperviseForkExecutorDeps`){};const Br=(e,t,n)=>e.pipe(be({onSuccess:e=>{let t=_r(e.stdout);if(le(t)){let e=t.value.hookSpecificOutput?.additionalContext;e!==void 0&&Lr(e)}},onFailure:e=>{se(e)||t.ui.notify(`Background hook failed: ${n}: ${ce(e).split(`
4
+ `)[0]}`,`error`)}}));var Vr=class extends _()(`RunHooksForEventExecutorDeps`){};const Hr=b(`runHooksForEventUnbounded`)(function*(t,i,o,s,l){let u=s.cwd,d=n(Fr(o.tool_input),()=>Pr),f,p=o,m=K({_tag:`MatcherUnreadable`,event:l},T),ee=e(Z.read(({hook:e,input:t})=>X(e,t,u,l)),Z.decode(e=>a({cmd:new Or({result:e,event:l,parsed:ue(_r(e.stdout),{onFailure:()=>r(),onSuccess:g})}),code:e.code,stdout:e.stdout})),Z.decide(Nr),Z.encode(e=>z(oe(e,{onFailure:({error:e})=>new Er({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`}),onSuccess:({verdict:e})=>e})).pipe(V(`Block`,e=>new pr({reason:e.reason})),V(`Warning`,e=>new mr({warning:e.message})),V(`Allow`,e=>new mr({updatedInput:e.updatedInput})),H)),Z.write(e=>Te(()=>z(e).pipe(V(`Blocked`,e=>g({block:!0,reason:e.reason})),V(`Continue`,e=>(e.warning!==void 0&&f===void 0&&(f=e.warning),e.updatedInput!==void 0&&(p={...p,...e.updatedInput}),r())),H))));for(let e of t)if(!(m&&e.matcher!==void 0)&&ot(i,e.matcher))for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0&&(!K({_tag:`IfEvaluatingEvent`,event:l},T)||!ft(t.if,i,d,u)))continue;if(t.async===!0||t.asyncRewake===!0){yield*ve(Br(X(t,p,u,l,!1),s,t.command));continue}let e=yield*Z.apply(ee,{hook:t,input:p});if(c(e))return e.value}return{...p===o?{}:{updatedInput:p},...f===void 0?{}:{warning:f}}}),$=b(`runHooksForEvent`)(function*(e,t,n,r,i){return yield*Hr(e,t,n,r,i).pipe(Me(26e3),we(`TimeoutError`,()=>x({})))});var Ur=class extends _()(`RunLifecycleHooksExecutorDeps`){};const Wr=b(`runLifecycleHooks`)(function*(e,t,n){let r=t.cwd,i={...L(()=>t.sessionManager.getSessionId())},a=K({_tag:`MatcherUnreadable`,event:n},T);yield*fe(ee(e,e=>!(a&&e.matcher!==void 0)),e=>fe(ee(e.hooks,e=>e.type===`command`&&e.if===void 0),e=>e.async===!0||e.asyncRewake===!0?ve(Br(X(e,i,r,n,!1),t,e.command)).pipe(je):X(e,i,r,n).pipe(je),{discard:!0}),{discard:!0})}),Gr=e=>e.reason===void 0?{}:{warning:e.reason};var Kr=class extends _()(`RunPostToolUseFailureHooksExecutorDeps`){};const qr=P(D(C({text:M(E)}))),Jr=P(E),Yr=e=>t(qr(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
5
+ `),onNone:()=>n(Jr(e),()=>``)}),Xr=b(`runPostToolUseFailureHooks`)(function*(e,t,r){let i=at(t.toolName),a=Qe(i,n(Fr(t.input),()=>Pr)),o={...L(()=>r.sessionManager.getSessionId()),tool_name:i,tool_input:a,tool_use_id:t.toolCallId,error:Yr(t.content)},s=yield*$(e.hooks.PostToolUseFailure,i,o,r,`PostToolUseFailure`);return s.block===!0?Gr(s):s});var Zr=class extends _()(`RunPostToolUseHooksExecutorDeps`){};const Qr=b(`runPostToolUseHooks`)(function*(e,t,r){let i=at(t.toolName),a=L(()=>r.sessionManager.getSessionId()),o=Qe(i,n(Fr(t.input),()=>Pr)),s=rt(i,o),c=s.length===0?[o]:s.map(e=>({...o,file_path:e})),l,u={};for(let n of c){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1},s=yield*$(e.hooks.PostToolUse,i,o,r,`PostToolUse`);if(s.block===!0)return Gr(s);l===void 0&&(l=s.warning),u=s}return l===void 0?u:{...u,warning:l}});var $r=class extends _()(`RunPreCompactHooksExecutorDeps`){};const ei=b(`runPreCompactHooks`)(function*(e,t){let n={...L(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)});var ti=class extends _()(`RunPreToolUseHooksExecutorDeps`){};const ni=b(`runPreToolUseHooks`)(function*(e,t,r){let i=at(t.toolName),a=L(()=>r.sessionManager.getSessionId()),o=n(Fr(t.input),()=>Pr),s=Qe(i,o),c=Xe(t.toolName,o);if(c!==void 0&&c.length>0){let n={...a,tool_name:`Bash`,tool_input:{command:c},tool_call_id:t.toolCallId},i=yield*$(e.hooks.PreToolUse,`Bash`,n,r,`PreToolUse`);if(i.block===!0)return i.reason===void 0?{block:!0}:{block:!0,reason:i.reason}}let l=rt(i,s),u=l.length===0?[s]:l.map(e=>({...s,file_path:e})),d={};for(let n of u){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId},s=yield*$(e.hooks.PreToolUse,i,o,r,`PreToolUse`);if(s.block===!0)return s.reason===void 0?{block:!0}:{block:!0,reason:s.reason};d=s}let f=u.length===1?d.updatedInput?.tool_input:void 0;Object.assign(t.input,dt(o,f))});var ri=class extends _()(`RunSessionStartHooksExecutorDeps`){};const ii=b(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...L(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!ot(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*ve(Br(X(t,a,i,`SessionStart`,!1),n,t.command));continue}yield*X(t,a,i,`SessionStart`)}}});var ai=class extends _()(`RunSessionSwitchHooksExecutorDeps`){};const oi=b(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*ii(e,t,n))});var si=class extends _()(`RunToolResultHooksExecutorDeps`){};const ci=b(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Xr(e,t,n):yield*Qr(e,t,n)}),li=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
6
+ `,`$\r`,`$$ `,`$$ `,`$$
7
+ `,`$$\r`],ui=e=>li.some(t=>`${e.trimStart()} `.startsWith(t));var di=class extends _()(`RunUserPromptSubmitHooksExecutorDeps`){};const fi=b(`runUserPromptSubmitHooks`)(function*(t,n,i){let o=t.hooks.UserPromptSubmit,s=i.cwd,l=ui(n.text),u=z(l).pipe(B(!0,()=>[]),B(!1,()=>Rr()),H),d=[],f={...L(()=>i.sessionManager.getSessionId()),prompt:n.text,source:n.source},p=e(Z.read(({hook:e,input:t})=>X(e,t,s,`UserPromptSubmit`)),Z.decode(e=>a({cmd:new Or({result:e,event:`UserPromptSubmit`,parsed:ue(_r(e.stdout),{onFailure:()=>r(),onSuccess:g})}),code:e.code,stdout:e.stdout})),Z.decide(Nr),Z.encode(e=>oe(e,{onFailure:({code:e,stdout:t})=>({blockReason:void 0,code:e,stdout:t}),onSuccess:({verdict:e,code:t,stdout:n})=>({blockReason:z(e).pipe(V(`Block`,e=>e.reason),jt(()=>void 0)),code:t,stdout:n})})),Z.write(({blockReason:e,code:t,stdout:n})=>Te(()=>{if(e!==void 0)return i.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${e}`,`error`),g({handled:!0});if(t!==0)return r();let a=n.trim();return a.length>0&&d.push(a),r()})));for(let e of o)for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0)continue;let e=yield*Z.apply(p,{hook:t,input:f});if(c(e))return e.value}return z(l).pipe(B(!0,()=>void 0),B(!1,()=>{let e=[...u,...d].join(`
8
+
9
+ `);if(e.length===0)return;let t={text:`${e}\n\n${n.text}`};return n.images!==void 0&&(t.images=n.images),t}),H)});export{hn as A,J as C,wn as D,Tn as E,z as F,_t as I,yt as L,mn as M,H as N,_n as O,V as P,An as S,xn as T,Vr as _,ai as a,jn as b,ii as c,$r as d,ei as f,Wr as g,Ur as h,ci as i,gn as j,yn as k,ti as l,Kr as m,fi as n,oi as o,Zr as p,si as r,ri as s,di as t,ni as u,zr as v,bn as w,On as x,qn as y};