@systemfsoftware/omp-claude-compat 1.7.0 → 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 +86 -0
- package/README.md +23 -0
- package/dist/Cause-BPRKNAWJ.js +1 -0
- package/dist/Effect-CYgXOp91.js +1 -0
- package/dist/Exit-Dz81ekW_.js +1 -0
- package/dist/HookDispatcherHandler-B8MCwQDv.js +2 -0
- package/dist/HookRuntime-CqLT5NiL.js +1 -0
- package/dist/InjectInstructionsHandler-DAJ1PFUG.js +3 -0
- package/dist/RunUserPromptSubmitHooksExecutor-C-kpE1OB.js +9 -0
- package/dist/dist-BkUkC5Q5.js +26 -0
- package/dist/effect-CczU2E3R.js +13 -0
- package/dist/index.js +1 -1
- package/package.json +26 -26
- package/dist/Cause-DsRZwSYW.js +0 -1
- package/dist/Effect-C1HfHpDW.js +0 -14
- package/dist/Exit-DWkYikJN.js +0 -1
- package/dist/core-CG9iBVjE.js +0 -13
- package/dist/dist-CJoMkiK8.js +0 -26
- package/dist/hook-dispatcher.executor-B43vD5qz.js +0 -8
- package/dist/hook-dispatcher.handler-W-5FqY16.js +0 -1
- package/dist/hook-runtime.state-CI_DEJtD.js +0 -1
- package/dist/inject-instructions.executor-C5AgD0Hh.js +0 -3
- package/dist/inject-instructions.handler-CT6g_sFm.js +0 -1
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/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};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{$o as e,Ba as t,Cs as n,Do as r,Dt as i,Eo as a,Ft as o,Ga as s,Ho as c,Ka as l,Ko as u,La as d,Lo as ee,M as f,Na as p,Pt as te,Qo as m,Ro as ne,Ss as re,To as ie,Ts as h,Ua as ae,Uo as oe,Va as se,Vn as ce,Wa as le,Wo as ue,Xo as de,Yo as fe,Zo as pe,_o as g,as as me,bs as _,cs as he,da as ge,ds as _e,fi as ve,fs as ye,go as be,gs as xe,hs as Se,is as Ce,li as we,ls as Te,lt as v,ma as Ee,mo as De,no as Oe,ns as y,oa as ke,pa as Ae,pi as je,qa as b,qo as Me,rs as Ne,sa as Pe,so as Fe,ss as Ie,ts as Le,ua as Re,uo as ze,us as Be,vs as x,wa as Ve,ws as He,xo as Ue,xs as S,y as We,za as Ge,zo as Ke}from"./effect-CczU2E3R.js";import{a as C,d as qe,u as Je}from"./Cause-BPRKNAWJ.js";import{a as Ye,c as Xe,n as Ze,r as Qe,s as $e}from"./Exit-Dz81ekW_.js";import{At as et,Bt as tt,C as nt,D as rt,Dt as it,E as at,G as ot,Ht as st,I as ct,K as lt,L as ut,M as dt,Mt as ft,Ot as pt,R as mt,Rt as ht,St as gt,T as _t,Tt as vt,U as yt,Vt as bt,W as xt,_ as w,a as St,at as Ct,b as T,f as wt,ft as E,g as Tt,gt as Et,ht as D,k as Dt,kt as Ot,l as kt,mt as O,o as At,p as jt,pt as Mt,ut as Nt,v as Pt,w as Ft,wt as It,x as Lt,y as Rt,z as zt,zt as Bt}from"./Effect-CYgXOp91.js";import Vt from"node:os";const Ht=class extends He{constructor(e){super(),e&&ne(this,e)}},Ut=ze,Wt=be,Gt=`~effect/time/DateTime`,Kt=`~effect/time/DateTime/TimeZone`,qt={[Gt]:Gt,pipe(){return h(this,arguments)},[c](){return this.toString()},toJSON(){return Yt(this).toJSON()}};({...qt}),{...qt};const Jt={[Kt]:Kt,[c](){return this.toString()}};({...Jt}),{...Jt};const Yt=e=>new Date(e.epochMilliseconds),Xt=`~effect/BigDecimal`,Zt={[Xt]:Xt,[Le](){let t=rn(this);return pe(m(t.value),e(t.scale))},[de](e){return Qt(e)&&cn(this,e)},toString(){return`BigDecimal(${ln(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[c](){return this.toJSON()},pipe(){return h(this,arguments)}},Qt=e=>y(e,Xt),$t=(e,t)=>{let n=Object.create(Zt);return n.value=e,n.scale=t,n},en=(e,t)=>{if(e!==k&&e%tn===k)throw RangeError(`Value must be normalized`);let n=$t(e,t);return n.normalized=n,n},k=BigInt(0),tn=BigInt(10),nn=en(k,0),rn=e=>{if(e.normalized===void 0){if(e.value===k)e.normalized=nn;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=en(r,i)}}return e.normalized},an=x(2,(e,t)=>t>e.scale?$t(e.value*tn**BigInt(t-e.scale),t):t<e.scale?$t(e.value/tn**BigInt(e.scale-t),t):e),on=e=>e.value<k?$t(-e.value,e.scale):e,sn=Oe((e,t)=>e.scale>t.scale?an(t,e.scale).value===e.value:e.scale<t.scale?an(e,t.scale).value===t.value:e.value===t.value),cn=x(2,(e,t)=>sn(e,t)),ln=e=>{let t=rn(e);if(Math.abs(t.scale)>=16)return un(t);let n=t.value<k,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},un=e=>{if(dn(e))return`0e+0`;let t=rn(e),n=`${on(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${fn(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},dn=e=>e.value===k,fn=e=>e.value<k;function pn(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function mn(e){return t=>pn(t)?.[e]}const hn=`~sentinels`,gn=`~constructor`,_n=mn(`brands`),vn=S(e=>{let t=pn(e)?.identifier;return typeof t==`string`?t:e.getExpected(vn)}),A=Symbol(),yn=$e,bn=yn(A),j=yn(A),xn=e=>e===A?l():b(e),Sn=e=>e._tag===`None`?bn:yn(e.value),Cn=`~effect/SchemaIssue/Issue`;function wn(e){return y(e,Cn)&&e[Cn]===Cn}function Tn(e){return Object.hasOwn(e,`input`)}var M=class{[Cn]=Cn;constructor(e,t){t?.reportInput===!0&&e!==A&&(this.input=e)}},En=class extends M{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},Dn=class extends M{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},N=class extends M{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},On=class extends M{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},kn=class extends M{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},P=class extends M{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},An=class extends M{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},F=class extends M{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function jn(e,t,n,r,i){return new P(e,[new N([t],n)],r,i)}var Mn=class extends M{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Nn=class extends M{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Pn=class extends M{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function Fn(e,t,n){if(wn(e))return e;if(typeof e==`string`)return new F({message:e},t,n);let r=typeof e.issue==`string`?new F({message:e.issue},t,n):e.issue;return new N(e.path,r)}function In(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new F(void 0,t,n):Fn(e,t,n)}function Ln(e,t,n,r){return Array.isArray(t)?ge(t)?t.length===1?Fn(t[0],n,r):new P(e,Ae(t,e=>Fn(e,n,r)),n,r):void 0:In(t,n,r)}const Rn=e=>{let t=qn(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Hn(vn(e.ast),e);case`InvalidValue`:{let t=Vn(e);if(t!==void 0)return Hn(t,e);let n=Bn(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Bn(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Bn(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},zn=e=>qn(e.issue)??qn(e);function Bn(e){return Tn(e)?ue(e.input):void 0}function Vn(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Hn(e,t){let n=Bn(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Un(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Un(e)).join(` & `)}}function Wn(){return e=>Kn(e,``)}const Gn=Wn();function Kn(e,t){let n;switch(e._tag){case`Filter`:{let r=zn(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Kn(e.issue,t);let r=Vn(e.issue);n=r===void 0?Hn(Un(e.filter),e):Hn(r,e.issue)}break}case`Encoding`:return Kn(e.issue,t);case`Pointer`:return Kn(e.issue,t+u(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Kn(e,t)).join(`
|
|
2
|
+
`);n=qn(e)??Hn(vn(e.ast),e);break;default:n=Rn(e)}return t?`${n}\n at ${t}`:n}function qn(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return qn(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Jn(e){let t;for(let n of e.reasons){if(!Je(n)||!wn(n.error))return;t??=n.error}return t}function Yn(e,t){let n=Jn(e);if(n===void 0)throw Error(t,{cause:e});return n}Ve()(`effect/DateTime/CurrentTimeZone`),Wt(`EncodingError`);var Xn=class e extends He{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(mt(le(t))))}compose(t){return er(this)?t:er(t)?this:new e((e,n)=>this.run(e,n).pipe(Lt(e=>t.run(e,n))))}};function Zn(e){return new Xn((t,n)=>w(e(t,n)))}function Qn(e){return Zn((t,n)=>{let r={message:e(t)};return se(t)?new Mn(r,t.value,n):new Mn(r)})}const $n=new Xn(E);function er(e){return e.run===$n.run}function tr(){return $n}function nr(e){return new Xn((t,n)=>Ge(t)?Mt:e(t.value,n))}function I(e){return ir(le(e))}function rr(e){return nr((t,n)=>e(t,n).pipe(mt(b)))}function ir(e){return new Xn(t=>E(e(t)))}function ar(){return new Xn(()=>Mt)}function or(e){return new Xn(t=>{let n=p(t,he);return se(n)?E(n):mt(e,b)})}function sr(){return I(globalThis.String)}function cr(){return I(globalThis.Number)}function lr(e){return nr((t,n)=>gt({try:()=>b(JSON.parse(t,e?.reviver)),catch:()=>new F({expected:`a valid JSON string`},t,n)}))}function ur(e){return nr((t,n)=>gt({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return b(n)},catch:()=>new F({expected:`a JSON-serializable value`},t,n)}))}const dr=`~effect/SchemaTransformation/Transformation`;var L=class e{[dr]=dr;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function fr(e){return y(e,dr)&&e[dr]===dr}const pr=e=>fr(e)?e:new L(e.decode,e.encode);function mr(e){return new L(I(e.decode),I(e.encode))}const hr=new L(tr(),tr());function gr(){return hr}const _r=new L(cr(),sr());function vr(e){return new L(lr(e??{}),ur(e))}function R(e){return t=>t._tag===e}const yr=R(`Declaration`),br=R(`Never`),xr=R(`Literal`),Sr=R(`UniqueSymbol`),Cr=R(`Arrays`),wr=R(`Objects`),Tr=R(`Suspend`);var z=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const Er={};var B=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}};const Dr=`~effect/Schema`;var V=class{[Dr]=Dr;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Or=class e extends V{_tag=`Declaration`;typeParameters;run;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o}getParser(){let e;return(t,n)=>t===A?bn:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(t,n,r){let i=Bi(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.run,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}};const kr=new class extends V{_tag=`Null`;getParser(){return na(this,null)}getExpected(){return`null`}};var Ar=class extends V{_tag=`Undefined`;getParser(){return na(this,void 0)}toCodecJson(){return U(this,[jr])}getExpected(){return`undefined`}};const jr=new z(kr,new L(I(()=>void 0),I(()=>null))),Mr=new Ar,Nr=new class extends V{_tag=`Never`;getParser(){return ra(this,me)}getExpected(){return`never`}},Pr=new class extends V{_tag=`Any`;getParser(){return ra(this,Se)}getExpected(){return`any`}},Fr=new class extends V{_tag=`Unknown`;getParser(){return ra(this,Se)}getExpected(){return`unknown`}};var H=class extends V{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${ue(e)}`);this.literal=e}getParser(){return na(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Ir(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Ir(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Ir(e){let t=globalThis.String(e.literal);return U(e,[new z(new H(t),new L(I(()=>e.literal),I(()=>t)))])}const Lr=new class extends V{_tag=`String`;getParser(){return ra(this,ye)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&fa(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}};var Rr=class extends V{_tag=`Number`;getParser(){return ra(this,Te)}matchKey(e,t){return this._match(sa,e,t)}matchPart(e,t){return this._match(oa,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:fa(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(zr(this.checks,`effect/schema/isFinite`)||zr(this.checks,`effect/schema/isInt`))?this:U(this,[Br(this.checks)])}toCodecStringTree(){return this.toCodecJson()===this?U(this,[ua]):U(this,[da])}getExpected(){return`number`}};function zr(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&zr(e.checks,t))}function Br(e){return new z(new pi([e?ji(Ci,e):Ci,gi],`anyOf`),new L(cr(),I(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))))}const Vr=new Rr,Hr=new class extends V{_tag=`Boolean`;getParser(){return ra(this,Ne)}getExpected(){return`boolean`}};var Ur=class e extends V{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(Yi(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(Yi(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}return _t(function*(e,c){if(e===A)return A;if(!Array.isArray(e))return yield*w(new An(n,e,c));r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)})));let l=e.length,u={ast:n,getParser:s,input:e,len:l,tailThreshold:Math.max(a,l-o),output:new globalThis.Array(l),issues:void 0,options:c},d=Gr(c?.concurrency),ee=Wr(u,e,{concurrency:d?.concurrency,end:n.rest.length===0?a:Math.max(l,a+o)});if(ee&&(yield*ee),n.rest.length===0&&l>a)for(let t=a;t<=l-1;t++){let r=new kn(n,e[t],c),i=new N([t],r);if(c.errors===`all`)u.issues?u.issues.push(i):u.issues=[i];else return yield*w(new P(n,[i],e,c))}return u.issues?yield*w(new P(n,u.issues,e,c)):u.output})}_rebuild(t,n,r){let i=Bi(this.elements,t),a=Bi(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};const Wr=ce()({onItem(e,t,n){let r=n<e.len?t:A;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Kr(e,e.ast,r,n);let i=n===j?t:n[g];if(i!==A)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Yi(t.ast))return;let n=new N([r],new On(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Ze(new P(e.ast,[n],e.input,e.options))}}}),Gr=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Kr=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Jn(r.cause);if(i===void 0)return Qe(qe(r.cause,r=>new P(t,[new N([n],r)],e.input,e.options)));let a=new N([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Ze(new P(t,[a],e.input,e.options))},qr=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function Jr(e,t,n=Er){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(ia(W(t)))}var Yr=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Xr(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Xr);default:return!1}}function Zr(e){return Xr(e)&&Xr(W(e))}var Qr=class{parameter;type;constructor(e,t){if(!Zr(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Yi(t)&&!ta(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},$r=class e extends V{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let e of n.propertySignatures)r.push(e.name);let i=r.length,a=n.indexSignatures.length,o=i&&a?new Set(r):void 0;if(!i&&!a)return ra(n,Ie);let s,c,l=(e,t,r,a,s)=>{if(s._tag===`Failure`)return Kr(e,n,t,s)??Xe;let c=s===j?a:s[g];if(r!==A&&c!==A){if(i&&(o.has(t)||o.has(r)))return Xe;Ke(e.out,r,c)}return Xe},u=(e,t,r,i)=>{if(!i){let n=r.parserKey(t,e.options);if(!v(n))return T(Tt(n),n=>u(e,t,r,n));i=n}if(i._tag===`Failure`)return Kr(e,n,t,i)??Xe;let a=i===j?t:i[g],o=e.input[t],s=r.parserValue(o,e.options);return v(s)?l(e,t,a,o,s):T(Tt(s),n=>l(e,t,a,o,n))},d=(e,t,n)=>{let r=e.input[t],i=n.parserValue(r,e.options);return v(i)?l(e,t,t,r,i):T(Tt(i),n=>l(e,t,t,r,n))},ee=a?ce()({onItem:(e,[t,n])=>u(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return _t(function*(l,f){if(l===A)return A;if(!(typeof l==`object`&&l&&!Array.isArray(l)))return yield*w(new An(n,l,f));s||(s=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),c=a?n.indexSignatures.map(n=>({is:n,parserKey:e(ia(n.parameter)),parserValue:t(n.type)})):void 0);let p=l,te={},m={ast:n,input:p,out:te,issues:void 0,options:f},ne=f.errors===`all`,re=f.onExcessProperty===`error`,ie=f.onExcessProperty===`preserve`,h;if(!a&&(re||ie)){o??=new Set(r),h=Reflect.ownKeys(p);for(let e=0;e<h.length;e++){let t=h[e];if(!o.has(t)){if(re){let e=new kn(n,p[t],f),r=new N([t],e);if(ne){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*w(new P(n,[r],l,f))}Ke(te,t,p[t])}}}let ae=Gr(f?.concurrency);if(i){let e=ei(m,s,ae);e&&(yield*e)}if(a&&!ae)for(let e=0;e<a;e++){let t=c[e],n=t.is.parameter===Lr?d:u,r=t.is.parameter===Lr?Object.keys(p):Jr(p,t.is.parameter,f);for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!v(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(ee){let e=Pe();for(let t=0;t<a;t++){let n=c[t],r=Jr(p,n.is.parameter,f);for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=ee(m,e,ae);t&&(yield*t)}if(m.issues)return yield*w(new P(n,m.issues,l,f));if(f.propertyOrder===`original`){let e=(h??Reflect.ownKeys(p)).concat(r),t={};for(let n of e)Object.hasOwn(te,n)&&Ke(t,n,te[n]);return t}return te})}_rebuild(t,n,r,i){let a=Bi(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Yr(e.name,n)}),o=Bi(this.indexSignatures,e=>{let r=n(e.parameter),i=t(e.type);return r===e.parameter&&i===e.type?e:new Qr(r,i)});return a===this.propertySignatures&&o===this.indexSignatures&&r===this.checks&&i===this.encodingChecks?this:new e(a,o,this.annotations,r,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const ei=ce()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(A,e.options);let n=e.input[t.name];return Ke(e.out,t.name,n),t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return Kr(e,e.ast,t.name,n);if(n===j)return;let r=n[g];if(r!==A){Ke(e.out,t.name,r);return}if(delete e.out[t.name],!Yi(t.type)){let n=new N([t.name],new On(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Ze(new P(e.ast,[n],e.input,e.options))}}});function ti(e,t){return e?t?[...e,...t]:e:t}function ni(e,t,n){return new $r(Reflect.ownKeys(e).map(t=>new Yr(t,e[t].ast)),[],n,t)}function ri(e){return e.ast}function ii(e,t,n){return new pi(e.map(ri),t,void 0,n)}const ai=re(e=>{for(;;){if(Tr(e))return Fr;let t=e.encoding;if(!t)return e.recur?.(ai,_)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==_))return Fr;e=t[t.length-1].to}});function oi(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(oi)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function si(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[hn];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Yi(t)){if(xr(t))return[{key:e.name,literal:t.literal}];if(Sr(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Yi(e)){if(xr(e))return[{key:t,literal:e.literal}];if(Sr(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>si(ai(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return si(e.thunk())}}const ci=new WeakMap,li=Object.freeze([]);function ui(e){let t=ci.get(e);if(t)return t;let n,r=0,i,a,o=!0;for(let t=0;t<e.length;t++){let s=e[t],c=ai(s);if(br(c))continue;if(o){if(xr(c)||Sr(c)){a??=new Map;let e=xr(c)?c.literal:c.symbol,t=a.get(e);t||a.set(e,t=[]),t.push(s)}else o=!1}let l=si(c);if(l.length){n??=new Map,r++;for(let{key:e,literal:r}of l){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=oi(c);for(let n of e)(i[n]??=[]).push(t)}}if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??li;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=i;for(let[t,n]of i)a.set(t,Object.freeze(Array.from(n,t=>e[t])));t=(t,n)=>{if(Be(t)){let i=Object.hasOwn(t,r)?t[r]:void 0;if(i!==void 0)return a.get(i)??li;if(n)return e}return li}}else if(n){let a;for(let e of n)(!a||e[1][0].size>a[1][0].size)&&e[1][1].size===r&&(a=e);t=(t,r)=>{let o=i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??li;if(!Be(t))return o.map(t=>e[t]);let s=new Set(o),c;if(a){let[n,[i]]=a,l=Object.hasOwn(t,n),u=l?t[n]:void 0;if(l&&(!r||u!==void 0)){let t=i.get(u);if(!t)return o.map(t=>e[t]);for(let e of t)s.add(e);c=n}}if(c===void 0)for(let[e,[i,a]]of n){let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);if(e)for(let t of e)s.add(t)}else if(r)for(let e of a)s.add(e)}for(let[e,[i,a]]of n){if(e===c)continue;let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);for(let t of s)a.has(t)&&!e?.has(t)&&s.delete(t)}}return Array.from(s).sort((e,t)=>e-t).map(t=>e[t])}}else t=t=>(i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??li).map(t=>e[t]).filter(di(t));return ci.set(e,t),t}function di(e){return t=>{let n=ai(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function fi(e,t,n=!1){return ui(t)(e,n)}var pi=class e extends V{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e,t){let n=this;return(r,i)=>{if(r===A)return bn;let a=fi(r,n.types,t!==void 0);if(a.length===1){let t=e(a[0])(r,i);return t._tag===`Success`?t:v(t)?mi(n,t.cause,r,i):kt(t,e=>mi(n,e,r,i))}let o={ast:n,compile:e,input:r,out:void 0,successes:n.mode===`oneOf`?[]:void 0,issues:void 0,options:i},s=Gr(i?.concurrency),c=hi(o,a,s?{...s,orderedStep:!0}:void 0);return c?Lt(c,e=>o.out===j?E(r):o.out?o.out:w(new Nn(n,o.issues??[],r,i))):o.out?o.out:w(new Nn(n,o.issues??[],r,i))}}_rebuild(t,n,r){let i=Bi(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=W(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(xr);if(t.length>0)return`${_i(n.isMutable)}[ ${t.map(t=>e(t)+vi(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>xr(e.type));if(t.length>0)return`{ ${t.map(t=>`${_i(t.type.context?.isMutable)}${Me(t.name)}${vi(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function mi(e,t,n,r){let i=Jn(t);return i?Ze(new Nn(e,[i],n,r)):Qe(t)}const hi=ce()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Jn(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(t),Ze(new Pn(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Xe}}}),gi=new pi([new H(`Infinity`),new H(`-Infinity`),new H(`NaN`)],`anyOf`);function _i(e){return e?``:`readonly `}function vi(e){return e?`?`:``}var yi=class e extends He{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new bi([this,e],t)}},bi=class e extends He{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function xi(e,t,n=!1){return new yi((t,n,r)=>Ln(n,e(t,n,r),t,r),t,n)}function Si(e){return xi(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}const Ci=ji(Vr,[Si()]);function wi(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return xi(e=>(r.lastIndex=0,r.test(e)),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Ti(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}const Ei=new WeakMap;function Di(e){return Ei.get(e)??e}function U(e,t){return e.encoding===t?e:Ti(e,e=>{e.encoding.value=t})}function Oi(e,t){if(e.context===t)return e;let n=Di(e);if(n.context===t)return n;let r=Ti(e,e=>{e.context.value=t});return Ei.set(r,n),r}function ki(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Ai(e,ke(e.checks.slice(0,-1),n.annotate(t)))}return Ti(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Ai(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Ti(e,e=>{e.checks.value=t})}function ji(e,t){return Ai(e,ti(e.checks,t))}function Mi(e,t){let n=t(e.to);return n===e.to?e:new z(n,e.transformation)}function Ni(e,t){let n=e,r=n[n.length-1],i=Mi(r,t);return i===r?e:ke(e.slice(0,e.length-1),i)}function Pi(e){return t=>t.encoding?U(t,Ni(t.encoding,e)):t}function Fi(e,t){return Pi(e=>Oi(e,t))(e)}function Ii(e){function t(n){return n.encoding?U(n,Ni(n.encoding,t)):e(n)}return S(t)}function Li(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:U(r,Ni(r.encoding,n))}return e(r)}return re(n)}function Ri(e,t,n){let r=new z(e,t);return U(n,n.encoding?[...n.encoding,r]:[r])}function zi(e,t){let n=_n(e);return ki(e,{brands:n?[...n,t]:[t]})}function Bi(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Vi(e,t){return Oi(e,e.context?new B(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new B(!1,!1,void 0,t))}const Hi=re(e=>{let t=e.context?e.context.isOptional===!1?new B(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new B(!0,!1);return Ui(Oi(e,t))}),Ui=Pi(Hi),Wi=S(e=>Hi(new pi([e,Mr],`anyOf`)));function Gi(e,t){let n=new L(or(t),tr()),r=new z(Fr,n);return Oi(e,e.context?new B(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new B(!1,!1,r))}function Ki(e,t,n){return Ri(e,n,t)}function qi(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:_e(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function Ji(e,t){let{literals:n,parameters:r}=qi(e);return new $r(n.map(e=>new Yr(e,t)),r.map(e=>new Qr(e,t)))}function Yi(e){return e.context?.isOptional??!1}function Xi(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Xi)}function Zi(e){function t(e){return Xi(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return Re(n)?n:void 0}const Qi=re(e=>{if(e.encoding)return Qi(U(e,void 0));let t=e,n=t.recur?.(Qi)??t,r=n.encodingChecks;if(r){let t=n===e?r:Cr(n)||wr(n)||yr(n)&&n.typeParameters.length>0?Zi(r):void 0;return Ti(n,e=>{e.encodingChecks.value=void 0,e.checks.value=ti(n.checks,t)})}return n}),W=re(e=>Qi(ea(e)));function $i(e,t){let n=t,r=n.length,i=n[r-1],a=[new z(ea(U(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new z(ea(n[e-1].to),n[e].transformation.flip()));let o=ea(i.to);return o.encoding?U(o,[...o.encoding,...a]):U(o,a)}const ea=S(e=>{if(e.encoding)return $i(e,e.encoding);let t=e;return t.flip?.(ea)??t.recur?.(ea)??t});function ta(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(ta);default:return!1}}function na(e,t){let n=yn(t);return(r,i)=>r===A?bn:r===t?n:w(new An(e,r,i))}function ra(e,t){return(n,r)=>n===A?bn:t(n)?j:w(new An(e,n,r))}const ia=Li(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(ia)}}),aa=Li(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(aa)}}),oa=new globalThis.RegExp(`^${qr}$`),sa=new globalThis.RegExp(`^(?:${qr}|Infinity|-Infinity|NaN)$`);function ca(e){return wi(oa,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:oa.source}),...e})}const la=ji(Lr,[ca()]),ua=new z(la,_r),da=new z(new pi([la,gi],`anyOf`),_r);function fa(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=fa(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new En(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function pa(e){if(!yr(e))return;let t=e.annotations?.[gn];return Ce(t)?t(e.typeParameters):void 0}function ma(e){return e===void 0||typeof e==`string`}function ha(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function ga(e){return ha(e,ma)}const _a=new z(new Or([],()=>(e,t,n)=>ga(e)?j:w(new An(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),gr()),va=`~effect/collections/MutableHashMap`,ya={[va]:va,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${ue(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:oe(Array.from(this))}},[c](){return this.toJSON()},pipe(){return h(this,arguments)}},ba=()=>{let e=Object.create(ya);return e.backing=new Map,e.buckets=new Map,e},xa=x(2,(e,t)=>{if(e.backing.has(t))return b(e.backing.get(t));if(Ca(t))return l();let n=Sa.get(e);if(n!==void 0)return e.backing.has(n)?b(e.backing.get(n)):l();let r=m(t),i=e.buckets.get(r);return i===void 0?l():wa(e,i,t)}),Sa=new WeakMap,Ca=e=>typeof e!=`object`&&typeof e!=`function`,wa=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(fe(n,t[r])){let i=t[r];return Sa.set(n,i),b(e.backing.get(i))}return l()},Ta=x(3,(e,t,n)=>{if(e.backing.has(t)||Ca(t))return e.backing.set(t,n),e;let r=Sa.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=m(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=Ea(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),Ea=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(fe(t,e[n]))return Sa.set(t,e[n]),e[n]},Da=`~effect/MutableRef`,Oa={[Da]:Da,...De,toJSON(){return{_id:`MutableRef`,current:oe(this.current)}}},ka=e=>{let t=Object.create(Oa);return t.current=e,t},Aa=Symbol.for(`effect/MutableList/Empty`),ja=()=>({head:void 0,tail:void 0,length:0}),Ma=()=>({array:[],mutable:!0,offset:0,next:void 0}),G=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=Ma(),e.tail=e.tail.next):e.head=e.tail=Ma(),e.tail.array.push(t),e.length++},Na=e=>{e.head=e.tail=void 0,e.length=0},Pa=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return Na(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&Na(e),n;i=i.next}return Na(e),n},Fa=e=>{if(!e.head)return Aa;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Na(e)),t},Ia={_A:_,_E:_},La={"~effect/Queue":Ia,"~effect/Queue/Enqueue":Ia,"~effect/Queue/Dequeue":Ia,...De,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:Xa(this)}}},Ra=e=>ee(t=>{let n=Object.create(La);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=ja(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},we(n)}),za=e=>Ra({capacity:e}),Ba=(e,t)=>ve(()=>{if(e.state._tag!==`Open`)return Za;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Za;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(G(e.messages,t),to(e),Qa):io(e,t);case`sliding`:return Fa(e.messages),G(e.messages,t),Qa}return G(e.messages,t),no(e),Qa}),Va=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Fa(e.messages),G(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(G(e.messages,t),to(e),!0):(G(e.messages,t),no(e),!0):!1,Ha=x(2,(e,t)=>je(()=>Ua(e,t))),Ua=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=a(t),r=o(n,$a);return e.state.offers.size===0&&e.messages.length===0?(so(e,r),!0):(e.state={...e.state,_tag:`Closing`,exit:r},!0)},Wa=e=>Ua(e,Ue(Fe())),Ga=e=>je(()=>{if(e.state._tag===`Done`)return!0;Na(e.messages);let t=e.state.offers;if(so(e,e.state._tag===`Open`?eo:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Za):e.resume(r(e.remaining.slice(e.offset)));t.clear()}return!0}),Ka=e=>qa(e,1,1/0),qa=(e,t,n)=>ve(()=>ro(e,t,n)??We(oo(e),qa(e,1,n))),Ja=e=>ve(()=>Ya(e)??We(oo(e),Ja(e))),Ya=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Fa(e.messages);return ao(e),r(t)}if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,ao(e),e.capacity=0;let t=Fa(e.messages);return ao(e),r(t)}},Xa=e=>e.state._tag===`Done`?0:e.messages.length,Za=r(!1),Qa=r(!0),$a=ie(Fe()),eo=i(),to=e=>{if(e.scheduleRunning=!1,e.state._tag!==`Done`&&e.state.takers.size!==0){for(let t of e.state.takers)if(e.state.takers.delete(t),t(te),e.messages.length===0)break}},no=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>to(e),0))},ro=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return r([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,ao(e),e.capacity=0;let t=[Fa(e.messages)];return ao(e),r(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Pa(e.messages,n);return ao(e),r(t)}},io=(e,t)=>f(n=>{if(e.state._tag!==`Open`)return n(Za);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),je(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),ao=e=>{if(e.state._tag===`Done`)return Ot(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(so(e,e.state.exit),Ot(e.state.exit.cause));let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)G(e.messages,n.message),t--,n.resume(Qa),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;G(e.messages,n.remaining[n.offset]),t--}n.resume(r([])),e.state.offers.delete(n)}return!1},oo=e=>f(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),je(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),so=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},co=`~effect/Channel`,lo=e=>y(e,co),uo={[co]:{_Env:_,_InErr:_,_InElem:_,_OutErr:_,_OutElem:_},pipe(){return h(this,arguments)}},K=e=>{let t=Object.create(uo);return t.transform=(t,n)=>kt(e(t,n),e=>E(Pt(e))),t},fo=(e,t)=>K((n,r)=>T(q(e)(n,r),e=>t(e,r))),po=e=>K((t,n)=>e),mo=e=>K(Ft(function*(t,n){let r=tt(n),i=e=>Bt(r,pt(e)),a=yield*yt(e(t,n,r),i);return yt(a,i)})),q=e=>e.transform,ho=4096,go=(e,t,n)=>Ra({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Et(t=>ht(e,Ga(t))),Et(n=>Dt(st(t(n),e),e))),_o=(e,t)=>K((n,r)=>ct(go(r,e,t),Ka)),vo=e=>K((t,n)=>O(()=>q(e())(t,n))),yo=(e,t=ho)=>po(D(()=>{let n=e(),r=l();return O(()=>{if(r._tag===`Some`)return C(r.value);let e=[];for(;e.length<t;){let t=n.next();if(t.done){if(e.length===0)return C(t.value);r=b(t.value);break}e.push(t.value)}return E(e)})})),bo=(e,t=ho)=>yo(()=>e[Symbol.iterator](),t),xo=e=>Co(E(e)),So=po(E(C())),Co=e=>po(D(()=>{let t=!1;return O(()=>t?C():(t=!0,e))})),wo=x(2,(e,t)=>fo(e,e=>D(()=>{let n=0;return ct(e,e=>t(e,n++))}))),To=x(2,(e,t)=>Eo(e,e=>E(t(e)))),Eo=x(2,(e,t)=>fo(e,e=>E(it(e,e=>T(t(e),C))))),Do=x(e=>lo(e[0])&&lo(e[1]),(e,t,n)=>mo(Ft(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*za(0);yield*ht(a,Ga(s));let c=0;function l(e,t){if(c++,!Ot(t))return Ha(s,t);switch(o){case`both`:return c===2?Ha(s,t):It;case`left`:case`right`:return e===o?Ha(s,t):It;case`either`:return Ha(s,t)}}let u=(e,t,n)=>q(t)(r,n).pipe(T(e=>e.pipe(T(e=>Ba(s,e)),rt)),yt(t=>St(Bt(n,pt(t)),l(e,t))),Dt(a));return yield*u(`left`,e,tt(a)),yield*u(`right`,t,tt(a)),Ja(s)}))),Oo=()=>K((e,t)=>D(()=>{let t=``,n=!1,r=l();function i(e){let r=[];function i(e){t.length===0?r.push(e):(r.push(t+e),t=``)}for(let r=0;r<e.length;r++){let a=e[r];if(a.length!==0){let e=0,r=a.indexOf(`\r`),o=a.indexOf(`
|
|
3
|
+
`);for(n&&=(o===0?(i(``),e=1,o=a.indexOf(`
|
|
4
|
+
`,e)):i(``),!1);r!==-1||o!==-1;)r===-1||o!==-1&&o<r?(i(a.substring(e,o)),e=o+1,o=a.indexOf(`
|
|
5
|
+
`,e)):a.length===r+1?(n=!0,r=-1):(i(a.substring(e,r)),e=r+(o===r+1?2:1),r=a.indexOf(`\r`,e),o=a.indexOf(`
|
|
6
|
+
`,e));t+=a.substring(e,a.length-+!!n)}}return ge(r)?r:null}let a=O(()=>r._tag===`Some`?C(r.value):et(e,{onSuccess:o,onFailure:Pt,onDone:e=>{if(r=b(e),t.length>0||n){let e=t;return t=``,n=!1,E([e])}return C(e)}}));function o(e){let t=i(e);return t===null?a:E(t)}return a})),ko=x(2,(e,t)=>K((n,r)=>T(q(e)(n,r),e=>q(t)(e,r)))),Ao=e=>K((t,n)=>{let r;return E(O(()=>r||e.pipe(st(n),T(e=>q(e)(t,n)),T(e=>r=e))))}),jo=(e,t,n)=>O(()=>{let r=bt(),i=q(e)(C(),r);return it(T(i,t),n||E).pipe(xt(e=>Bt(r,e)))}),Mo=x(3,(e,t,n)=>O(()=>{let r=t();return jo(e,e=>vt({while:xe,body:()=>e,step:e=>{r=n(r,e)}}),()=>E(r))})),No=(e,t)=>q(e)(C(),t);function Po(e){let t=Ko(Xo,Qi(e.ast));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Fo(e){let t=Po(e);return(e,n)=>{let r=Ct(t(e,n));return Ye(r)?b(r.value):(Yn(r.cause,`Option adapter can only return none for schema issues`),l())}}function Io(e){let t=Po(e);return(e,n)=>{let r=Ct(t(e,n));if(Ye(r))return r.value;let i=Yn(r.cause,`Constructor adapter can only throw schema issues`);throw Error(`Schema validation failed`,{cause:i})}}function Lo(e){return Ro(e.ast)}function Ro(e){let t=qo(Go(Qi(e)));return e=>{let n=t(e,Er);return Ye(n)?!0:(Yn(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}function zo(e,t){let n=Go(e.ast);return t===void 0?n:(e,r)=>n(e,Uo(t,r))}function Bo(e,t){return qo(zo(e,t))}function Vo(e,t){return Jo(zo(e,t))}function Ho(e,t){let n=Go(ea(e.ast));return t===void 0?n:(e,r)=>n(e,Uo(t,r))}const Uo=(e,t)=>t?{...e,...t}:e,Wo=e=>e===A?w(new F):E(e);function Go(e){return Ko(Yo,e)}function Ko(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??Er);return a===j?E(r):v(a)?a[g]===A?Wo(A):a:Lt(a,Wo)}}function qo(e){return(t,n)=>Ct(e(t,n))}function Jo(e){let t=qo(e);return(e,n)=>{let r=t(e,n);return Ye(r)?b(r.value):(Yn(r.cause,`Option adapter can only return none for schema issues`),l())}}const Yo=S(e=>ts(e,Yo)),Xo=S(e=>ts(e,Xo,Qo)),Zo=S(e=>ts(e,Xo,Qo,e.context?.constructorDefault));function Qo(e){return e.context?.constructorDefault?Zo(e):Xo(e)}function $o(e,t,n,r){let i;if(v(e)&&e._tag===`Success`){let a=xn(e===j?t:e[g]);i=n._tag===`Transformation`?n.decode.run(a,r):n.decode(yn(a),r)}else i=n._tag===`Transformation`?Lt(e,e=>n.decode.run(xn(e),r)):n.decode(mt(e,xn),r);return v(i)&&i._tag===`Success`?Sn(i[g]):Lt(i,Sn)}function es(e,t){let n;return(r,i)=>r===A?bn:e.isConstructed(r)?j:$o((n??=t(e.link.to))(r,i),r,e.link.transformation,i)}function ts(e,t,n,r){let i=n?pa(e):void 0,a=i?es(i,t):e.getParser(t,n),o=e.checks,s=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,l=(o?o[o.length-1].annotations:e.annotations)?.parseOptions;if(!s&&!o&&!c)return l?(e,t)=>a(e,Uo(t,l)):a;let u,d=(t,n)=>{let r=a(t,n);if(c&&!n.disableChecks){if(v(r)){if(r._tag===`Success`){let i=r===j?t:r[g];if(t!==A&&i!==A){let i=fa(c,t,void 0,e,n);i&&(r=w(new P(e,i,t,n)))}}}else r=T(r,r=>{if(t!==A&&r!==A){let r=fa(c,t,void 0,e,n);if(r)return w(new P(e,r,t,n))}return E(r)})}if(o&&!n.disableChecks){if(v(r)){if(r._tag===`Success`){let i=r===j?t:r[g];if(i===A)return r;let a=fa(o,i,void 0,e,n);a&&(r=w(new P(e,a,i,n)))}}else r=T(r,t=>{if(t!==A){let r=fa(o,t,void 0,e,n);if(r)return w(new P(e,r,t,n))}return E(t)})}return r};return s?(n,r)=>{l&&(r=Uo(r,l));let i=u??=s.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=s.length-1;e>=0;e--)if(o=$o(o,a,s[e].transformation,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[g],o=t(a,r)):o=Lt(o,e=>{let n=t(e,r);return n===j?yn(e):n})}if(o._tag===`Success`){let e=o[g],t=d(e,r);return t===j?o:t}return o=kt(o,t=>Rt(()=>qe(t,t=>new Dn(e,t,n,r)))),Lt(o,e=>{let t=d(e,r);return t===j?yn(e):t})}:l?(e,t)=>d(e,Uo(t,l)):d}const ns=`~effect/Schema/Schema`,rs={[ns]:ns,pipe(){return h(this,arguments)},annotate(e){return this.rebuild(ki(this.ast,e))},annotateKey(e){return this.rebuild(Vi(this.ast,e))},check(...e){return this.rebuild(ji(this.ast,e))}};function is(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,rs),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=e=>is(e,t),r.makeEffect=Po(r),r.make=Io(r),r.makeOption=Fo(r),r}const as=e=>e,os=ns;function ss(){return(e,t,n)=>J(new Or(e.map(ri),e=>t(e.map(e=>J(e))),n))}function cs(e){return t=>t.annotate(e)}const ls=`~effect/SchemaError/SchemaError`;var us=class extends Wt(`SchemaError`){[ls]=ls;constructor(e){super({issue:e})}get message(){return Gn(this.issue)}toString(){return`SchemaError(${this.message})`}};function ds(e){return y(e,ls)&&e[ls]===ls}const fs=Lo;function ps(e,t){let n=zo(e,t);return(e,t)=>ms(n(e,t))}function ms(e){return kt(e,e=>Rt(()=>qe(e,e=>new us(e))))}const hs=ps;function gs(e,t){let n;for(let r of e.reasons){if(!Je(r)||!ds(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function _s(e){let t=Ct(e);if(Ye(t))return t.value;throw gs(t.cause,`Sync adapter can only throw schema errors`)}function vs(e,t){let n=Bo(e,t);return(e,t)=>ys(n(e,t))}function ys(e){return Ye(e)?e:Qe(qe(e.cause,e=>new us(e)))}const bs=Vo;function xs(e,t){let n=ps(e,t);return(e,t)=>_s(n(e,t))}const Ss=xs;function Cs(e,t){let n=Ho(e,t);return(e,t)=>ms(n(e,t))}function ws(e,t){let n=Cs(e,t);return(e,t)=>_s(n(e,t))}const Ts=ws,J=is;function Es(e){return y(e,os)&&e[os]===os}const Ds=as(e=>J(Hi(e.ast),{schema:e})),Os=as(e=>{let t=Gs(e);return J(Wi(e.ast),{schema:t})}),ks=as(e=>J(Qi(e.ast),{schema:e})),As=as(e=>J(W(e.ast),{schema:e}));function js(e){let t=J(new H(e),{literal:e,transform(n){return t.pipe(X(js(n),{decode:I(()=>n),encode:I(()=>e)}))}});return t}const Ms=J(Nr),Ns=J(Pr),Ps=J(Fr),Fs=J(Mr),Is=J(Lr),Ls=J(Vr),Rs=J(Hr);function zs(e,t){return J(e,{fields:t,mapFields(e,t){let n=e(this.fields);return zs(ni(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Y(e){return zs(ni(e,void 0),e)}function Bs(e,t){return J(Ji(e.ast,t.ast),{key:e,value:t})}const Vs=as(e=>J(new Ur(!1,[],[e.ast]),{value:e}));function Hs(e,t){return J(e,{members:t,mapMembers(e,t){let n=e(this.members);return Hs(ii(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Us(e,t){return Hs(ii(e,t?.mode??`anyOf`,void 0),e)}function Ws(e){let t=e.map(js);return J(ii(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Us(e(this.members))},pick(e){return Ws(e)},transform(e){return Us(t.map((t,n)=>t.transform(e[n])))}})}const Gs=as(e=>Us([e,Fs]));function Ks(...e){return t=>t.check(...e)}function qs(e){return t=>J(zi(t.ast,e),{schema:t,identifier:e})}function X(e,t){return n=>J(Ki(n.ast,e.ast,t?pr(t):gr()),{from:n,to:e})}function Js(e,t){return n=>t?X(n,t)(e):X(n)(e)}function Ys(e){return t=>J(Gi(t.ast,e),{schema:t})}function Xs(e){return kt(e,e=>Rt(()=>qe(e,e=>e.issue)))}function Zs(e,t){let n=t?.encodingStrategy===`omit`?ar():tr();return t=>Ds(As(t)).pipe(X(t,{decode:or(Xs(e)),encode:n}))}function Qs(e,t){return n=>ks(n).pipe(Zs(e,t),Js(Ds(n)))}function $s(e){return js(e).pipe(Ys(E(e)))}function ec(e,t){return Y({_tag:$s(e),...t})}function tc(){return(e,t)=>new z(e.ast,pr(t))}const nc=xi,rc=J(Ci);function ic(e){return nc(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}const ac=Ls.check(ic());function oc(e,t){return e=Math.max(0,Math.floor(e)),nc(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:t})=>t===`array`?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),"~structural":!0,arbitrary:{constraint:{minLength:e}},...t})}function sc(e){return oc(1,e)}function cc(e){let n=ss()([e],([e])=>(n,r,i)=>t(n)?Ge(n)?Mt:ut(zo(e)(n.value,i),{onSuccess:b,onFailure:e=>jn(r,`value`,e,n,i)}):w(new An(r,n,i)),{representation:{id:`effect/schema/Option`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Option(${e[0].runtime})`,Type:`Option.Option<${e[0].Type}>`,importDeclarations:[`import * as Option from "effect/Option"`]}),expected:`Option`,toCodec:([e])=>tc()(Us([Y({_tag:js(`Some`),value:e}),Y({_tag:js(`None`)})]),mr({decode:e=>e._tag===`None`?l():b(e.value),encode:e=>se(e)?{_tag:`Some`,value:e.value}:{_tag:`None`}})),toArbitrary:([e])=>(t,n)=>{let r=t.constant(l());return lc(t,n,r,t.oneof(r,e.arbitrary.map(b)))},toEquivalence:([e])=>ae(e),toFormatter:([e])=>s({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})});return J(n.ast,{value:e})}function lc(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}globalThis.RegExp,globalThis.URL;const uc=Is.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function dc(e,t){return uc.pipe(X(e,vr(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const fc=globalThis.Symbol.for(`immer-draftable`),pc={};function mc(e,t,n,r,i){let a=_c(n,t,r),o=gc(t),s=class extends e{constructor(...[e,t]){let r=t?.[`~payload`],i=r?.token===pc?r.value:n.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:pc,value:i}})}static[os]=os;get[o](){return o}static[fc]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return h(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return Fo(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(ki(this.ast,e))}static annotateKey(e){return this.rebuild(Vi(this.ast,e))}static check(...e){return this.rebuild(ji(this.ast,e))}static extend(e){return(t,r)=>{let a=vc(t)?t:Y(t),o={...n.fields,...a.fields},s=ni(o,n.ast.checks,{identifier:e});return mc(this,e,zs(ji(s,a.ast.checks),o),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function hc(e){return new L(I(t=>new e(t,{"~payload":{token:pc,value:t}})),tr())}function gc(e){return`~effect/Schema/Class/${e}`}function _c(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=gc(t),o=e=>e instanceof i||y(e,a),s=hc(i);return r=X(J(new Or([e.ast],()=>(e,t,n)=>o(e)?E(e):w(new An(t,e,n)),{identifier:t,[gn]:([e])=>({isConstructed:o,link:new z(e,s)}),toCodec:([e])=>new z(e.ast,s),toArbitrary:([e])=>()=>({arbitrary:e.arbitrary.map(e=>new i(e)),terminal:e.terminal?.map(e=>new i(e))}),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[hn]:si(e.ast),...n})),s)(e)}}function vc(e){return Es(e)}const yc=e=>(t,n)=>{let r=vc(t)?t:Y(t);return mc(Ht,e,r,n,e=>({toString(){return`${e}(${ue({...this})})`}}))},bc=e=>(t,n,r)=>{let i=vc(n)?n.mapFields(e=>({_tag:$s(t),...e}),{unsafePreserveChecks:!0}):ec(t,n);return yc(e??t)(i,r)},xc=e=>(t,n)=>{let r=vc(t)?t:Y(t);return mc(ze,e,r,n,e=>({name:e}))},Sc=e=>(t,n,r)=>{let i=vc(n)?n.mapFields(e=>({_tag:$s(t),...e}),{unsafePreserveChecks:!0}):ec(t,n);return xc(e??t)(i,r)};function Cc(e){return e.constructorDefault===void 0?e:new B(e.isOptional,e.isMutable,void 0,e.annotations)}function wc(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function Tc(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(W(t[e]),e);let r=[...t].sort((t,r)=>{t=W(t),r=W(r);let i=e(t),a=e(r);return i===a?n.get(t)-n.get(r):i-a});return r.some((e,n)=>e!==t[n])?r:t}}function Ec(e){return J(Mc(e.ast),{schema:e})}const Dc=Tc(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Oc(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>J(t(W(e)))),i=e.annotations?.toCodecStringTree;if(Ce(i)){let n=i(r);return n===void 0?e:U(e,[Mi(n,t)])}let a=e.annotations?.toCodecJson,o=Ce(a)?a(r):void 0,s=o===void 0?e.annotations?.toCodec:void 0,c=o??(Ce(s)?s(r):void 0);return c===void 0?n(e):U(e,[Mi(c,t)])}case`Null`:return U(e,[kc]);case`Boolean`:return U(e,[Ac]);case`Unknown`:case`ObjectKeyword`:return U(e,[_a]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return wc(e),e.recur(t,aa);case`Union`:{let n=Dc(e.types);return n===e.types?e.recur(t):new pi(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}const kc=new z(new H(`null`),new L(I(()=>null),I(()=>`null`))),Ac=new z(new pi([new H(`true`),new H(`false`)],`anyOf`),new L(I(e=>e===`true`),sr())),jc=new L(I(e=>typeof e==`string`?[e]:e),tr()),Mc=Li(e=>{let t=Oc(e,Mc,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?Fi(t,Cc(e.context)):t},{stopAt:e=>e.transformation===jc}),Nc=`~effect/platform/PlatformError`;var Pc=class extends Wt(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},Fc=class extends Ut{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},Ic=class extends Wt(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[Nc]=Nc;get message(){return this.reason.message}};const Lc=e=>new Ic(new Fc(e)),Rc=e=>new Ic(new Pc(e)),zc={"~effect/Stream":{_R:_,_E:_,_A:_},pipe(){return h(this,arguments)}},Bc=e=>{let t=Object.create(zc);return t.channel=e,t},Vc=`~effect/Sink`,Hc=E([void 0]),Uc={_A:_,_In:_,_L:_,_E:_,_R:_},Wc={[Vc]:Uc,pipe(){return h(this,arguments)}},Gc=e=>y(e,Vc),Kc=e=>qc((t,n)=>q(e)(t,n).pipe(T(rt({disableYield:!0})),it(E))),qc=e=>{let t=Object.create(Wc);return t.transform=e,t},Jc=e=>K((t,n)=>E(T(e.transform(t,n),C))),Yc=qc(e=>it(rt(e,{disableYield:!0}),()=>Hc)),Xc=e=>Zc(at(t=>e(t),{discard:!0})),Zc=e=>qc(t=>t.pipe(T(e),rt({disableYield:!0}),it(()=>Hc))),Qc=e=>Kc(Ao(ct(e,Jc))),$c=e=>y(e,`~effect/Stream`),Z=Bc,el=e=>Z(po(e)),tl=(e,t)=>Z(K((n,r)=>T(No(e.channel,r),e=>t(e,r)))),nl=e=>e.channel,rl=(e,t)=>Z(_o(e,t)),il=Z(So),al=e=>Z(vo(()=>e().channel)),ol=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?sl(e):Z(bo(e,t?.chunkSize)),sl=e=>ge(e)?Z(xo(e)):il,cl=e=>Z(Ao(ct(e,nl))),ll=x(2,(e,t)=>al(()=>{let n=0;return Z(wo(e.channel,Ae(e=>t(e,n++))))})),ul=x(e=>$c(e[0])&&$c(e[1]),(e,t,n)=>Z(Do(nl(e),nl(t),n))),dl=x(2,(e,t)=>tl(e,(e,n)=>D(()=>{let r,i,a=O(()=>{if(i!==void 0){let e=i;return i=void 0,E(e)}return e}).pipe(jt(e=>(r=Ze(e),C()))),o=ct(O(()=>t.transform(a,n)),([e,t])=>(i=t,Ee(e)));return O(()=>r||o)}))),fl=x(e=>$c(e[0]),(e,t)=>al(()=>{let n=new TextDecoder(t?.encoding);return ll(e,e=>n.decode(e,{stream:!0}))})),pl=e=>e.channel.pipe(ko(Oo()),Z),ml=x(2,(e,t)=>Nt(n=>No(e.channel,n).pipe(T(e=>t.transform(e,n)),ct(([e])=>e)))),hl=e=>Mo(e.channel,()=>[],(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n]);return e}),gl=e=>Mo(e.channel,()=>``,(e,t)=>e+t.join(``)),_l=`~effect/platform/FileSystem`,vl=e=>typeof e==`bigint`?e:BigInt(e),yl=BigInt(1024);yl*yl*yl*yl*yl;const bl=Ve(`effect/platform/FileSystem`),xl=e=>bl.of({...e,[_l]:_l,exists:t=>n(e.access(t),At(!0),wt(`PlatformError`,e=>e.reason._tag===`NotFound`?E(!1):w(e))),readFileString:(t,n)=>T(e.readFile(t),e=>gt({try:()=>new TextDecoder(n).decode(e),catch:e=>Rc({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})})),stream:Ft(function*(t,n){let r=yield*e.open(t,{flag:`r`});n?.offset&&(yield*r.seek(n.offset,`start`));let i=n?.bytesToRead===void 0?void 0:vl(n.bytesToRead),a=BigInt(0),o=vl(n?.chunkSize??65536),c=r.readAlloc(o);return el(E(T(O(()=>i!==void 0&&i<=a?C():i!==void 0&&i-a<o?r.readAlloc(i-a):c),s({onNone:()=>C(),onSome:e=>(a+=BigInt(e.length),E(Ee(e)))}))))},cl),sink:(t,r)=>n(e.open(t,{flag:`w`,...r}),ct(e=>Xc(t=>e.writeAll(t))),Qc),writeFileString:(t,n,r)=>T(gt({try:()=>new TextEncoder().encode(n),catch:e=>Rc({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),Sl=`~effect/platform/FileSystem/File`;var Cl=class extends Ve()(`effect/platform/FileSystem/WatchBackend`){};const wl=`~effect/platform/Path`,Tl=Ve(`effect/Path`),El={"~effect/Ref":{_A:_},...De,toJSON(){return{_id:`Ref`,ref:this.ref}}},Dl=e=>{let t=Object.create(El);return t.ref=ka(e),t},Ol=e=>D(()=>Dl(e)),kl=e=>D(()=>e.ref.current),Al=x(2,(e,t)=>D(()=>{let n=e.ref.current;return e.ref.current=t,n})),jl=x(2,(e,t)=>D(()=>{e.ref.current=t(e.ref.current)}));function Ml(e){return e.map(e=>e.length===0||e.match(/[^A-Za-z0-9_-]/)?JSON.stringify(e):e).join(`.`)}var Nl=class{maxPad=0;srcObject;output=[];#e=new Map;constructor(e){this.srcObject=e}dump(e={}){return this.output=this.#t(this.srcObject),this.output=this.#g(e),this.output}#t(e,t=[]){let n=[],r=Object.keys(e),i=[],a=[];for(let t of r)this.#o(e[t])?i.push(t):a.push(t);let o=i.concat(a);for(let r of o){let i=e[r];if(i instanceof Date)n.push(this.#h([r],i));else if(typeof i==`string`||i instanceof RegExp)n.push(this.#d([r],i.toString()));else if(typeof i==`number`)n.push(this.#f([r],i));else if(typeof i==`boolean`)n.push(this.#p([r],i));else if(i instanceof Array){let e=this.#r(i);if(e===`ONLY_PRIMITIVE`)n.push(this.#u([r],i));else if(e===`ONLY_OBJECT_EXCLUDING_ARRAY`)for(let e=0;e<i.length;e++)n.push(``),n.push(this.#c([...t,r])),n.push(...this.#t(i[e],[...t,r]));else{let e=i.map(e=>this.#a(e)).join(`,`);n.push(`${this.#l([r])}[${e}]`)}}else if(typeof i==`object`&&(n.push(``),n.push(this.#s([...t,r])),i)){let e=i;n.push(...this.#t(e,[...t,r]))}}return n.push(``),n}#n(e){return e instanceof Date||e instanceof RegExp||[`string`,`number`,`boolean`].includes(typeof e)}#r(e){if(this.#e.has(e))return this.#e.get(e);let t=this.#i(e);return this.#e.set(e,t),t}#i(e){if(!e.length)return`ONLY_PRIMITIVE`;let t=this.#n(e[0]);if(e[0]instanceof Array)return`MIXED`;for(let n=1;n<e.length;n++)if(t!==this.#n(e[n])||e[n]instanceof Array)return`MIXED`;return t?`ONLY_PRIMITIVE`:`ONLY_OBJECT_EXCLUDING_ARRAY`}#a(e){if(e instanceof Date)return`"${this.#m(e)}"`;if(typeof e==`string`||e instanceof RegExp)return JSON.stringify(e.toString());if(typeof e==`number`)return e;if(typeof e==`boolean`)return e.toString();if(e instanceof Array)return`[${e.map(e=>this.#a(e)).join(`,`)}]`;if(typeof e==`object`){if(!e)throw Error(`Should never reach`);return`{${Object.keys(e).map(t=>`${Ml([t])} = ${this.#a(e[t])}`).join(`,`)}}`}throw Error(`Should never reach`)}#o(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof RegExp||e instanceof Date||e instanceof Array&&this.#r(e)!==`ONLY_OBJECT_EXCLUDING_ARRAY`}#s(e){return`[${Ml(e)}]`}#c(e){return`[[${Ml(e)}]]`}#l(e){let t=Ml(e);return t.length>this.maxPad&&(this.maxPad=t.length),`${t} = `}#u(e,t){return`${this.#l(e)}${JSON.stringify(t)}`}#d(e,t){return`${this.#l(e)}${JSON.stringify(t)}`}#f(e,t){if(Number.isNaN(t))return`${this.#l(e)}nan`;switch(t){case 1/0:return`${this.#l(e)}inf`;case-1/0:return`${this.#l(e)}-inf`;default:return`${this.#l(e)}${t}`}}#p(e,t){return`${this.#l(e)}${t}`}#m(e){function t(e,t=2){return e.padStart(t,`0`)}let n=t((e.getUTCMonth()+1).toString()),r=t(e.getUTCDate().toString()),i=t(e.getUTCHours().toString()),a=t(e.getUTCMinutes().toString()),o=t(e.getUTCSeconds().toString()),s=t(e.getUTCMilliseconds().toString(),3);return`${e.getUTCFullYear()}-${n}-${r}T${i}:${a}:${o}.${s}`}#h(e,t){return`${this.#l(e)}${this.#m(t)}`}#g(e={}){let{keyAlignment:t=!1}=e,n=/^(\".*\"|[^=]*)\s=/,r=[];for(let e=0;e<this.output.length;e++){let i=this.output[e];if(i[0]===`[`&&i[1]!==`[`){if(this.output[e+1]===``&&this.output[e+2]?.slice(0,i.length)===i.slice(0,-1)+`.`){e+=1;continue}r.push(i)}else if(t){let e=n.exec(i);e&&e[1]?r.push(i.replace(e[1],e[1].padEnd(this.maxPad))):r.push(i)}else r.push(i)}let i=[];for(let e=0;e<r.length;e++){let t=r[e];(t!==``||r[e+1]!==``)&&i.push(t)}return i}};function Pl(e,t){return new Nl(e).dump(t).join(`
|
|
7
|
+
`)}const Fl={arrays:`merge`,sets:`merge`,maps:`merge`};function Il(e,t,n){return Ll(e,t,new Set,n??Fl)}function Ll(e,t,n,r){let i={},a=new Set([...Hl(e),...Hl(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(Vl(a)&&Vl(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=Rl(a,s,n,r);continue}i[o]=s}return i}function Rl(e,t,n,r){if(zl(e)&&zl(t))return Ll(e,t,n,r);if(Bl(e)&&Bl(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function zl(e){return Object.getPrototypeOf(e)===Object.prototype}function Bl(e){return typeof e[Symbol.iterator]==`function`}function Vl(e){return typeof e==`object`&&!!e}function Hl(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function Ul(e){return e%4==0&&e%100!=0||e%400==0}var Wl=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
|
|
8
|
+
`||this.startsWith(`\r
|
|
9
|
+
`)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function Q(e){return{ok:!0,body:e}}function $(){return{ok:!1}}function Gl(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function Kl(e){return typeof e==`object`&&!!e}function ql(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function Jl(e,t){let{keys:n,type:r,value:i}=t,a=ql(e,n);if(a===void 0)return Object.assign(e,Gl(n,i));if(Array.isArray(a))return Xl(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(Kl(a))return Xl(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function Yl(e,t){let{type:n,keys:r,value:i}=t,a=ql(e,r);if(a===void 0)return Object.assign(e,Gl(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):Xl(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(Kl(a))return Xl(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function Xl(e,t){switch(t.type){case`Block`:return Il(e,t.value);case`Table`:return Jl(e,t);case`TableArray`:return Yl(e,t)}}function Zl(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function Ql(e,t){let n=iu(t);return r=>{let i=[],a=e(r);if(!a.ok)return Q(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return Q(i)}}function $l(e,t){let n=iu(t);return r=>{let i=e(r);if(!i.ok)return $();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return Q(a)}}function eu(e,t,n){let r=iu(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return $();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
|
|
10
|
+
`,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return Q(Gl(o.body,s.body))}}function tu(e){return t=>{let n=e(t);if(!n.ok)return $();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=Il(r,e));return Q(r)}}function nu(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?$():Q(n)}}function ru(e,t,n){let r=iu(e),i=iu(n);return a=>{if(!r(a).ok)return $();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return Q(o.body)}}function iu(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const au=/[A-Za-z0-9_-]+/y;function ou(e){e.skipWhitespaces();let t=e.match(au)?.[0];return t?(e.next(t.length),Q(t)):$()}function su(e){if(e.char()!==`\\`)return $();switch(e.next(),e.char()){case`b`:return e.next(),Q(`\b`);case`t`:return e.next(),Q(` `);case`n`:return e.next(),Q(`
|
|
11
|
+
`);case`f`:return e.next(),Q(`\f`);case`r`:return e.next(),Q(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),Q(r)}case`"`:return e.next(),Q(`"`);case`\\`:return e.next(),Q(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function cu(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
|
|
12
|
+
`)throw SyntaxError(`Single-line string cannot contain EOL`);let n=su(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function lu(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
|
|
13
|
+
`)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function uu(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
|
|
14
|
+
`?e.next():e.startsWith(`\r
|
|
15
|
+
`)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
|
|
16
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}if(e.startsWith(`\\\r
|
|
17
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=su(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),Q(t.join(``))}function du(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
|
|
18
|
+
`?e.next():e.startsWith(`\r
|
|
19
|
+
`)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),Q(t.join(``))}const fu=/(?:true|false)\b/y;function pu(e){e.skipWhitespaces();let t=e.match(fu);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const mu=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),hu=/[+-]?inf\b/y;function gu(e){e.skipWhitespaces();let t=e.match(hu);if(!t)return $();let n=t[0];return e.next(n.length),Q(mu.get(n))}const _u=/[+-]?nan\b/y;function vu(e){e.skipWhitespaces();let t=e.match(_u);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const yu=$l(Zl([ou,cu,lu]),`.`),bu=/0b[01]+(?:_[01]+)*\b/y;function xu(e){e.skipWhitespaces();let t=e.match(bu)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const Su=/0o[0-7]+(?:_[0-7]+)*\b/y;function Cu(e){e.skipWhitespaces();let t=e.match(Su)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const wu=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Tu(e){e.skipWhitespaces();let t=e.match(wu)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Eu=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Du(e){e.skipWhitespaces();let t=e.match(Eu)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const Ou=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function ku(e){e.skipWhitespaces();let t=e.match(Ou)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const Au=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function ju(e){e.skipWhitespaces();let t=e.match(Au);if(!t)return $();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!Ul(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return Q(i)}const Mu=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function Nu(e){e.skipWhitespaces();let t=e.match(Mu)?.[0];return t?(e.next(t.length),Q(t)):$()}function Pu(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=Iu(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),Q(t)}function Fu(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=ru(`{`,Ql(Lu,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=Il(n,e);return Q(n)}const Iu=Zl([uu,du,cu,lu,pu,gu,vu,ju,Nu,xu,Cu,Tu,ku,Du,Pu,Fu]),Lu=eu(yu,`=`,Iu);function Ru(e){e.nextUntilChar();let t=tu(nu(Lu))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const zu=ru(`[`,yu,`]`);function Bu(e){e.nextUntilChar();let t=zu(e);if(!t.ok)return $();e.nextUntilChar();let n=Ru(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const Vu=ru(`[[`,yu,`]]`);function Hu(e){e.nextUntilChar();let t=Vu(e);if(!t.ok)return $();e.nextUntilChar();let n=Ru(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function Uu(e){let t=nu(Zl([Ru,Hu,Bu]))(e);return t.ok?Q(t.body.reduce(Xl,{__proto__:null})):Q({__proto__:null})}function Wu(e,t){let n=e.source.slice(0,e.position).split(`
|
|
20
|
+
`);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function Gu(e){return t=>{let n=new Wl(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(Wu(n,r))}catch(e){throw e instanceof Error?SyntaxError(Wu(n,e.message)):SyntaxError(Wu(n,`Invalid error type caught`))}}}function Ku(e){return Gu(Uu)(e)}const qu={ctx_execute:!0,ctx_batch_execute:!0};function Ju(e,t){return qu[e]?e!==`ctx_execute`||t.language===`shell`:!1}function Yu(e,t){if(Ju(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e&&`command`in e&&typeof e.command==`string`?e.command:``).filter(e=>typeof e==`string`).join(`
|
|
21
|
+
`)}}const Xu=/#[0-9a-fA-F]{4}$/u,Zu=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,Qu=/^\*\*\* Move to:\s*(.+)$/,$u={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function ed(e){let t=e.trim(),n=Xu.exec(t)?.index,r=n===void 0?t:t.slice(0,n);if(r.length<2)return r;let i=r[0],a=r[r.length-1];return(i===`"`||i===`'`)&&i===a?r.slice(1,-1):r}function td(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=ed(t.slice(1,n));return r.length>0?r:void 0}function nd(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
|
|
22
|
+
`)){let n=td(e);if(n!==void 0){t.push(n),r=!0;continue}let i=Zu.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=Qu.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=ed(o.slice(3));e.length>0&&t.push(e)}}return t}function rd(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function id(e,t){if($u[e]!==!0)return[];let n=t.input,r=typeof n==`string`?nd(n):[];if(r.length>0)return Array.from(new Set(r));let i=rd(t,`file_path`)??rd(t,`path`);return i===void 0?[]:[i]}const ad=new Map;function od(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=ad.get(n);if(r!==void 0)return r===!0||r.test(e);let i=sd(n);return ad.size>=256&&ad.clear(),ad.set(n,i),i===!0||i.test(e)}function sd(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const cd=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,ld=/\$\(|`|\$\{?\w/,ud=/\$\(([^()]*)\)|`([^`]*)`/g,dd=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,fd=/&&|\|\||[;|]/,pd=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function md(e,t,n,r){let i=cd.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?hd(o,n.command):yd(o,n.file_path,r)}function hd(e,t){if(typeof t!=`string`)return!0;let n=gd(t);return n.length===0||n.some(t=>vd(e,t))?!0:_d(e)&&ld.test(t)}function gd(e){let t=[...e.matchAll(ud)].map(e=>e[1]??e[2]??``);return[e.replace(ud,` `),...t].flatMap(e=>e.split(fd)).map(e=>e.trim().replace(dd,``)).filter(e=>e.length>0)}function _d(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function vd(e,t){return RegExp(`^${e.split(`*`).map(pd).join(`.*`)}$`).test(t)}function yd(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:bd(r);return RegExp(`^${xd(i)}$`).test(a)}const bd=e=>e.slice(e.lastIndexOf(`/`)+1);function xd(e){let t=Sd(e);return e.endsWith(`/**`)?`(?:${Sd(e.slice(0,-3))}|${t})`:t}function Sd(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:pd(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function Cd(e){return{session_id:e(),agent_id:null}}const wd=Bs(Is.pipe(Ks(nc(e=>e!==`__proto__`))),Vs(Is)).pipe(qs(`TomlConfig`)),Td=e=>new F({message:e instanceof Error?`TOML parse error: ${e.message}`:`TOML parse error`});Is.pipe(X(ks(wd),{decode:rr(e=>gt({try:()=>Ku(e),catch:Td}).pipe(T(e=>ps(wd)(e)),zt(e=>ds(e)?e.issue:e))),encode:I(e=>Pl(e))}));const Ed=`systemfsoftware.toml`,Dd=Ss(wd)({});var Od=class extends Ve()(`@systemfsoftware/omp-utils/TomlLoader`){};const kd=e=>{let t={};for(let n of e)for(let[e,r]of Object.entries(n))t[e]=r;return t},Ad=e=>gt({try:()=>Ku(e),catch:e=>new F({message:e instanceof Error?`TOML parse error: ${e.message}`:`TOML parse error`})}).pipe(T(e=>ps(wd)(e))),jd=(e,t,n)=>e.exists(n).pipe(T(t=>t?e.readFileString(n).pipe(T(Ad),lt(()=>Dd)):E(Dd))),Md=ft(Od,T(D(()=>{let e=process.env.OMP_USER_CONFIG_HOME;return typeof e==`string`&&e.length>0?e:Vt.homedir()}),e=>dt(function*(){let t=yield*Ol(ba()),n=yield*bl,r=yield*Tl,i=r.join(e,`.config/systemfsoftware`,Ed);return Od.of({load:nt(`TomlLoader.load`)(function*(e){let a=yield*kl(t),o=xa(a,e);if(se(o))return o.value;let s=r.join(e,Ed),c=r.join(e,`systemfsoftware.local.toml`),l=yield*jd(n,r,i),u=yield*jd(n,r,s),d=yield*jd(n,r,c),ee=yield*hs(wd)(kd([l,u,d])).pipe(ot);return yield*jl(t,t=>(Ta(t,e,ee),t)),ee})})}))),Nd=Vs(Y({old_text:Os(Ps),new_text:Os(Ps)}).pipe(Ks(nc(e=>`old_text`in e||`new_text`in e)))).pipe(Ks(sc())),Pd=Vs(Y({old_string:Os(Ps),new_string:Os(Ps)}).pipe(Ks(nc(e=>`old_string`in e||`new_string`in e)))),Fd=fs(Nd),Id=fs(Pd),Ld={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},Rd={Edit:!0,MultiEdit:!0,Update:!0},zd=(e,t)=>{let n=e.split(`
|
|
23
|
+
`).filter(e=>e.startsWith(t));return n.length===0?void 0:n.map(e=>e.slice(t.length)).join(`
|
|
24
|
+
`)};function Bd(e,t){let n=t;if(Ld[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(Rd[e]===!0&&`edits`in n&&Fd(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
|
|
25
|
+
`),new_string:e.map(e=>e.new_string).join(`
|
|
26
|
+
`)}}if(Rd[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=zd(n.input,`+`),t=zd(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const Vd=bs(Bs(Is,Ps));function Hd(e,t){let n=d(Vd(t));if(n===null)return{};let r=`file_path`in e||!(`path`in e)?`file_path`:`path`,i={};for(let[t,a]of Object.entries(n)){if(t===`file_path`){i[r]=a;continue}if(!((t===`old_string`||t===`new_string`)&&!(t in e))){if(t===`edits`&&Id(a)&&Fd(e.edits)){i.edits=a.map(e=>({old_text:typeof e.old_string==`string`?e.old_string:``,new_text:typeof e.new_string==`string`?e.new_string:``}));continue}i[t]=a}}return i}const Ud={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function Wd(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=Ud[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{Y as $,hl as A,W as At,Ns as B,il as C,Wa as Ct,ul as D,ka as Dt,$c as E,Va as Et,Kc as F,I as Ft,js as G,Rs as H,Gc as I,rr as It,Ls as J,Ws as K,Pc as L,N as Lt,dl as M,L as Mt,cl as N,Qn as Nt,gl as O,Ii as Ot,Yc as P,tr as Pt,Is as Q,Rc as R,Wt as Rt,fl as S,To as St,ol as T,Ba as Tt,rc as U,Vs as V,ac as W,Bs as X,cc as Y,us as Z,Sl as _,ks as _t,Yu as a,cs as at,xl as b,zo as bt,Bd as c,vs as ct,Al as d,Ts as dt,bc as et,Dl as f,dc as ft,bl as g,Ec as gt,wl as h,Os as ht,id as i,Ps as it,pl as j,Fr as jt,ml as k,Ki as kt,Wd as l,bs as lt,Tl as m,J as mt,Md as n,ec as nt,od as o,X as ot,jl as p,ds as pt,Ms as q,Hd as r,Us as rt,md as s,ps as st,Od as t,Sc as tt,Cd as u,xs as ut,vl as v,Qs as vt,Z as w,Ua as wt,rl as x,K as xt,Cl as y,Ro as yt,Lc as z};
|