@unieai/code 0.0.10 → 0.0.11
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/README.en.md +6 -59
- package/README.md +5 -59
- package/dist/chunks/App-s5ex5j86.js +2 -0
- package/dist/chunks/ApproveApiKey-b4z6h2gn.js +2 -0
- package/dist/chunks/{assistant-yvtpv5sv.js → AssistantSessionChooser-g1vsya6h.js} +1 -1
- package/dist/chunks/BypassPermissionsModeDialog-jbg97eja.js +2 -0
- package/dist/chunks/ClaudeInChromeOnboarding-qa0pvwfw.js +2 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-gqmed78y.js +2 -0
- package/dist/chunks/ConsoleOAuthFlow-yh72vs8j.js +2 -0
- package/dist/chunks/{DiffDialog-v8smgzpd.js → DiffDialog-t6vvtbb2.js} +1 -1
- package/dist/chunks/Doctor-k08ggw2j.js +2 -0
- package/dist/chunks/Grove-tkkskg8n.js +2 -0
- package/dist/chunks/ITermBackend-73waaahf.js +2 -0
- package/dist/chunks/{InProcessTransport-57c2w5v4.js → InProcessTransport-qwjgb17j.js} +1 -1
- package/dist/chunks/InvalidConfigDialog-zmqw3fj1.js +2 -0
- package/dist/chunks/InvalidSettingsDialog-tnd5hymg.js +2 -0
- package/dist/chunks/Onboarding-p0tq6pgz.js +2 -0
- package/dist/chunks/REPL-hjjz80kq.js +2 -0
- package/dist/chunks/ResumeConversation-krn9hqb1.js +2 -0
- package/dist/chunks/{SnapshotUpdateDialog-5yvfnp0q.js → SnapshotUpdateDialog-raq029pd.js} +1 -1
- package/dist/chunks/TeleportProgress-vyy2k3bv.js +2 -0
- package/dist/chunks/TeleportRepoMismatchDialog-ff0h2cnq.js +2 -0
- package/dist/chunks/TeleportResumeWrapper-esjykret.js +2 -0
- package/dist/chunks/{TmuxBackend-j665sv6f.js → TmuxBackend-14kmnkcb.js} +1 -1
- package/dist/chunks/ToolSearchTool-w4t61c7d.js +2 -0
- package/dist/chunks/TrustDialog-7fvaze2x.js +2 -0
- package/dist/chunks/TungstenTool-rv96z549.js +2 -0
- package/dist/chunks/add-dir-kqw72mky.js +2 -0
- package/dist/chunks/agents-3exybgtb.js +4 -0
- package/dist/chunks/{agents-e7x38q37.js → agents-z66twpqr.js} +1 -1
- package/dist/chunks/ant-claude-for-chrome-mcp-712xg07f.js +2 -0
- package/dist/chunks/api-z8svc3xt.js +2 -0
- package/dist/chunks/asciicast-vzd7qjbb.js +2 -0
- package/dist/chunks/{AssistantSessionChooser-0r5zamt1.js → assistant-ftzr3mjp.js} +1 -1
- package/dist/chunks/auth-gbyfq0g2.js +2 -0
- package/dist/chunks/auth-wk077awh.js +2 -0
- package/dist/chunks/backgroundHousekeeping-m8gthtkh.js +2 -0
- package/dist/chunks/branch-1d0b8590.js +5 -0
- package/dist/chunks/{bridgePointer-9q6wh2ct.js → bridgePointer-vhd47np6.js} +1 -1
- package/dist/chunks/btw-s3r5jhyd.js +2 -0
- package/dist/chunks/buddy-xzm5npk8.js +2 -0
- package/dist/chunks/{cachedMicrocompact-thnhx1zt.js → cachedMicrocompact-6j3zxr4g.js} +1 -1
- package/dist/chunks/caches-fbggdeq7.js +2 -0
- package/dist/chunks/chrome-mdyx0s5j.js +2 -0
- package/dist/chunks/{chromeNativeHost-nnjkj164.js → chromeNativeHost-8wc6wcr6.js} +1 -1
- package/dist/chunks/{claudeDesktop-nsangyk5.js → claudeDesktop-p5bfxmvz.js} +1 -1
- package/dist/chunks/{cleanup-mv462dsh.js → cleanup-q46nbce1.js} +1 -1
- package/dist/chunks/clear-fwad6zxy.js +2 -0
- package/dist/chunks/{cli-sbp2221d.js → cli-0dc8sd37.js} +2 -2
- package/dist/chunks/{cli-3xhqacdd.js → cli-0qt9btbe.js} +2 -2
- package/dist/chunks/{cli-4j5yyvek.js → cli-0w4wc1z0.js} +2 -2
- package/dist/chunks/{cli-r6hm1q63.js → cli-15sqp3mq.js} +2 -2
- package/dist/chunks/{cli-45ftgn85.js → cli-15w3eaed.js} +1 -1
- package/dist/chunks/{cli-b7wx1479.js → cli-19ncan36.js} +1 -1
- package/dist/chunks/{cli-hx28w3cq.js → cli-1jp3rm7n.js} +1 -1
- package/dist/chunks/{cli-90b87f45.js → cli-1n8he7s8.js} +2 -2
- package/dist/chunks/{cli-bthzmdgv.js → cli-1ny2386w.js} +2 -2
- package/dist/chunks/{cli-vq899n8p.js → cli-27mzrnr8.js} +1 -1
- package/dist/chunks/{cli-gnjff7md.js → cli-2rw44zfx.js} +2 -2
- package/dist/chunks/{cli-7gpep1x5.js → cli-2rwjx3w0.js} +1 -1
- package/dist/chunks/{cli-jqppy97b.js → cli-2wd8eaac.js} +2 -2
- package/dist/chunks/{cli-3hwpymrd.js → cli-350pymj4.js} +2 -2
- package/dist/chunks/{cli-w754xmyv.js → cli-3ac555qw.js} +2 -2
- package/dist/chunks/{cli-8kyjh67j.js → cli-3gwqrmcd.js} +1 -1
- package/dist/chunks/{cli-msr9n6da.js → cli-3m8n808e.js} +2 -2
- package/dist/chunks/{cli-ptv3h2tx.js → cli-42kma5r3.js} +1 -1
- package/dist/chunks/{cli-r9p0g894.js → cli-49m97nbg.js} +2 -2
- package/dist/chunks/{cli-bkxwwj81.js → cli-4a4bb1kf.js} +1 -1
- package/dist/chunks/{cli-3bxtq5dc.js → cli-4ewb3q42.js} +2 -2
- package/dist/chunks/{cli-v3mf1g0z.js → cli-4mvvtchx.js} +2 -2
- package/dist/chunks/{cli-r2p5bkx5.js → cli-4nejhkd0.js} +2 -2
- package/dist/chunks/{cli-dx46fn1w.js → cli-51720d82.js} +2 -2
- package/dist/chunks/cli-55jdp9ky.js +3 -0
- package/dist/chunks/{cli-6vwdnz9p.js → cli-55ntywtj.js} +1 -1
- package/dist/chunks/{cli-pz8vxqw0.js → cli-57yrpnaq.js} +2 -2
- package/dist/chunks/{cli-59ysj9y4.js → cli-5dt9yjha.js} +2 -2
- package/dist/chunks/{cli-e37w9dxm.js → cli-5f0w3fy6.js} +1 -1
- package/dist/chunks/{cli-z9jm4xjn.js → cli-5vsnhp97.js} +2 -2
- package/dist/chunks/{cli-x758qvv7.js → cli-61x73ksv.js} +1 -1
- package/dist/chunks/{cli-ye3qk73s.js → cli-66jj9zj3.js} +1 -1
- package/dist/chunks/{cli-zac1afnb.js → cli-6bxfdgv1.js} +1 -1
- package/dist/chunks/{cli-md1h6sbv.js → cli-6pdpyz1a.js} +1 -1
- package/dist/chunks/{cli-mejr8b5m.js → cli-6yprtw88.js} +2 -2
- package/dist/chunks/{cli-qs0v3mf6.js → cli-73jf8hyz.js} +2 -2
- package/dist/chunks/{cli-948we41z.js → cli-749tdaqc.js} +2 -2
- package/dist/chunks/{cli-vxxkrd5y.js → cli-764c4bsm.js} +2 -2
- package/dist/chunks/cli-78apjp3t.js +3 -0
- package/dist/chunks/{cli-k0jpcxwa.js → cli-7c99j0pt.js} +2 -2
- package/dist/chunks/{cli-by5b2216.js → cli-89x414pj.js} +2 -2
- package/dist/chunks/{cli-fqb71hy3.js → cli-8dmy2s42.js} +1 -1
- package/dist/chunks/cli-8hxz2qs6.js +3 -0
- package/dist/chunks/cli-8mk2zg4a.js +4 -0
- package/dist/chunks/{cli-29gcax34.js → cli-8qd16mt4.js} +2 -2
- package/dist/chunks/cli-95wg48h9.js +3 -0
- package/dist/chunks/{cli-wz9r5s81.js → cli-99mqr54v.js} +2 -2
- package/dist/chunks/{cli-8qk46mt3.js → cli-9aq7vxaq.js} +1 -1
- package/dist/chunks/{cli-zcpjf07m.js → cli-9z9r2set.js} +2 -2
- package/dist/chunks/{cli-2wvsym16.js → cli-a52ra30v.js} +1 -1
- package/dist/chunks/{cli-s6qk3rbv.js → cli-akcxtvv9.js} +2 -2
- package/dist/chunks/{cli-h3kcprht.js → cli-bmk0rb5v.js} +2 -2
- package/dist/chunks/{cli-pmzht94n.js → cli-br6zjh6x.js} +2 -2
- package/dist/chunks/{cli-z8hqtyjg.js → cli-c22wpdk4.js} +1 -1
- package/dist/chunks/{cli-zbt28krs.js → cli-c60c9qvm.js} +1 -1
- package/dist/chunks/{cli-3357rxva.js → cli-cqkne34j.js} +2 -2
- package/dist/chunks/{cli-0s65jzgr.js → cli-cwbxhdt1.js} +1 -1
- package/dist/chunks/{cli-xsap3gxj.js → cli-d0hzw78c.js} +1 -1
- package/dist/chunks/{cli-0b4dmvvw.js → cli-d53fhs6v.js} +2 -2
- package/dist/chunks/{cli-extf4h54.js → cli-dbdqrqmt.js} +1 -1
- package/dist/chunks/{cli-yf3sh3aw.js → cli-de1hwp88.js} +1 -1
- package/dist/chunks/cli-edkqs0ge.js +3 -0
- package/dist/chunks/{cli-dsnjsvqs.js → cli-er7z496e.js} +2 -2
- package/dist/chunks/{cli-atpfeg28.js → cli-eyw3czmn.js} +2 -2
- package/dist/chunks/{cli-tyxvdf66.js → cli-ezs5sney.js} +2 -2
- package/dist/chunks/{cli-tn47e131.js → cli-f63fdj4w.js} +2 -2
- package/dist/chunks/cli-fakdskp6.js +3 -0
- package/dist/chunks/{cli-nj726gac.js → cli-fdya77ch.js} +3 -3
- package/dist/chunks/{cli-b1dptek2.js → cli-fghyxar5.js} +2 -2
- package/dist/chunks/{cli-g1spmn9n.js → cli-fm14mg07.js} +1 -1
- package/dist/chunks/{cli-cr1hvkmz.js → cli-fs7yttfp.js} +2 -2
- package/dist/chunks/{cli-rcvta3zk.js → cli-fwrj8ybs.js} +2 -2
- package/dist/chunks/{cli-v77avvvk.js → cli-g4n9das2.js} +1 -1
- package/dist/chunks/{cli-cbdrqqf2.js → cli-g5wq5ptg.js} +2 -2
- package/dist/chunks/{cli-yrk194b9.js → cli-gq5fve62.js} +1 -1
- package/dist/chunks/{cli-nykt265k.js → cli-grxvgq2n.js} +1 -1
- package/dist/chunks/{cli-ffjjv4j8.js → cli-gtm212j6.js} +2 -2
- package/dist/chunks/{cli-skq9ktf8.js → cli-gxgdnjfn.js} +1 -1
- package/dist/chunks/{cli-x5z5m6y7.js → cli-h120wpk2.js} +1 -1
- package/dist/chunks/{cli-58t6a5n6.js → cli-h4a90xbh.js} +1 -1
- package/dist/chunks/cli-h4dspaac.js +3 -0
- package/dist/chunks/{cli-a98b285v.js → cli-hke6r0q8.js} +2 -2
- package/dist/chunks/{cli-jxwm52wg.js → cli-hzr2zraz.js} +1 -1
- package/dist/chunks/{cli-x4a9geyz.js → cli-j08dmxw5.js} +1 -1
- package/dist/chunks/{cli-jvs98a70.js → cli-ja540nr7.js} +1 -1
- package/dist/chunks/{cli-dr1ph0pp.js → cli-jegyadmb.js} +2 -2
- package/dist/chunks/{cli-xjx11p6m.js → cli-jgn9jprh.js} +2 -2
- package/dist/chunks/{cli-n3m134cf.js → cli-jj93qmmc.js} +2 -2
- package/dist/chunks/{cli-kje3t5yg.js → cli-jkj867t1.js} +3 -3
- package/dist/chunks/{cli-6he3kpeb.js → cli-k2nh5cby.js} +2 -2
- package/dist/chunks/{cli-3je4vtx7.js → cli-k4v08k8t.js} +2 -2
- package/dist/chunks/{cli-c2pn6csk.js → cli-khs3sj9k.js} +1 -1
- package/dist/chunks/{cli-shz2e0q5.js → cli-kq16afrr.js} +2 -2
- package/dist/chunks/{cli-2zh6c5xz.js → cli-kqv5b8zh.js} +1 -1
- package/dist/chunks/{cli-k8fd74g6.js → cli-m0z3rmf0.js} +2 -2
- package/dist/chunks/{cli-a72n4ej7.js → cli-m12smc5e.js} +1 -1
- package/dist/chunks/{cli-15zbq52w.js → cli-m8fq163z.js} +1 -1
- package/dist/chunks/{cli-1215h20m.js → cli-mb1qrqw1.js} +2 -2
- package/dist/chunks/{cli-50wh7ttg.js → cli-mbp8f3f3.js} +2 -2
- package/dist/chunks/{cli-5pb6kdxn.js → cli-me4e2p3e.js} +595 -595
- package/dist/chunks/{cli-vz1j9n38.js → cli-mj03488e.js} +2 -2
- package/dist/chunks/{cli-6dcra6rs.js → cli-ms5j6fff.js} +2 -2
- package/dist/chunks/{cli-0v6qg4zv.js → cli-msgx4pnp.js} +2 -2
- package/dist/chunks/cli-msmzt4c3.js +130 -0
- package/dist/chunks/{cli-h5yfk29j.js → cli-msw0vv86.js} +2 -2
- package/dist/chunks/{cli-ewts4g0p.js → cli-mzcsnm06.js} +2 -2
- package/dist/chunks/{cli-wr4k6ngg.js → cli-n5s5fnyj.js} +2 -2
- package/dist/chunks/{cli-ygq3fy9g.js → cli-ns0aaggm.js} +1 -1
- package/dist/chunks/{cli-1a2nss2m.js → cli-nvnj7r73.js} +1 -1
- package/dist/chunks/{cli-hpzy0mat.js → cli-p0vh69b9.js} +2 -2
- package/dist/chunks/{cli-zf7yzkn6.js → cli-p2cqnrnp.js} +2 -2
- package/dist/chunks/{cli-px7jhzgq.js → cli-pbc8sk2d.js} +2 -2
- package/dist/chunks/{cli-29078yxj.js → cli-pgg33dhw.js} +2 -2
- package/dist/chunks/cli-przq3zk6.js +3 -0
- package/dist/chunks/{cli-q9fn82b1.js → cli-q0156x0d.js} +2 -2
- package/dist/chunks/{cli-zdy5bccv.js → cli-q46epwyh.js} +1 -1
- package/dist/chunks/{cli-v8w48y51.js → cli-qaxvg7gv.js} +1 -1
- package/dist/chunks/{cli-ytj910yt.js → cli-qm684n63.js} +1 -1
- package/dist/chunks/{cli-2qec7gn4.js → cli-r3etpht1.js} +1 -1
- package/dist/chunks/{cli-amy2yafd.js → cli-r83ttew2.js} +2 -2
- package/dist/chunks/{cli-22zbzzap.js → cli-r9db9mqv.js} +1 -1
- package/dist/chunks/{cli-3q7meftn.js → cli-rjerv816.js} +2 -2
- package/dist/chunks/{cli-mx6xk0dw.js → cli-rvad3yhg.js} +2 -2
- package/dist/chunks/{cli-wfqsfwa2.js → cli-rxb5q8zw.js} +2 -2
- package/dist/chunks/{cli-7cn4gwqc.js → cli-s160fqyz.js} +2 -2
- package/dist/chunks/{cli-v2hg35qk.js → cli-s6vr7213.js} +2 -2
- package/dist/chunks/{cli-49dqgzsg.js → cli-s9fhtgmz.js} +2 -2
- package/dist/chunks/{cli-tezq577c.js → cli-scaqq0v9.js} +2 -2
- package/dist/chunks/{cli-15tr7ade.js → cli-sh9w2tbd.js} +1 -1
- package/dist/chunks/{cli-zd2e6bq1.js → cli-sycqd3xe.js} +4 -4
- package/dist/chunks/{cli-d06qr5p3.js → cli-t4j047cx.js} +2 -2
- package/dist/chunks/{cli-s5epnnj5.js → cli-t9jht3kb.js} +2 -2
- package/dist/chunks/{cli-bd1ryrzd.js → cli-tckzkegq.js} +1 -1
- package/dist/chunks/{cli-p2gt60aj.js → cli-tfv2qcgf.js} +1 -1
- package/dist/chunks/{cli-1qszxdan.js → cli-tq5z9qv3.js} +2 -2
- package/dist/chunks/{cli-wthnf2t5.js → cli-tt9a4124.js} +1 -1
- package/dist/chunks/{cli-8v5ajztt.js → cli-tyqh91zq.js} +1 -1
- package/dist/chunks/cli-v943fd6a.js +3 -0
- package/dist/chunks/{cli-wn4ywgbv.js → cli-v9f860t5.js} +2 -2
- package/dist/chunks/{cli-qc7zfabw.js → cli-vkvmhjha.js} +2 -2
- package/dist/chunks/{cli-6b6e5zj9.js → cli-vkzp66cm.js} +2 -2
- package/dist/chunks/{cli-6qhwqfwp.js → cli-vwg0v35a.js} +2 -2
- package/dist/chunks/{cli-x514vyva.js → cli-w1d8n9g3.js} +1 -1
- package/dist/chunks/cli-w52yvzkn.js +3 -0
- package/dist/chunks/{cli-et2cj5dc.js → cli-wbe1p8n2.js} +2 -2
- package/dist/chunks/{cli-5mdbbvnv.js → cli-wm8qb6j3.js} +1 -1
- package/dist/chunks/{cli-1tq57kq0.js → cli-wn2srq2e.js} +1 -1
- package/dist/chunks/{cli-088ac95n.js → cli-wt2bfbn0.js} +2 -2
- package/dist/chunks/{cli-jmypsed1.js → cli-x70v8rsj.js} +2 -2
- package/dist/chunks/{cli-5wh173wa.js → cli-x8xgga1a.js} +3 -3
- package/dist/chunks/{cli-2vc9kv40.js → cli-xfsqvp8r.js} +2 -2
- package/dist/chunks/{cli-6xmbrh42.js → cli-xmgm2573.js} +2 -2
- package/dist/chunks/{cli-d58ptbve.js → cli-xpa1neza.js} +2 -2
- package/dist/chunks/{cli-6bxmycm6.js → cli-yqbvprz7.js} +1 -1
- package/dist/chunks/{cli-bz32070f.js → cli-yrwenjxs.js} +1 -1
- package/dist/chunks/{cli-3p0mfsqg.js → cli-z5e72gsd.js} +1 -1
- package/dist/chunks/{cli-z2jpyr57.js → cli-zev50xap.js} +1 -1
- package/dist/chunks/{cli-mjz85907.js → cli-zjbzak9n.js} +1 -1
- package/dist/chunks/{cli-h2dynmt7.js → cli-zjfya500.js} +1 -1
- package/dist/chunks/{cli-60mdvk6q.js → cli-zp8s7q5w.js} +1 -1
- package/dist/chunks/{cli-znz72ctn.js → cli-zpcncwrv.js} +1 -1
- package/dist/chunks/{cli-ew59cmn3.js → cli-zxdnz6vp.js} +1 -1
- package/dist/chunks/client-dkpgx025.js +2 -0
- package/dist/chunks/color-zrm6r755.js +2 -0
- package/dist/chunks/commitAttribution-3y6pessz.js +2 -0
- package/dist/chunks/common-0bee37at.js +2 -0
- package/dist/chunks/compact-zmvj1pk0.js +4 -0
- package/dist/chunks/config-gj0gbg5g.js +2 -0
- package/dist/chunks/config-hbq35b68.js +2 -0
- package/dist/chunks/context-h1qc69rg.js +2 -0
- package/dist/chunks/context-noninteractive-7wbe6qvd.js +2 -0
- package/dist/chunks/conversation-fwnfp0p5.js +2 -0
- package/dist/chunks/{copy-bpypgpy8.js → copy-76r9v46d.js} +1 -1
- package/dist/chunks/cost-56r5xxqy.js +5 -0
- package/dist/chunks/createSession-m5y8fjy4.js +2 -0
- package/dist/chunks/desktop-z3jqgnw7.js +2 -0
- package/dist/chunks/detectRepository-w6wawmmg.js +2 -0
- package/dist/chunks/detection-1yb2c7hh.js +2 -0
- package/dist/chunks/{devtools-mt3vnaw3.js → devtools-10ba48t9.js} +1 -1
- package/dist/chunks/{diff-bcdc10jv.js → diff-05xxjeqc.js} +1 -1
- package/dist/chunks/doctor-hgwjdraj.js +2 -0
- package/dist/chunks/earlyInput-navj6cdn.js +2 -0
- package/dist/chunks/effort-a190c878.js +9 -0
- package/dist/chunks/executor-s42mdmqs.js +2 -0
- package/dist/chunks/exit-kyrjy6hb.js +2 -0
- package/dist/chunks/export-ct4sty4d.js +3 -0
- package/dist/chunks/extra-usage-noninteractive-byts9mme.js +2 -0
- package/dist/chunks/extra-usage-xh1mkrca.js +2 -0
- package/dist/chunks/fast-g4aa49jf.js +2 -0
- package/dist/chunks/feedback-m5r66qd5.js +2 -0
- package/dist/chunks/{files-fx3xz1bj.js → files-qrrrkjke.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-mthxtmgc.js +2 -0
- package/dist/chunks/gates-yhakv4vb.js +2 -0
- package/dist/chunks/git-c39vd9dm.js +2 -0
- package/dist/chunks/goal-24dr7fwz.js +2 -0
- package/dist/chunks/growthbook-f7ag30hy.js +2 -0
- package/dist/chunks/heapdump-16gnh3zm.js +7 -0
- package/dist/chunks/help-rgcakcxe.js +2 -0
- package/dist/chunks/hooks-8dh43zmv.js +2 -0
- package/dist/chunks/{hooks-7kspbr6v.js → hooks-c7fqwas5.js} +1 -1
- package/dist/chunks/{ide-5bsqkr23.js → ide-q83qr9cn.js} +1 -1
- package/dist/chunks/index-v875zpde.js +2 -0
- package/dist/chunks/initReplBridge-zfwxgpsm.js +2 -0
- package/dist/chunks/ink-vkxsn90v.js +2 -0
- package/dist/chunks/{insights-z9edzgf1.js → insights-4fwap4e5.js} +1 -1
- package/dist/chunks/install-7nxzmgp5.js +2 -0
- package/dist/chunks/{install-github-app-918fh4r2.js → install-github-app-djzea7r4.js} +1 -1
- package/dist/chunks/install-slack-app-3rde0k08.js +2 -0
- package/dist/chunks/{instrumentation-b8ysw74t.js → instrumentation-223qqr23.js} +1 -1
- package/dist/chunks/keybindings-6t5f69wx.js +3 -0
- package/dist/chunks/loadAgentsDir-f8shfnw3.js +2 -0
- package/dist/chunks/loadPluginHooks-mdwjrjtp.js +2 -0
- package/dist/chunks/login-34j3xdr9.js +2 -0
- package/dist/chunks/logout-yew8mymc.js +2 -0
- package/dist/chunks/{main-sqrzjvg9.js → main-0b8hyp8h.js} +79 -79
- package/dist/chunks/mcp-9enw5a8j.js +2 -0
- package/dist/chunks/mcp-fn4yrf5y.js +3 -0
- package/dist/chunks/{mcp-dqh1vtvf.js → mcp-yymqpmv6.js} +3 -3
- package/dist/chunks/mcpServer-60jg9v58.js +2 -0
- package/dist/chunks/mcpServer-85gt8ypc.js +2 -0
- package/dist/chunks/memory-kam5z1cw.js +4 -0
- package/dist/chunks/{mobile-9m41g9bp.js → mobile-7zsgawnb.js} +1 -1
- package/dist/chunks/model-03987182.js +2 -0
- package/dist/chunks/model-wbxx5kcd.js +3 -0
- package/dist/chunks/{oauth-98khjrd8.js → oauth-y0p2y1w5.js} +1 -1
- package/dist/chunks/{output-style-1h6b2zf8.js → output-style-x148mzhn.js} +1 -1
- package/dist/chunks/parser-4y4b0e6b.js +2 -0
- package/dist/chunks/passes-jrmjk5zk.js +2 -0
- package/dist/chunks/permissions-karmgb0m.js +4 -0
- package/dist/chunks/plan-w0beh9bh.js +2 -0
- package/dist/chunks/plugin-6nwptn3s.js +2 -0
- package/dist/chunks/pluginStartupCheck-0nzv1ae9.js +2 -0
- package/dist/chunks/{plugins-pe89pa7p.js → plugins-vvf897b4.js} +2 -2
- package/dist/chunks/{preauthorizedConfig-g0aq6f03.js → preauthorizedConfig-p02f23jb.js} +1 -1
- package/dist/chunks/{print-cjjnhg9d.js → print-krwpbp2j.js} +4 -4
- package/dist/chunks/privacy-settings-m0mfykh0.js +2 -0
- package/dist/chunks/process-26nny2p0.js +2 -0
- package/dist/chunks/processBashCommand-8fqgv2ec.js +2 -0
- package/dist/chunks/{processSlashCommand-6d8rnm8v.js → processSlashCommand-q32wy80b.js} +1 -1
- package/dist/chunks/prompt-gw1e1gef.js +2 -0
- package/dist/chunks/prompt-xgw2hxrc.js +2 -0
- package/dist/chunks/provider-prompt-s26vatcw.js +2 -0
- package/dist/chunks/rate-limit-options-rd4rjfv5.js +2 -0
- package/dist/chunks/registry-fp7x9ekd.js +2 -0
- package/dist/chunks/release-notes-76y1r2s1.js +6 -0
- package/dist/chunks/reload-plugins-z0fepkva.js +3 -0
- package/dist/chunks/remote-env-nn9ngr99.js +2 -0
- package/dist/chunks/remoteBridgeCore-cg7qd8m4.js +2 -0
- package/dist/chunks/rename-fdjzyjar.js +2 -0
- package/dist/chunks/resume-4rvj8jbz.js +3 -0
- package/dist/chunks/{rewind-cpv2pwfx.js → rewind-r4g5njsg.js} +1 -1
- package/dist/chunks/sandbox-adapter-craea9vm.js +2 -0
- package/dist/chunks/sandbox-toggle-620bkz9q.js +2 -0
- package/dist/chunks/session-5vm1vwv1.js +3 -0
- package/dist/chunks/sessionFileAccessHooks-5jbvwabj.js +2 -0
- package/dist/chunks/sessionStorage-ffkhmn5q.js +2 -0
- package/dist/chunks/settings-s2bcajs6.js +2 -0
- package/dist/chunks/setup-fwcttwbm.js +2 -0
- package/dist/chunks/setup-pf09nfsj.js +7 -0
- package/dist/chunks/{setup-mecsw2ye.js → setup-vegs56f5.js} +1 -1
- package/dist/chunks/sinks-wd4ccgbf.js +2 -0
- package/dist/chunks/skills-evga8f7n.js +2 -0
- package/dist/chunks/startupProfiler-x5zbs2j7.js +2 -0
- package/dist/chunks/state-qpmfrvsv.js +2 -0
- package/dist/chunks/{stats-3v0r4e1v.js → stats-mgqf6r7c.js} +1 -1
- package/dist/chunks/status-78yks3jw.js +2 -0
- package/dist/chunks/stickers-bdp8w2gr.js +2 -0
- package/dist/chunks/subprocessEnv-s797f06r.js +2 -0
- package/dist/chunks/{systemPromptSections-htbs443y.js → systemPromptSections-07y2z2wn.js} +1 -1
- package/dist/chunks/tag-gd73kstd.js +12 -0
- package/dist/chunks/tasks-63qaca0z.js +2 -0
- package/dist/chunks/{teamHelpers-dddedf19.js → teamHelpers-8ykc4bxa.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-ae9r29dy.js +2 -0
- package/dist/chunks/teleport-es58k4xz.js +2 -0
- package/dist/chunks/terminalSetup-gyh5z5e2.js +2 -0
- package/dist/chunks/theme-qrhbaht6.js +2 -0
- package/dist/chunks/thinkback-5bs7ezv5.js +2 -0
- package/dist/chunks/thinkback-play-1dy160y5.js +2 -0
- package/dist/chunks/toolSearch-6cv284b7.js +2 -0
- package/dist/chunks/trustedDevice-77ketbgg.js +2 -0
- package/dist/chunks/{ultrareviewCommand-jtmh2xb1.js → ultrareviewCommand-j23bjbf8.js} +1 -1
- package/dist/chunks/{update-mkzzbt54.js → update-w8wdxh3m.js} +1 -1
- package/dist/chunks/upgrade-nft7c1yk.js +2 -0
- package/dist/chunks/{upstreamproxy-hbbvxzb5.js → upstreamproxy-x405ef9p.js} +1 -1
- package/dist/chunks/usage-s5qgc615.js +2 -0
- package/dist/chunks/util-1geb93kp.js +2 -0
- package/dist/chunks/utils-6sb44pg8.js +2 -0
- package/dist/chunks/vim-kq91w44a.js +2 -0
- package/dist/chunks/worktree-0af6b1mt.js +2 -0
- package/dist/chunks/worktreeModeEnabled-ea6wb7aj.js +2 -0
- package/dist/cli.js +1 -1
- package/package.json +4 -1
- package/dist/chunks/App-skattzvx.js +0 -2
- package/dist/chunks/ApproveApiKey-1zk1g80v.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-4bd5a65d.js +0 -2
- package/dist/chunks/ClaudeInChromeOnboarding-jrj410t2.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-2bn5pwwr.js +0 -2
- package/dist/chunks/ConsoleOAuthFlow-8hn6958t.js +0 -2
- package/dist/chunks/Doctor-w0eqwfzb.js +0 -2
- package/dist/chunks/Grove-ygg0z9mr.js +0 -2
- package/dist/chunks/ITermBackend-ht0ds6se.js +0 -2
- package/dist/chunks/InvalidConfigDialog-h2jkde64.js +0 -2
- package/dist/chunks/InvalidSettingsDialog-3p7ehs0t.js +0 -2
- package/dist/chunks/Onboarding-np5yfyy1.js +0 -2
- package/dist/chunks/REPL-8811fta4.js +0 -2
- package/dist/chunks/ResumeConversation-d03pbgnw.js +0 -2
- package/dist/chunks/TeleportProgress-ghjbbh9h.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-hhcyekar.js +0 -2
- package/dist/chunks/TeleportResumeWrapper-66e7dnk5.js +0 -2
- package/dist/chunks/ToolSearchTool-dgwhh0gd.js +0 -2
- package/dist/chunks/TrustDialog-w9tj4t8r.js +0 -2
- package/dist/chunks/TungstenTool-7k2gt6pa.js +0 -2
- package/dist/chunks/add-dir-pg1rb88e.js +0 -2
- package/dist/chunks/agents-mcbqv3h3.js +0 -4
- package/dist/chunks/ant-claude-for-chrome-mcp-c765s2bt.js +0 -2
- package/dist/chunks/api-qvdz0vdp.js +0 -2
- package/dist/chunks/asciicast-ygqjzj6w.js +0 -2
- package/dist/chunks/auth-gkfrn4ga.js +0 -2
- package/dist/chunks/auth-y1hqesm6.js +0 -2
- package/dist/chunks/backgroundHousekeeping-wk8ne1wg.js +0 -2
- package/dist/chunks/branch-yre4hh7s.js +0 -5
- package/dist/chunks/btw-091q02sh.js +0 -2
- package/dist/chunks/buddy-5xd2vjhm.js +0 -2
- package/dist/chunks/caches-g4cc992y.js +0 -2
- package/dist/chunks/chrome-rd8crze6.js +0 -2
- package/dist/chunks/clear-25jzke5j.js +0 -2
- package/dist/chunks/cli-6hvqmebc.js +0 -3
- package/dist/chunks/cli-9hskw92e.js +0 -130
- package/dist/chunks/cli-avcnnw0n.js +0 -3
- package/dist/chunks/cli-e9pafjv1.js +0 -4
- package/dist/chunks/cli-gyp5wyzg.js +0 -3
- package/dist/chunks/cli-jbbxj53h.js +0 -3
- package/dist/chunks/cli-pbp5hza0.js +0 -3
- package/dist/chunks/cli-tzaj50bd.js +0 -3
- package/dist/chunks/cli-xzsc9n84.js +0 -3
- package/dist/chunks/cli-yv1znypb.js +0 -3
- package/dist/chunks/client-037bm52v.js +0 -2
- package/dist/chunks/color-ceqfke15.js +0 -2
- package/dist/chunks/commitAttribution-3ewwca68.js +0 -2
- package/dist/chunks/common-jn8w5r1w.js +0 -2
- package/dist/chunks/compact-631qpkbp.js +0 -4
- package/dist/chunks/config-6em7qq45.js +0 -2
- package/dist/chunks/config-h2e5ra49.js +0 -2
- package/dist/chunks/context-31c3znwn.js +0 -2
- package/dist/chunks/context-noninteractive-q418vz0p.js +0 -2
- package/dist/chunks/conversation-yz22h1cb.js +0 -2
- package/dist/chunks/cost-8rr9expn.js +0 -5
- package/dist/chunks/createSession-jratqxvc.js +0 -2
- package/dist/chunks/desktop-zq22ksq3.js +0 -2
- package/dist/chunks/detectRepository-djxyq37h.js +0 -2
- package/dist/chunks/detection-b18r43da.js +0 -2
- package/dist/chunks/doctor-cs43t62h.js +0 -2
- package/dist/chunks/earlyInput-361tx72y.js +0 -2
- package/dist/chunks/effort-qw83nert.js +0 -9
- package/dist/chunks/executor-rvxyyheh.js +0 -2
- package/dist/chunks/exit-kynz824m.js +0 -2
- package/dist/chunks/export-95j3srp6.js +0 -3
- package/dist/chunks/extra-usage-hxyp53v5.js +0 -2
- package/dist/chunks/extra-usage-noninteractive-53w28t1j.js +0 -2
- package/dist/chunks/fast-ec1hxnv7.js +0 -2
- package/dist/chunks/feedback-qtsk3t9f.js +0 -2
- package/dist/chunks/firstPartyEventLogger-4yfx731e.js +0 -2
- package/dist/chunks/gates-85t459a0.js +0 -2
- package/dist/chunks/git-e0mvprv8.js +0 -2
- package/dist/chunks/goal-ywc7exvv.js +0 -2
- package/dist/chunks/growthbook-ykj8089v.js +0 -2
- package/dist/chunks/heapdump-w6a13cfe.js +0 -7
- package/dist/chunks/help-enq1htxe.js +0 -2
- package/dist/chunks/hooks-wxm384wn.js +0 -2
- package/dist/chunks/initReplBridge-acrf7hyb.js +0 -2
- package/dist/chunks/ink-9vrw9yhe.js +0 -2
- package/dist/chunks/install-c8gv4wfg.js +0 -2
- package/dist/chunks/install-slack-app-1aqgxsb6.js +0 -2
- package/dist/chunks/keybindings-v92d2xht.js +0 -3
- package/dist/chunks/loadAgentsDir-k53rdwbr.js +0 -2
- package/dist/chunks/loadPluginHooks-rmzgs29p.js +0 -2
- package/dist/chunks/login-j9bz1g34.js +0 -2
- package/dist/chunks/logout-58wm6hsc.js +0 -2
- package/dist/chunks/mcp-z3j236hk.js +0 -3
- package/dist/chunks/mcp-zryxxcaz.js +0 -2
- package/dist/chunks/mcpServer-b2m7ewct.js +0 -2
- package/dist/chunks/mcpServer-xpq096r4.js +0 -2
- package/dist/chunks/memory-5tvqvktk.js +0 -4
- package/dist/chunks/model-cta1svwb.js +0 -3
- package/dist/chunks/model-d96jkka7.js +0 -2
- package/dist/chunks/parser-jpf6bfmz.js +0 -2
- package/dist/chunks/passes-reh6ja9j.js +0 -2
- package/dist/chunks/permissions-xgydmrq2.js +0 -4
- package/dist/chunks/plan-z4k8zj56.js +0 -2
- package/dist/chunks/plugin-0tztmcsg.js +0 -2
- package/dist/chunks/pluginStartupCheck-vxmkvt40.js +0 -2
- package/dist/chunks/privacy-settings-zbrc40a1.js +0 -2
- package/dist/chunks/process-msr26xa0.js +0 -2
- package/dist/chunks/processBashCommand-hnhy8brr.js +0 -2
- package/dist/chunks/prompt-cfaneybz.js +0 -2
- package/dist/chunks/prompt-wg6hfj0k.js +0 -2
- package/dist/chunks/provider-prompt-c8wew66t.js +0 -2
- package/dist/chunks/rate-limit-options-fyjqpxp3.js +0 -2
- package/dist/chunks/registry-ht9aazng.js +0 -2
- package/dist/chunks/release-notes-5v16zb9c.js +0 -6
- package/dist/chunks/reload-plugins-apyma8vs.js +0 -3
- package/dist/chunks/remote-env-p6ym55w6.js +0 -2
- package/dist/chunks/remoteBridgeCore-0v9x8112.js +0 -2
- package/dist/chunks/rename-j9rc9dwj.js +0 -2
- package/dist/chunks/resume-tbr3mkch.js +0 -3
- package/dist/chunks/sandbox-adapter-qh943bs4.js +0 -2
- package/dist/chunks/sandbox-toggle-1f70ejwk.js +0 -2
- package/dist/chunks/session-42zhjgd2.js +0 -3
- package/dist/chunks/sessionFileAccessHooks-1nh915er.js +0 -2
- package/dist/chunks/sessionStorage-j5m0nf55.js +0 -2
- package/dist/chunks/settings-c709knqg.js +0 -2
- package/dist/chunks/setup-0n2p20yw.js +0 -7
- package/dist/chunks/setup-2hqyyxff.js +0 -2
- package/dist/chunks/sinks-q6etaenz.js +0 -2
- package/dist/chunks/skills-xads3027.js +0 -2
- package/dist/chunks/startupProfiler-4wmjq0yd.js +0 -2
- package/dist/chunks/state-edaz98bj.js +0 -2
- package/dist/chunks/status-9rtty0ee.js +0 -2
- package/dist/chunks/stickers-m73qwecp.js +0 -2
- package/dist/chunks/subprocessEnv-rass28aq.js +0 -2
- package/dist/chunks/tag-vj93fgp6.js +0 -12
- package/dist/chunks/tasks-avbqta2s.js +0 -2
- package/dist/chunks/teammateModeSnapshot-32yfa4hf.js +0 -2
- package/dist/chunks/teleport-jw6w0rn4.js +0 -2
- package/dist/chunks/terminalSetup-ppt6v9xf.js +0 -2
- package/dist/chunks/theme-2csrfbca.js +0 -2
- package/dist/chunks/thinkback-2ahfejyt.js +0 -2
- package/dist/chunks/thinkback-play-kffa7rdp.js +0 -2
- package/dist/chunks/toolSearch-ptrcr8ec.js +0 -2
- package/dist/chunks/trustedDevice-xvtp79f1.js +0 -2
- package/dist/chunks/upgrade-c4argpvv.js +0 -2
- package/dist/chunks/usage-w30yajzy.js +0 -2
- package/dist/chunks/util-zkawe0w0.js +0 -2
- package/dist/chunks/utils-v86tf27x.js +0 -2
- package/dist/chunks/vim-3stm1kbg.js +0 -2
- package/dist/chunks/worktree-pbeayfjp.js +0 -2
- package/dist/chunks/worktreeModeEnabled-ysks760x.js +0 -2
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{f4 as M2,g4 as i6,h4 as V0,k4 as sX,m4 as k2,p4 as N6,r4 as WB}from"./cli-h5yfk29j.js";import{A4 as G9,G4 as bX,I4 as hX,K4 as pX,L4 as gX,T4 as oG,t4 as E6,u4 as sY,v4 as xY,w4 as u3,x4 as V9}from"./cli-v2hg35qk.js";import{Z4 as Fq,b5 as W1,c5 as R8}from"./cli-b1dptek2.js";import{k5 as s6}from"./cli-bthzmdgv.js";import{D5 as G3,F5 as E8,H5 as w9}from"./cli-tn47e131.js";import{I5 as O,J5 as b1}from"./cli-avcnnw0n.js";import{L5 as j0,M5 as L4,N5 as yX,O5 as SX,P5 as T2}from"./cli-1215h20m.js";import{R5 as IZ,S5 as V5}from"./cli-3je4vtx7.js";import{T5 as W4,U5 as d3}from"./cli-29078yxj.js";import{q6 as n0,v6 as G6}from"./cli-dx46fn1w.js";import{K6 as Y1,M6 as F8,_6 as v4,d7 as Mq,j7 as fX,w7 as k4}from"./cli-nj726gac.js";import{x7 as dJ,z7 as CV}from"./cli-ewts4g0p.js";import{A7 as K1,B7 as o7,C7 as r4,D7 as p1,E7 as h2}from"./cli-hpzy0mat.js";import{B8 as t,p8 as X$,q8 as eJ,r8 as W9,s8 as b4,w8 as D}from"./cli-3bxtq5dc.js";import{I8 as S0,J8 as h4}from"./cli-mx6xk0dw.js";import{S8 as oX,U8 as F,V8 as V1}from"./cli-s5epnnj5.js";import{b9 as sG,c9 as aG}from"./cli-3hwpymrd.js";import{d9 as t$,e9 as fB}from"./cli-wfqsfwa2.js";import{g9 as zQ,h9 as OW,k9 as r,l9 as DX,m9 as s,n9 as v$,o9 as j2}from"./cli-n3m134cf.js";import{q9 as s8,r9 as m3,s9 as P0,u9 as o9,v9 as s9,x9 as f,y9 as M0}from"./cli-shz2e0q5.js";import{$9 as A,G9 as O8,I9 as N7,N9 as y4,S9 as u1,T9 as c,U9 as W0,V9 as H1,X9 as m$,Z9 as H0,a_ as a,b_ as g6,c_ as b9,d_ as X0,e_ as e0,h_ as x,l_ as $1,o_ as J4,r_ as L,t_ as Y4,u_ as p}from"./cli-a98b285v.js";import{B_ as b,E_ as w,F_ as C4,G_ as C0,I_ as S2,L_ as g3,N_ as V3,O_ as j}from"./cli-1qszxdan.js";import{$_ as $J,Aba as Eq,Cba as Z$,Iba as oY,P_ as uY,Paa as u,Q_ as dY,Qaa as kX,R_ as cY,Rba as v2,S_ as lY,Saa as jX,T_ as nY,U_ as iY,V_ as I2,W_ as rY,Waa as FQ,Z$ as kQ,Z_ as n6,Zca as i,__ as m0,a$ as A0,c$ as vX,g$ as q1,h$ as E4,hba as m6,jba as u6,laa as cQ,nba as e9,oba as $Q,paa as P3,pba as JQ,qba as QQ,uaa as f2,vaa as u4}from"./cli-w754xmyv.js";import{_ca as rG,ada as AV,bda as H,cda as o}from"./cli-x514vyva.js";function K8($){let{buffer:J,bytesRead:Q}=x().readSync($,{length:4096});if(Q===0)return"utf8";if(Q>=2){if(J[0]===255&&J[1]===254)return"utf16le"}if(Q>=3&&J[0]===239&&J[1]===187&&J[2]===191)return"utf8";return"utf8"}function B8($){let J=0,Q=0;for(let Z=0;Z<$.length;Z++)if($[Z]===`
|
|
3
|
-
`)if(Z>0&&$[Z-1]==="\r")J++;else Q++;return J>Q?"CRLF":"LF"}function Q7($){let J=x(),{resolvedPath:Q,isSymlink:Z}=e0(J,$);if(Z)L(`Reading through symlink: ${$} -> ${Q}`);let X=K8(Q),q=J.readFileSync(Q,{encoding:X}),Y=B8(q.slice(0,4096));return{content:q.replaceAll(`\r
|
|
4
|
-
`,`
|
|
5
|
-
`),encoding:X,lineEndings:Y}}function k0($){return Q7($).content}var z2=H(()=>{p();$1()});import{join as Z7}from"path";function FL($){x2=$}function zL(){x2=null,L8=void 0}function xL($){return L8=$,$}function q7(){return Z7(b(),X7)}function Y7(){try{let $=k0(q7()),J=a(M2($));if(!J||typeof J!=="object"||Array.isArray(J))return null;return J}catch{return null}}function P4(){if(L8!==!0)return null;if(x2)return x2;let $=Y7();if($)return x2=$,I2(),$;return null}var X7="remote-settings.json",x2=null,L8;var r6=H(()=>{j();z2();i6();n6();X0()});function H8(){return process.env.USER_TYPE==="ant"?w(process.env.ENABLE_GROWTHBOOK_DEV)?"":"":""}var o6=H(()=>{j()});import W7 from"lodash-es/memoize.js";import{homedir as V7}from"os";import{isAbsolute as G7,join as A4,normalize as U8,sep as a6}from"path";function fL(){let $=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(w($))return!1;if(C4($))return!0;if(w(process.env.CLAUDE_CODE_SIMPLE))return!1;if(w(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let J=N0();if(J.autoMemoryEnabled!==void 0)return J.autoMemoryEnabled;return!0}function K7(){if(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR;return b()}function t6($,J){if(!$)return;let Q=$;if(J&&(Q.startsWith("~/")||Q.startsWith("~\\"))){let X=Q.slice(2),q=U8(X||".");if(q==="."||q==="..")return;Q=A4(V7(),X)}let Z=U8(Q).replace(/[/\\]+$/,"");if(!G7(Z)||Z.length<3||/^[A-Za-z]:$/.test(Z)||Z.startsWith("\\\\")||Z.startsWith("//")||Z.includes("\x00"))return;return(Z+a6).normalize("NFC")}function e6(){return t6(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function H7(){let $=S("policySettings")?.autoMemoryDirectory??S("flagSettings")?.autoMemoryDirectory??S("localSettings")?.autoMemoryDirectory??S("userSettings")?.autoMemoryDirectory;return t6($,!0)}function bL(){return e6()!==void 0}function U7(){return v4(E4())??E4()}function J9(){return A4($9(),L7)}function hL($){return U8($).startsWith($9())}var B7="memory",L7="MEMORY.md",$9;var Q9=H(()=>{i();Q1();j();k4();R8();J1();$9=W7(()=>{let $=e6()??H7();if($)return $;let J=A4(K7(),"projects");return(A4(J,s6(U7()),B7)+a6).normalize("NFC")},()=>E4())});import Z9 from"lodash-es/memoize.js";import{join as R7}from"path";var Z1,P2;var j4=H(()=>{T2();Z1=Z9(function(){if(process.env.USER_TYPE==="ant"&&process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH)return process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH;switch(j0()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}}),P2=Z9(function(){return R7(Z1(),"managed-settings.d")})});var w7,_7,cL;var X9=H(()=>{w7=["auto","iterm2","iterm2_with_bell","terminal_bell","kitty","ghostty","notifications_disabled"],_7=["normal","vim"],cL=["auto","tmux","in-process"]});import{randomBytes as F7}from"crypto";import{unwatchFile as z7,watchFile as x7}from"fs";import I7 from"lodash-es/memoize.js";import K9 from"lodash-es/pickBy.js";import{basename as z8,dirname as x8,join as Y0,resolve as A2}from"path";function y0(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:"dark",preferredNotifChannel:"auto",verbose:!1,editorMode:"normal",autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:"auto",customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:60000,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},cachedGrowthBookFeatures:{},respectGitignore:!0,copyFullResponse:!1}}function _H($){return M7.includes($)}function NH(){B9=!1}function e(){return B9||=P7()}function P7(){if(v2())return!0;let $=I(),J=P8();if($.projects?.[J]?.hasTrustDialogAccepted)return!0;let Z=W1(S0());while(!0){if($.projects?.[Z]?.hasTrustDialogAccepted)return!0;let q=W1(A2(Z,".."));if(q===Z)break;Z=q}return!1}function DH($){let J=I(),Q=W1(A2($));while(!0){if(J.projects?.[Q]?.hasTrustDialogAccepted)return!0;let Z=W1(A2(Q,".."));if(Z===Q)return!1;Q=Z}}function zH($){return T7.includes($)}function g4($){let J=I0.config;if(!J)return!1;let Q=J.oauthAccount!==void 0&&$.oauthAccount===void 0,Z=J.hasCompletedOnboarding===!0&&$.hasCompletedOnboarding!==!0;return Q||Z}function n($){let J=null;try{if(H9(r(),y0,(Z)=>{let X=$(Z);if(X===Z)return Z;return J={...X,projects:q9(Z.projects)},J})&&J)f4(J)}catch(Q){L(`Failed to save config with lock: ${Q}`,{level:"error"});let Z=M1(r(),y0);if(g4(Z)){L("saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.",{level:"error"}),F("tengu_config_auth_loss_prevented",{});return}let X=$(Z);if(X===Z)return;J={...X,projects:q9(Z.projects)},L9(r(),J,I8),f4(J)}}function xH(){return M8}function E7(){let $=E2+S4;if($>0)F("tengu_config_cache_stats",{cache_hits:E2,cache_misses:S4,hit_rate:E2/$});E2=0,S4=0}function N8($){if($.installMethod!==void 0)return $;let J=$,Q="unknown",Z=$.autoUpdates??!0;switch(J.autoUpdaterStatus){case"migrated":Q="local";break;case"installed":Q="native";break;case"disabled":Z=!1;break;case"enabled":case"no_permissions":case"not_configured":Q="global";break;case void 0:break}return{...$,installMethod:Q,autoUpdates:Z}}function q9($){if(!$)return $;let J={},Q=!1;for(let[Z,X]of Object.entries($)){let q=X;if(q.history!==void 0){Q=!0;let{history:Y,...W}=q;J[Z]=W}else J[Z]=X}return Q?J:$}function C7(){if(_8)return;_8=!0;let $=r();x7($,{interval:A7,persistent:!1},(J)=>{if(J.mtimeMs<=I0.mtime)return;x().readFile($,{encoding:"utf-8"}).then((Q)=>{if(J.mtimeMs<=I0.mtime)return;let Z=V0(M2(Q));if(Z===null||typeof Z!=="object")return;I0={config:N8({...y0(),...Z}),mtime:J.mtimeMs},X1={mtime:J.mtimeMs,size:J.size}}).catch(()=>{})}),O8(async()=>{z7($),_8=!1})}function f4($){I0={config:$,mtime:Date.now()},X1=null}function I(){if(I0.config)return E2++,I0.config;S4++;try{let $=null;try{$=x().statSync(r())}catch{}let J=N8(M1(r(),y0));return I0={config:J,mtime:$?.mtimeMs??Date.now()},X1=$?{mtime:$.mtimeMs,size:$.size}:null,C7(),J}catch{return N8(M1(r(),y0))}}function MH(){let $=I().remoteControlAtStartup;if($!==void 0)return $;return!1}function TH($){let J=I();if(J.customApiKeyResponses?.approved?.includes($))return"approved";if(J.customApiKeyResponses?.rejected?.includes($))return"rejected";return"new"}function L9($,J,Q){let Z=x8($);x().mkdirSync(Z);let q=K9(J,(Y,W)=>A(Y)!==A(Q[W]));if(i1($,A(q,null,2),{encoding:"utf-8",mode:384}),$===r())M8++}function H9($,J,Q){let Z=J(),X=x8($),q=x();q.mkdirSync(X);let Y;try{let W=`${$}.lock`,K=Date.now();Y=V9($,{lockfilePath:W,onCompromised:(_)=>{L(`Config lock compromised: ${_}`,{level:"error"})}});let B=Date.now()-K;if(B>100)L("Lock acquisition took longer than expected - another Claude instance may be running"),F("tengu_config_lock_contention",{lock_time_ms:B});if(X1&&$===r())try{let _=q.statSync($);if(_.mtimeMs!==X1.mtime||_.size!==X1.size)F("tengu_config_stale_write",{read_mtime:X1.mtime,write_mtime:_.mtimeMs,read_size:X1.size,write_size:_.size})}catch(_){if(W0(_)!=="ENOENT")throw _}let R=M1($,J);if($===r()&&g4(R))return L("saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.",{level:"error"}),F("tengu_config_auth_loss_prevented",{}),!1;let U=Q(R);if(U===R)return!1;let z=K9(U,(_,T)=>A(_)!==A(Z[T]));try{let _=z8($),T=T8();try{q.mkdirSync(T)}catch(h){if(W0(h)!=="EEXIST")throw h}let v=60000,F1=q.readdirStringSync(T).filter((h)=>h.startsWith(`${_}.backup.`)).sort().reverse(),z1=F1[0],F2=z1?Number(z1.split(".backup.").pop()):0,x1=Number.isNaN(F2)||Date.now()-F2>=v;if(x1){let h=Y0(T,`${_}.backup.${Date.now()}`);q.copyFileSync($,h)}let V8=5,I1=x1?q.readdirStringSync(T).filter((h)=>h.startsWith(`${_}.backup.`)).sort().reverse():F1;for(let h of I1.slice(V8))try{q.unlinkSync(Y0(T,h))}catch{}}catch(_){if(W0(_)!=="ENOENT")L(`Failed to backup config: ${_}`,{level:"error"})}if(i1($,A(z,null,2),{encoding:"utf-8",mode:384}),$===r())M8++;return!0}finally{if(Y)Y()}}function PH(){if(D8)return;let $=Date.now();Y1("info","enable_configs_started"),D8=!0,M1(r(),y0,!0),Y1("info","enable_configs_completed",{duration_ms:Date.now()-$})}function T8(){return Y0(b(),"backups")}function Y9($){let J=x(),Q=z8($),Z=T8();try{let Y=J.readdirStringSync(Z).filter((W)=>W.startsWith(`${Q}.backup.`)).sort().at(-1);if(Y)return Y0(Z,Y)}catch{}let X=x8($);try{let Y=J.readdirStringSync(X).filter((K)=>K.startsWith(`${Q}.backup.`)).sort().at(-1);if(Y)return Y0(X,Y);let W=`${$}.backup`;try{return J.statSync(W),W}catch{}}catch{}return null}function M1($,J,Q){if(!D8)throw Error("Config accessed before allowed.");let Z=x();try{let X=Z.readFileSync($,{encoding:"utf-8"});try{let q=a(M2(X));return{...J(),...q}}catch(q){let Y=q instanceof Error?q.message:String(q);throw new y4(Y,$,J())}}catch(X){if(W0(X)==="ENOENT"){let Y=Y9($);if(Y)process.stderr.write(`
|
|
6
|
-
Claude configuration file not found at: ${$}
|
|
7
|
-
A backup file exists at: ${Y}
|
|
8
|
-
You can manually restore it by running: cp "${Y}" "${$}"
|
|
9
|
-
|
|
10
|
-
`);return J()}if(X instanceof y4&&Q)throw X;if(X instanceof y4){if(L(`Config file corrupted, resetting to defaults: ${X.message}`,{level:"error"}),!w8){w8=!0;try{D(X);let _=!1;try{Z.statSync(`${$}.backup`),_=!0}catch{}F("tengu_config_parse_error",{has_backup:_})}finally{w8=!1}}process.stderr.write(`
|
|
11
|
-
Claude configuration file at ${$} is corrupted: ${X.message}
|
|
12
|
-
`);let Y=z8($),W=T8();try{Z.mkdirSync(W)}catch(_){if(W0(_)!=="EEXIST")throw _}let K=Z.readdirStringSync(W).filter((_)=>_.startsWith(`${Y}.corrupted.`)),B,R=!1,U=Z.readFileSync($,{encoding:"utf-8"});for(let _ of K)try{let T=Z.readFileSync(Y0(W,_),{encoding:"utf-8"});if(U===T){R=!0;break}}catch{}if(!R){B=Y0(W,`${Y}.corrupted.${Date.now()}`);try{Z.copyFileSync($,B),L(`Corrupted config backed up to: ${B}`,{level:"error"})}catch{}}let z=Y9($);if(B)process.stderr.write(`The corrupted file has been backed up to: ${B}
|
|
13
|
-
`);else if(R)process.stderr.write(`The corrupted file has already been backed up.
|
|
14
|
-
`);if(z)process.stderr.write(`A backup file exists at: ${z}
|
|
15
|
-
You can manually restore it by running: cp "${z}" "${$}"
|
|
16
|
-
|
|
17
|
-
`);else process.stderr.write(`
|
|
18
|
-
`)}return J()}}function v7($){let J=v4($);if(J)return W1(J);return W1(A2($))}function EH($){let J=P8($),Q=I();if(!Q.projects)return C2;let Z=Q.projects[J]??C2;if(typeof Z.allowedTools==="string")Z.allowedTools=V0(Z.allowedTools)??[];return Z}function AH($,J){let Q=P8(J),Z=null;try{if(H9(r(),y0,(q)=>{let Y=q.projects?.[Q]??C2,W=$(Y);if(W===Y)return q;return Z={...q,projects:{...q.projects,[Q]:W}},Z})&&Z)f4(Z)}catch(X){L(`Failed to save config with lock: ${X}`,{level:"error"});let q=M1(r(),y0);if(g4(q)){L("saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.",{level:"error"}),F("tengu_config_auth_loss_prevented",{});return}let Y=q.projects?.[Q]??C2,W=$(Y);if(W===Y)return;Z={...q,projects:{...q.projects,[Q]:W}},L9(r(),Z,I8),f4(Z)}}function k7(){return j7()!==null}function CH(){return k7()&&!w(process.env.FORCE_AUTOUPDATE_PLUGINS)}function vH($){switch($.type){case"development":return"development build";case"env":return`${$.envVar} set`;case"config":return"config"}}function j7(){return{type:"development"}}function y2(){let $=I();if($.userID)return $.userID;let J=F7(32).toString("hex");return n((Q)=>({...Q,userID:J})),J}function kH(){if(!I().firstStartTime){let J=new Date().toISOString();n((Q)=>({...Q,firstStartTime:Q.firstStartTime??J}))}}function jH($){let J=q1();switch($){case"User":return Y0(b(),"CLAUDE.md");case"Local":return Y0(J,"CLAUDE.local.md");case"Project":return Y0(J,"CLAUDE.md");case"Managed":return Y0(Z1(),"CLAUDE.md");case"AutoMem":return J9()}return""}function yH(){return Y0(Z1(),".claude","rules")}function SH(){return Y0(b(),"rules")}function hH($){I0.config=$,I0.mtime=$?Date.now():0}var w8=!1,C2,I8,M7,T7,B9=!1,OH,FH,I0,X1=null,E2=0,S4=0,M8=0,IH=20,A7=1000,_8=!1,D8=!1,P8,fH,bH;var D0=H(()=>{i();Q9();V1();h4();N7();p();F8();j2();j();H0();p4();$1();k4();k2();i6();G9();t();R8();b4();j4();X0();X9();C2={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1};I8=y0(),M7=["apiKeyHelper","installMethod","autoUpdates","autoUpdatesProtectedForNative","theme","verbose","preferredNotifChannel","shiftEnterKeyBindingInstalled","editorMode","hasUsedBackslashReturn","autoCompactEnabled","showTurnDuration","diffTool","env","tipsHistory","todoFeatureEnabled","showExpandedTodos","messageIdleNotifThresholdMs","autoConnectIde","autoInstallIdeExtension","fileCheckpointingEnabled","terminalProgressBarEnabled","showStatusInTerminalTab","taskCompleteNotifEnabled","inputNeededNotifEnabled","agentPushNotifEnabled","respectGitignore","claudeInChromeDefaultEnabled","hasCompletedClaudeInChromeOnboarding","lspRecommendationDisabled","lspRecommendationNeverPlugins","lspRecommendationIgnoredCount","copyFullResponse","copyOnSelect","permissionExplainerEnabled","prStatusFooterEnabled","remoteControlAtStartup","remoteDialogSeen"];T7=["allowedTools","hasTrustDialogAccepted","hasCompletedProjectOnboarding"];OH={...I8,autoUpdates:!1},FH={...C2};I0={config:null,mtime:0};O8(async()=>{E7()});P8=I7(($)=>v7($??q1()),($)=>W1(A2($??q1())));fH=M1,bH=g4});function U9($){let J=[],Q=!1;async function Z(){if(Q)return;if(J.length===0)return;Q=!0;while(J.length>0){let{args:X,resolve:q,reject:Y,context:W}=J.shift();try{let K=await $.apply(W,X);q(K)}catch(K){Y(K)}}if(Q=!1,J.length>0)Z()}return function(...X){return new Promise((q,Y)=>{J.push({args:X,resolve:q,reject:Y,context:this}),Z()})}}var R9=()=>{};import _9 from"lodash-es/memoize.js";function D9($,J){return $.find((Q)=>Q.includes(J))??null}async function O9(){let{BedrockClient:$}=await import("@aws-sdk/client-bedrock"),J=S2(),Q=w(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),Z={region:J,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await E8(),...Q&&{requestHandler:new(await import("@smithy/node-http-handler")).NodeHttpHandler,httpAuthSchemes:[{schemeId:"smithy.api#noAuth",identityProvider:()=>async()=>({}),signer:new(await import("@smithy/core")).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:"smithy.api#noAuth"}]}};if(!Q&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let X=await G1();if(X)Z.credentials={accessKeyId:X.accessKeyId,secretAccessKey:X.secretAccessKey,sessionToken:X.sessionToken}}return new $(Z)}async function iH(){let{BedrockRuntimeClient:$}=await import("@aws-sdk/client-bedrock-runtime"),J=S2(),Q=w(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),Z={region:J,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await E8(),...Q&&{requestHandler:new(await import("@smithy/node-http-handler")).NodeHttpHandler,httpAuthSchemes:[{schemeId:"smithy.api#noAuth",identityProvider:()=>async()=>({}),signer:new(await import("@smithy/core")).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:"smithy.api#noAuth"}]}};if(!Q&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let X=await G1();if(X)Z.credentials={accessKeyId:X.accessKeyId,secretAccessKey:X.secretAccessKey,sessionToken:X.sessionToken}}return new $(Z)}function y7($){return $.startsWith("anthropic.")}function f7($){if(!$.startsWith("arn:"))return $;let J=$.lastIndexOf("/");if(J===-1)return $;return $.substring(J+1)}function b7($){let J=f7($);for(let Q of S7)if(J.startsWith(`${Q}.anthropic.`))return Q;return}function oH($,J){let Q=b7($);if(Q)return $.replace(`${Q}.`,`${J}.`);if(y7($))return`${J}.${$}`;return $}var N9,rH,S7;var F9=H(()=>{$0();j();t();w9();N9=_9(async function(){let[$,{ListInferenceProfilesCommand:J}]=await Promise.all([O9(),import("@aws-sdk/client-bedrock")]),Q=[],Z;try{do{let X=new J({...Z&&{nextToken:Z},typeEquals:"SYSTEM_DEFINED"}),q=await $.send(X);if(q.inferenceProfileSummaries)Q.push(...q.inferenceProfileSummaries);Z=q.nextToken}while(Z);return Q.filter((X)=>X.inferenceProfileId?.includes("anthropic")).map((X)=>X.inferenceProfileId).filter(Boolean)}catch(X){throw D(X),X}});rH=_9(async function($){try{let[J,{GetInferenceProfileCommand:Q}]=await Promise.all([O9(),import("@aws-sdk/client-bedrock")]),Z=new Q({inferenceProfileIdentifier:$}),X=await J.send(Z);if(!X.models||X.models.length===0)return null;let q=X.models[0];if(!q?.modelArn)return null;let Y=q.modelArn.lastIndexOf("/");return Y>=0?q.modelArn.substring(Y+1):q.modelArn}catch(J){return D(J),null}});S7=["us","eu","apac","global"]});var A8,C8,v8,k8,j8,y8,S8,f8,b8,m4,h8,h7,p7,g7,r1,aH,z9;var p8=H(()=>{A8={firstParty:"claude-3-7-sonnet-20250219",bedrock:"us.anthropic.claude-3-7-sonnet-20250219-v1:0",vertex:"claude-3-7-sonnet@20250219",foundry:"claude-3-7-sonnet",azureOpenAI:"claude-3-7-sonnet-20250219"},C8={firstParty:"claude-3-5-sonnet-20241022",bedrock:"anthropic.claude-3-5-sonnet-20241022-v2:0",vertex:"claude-3-5-sonnet-v2@20241022",foundry:"claude-3-5-sonnet",azureOpenAI:"claude-3-5-sonnet-20241022"},v8={firstParty:"claude-3-5-haiku-20241022",bedrock:"us.anthropic.claude-3-5-haiku-20241022-v1:0",vertex:"claude-3-5-haiku@20241022",foundry:"claude-3-5-haiku",azureOpenAI:"claude-3-5-haiku-20241022"},k8={firstParty:"claude-haiku-4-5-20251001",bedrock:"us.anthropic.claude-haiku-4-5-20251001-v1:0",vertex:"claude-haiku-4-5@20251001",foundry:"claude-haiku-4-5",azureOpenAI:"claude-haiku-4-5-20251001"},j8={firstParty:"claude-sonnet-4-20250514",bedrock:"us.anthropic.claude-sonnet-4-20250514-v1:0",vertex:"claude-sonnet-4@20250514",foundry:"claude-sonnet-4",azureOpenAI:"claude-sonnet-4-20250514"},y8={firstParty:"claude-sonnet-4-5-20250929",bedrock:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",vertex:"claude-sonnet-4-5@20250929",foundry:"claude-sonnet-4-5",azureOpenAI:"claude-sonnet-4-5-20250929"},S8={firstParty:"claude-opus-4-20250514",bedrock:"us.anthropic.claude-opus-4-20250514-v1:0",vertex:"claude-opus-4@20250514",foundry:"claude-opus-4",azureOpenAI:"claude-opus-4-20250514"},f8={firstParty:"claude-opus-4-1-20250805",bedrock:"us.anthropic.claude-opus-4-1-20250805-v1:0",vertex:"claude-opus-4-1@20250805",foundry:"claude-opus-4-1",azureOpenAI:"claude-opus-4-1-20250805"},b8={firstParty:"claude-opus-4-5-20251101",bedrock:"us.anthropic.claude-opus-4-5-20251101-v1:0",vertex:"claude-opus-4-5@20251101",foundry:"claude-opus-4-5",azureOpenAI:"claude-opus-4-5-20251101"},m4={firstParty:"claude-opus-4-7",bedrock:"us.anthropic.claude-opus-4-7-v1",vertex:"claude-opus-4-7",foundry:"claude-opus-4-7",azureOpenAI:"claude-opus-4-7"},h8={firstParty:"claude-sonnet-4-6",bedrock:"us.anthropic.claude-sonnet-4-6",vertex:"claude-sonnet-4-6",foundry:"claude-sonnet-4-6",azureOpenAI:"claude-sonnet-4-6"},h7={firstParty:"gpt-5.2-codex",bedrock:"gpt-5.2-codex",vertex:"gpt-5.2-codex",foundry:"gpt-5.2-codex",azureOpenAI:"gpt-5.2-codex"},p7={firstParty:"gpt-5.3-codex",bedrock:"gpt-5.3-codex",vertex:"gpt-5.3-codex",foundry:"gpt-5.3-codex",azureOpenAI:"gpt-5.3-codex"},g7={firstParty:"gpt-5.4-codex",bedrock:"gpt-5.4-codex",vertex:"gpt-5.4-codex",foundry:"gpt-5.4-codex",azureOpenAI:"gpt-5.4-codex"},r1={haiku35:v8,haiku45:k8,sonnet35:C8,sonnet37:A8,sonnet40:j8,sonnet45:y8,sonnet46:h8,opus40:S8,opus41:f8,opus45:b8,opus46:m4,gpt52codex:h7,gpt53codex:p7,gpt54codex:g7},aH=Object.values(r1).map(($)=>$.firstParty),z9=Object.fromEntries(Object.entries(r1).map(([$,J])=>[J.firstParty,$]))});function P(){return w(process.env.CLAUDE_CODE_USE_BEDROCK)?"bedrock":w(process.env.CLAUDE_CODE_USE_VERTEX)?"vertex":w(process.env.CLAUDE_CODE_USE_FOUNDRY)?"foundry":w(process.env.CLAUDE_CODE_USE_AZURE_OPENAI)?"azureOpenAI":"firstParty"}function $U(){return P()}function f0(){let $=process.env.ANTHROPIC_BASE_URL;if(!$)return!0;try{let J=new URL($).host,Q=["api.anthropic.com"];if(process.env.USER_TYPE==="ant")Q.push("api-staging.anthropic.com");return Q.includes(J)}catch{return!1}}var b0=H(()=>{j()});function d4($){let J={};for(let Q of I9)J[Q]=r1[Q][$];return J}async function m7(){let $=d4("bedrock"),J;try{J=await N9()}catch(Z){return D(Z),$}if(!J?.length)return $;let Q={};for(let Z of I9){let X=r1[Z].firstParty;Q[Z]=D9(J,X)||$[Z]}return Q}function x9($){let J=N0().modelOverrides;if(!J)return $;let Q={...$};for(let[Z,X]of Object.entries(J)){let q=z9[Z];if(q&&X)Q[q]=X}return Q}function c4($){let J;try{J=N0().modelOverrides}catch{return $}if(!J)return $;for(let[Q,Z]of Object.entries(J))if(Z===$)return Q;return $}function u7(){if(f2()!==null)return;if(P()!=="bedrock"){u4(d4(P()));return}M9()}function k(){let $=f2();if($===null)return u7(),x9(d4(P()));return x9($)}async function GU(){if(f2()!==null)return;if(P()!=="bedrock"){u4(d4(P()));return}await M9()}var I9,M9;var l4=H(()=>{i();t();R9();J1();F9();p8();b0();I9=Object.keys(r1);M9=U9(async()=>{if(f2()!==null)return;try{let $=await m7();u4($)}catch($){D($)}})});function UU(){if(w(process.env.DISABLE_COST_WARNINGS))return!1;if(y())return!1;let J=T1(),Q=U0()!==null;if(!J.hasToken&&!Q)return!1;let Z=I(),X=Z.oauthAccount?.organizationRole,q=Z.oauthAccount?.workspaceRole;if(!X||!q)return!1;return["admin","billing"].includes(X)||["workspace_admin","workspace_billing"].includes(q)}function T9($){g8=$}function RU(){if(g8!==null)return g8;if(!y())return!1;let $=d();if($==="max"||$==="pro")return!0;let Q=I().oauthAccount?.organizationRole;return!!Q&&["admin","billing","owner","primary_owner"].includes(Q)}var g8=null;var P9=H(()=>{$0();D0();j()});function NU(){if(process.env.USER_TYPE!=="ant")return null;if(process.env.CLAUDE_MOCK_HEADERLESS_429)return process.env.CLAUDE_MOCK_HEADERLESS_429;if(!s1)return null;return E9}function l7(){if(!s1||process.env.USER_TYPE!=="ant"||Object.keys(n4).length===0)return null;return n4}function n7(){n4={},c7=[],m8=null,i4=null,o1=null,E9=null,T9(null),s1=!1}function DU($){let J=l7();if(!J)return $;let Q=new globalThis.Headers($);return Object.entries(J).forEach(([Z,X])=>{if(X!==void 0)Q.set(Z,X)}),Q}function OU(){if(process.env.USER_TYPE!=="ant")return!1;return s1||Boolean(process.env.CLAUDE_MOCK_HEADERLESS_429)}function A9(){if(!s1||process.env.USER_TYPE!=="ant")return null;return m8||d7}function C9(){return s1&&m8!==null&&process.env.USER_TYPE==="ant"}function FU(){return i4!==null}function zU($){if(i4===null)return null;if(!$)return null;if(o1!==null&&Date.now()>=o1)return n7(),null;if(o1===null)o1=Date.now()+i4;let J=o1-Date.now(),Q={...n4};return Q["retry-after"]=String(Math.max(1,Math.ceil(J/1000))),Q}var n4,s1=!1,E9=null,m8=null,i4=null,o1=null,d7="max",c7;var v9=H(()=>{P9();n4={},c7=[]});function k9($,J){return{name:`${$.name}-with-${J.name}-fallback`,read(){let Q=$.read();if(Q!==null&&Q!==void 0)return Q;return J.read()||{}},async readAsync(){let Q=await $.readAsync();if(Q!==null&&Q!==void 0)return Q;return await J.readAsync()||{}},update(Q){let Z=$.read(),X=$.update(Q);if(X.success){if(Z===null)J.delete();return X}let q=J.update(Q);if(q.success){if(Z!==null)$.delete();return{success:!0,warning:q.warning}}return{success:!1}},delete(){let Q=$.delete(),Z=J.delete();return Q||Z}}}var j9=()=>{};import{createHash as i7}from"crypto";import{userInfo as r7}from"os";function G0($=""){let J=b(),Z=!process.env.CLAUDE_CONFIG_DIR?"":`-${i7("sha256").update(J).digest("hex").substring(0,8)}`;return`Claude Code${f().OAUTH_FILE_SUFFIX}${$}${Z}`}function h0(){try{return process.env.USER||r7().username}catch{return"claude-code-user"}}function p0(){g.cache={data:null,cachedAt:0},g.generation++,g.readInFlight=null}function y9($){if(g.cache.cachedAt!==0)return;let J=null;if($)try{J=JSON.parse($)}catch{return}g.cache={data:J,cachedAt:Date.now()}}var P1="-credentials",u8=30000,g;var b2=H(()=>{M0();j();g={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}});import{execaSync as d8}from"execa";async function a7(){try{let $=G0(P1),J=h0(),{stdout:Q,code:Z}=await r4("security",["find-generic-password","-a",J,"-w","-s",$],{useCwd:!1,preserveOutputOnError:!1});if(Z===0&&Q)return a(Q.trim())}catch($){}return null}function fU(){if(a1!==void 0)return a1;if(process.platform!=="darwin")return a1=!1,!1;try{a1=d8("security",["show-keychain-info"],{reject:!1,stdio:["ignore","pipe","pipe"]}).exitCode===36}catch{a1=!1}return a1}var s7=4032,S9,a1;var f9=H(()=>{p();h2();o7();X0();b2();S9={name:"keychain",read(){let $=g.cache;if(Date.now()-$.cachedAt<u8)return $.data;try{let J=G0(P1),Q=h0(),Z=K1(`security find-generic-password -a "${Q}" -w -s "${J}"`);if(Z){let X=a(Z);return g.cache={data:X,cachedAt:Date.now()},X}}catch(J){}if($.data!==null)return L("[keychain] read failed; serving stale cache",{level:"warn"}),g.cache={data:$.data,cachedAt:Date.now()},$.data;return g.cache={data:null,cachedAt:Date.now()},null},async readAsync(){let $=g.cache;if(Date.now()-$.cachedAt<u8)return $.data;if(g.readInFlight)return g.readInFlight;let J=g.generation,Q=a7().then((Z)=>{if(J===g.generation){if(Z===null&&$.data!==null)L("[keychain] readAsync failed; serving stale cache",{level:"warn"});let X=Z??$.data;return g.cache={data:X,cachedAt:Date.now()},g.readInFlight=null,X}return Z});return g.readInFlight=Q,Q},update($){p0();try{let J=G0(P1),Q=h0(),Z=A($),X=Buffer.from(Z,"utf-8").toString("hex"),q=`add-generic-password -U -a "${Q}" -s "${J}" -X "${X}"
|
|
19
|
-
`,Y;if(q.length<=s7)Y=d8("security",["-i"],{input:q,stdio:["pipe","pipe","pipe"],reject:!1});else L(`Keychain payload (${Z.length}B JSON) exceeds security -i stdin limit; using argv`,{level:"warn"}),Y=d8("security",["add-generic-password","-U","-a",Q,"-s",J,"-X",X],{stdio:["ignore","pipe","pipe"],reject:!1});if(Y.exitCode!==0)return{success:!1};return g.cache={data:$,cachedAt:Date.now()},{success:!0}}catch(J){return{success:!1}}},delete(){p0();try{let $=G0(P1),J=h0();return K1(`security delete-generic-password -a "${J}" -s "${$}"`),!0}catch($){return!1}}}});import{chmodSync as t7}from"fs";import{join as e7}from"path";function o4(){let $=b(),J=".credentials.json";return{storageDir:$,storagePath:e7($,".credentials.json")}}var c8;var h9=H(()=>{j();H0();$1();X0();c8={name:"plaintext",read(){let{storagePath:$}=o4();try{let J=x().readFileSync($,{encoding:"utf8"});return a(J)}catch{return null}},async readAsync(){let{storagePath:$}=o4();try{let J=await x().readFile($,{encoding:"utf8"});return a(J)}catch{return null}},update($){try{let{storageDir:J,storagePath:Q}=o4();try{x().mkdirSync(J)}catch(Z){if(W0(Z)!=="EEXIST")throw Z}return b9(Q,A($),{encoding:"utf8",flush:!1}),t7(Q,384),{success:!0,warning:"Warning: Storing credentials in plaintext."}}catch{return{success:!1}}},delete(){let{storagePath:$}=o4();try{return x().unlinkSync($),!0}catch(J){if(W0(J)==="ENOENT")return!0;return!1}}}});function T0(){if(process.platform==="darwin")return k9(S9,c8);return c8}var l8=H(()=>{j9();f9();h9()});import*as l from"fs";import*as p9 from"os";import*as t1 from"path";import $W from"lodash-es/memoize.js";function e1(){let $=process.env[JW]?.trim();return $?$:null}function m9(){let $=process.env.CLAUDE_CONFIG_DIR||t1.join(p9.homedir(),".claude");return t1.join($,"cc-haha")}function i8(){return t1.join(m9(),ZW)}function u9(){try{l.mkdirSync(m9(),{recursive:!0}),l.writeFileSync(i8(),`1
|
|
20
|
-
`,{mode:384})}catch($){D($)}}function XW(){try{l.rmSync(i8(),{force:!0})}catch($){if($.code!=="ENOENT")D($)}}function d9(){return l.existsSync(i8())}function c9($){if(!$||typeof $!=="object"||Array.isArray($))return null;let J=$;if(typeof J.accessToken!=="string"||typeof J.refreshToken!=="string"||typeof J.expiresAt!=="number")return null;return{accessToken:J.accessToken,refreshToken:J.refreshToken,expiresAt:J.expiresAt,...typeof J.idToken==="string"&&{idToken:J.idToken},...typeof J.accountId==="string"&&{accountId:J.accountId},...typeof J.email==="string"&&{email:J.email},...typeof J.clientId==="string"&&{clientId:J.clientId}}}function qW($=e1()){if(!$)return null;try{return c9(JSON.parse(l.readFileSync($,"utf-8")))}catch(J){if(J.code!=="ENOENT")D(J);return null}}async function YW($=e1()){if(!$)return null;try{let J=await l.promises.readFile($,"utf-8");return c9(JSON.parse(J))}catch(J){if(J.code!=="ENOENT")D(J);return null}}function WW($){let J=e1();if(!J)return!1;l.mkdirSync(t1.dirname(J),{recursive:!0});let Q=`${J}.tmp.${process.pid}.${Date.now()}`,Z=!1;try{return l.writeFileSync(Q,JSON.stringify($,null,2)+`
|
|
21
|
-
`,{mode:384}),l.renameSync(Q,J),Z=!0,!0}finally{if(!Z)try{l.rmSync(Q,{force:!0})}catch(X){if(X.code!=="ENOENT")D(X)}}}function s4($){try{if(WW($))return u9(),B1(),{success:!0};let J=T0(),Q=J.read()??{};Q[g9]=$;let Z=J.update(Q);if(Z.success)XW();return B1(),Z}catch(J){return D(J),{success:!1,warning:`Failed to save OpenAI OAuth tokens: ${c(J)}`}}}function p2(){let $=e1();return l9($?`${n8}${$}`:QW)}async function r8(){let $=e1();if($)return YW($);if(d9())return null;try{return(await T0().readAsync())?.openaiCodexOauth??null}catch(J){return D(J),null}}function B1(){l9.cache?.clear?.()}function n9(){try{let $=e1();if($)return l.rmSync($,{force:!0}),u9(),B1(),!0;let J=T0(),Q=J.read()??{};delete Q[g9];let Z=J.update(Q);return B1(),Z.success}catch($){return D($),!1}}var g9="openaiCodexOauth",JW="OPENAI_CODEX_OAUTH_FILE",QW="secure-storage",n8="file:",ZW="openai-oauth-file-backed",l9;var a4=H(()=>{l8();H0();t();l9=$W(($)=>{if($.startsWith(n8))return qW($.slice(n8.length));if(d9())return null;try{return T0().read()?.openaiCodexOauth??null}catch(J){return D(J),null}})});import i9 from"axios";async function qR(){let J=I().oauthAccount?.accountUuid,Q=U0();if(!J||!Q)return;let Z=`${f().BASE_API_URL}/api/claude_cli_profile`;try{return(await i9.get(Z,{headers:{"x-api-key":Q,"anthropic-beta":P0},params:{account_uuid:J},timeout:1e4})).data}catch(X){D(X)}}async function $2($){let J=`${f().BASE_API_URL}/api/oauth/profile`;try{return(await i9.get(J,{headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"},timeout:1e4})).data}catch(Q){D(Q)}}var o8=H(()=>{M0();$0();D0();t()});import g2 from"axios";function L1($){return Boolean($?.includes(s8))}function VW($){return $?.split(" ").filter(Boolean)??[]}function UR({codeChallenge:$,state:J,port:Q,isManual:Z,loginWithClaudeAi:X,inferenceOnly:q,orgUUID:Y,loginHint:W,loginMethod:K}){let B=X?f().CLAUDE_AI_AUTHORIZE_URL:f().CONSOLE_AUTHORIZE_URL,R=new URL(B);R.searchParams.append("code","true"),R.searchParams.append("client_id",f().CLIENT_ID),R.searchParams.append("response_type","code"),R.searchParams.append("redirect_uri",Z?f().MANUAL_REDIRECT_URL:`http://localhost:${Q}/callback`);let U=q?[s8]:s9;if(R.searchParams.append("scope",U.join(" ")),R.searchParams.append("code_challenge",$),R.searchParams.append("code_challenge_method","S256"),R.searchParams.append("state",J),Y)R.searchParams.append("orgUUID",Y);if(W)R.searchParams.append("login_hint",W);if(K)R.searchParams.append("login_method",K);return R.toString()}async function RR($,J,Q,Z,X=!1,q){let Y={grant_type:"authorization_code",code:$,redirect_uri:X?f().MANUAL_REDIRECT_URL:`http://localhost:${Z}/callback`,client_id:f().CLIENT_ID,code_verifier:Q,state:J};if(q!==void 0)Y.expires_in=q;let W=await g2.post(f().TOKEN_URL,Y,{headers:{"Content-Type":"application/json"},timeout:15000});if(W.status!==200)throw Error(W.status===401?"Authentication failed: Invalid authorization code":`Token exchange failed (${W.status}): ${W.statusText}`);return F("tengu_oauth_token_exchange_success",{}),W.data}async function a9($,{scopes:J}={}){let Q={grant_type:"refresh_token",refresh_token:$,client_id:f().CLIENT_ID,scope:((J?.length)?J:o9).join(" ")};try{let Z=await g2.post(f().TOKEN_URL,Q,{headers:{"Content-Type":"application/json"},timeout:15000});if(Z.status!==200)throw Error(`Token refresh failed: ${Z.statusText}`);let X=Z.data,{access_token:q,refresh_token:Y=$,expires_in:W}=X,K=Date.now()+W*1000,B=VW(X.scope);F("tengu_oauth_token_refresh_success",{});let R=I(),U=C(),_=R.oauthAccount?.billingType!==void 0&&R.oauthAccount?.accountCreatedAt!==void 0&&R.oauthAccount?.subscriptionCreatedAt!==void 0&&U?.subscriptionType!=null&&U?.rateLimitTier!=null?null:await GW(q);if(_&&R.oauthAccount){let T={};if(_.displayName!==void 0)T.displayName=_.displayName;if(typeof _.hasExtraUsageEnabled==="boolean")T.hasExtraUsageEnabled=_.hasExtraUsageEnabled;if(_.billingType!==null)T.billingType=_.billingType;if(_.accountCreatedAt!==void 0)T.accountCreatedAt=_.accountCreatedAt;if(_.subscriptionCreatedAt!==void 0)T.subscriptionCreatedAt=_.subscriptionCreatedAt;if(Object.keys(T).length>0)n((v)=>({...v,oauthAccount:v.oauthAccount?{...v.oauthAccount,...T}:v.oauthAccount}))}return{accessToken:q,refreshToken:Y,expiresAt:K,scopes:B,subscriptionType:_?.subscriptionType??U?.subscriptionType??null,rateLimitTier:_?.rateLimitTier??U?.rateLimitTier??null,profile:_?.rawProfile,tokenAccount:X.account?{uuid:X.account.uuid,emailAddress:X.account.email_address,organizationUuid:X.organization?.uuid}:void 0}}catch(Z){let X=g2.isAxiosError(Z)&&Z.response?.data?JSON.stringify(Z.response.data):void 0;throw F("tengu_oauth_token_refresh_failure",{error:Z.message,...X&&{responseBody:X}}),Z}}async function wR($){let J=await g2.get(f().ROLES_URL,{headers:{Authorization:`Bearer ${$}`}});if(J.status!==200)throw Error(`Failed to fetch user roles: ${J.statusText}`);let Q=J.data;if(!I().oauthAccount)throw Error("OAuth account information not found in config");n((X)=>({...X,oauthAccount:X.oauthAccount?{...X.oauthAccount,organizationRole:Q.organization_role,workspaceRole:Q.workspace_role,organizationName:Q.organization_name}:X.oauthAccount})),F("tengu_oauth_roles_stored",{org_role:Q.organization_role})}async function _R($){try{let J=await g2.post(f().API_KEY_URL,null,{headers:{Authorization:`Bearer ${$}`}}),Q=J.data?.raw_key;if(Q)return await a8(Q),F("tengu_oauth_api_key",{status:"success",statusCode:J.status}),Q;return null}catch(J){throw F("tengu_oauth_api_key",{status:"failure",error:J instanceof Error?J.message:String(J)}),J}}function E1($){if($===null)return!1;let J=300000;return Date.now()+J>=$}async function GW($){let J=await $2($),Q=J?.organization?.organization_type,Z=null;switch(Q){case"claude_max":Z="max";break;case"claude_pro":Z="pro";break;case"claude_enterprise":Z="enterprise";break;case"claude_team":Z="team";break;default:Z=null;break}let X={subscriptionType:Z,rateLimitTier:J?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:J?.organization?.has_extra_usage_enabled??null,billingType:J?.organization?.billing_type??null};if(J?.account?.display_name)X.displayName=J.account.display_name;if(J?.account?.created_at)X.accountCreatedAt=J.account.created_at;if(J?.organization?.subscription_created_at)X.subscriptionCreatedAt=J.organization.subscription_created_at;return F("tengu_oauth_profile_fetch_success",{}),{...X,rawProfile:J}}async function NR(){let J=I().oauthAccount?.organizationUuid;if(J)return J;let Q=C()?.accessToken;if(Q===void 0||!g0())return null;let X=(await $2(Q))?.organization?.uuid;if(!X)return null;return X}async function DR(){let $=process.env.CLAUDE_CODE_ACCOUNT_UUID,J=process.env.CLAUDE_CODE_USER_EMAIL,Q=process.env.CLAUDE_CODE_ORGANIZATION_UUID,Z=Boolean($&&J&&Q);if($&&J&&Q){if(!I().oauthAccount)r9({accountUuid:$,emailAddress:J,organizationUuid:Q})}await A1();let X=I();if(X.oauthAccount&&X.oauthAccount.billingType!==void 0&&X.oauthAccount.accountCreatedAt!==void 0&&X.oauthAccount.subscriptionCreatedAt!==void 0||!y()||!g0())return!1;let q=C();if(q?.accessToken){let Y=await $2(q.accessToken);if(Y){if(Z)L("OAuth profile fetch succeeded, overriding env var account info",{level:"info"});return r9({accountUuid:Y.account.uuid,emailAddress:Y.account.email,organizationUuid:Y.organization.uuid,displayName:Y.account.display_name||void 0,hasExtraUsageEnabled:Y.organization.has_extra_usage_enabled??!1,billingType:Y.organization.billing_type??void 0,accountCreatedAt:Y.account.created_at,subscriptionCreatedAt:Y.organization.subscription_created_at??void 0}),!0}}return!1}function r9({accountUuid:$,emailAddress:J,organizationUuid:Q,displayName:Z,hasExtraUsageEnabled:X,billingType:q,accountCreatedAt:Y,subscriptionCreatedAt:W}){let K={accountUuid:$,emailAddress:J,organizationUuid:Q,hasExtraUsageEnabled:X,billingType:q,accountCreatedAt:Y,subscriptionCreatedAt:W};if(Z)K.displayName=Z;n((B)=>{if(B.oauthAccount?.accountUuid===K.accountUuid&&B.oauthAccount?.emailAddress===K.emailAddress&&B.oauthAccount?.organizationUuid===K.organizationUuid&&B.oauthAccount?.displayName===K.displayName&&B.oauthAccount?.hasExtraUsageEnabled===K.hasExtraUsageEnabled&&B.oauthAccount?.billingType===K.billingType&&B.oauthAccount?.accountCreatedAt===K.accountCreatedAt&&B.oauthAccount?.subscriptionCreatedAt===K.subscriptionCreatedAt)return B;return{...B,oauthAccount:K}})}var t4=H(()=>{V1();M0();$0();D0();p();o8()});import{mkdirSync as KW,writeFileSync as BW}from"fs";function UW($,J,Q){if(!w(process.env.CLAUDE_CODE_REMOTE))return;try{KW(e4,{recursive:!0,mode:448}),BW($,J,{encoding:"utf8",mode:384}),L(`Persisted ${Q} to ${$} for subprocess access`)}catch(Z){L(`Failed to persist ${Q} to disk (non-fatal): ${c(Z)}`,{level:"error"})}}function t9($,J){try{let Z=x().readFileSync($,{encoding:"utf8"}).trim();if(!Z)return null;return L(`Read ${J} from well-known file ${$}`),Z}catch(Q){if(!H1(Q))L(`Failed to read ${J} from ${$}: ${c(Q)}`,{level:"debug"});return null}}function ZQ({envVar:$,wellKnownPath:J,label:Q,getCached:Z,setCached:X}){let q=Z();if(q!==void 0)return q;let Y=process.env[$];if(!Y){let K=t9(J,Q);return X(K),K}let W=parseInt(Y,10);if(Number.isNaN(W))return L(`${$} must be a valid file descriptor number, got: ${Y}`,{level:"error"}),X(null),null;try{let K=x(),B=process.platform==="darwin"||process.platform==="freebsd"?`/dev/fd/${W}`:`/proc/self/fd/${W}`,R=K.readFileSync(B,{encoding:"utf8"}).trim();if(!R)return L(`File descriptor contained empty ${Q}`,{level:"error"}),X(null),null;return L(`Successfully read ${Q} from file descriptor ${W}`),X(R),UW(J,R,Q),R}catch(K){L(`Failed to read ${Q} from file descriptor ${W}: ${c(K)}`,{level:"error"});let B=t9(J,Q);return X(B),B}}function $$(){return ZQ({envVar:"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",wellKnownPath:LW,label:"OAuth token",getCached:e9,setCached:$Q})}function t8(){return ZQ({envVar:"CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR",wellKnownPath:HW,label:"API key",getCached:JQ,setCached:QQ})}var e4="/home/claude/.claude/remote",LW,HW,PR;var XQ=H(()=>{i();p();j();H0();$1();LW=`${e4}/.oauth_token`,HW=`${e4}/.api_key`,PR=`${e4}/.session_ingress_token`});import{execa as RW}from"execa";async function qQ(){if(process.platform==="darwin"){let $=G0();if((await RW(`security delete-generic-password -a $USER -s "${$}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error("Failed to delete keychain entry")}}function J$($){return $.slice(-20)}var YQ=H(()=>{b2()});function jR($){return $?.name==="CredentialsProviderError"}function WQ($){if(!$||typeof $!=="object")return!1;let J=$;if(!J.Credentials||typeof J.Credentials!=="object")return!1;let Q=J.Credentials;return typeof Q.AccessKeyId==="string"&&typeof Q.SecretAccessKey==="string"&&typeof Q.SessionToken==="string"&&Q.AccessKeyId.length>0&&Q.SecretAccessKey.length>0&&Q.SessionToken.length>0}async function e8(){let{STSClient:$,GetCallerIdentityCommand:J}=await import("@aws-sdk/client-sts");await new $().send(new J({}))}async function VQ(){try{L("Clearing AWS credential provider cache");let{fromIni:$}=await import("@aws-sdk/credential-providers");await $({ignoreCache:!0})(),L("AWS credential provider cache refreshed")}catch($){L("Failed to clear AWS credential cache (this is expected if no credentials are configured)")}}var GQ=H(()=>{p()});class O0{static instance=null;status={isAuthenticating:!1,output:[]};changed=m0();static getInstance(){if(!O0.instance)O0.instance=new O0;return O0.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput($){this.status.output.push($),this.changed.emit(this.getStatus())}setError($){this.status.error=$,this.changed.emit(this.getStatus())}endAuthentication($){if($)this.status={isAuthenticating:!1,output:[]};else this.status.isAuthenticating=!1;this.changed.emit(this.getStatus())}subscribe=this.changed.subscribe;static reset(){if(O0.instance)O0.instance.changed.clear(),O0.instance=null}}var KQ=H(()=>{$J()});var Q$="claude-code-20250219",BQ="interleaved-thinking-2025-05-14",m2="context-1m-2025-08-07",LQ="context-management-2025-06-27",HQ="structured-outputs-2025-12-15",JJ="web-search-2025-03-05",UQ="advanced-tool-use-2025-11-20",RQ="tool-search-tool-2025-10-19",bR="effort-2025-11-24",hR="task-budgets-2026-03-13",wQ="prompt-caching-scope-2026-01-05",pR="fast-mode-2026-02-01",_Q="redact-thinking-2026-02-12",NQ="token-efficient-tools-2026-03-28",QJ="",gR="",J2,mR="advisor-tool-2026-03-01",ZJ,uR;var XJ=H(()=>{J2=process.env.USER_TYPE==="ant"?"cli-internal-2026-02-09":"",ZJ=new Set(["interleaved-thinking-2025-05-14","context-1m-2025-08-07","tool-search-tool-2025-10-19"]),uR=new Set(["claude-code-20250219","interleaved-thinking-2025-05-14","context-management-2025-06-27"])});function qJ($){let J=$.trim().toLowerCase();return J.startsWith("gpt-")||/^o\d/.test(J)}function C1($){if(process.env.OPENAI_CODEX_MODEL?.trim())return process.env.OPENAI_CODEX_MODEL.trim();let J=$.trim().toLowerCase();if(qJ(J))return $;if(J.includes("haiku"))return process.env.OPENAI_CODEX_HAIKU_MODEL?.trim()||"gpt-5.4-mini";if(J.includes("sonnet"))return process.env.OPENAI_CODEX_SONNET_MODEL?.trim()||"gpt-5.4";if(J.includes("opus"))return process.env.OPENAI_CODEX_OPUS_MODEL?.trim()||"gpt-5.3-codex";return"gpt-5.3-codex"}function YJ($){switch($.trim().toLowerCase()){case"gpt-5.3-codex":return"GPT-5.3 Codex";case"gpt-5.3-codex-spark":return"GPT-5.3 Codex Spark";case"gpt-5.5":return"GPT-5.5";case"gpt-5.4":return"GPT-5.4";case"gpt-5.4-mini":return"GPT-5.4 Mini";case"gpt-5.2":return"GPT-5.2";case"gpt-5.2-codex":return"GPT-5.2 Codex";case"gpt-5.1-codex":return"GPT-5.1 Codex";case"gpt-5.1-codex-max":return"GPT-5.1 Codex Max";case"gpt-5.1-codex-mini":return"GPT-5.1 Codex Mini";default:return null}}function DQ($){let J=$.trim().toLowerCase();if(J==="gpt-5.4"||J==="gpt-5.4-pro")return NW;if(J==="gpt-5.3-codex-spark")return DW;if(J==="gpt-5.5"||J==="gpt-5.5-pro"||J==="gpt-5.4-mini"||J==="gpt-5.4-nano"||J==="gpt-5.3-codex"||J==="gpt-5.2"||J==="gpt-5.2-codex"||J==="gpt-5.1"||J==="gpt-5.1-codex"||J==="gpt-5.1-codex-max"||J==="gpt-5.1-codex-mini"||J==="gpt-5-codex"||J==="gpt-5"||J==="gpt-5-mini"||J==="gpt-5-nano")return _W;return null}var cR="gpt-5.3-codex",lR="gpt-5.4",nR="gpt-5.4-mini",_W,NW,DW,iR;var u2=H(()=>{_W=Math.floor(258400),NW=Math.floor(950000),DW=Math.floor(121600),iR=[{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",description:"Best for coding and agentic work",descriptionForModel:"GPT-5.3 Codex - best for coding and agentic work"},{value:"gpt-5.4",label:"GPT-5.4",description:"Strong general-purpose model",descriptionForModel:"GPT-5.4 - strong general-purpose model"},{value:"gpt-5.5",label:"GPT-5.5",description:"Latest general-purpose model",descriptionForModel:"GPT-5.5 - latest general-purpose model"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Fastest for quick tasks",descriptionForModel:"GPT-5.4 Mini - fastest for quick tasks"}]});import WJ from"axios";function F0(){return!w(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function xQ(){if(!F0())return!1;return zW()===null}function FW($,J){switch($){case"free":return J==="oauth"?"Fast mode requires a paid subscription":"Fast mode unavailable during evaluation. Please purchase credits.";case"preference":return"Fast mode has been disabled by your organization";case"extra_usage_disabled":return"Fast mode requires extra usage billing \xB7 /extra-usage to enable";case"network_error":return"Fast mode unavailable due to network connectivity issues";case"unknown":return"Fast mode is currently unavailable"}}function zW(){if(!F0())return"Fast mode is not available";let $=q0("tengu_penguins_off",null);if($!==null)return L(`Fast mode unavailable: ${$}`),$;if(!zQ()&&q0("tengu_marble_sandcastle",!1))return"Fast mode requires the native binary \xB7 Install from: https://claude.com/product/claude-code";if(u()&&Z$()&&!FQ()){if(!S("flagSettings")?.fastMode)return L("Fast mode unavailable: Fast mode is not available in the Agent SDK"),"Fast mode is not available in the Agent SDK"}if(P()!=="firstParty")return L("Fast mode unavailable: Fast mode is not available on Bedrock, Vertex, or Foundry"),"Fast mode is not available on Bedrock, Vertex, or Foundry";if(J0.status==="disabled"){if(J0.reason==="network_error"||J0.reason==="unknown"){if(w(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null}let J=C()!==null?"oauth":"api-key",Q=FW(J0.reason,J);return L(`Fast mode unavailable: ${Q}`),Q}return null}function Bw(){return"opus"+(c2()?"[1m]":"")}function Lw($){if(!F0())return!1;if(!xQ())return!1;if(!IQ($))return!1;let J=N0();if(J.fastModePerSessionOptIn)return!1;return J.fastMode===!0}function IQ($){if(!F0())return!1;let J=$??v1();return K0(J).toLowerCase().includes("opus-4-6")}function xW(){if(Q2.status==="cooldown"&&Date.now()>=Q2.resetAt){if(F0()&&!VJ)L("Fast mode cooldown expired, re-enabling fast mode"),VJ=!0,TQ.emit();Q2={status:"active"}}return Q2}function Rw($,J){if(!F0())return;Q2={status:"cooldown",resetAt:$,reason:J},VJ=!1;let Q=$-Date.now();L(`Fast mode cooldown triggered (${J}), duration ${Math.round(Q/1000)}s`),F("tengu_fast_mode_fallback_triggered",{cooldown_duration_ms:Q,cooldown_reason:J}),MQ.emit($,J)}function ww(){Q2={status:"active"}}function _w(){if(J0.status==="disabled")return;J0={status:"disabled",reason:"preference"},q$("userSettings",{fastMode:void 0}),n(($)=>({...$,penguinModeOrgEnabled:!1})),GJ.emit(!1)}function IW($){switch($){case"out_of_credits":return"Fast mode disabled \xB7 extra usage credits exhausted";case"org_level_disabled":case"org_service_level_disabled":return"Fast mode disabled \xB7 extra usage disabled by your organization";case"org_level_disabled_until":return"Fast mode disabled \xB7 extra usage spending cap reached";case"member_level_disabled":return"Fast mode disabled \xB7 extra usage disabled for your account";case"seat_tier_level_disabled":case"seat_tier_zero_credit_limit":case"member_zero_credit_limit":return"Fast mode disabled \xB7 extra usage not available for your plan";case"overage_not_provisioned":case"no_limits_configured":return"Fast mode requires extra usage billing \xB7 /extra-usage to enable";default:return"Fast mode disabled \xB7 extra usage not available"}}function MW($){return $==="org_level_disabled_until"||$==="out_of_credits"}function Dw($){let J=IW($);if(L(`Fast mode overage rejection: ${$??"unknown"} \u2014 ${J}`),F("tengu_fast_mode_overage_rejected",{overage_disabled_reason:$??"unknown"}),!MW($))q$("userSettings",{fastMode:void 0}),n((Q)=>({...Q,penguinModeOrgEnabled:!1}));PQ.emit(J)}function TW(){return xW().status==="cooldown"}function Ow($,J){let Q=F0()&&xQ()&&!!J&&IQ($);if(Q&&TW())return"cooldown";if(Q)return"on";return"off"}async function PW($){let J=`${f().BASE_API_URL}/api/claude_code_penguin_mode`,Q="accessToken"in $?{Authorization:`Bearer ${$.accessToken}`,"anthropic-beta":P0}:{"x-api-key":$.apiKey};return(await WJ.get(J,{headers:Q})).data}function zw(){if(!F0())return;if(J0.status!=="pending")return;let $=process.env.USER_TYPE==="ant",J=I().penguinModeOrgEnabled===!0;J0=$||J?{status:"enabled"}:{status:"disabled",reason:"unknown"}}async function xw(){if(X$())return;if(!F0())return;if(d2)return L("Fast mode prefetch in progress, returning in-flight promise"),d2;let $=U0();if(!(C()?.accessToken&&g0())&&!$){let q=process.env.USER_TYPE==="ant",Y=I().penguinModeOrgEnabled===!0;J0=q||Y?{status:"enabled"}:{status:"disabled",reason:"preference"};return}let Q=Date.now();if(Q-OQ<EW){L("Skipping fast mode prefetch, fetched recently");return}OQ=Q;let Z=async()=>{let q=C(),Y=q?.accessToken&&g0()?{accessToken:q.accessToken}:$?{apiKey:$}:null;if(!Y)throw Error("No auth available");return PW(Y)};async function X(){try{let q;try{q=await Z()}catch(W){if(WJ.isAxiosError(W)&&(W.response?.status===401||W.response?.status===403&&typeof W.response?.data==="string"&&W.response.data.includes("OAuth token has been revoked"))){let B=C()?.accessToken;if(B)await l2(B),q=await Z();else throw W}else throw W}let Y=J0.status!=="pending"?J0.status==="enabled":I().penguinModeOrgEnabled;if(J0=q.enabled?{status:"enabled"}:{status:"disabled",reason:q.disabled_reason??"preference"},Y!==q.enabled){if(!q.enabled)q$("userSettings",{fastMode:void 0});n((W)=>({...W,penguinModeOrgEnabled:q.enabled})),GJ.emit(q.enabled)}L(`Org fast mode: ${q.enabled?"enabled":`disabled (${q.disabled_reason??"preference"})`}`)}catch(q){let Y=process.env.USER_TYPE==="ant",W=I().penguinModeOrgEnabled===!0;J0=Y||W?{status:"enabled"}:{status:"disabled",reason:"network_error"},L(`Failed to fetch org fast mode status, defaulting to ${J0.status==="enabled"?"enabled (cached)":"disabled (network_error)"}: ${q}`,{level:"error"}),F("tengu_org_penguin_mode_fetch_failed",{})}finally{d2=null}}return d2=X(),d2}var Kw="Opus 4.7",Q2,VJ=!1,MQ,TQ,Hw,Uw,PQ,Nw,J0,GJ,Fw,EW=30000,OQ=0,d2=null;var EQ=H(()=>{M0();Q1();i();V1();$0();OW();D0();p();j();u0();b0();b4();J1();$J();Q2={status:"active"},MQ=m0(),TQ=m0(),Hw=MQ.subscribe,Uw=TQ.subscribe;PQ=m0(),Nw=PQ.subscribe;J0={status:"pending"},GJ=m0(),Fw=GJ.subscribe});function KJ($){if(F0()&&$)return AW;return Y$}function jW($,J){return J.input_tokens/1e6*$.inputTokens+J.output_tokens/1e6*$.outputTokens+(J.cache_read_input_tokens??0)/1e6*$.promptCacheReadTokens+(J.cache_creation_input_tokens??0)/1e6*$.promptCacheWriteTokens+(J.server_tool_use?.web_search_requests??0)*$.webSearchRequests}function yW($,J){let Q=Z0($);if(Q===Q0(m4.firstParty)){let X=J.speed==="fast";return KJ(X)}let Z=CQ[Q];if(!Z)return SW($,Q),CQ[Z0(v1())]??kW;return Z}function SW($,J){F("tengu_unknown_model_cost",{model:$,shortName:J}),kQ()}function Cw($,J){let Q=yW($,J);return jW(Q,J)}function vQ($){if(Number.isInteger($))return`$${$}`;return`$${$.toFixed(2)}`}function jQ($){return`${vQ($.inputTokens)}/${vQ($.outputTokens)} per Mtok`}var n2,AQ,Y$,AW,CW,vW,kW,CQ;var yQ=H(()=>{V1();i();EQ();p8();u0();n2={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:0.3,webSearchRequests:0.01},AQ={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:0.01},Y$={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:0.5,webSearchRequests:0.01},AW={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:0.01},CW={inputTokens:0.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:0.08,webSearchRequests:0.01},vW={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:0.1,webSearchRequests:0.01},kW=Y$;CQ={[Q0(v8.firstParty)]:CW,[Q0(k8.firstParty)]:vW,[Q0(C8.firstParty)]:n2,[Q0(A8.firstParty)]:n2,[Q0(j8.firstParty)]:n2,[Q0(y8.firstParty)]:n2,[Q0(h8.firstParty)]:n2,[Q0(S8.firstParty)]:AQ,[Q0(f8.firstParty)]:AQ,[Q0(b8.firstParty)]:Y$,[Q0(m4.firstParty)]:Y$}});var jw,yw="\u273B",Sw="\u2191",fw="\u2193",SQ="\u21AF",bw="\u25CB",hw="\u25D0",pw="\u25CF",gw="\u25C9",fQ="\u23F8",mw="\u21BB",uw="\u25C7",dw="\u25C6",cw="\u203B",lw="\u258E",nw="\xB7\u2714\uFE0E\xB7",iw="\xD7";var BJ=H(()=>{j2();jw=s.platform==="darwin"?"\u23FA":"\u25CF"});function d0($){return fW.includes($)}function Z2($){return bW.includes($)}var fW,bW;var LJ=H(()=>{fW=["sonnet","opus","haiku","best","sonnet[1m]","opus[1m]","opusplan"];bW=["sonnet","opus","haiku"]});function hW($,J){if($.includes(J))return!0;if(d0($))return K0($).toLowerCase().includes(J);return!1}function bQ($,J){if(!$.startsWith(J))return!1;return $.length===J.length||$[J.length]==="-"}function pW($,J){let Q=d0($)?K0($).toLowerCase():$;if(bQ(Q,J))return!0;if(!J.startsWith("claude-")&&bQ(Q,`claude-${J}`))return!0;return!1}function hQ($,J){for(let Q of J){if(Z2(Q))continue;let Z=Q.indexOf($);if(Z===-1)continue;let X=Z+$.length;if(X===Q.length||Q[X]==="-")return!0}return!1}function pQ($){let J=z0()||{},{availableModels:Q}=J;if(!Q)return!0;if(Q.length===0)return!1;let X=c4($).trim().toLowerCase(),q=Q.map((Y)=>Y.trim().toLowerCase());if(q.includes(X)){if(!Z2(X)||!hQ(X,q))return!0}for(let Y of q)if(Z2(Y)&&!hQ(Y,q)&&hW(X,Y))return!0;if(d0(X)){let Y=K0(X).toLowerCase();if(q.includes(Y))return!0}for(let Y of q)if(!Z2(Y)&&d0(Y)){if(K0(Y).toLowerCase()===X)return!0}for(let Y of q)if(!Z2(Y)&&!d0(Y)){if(pW(X,Y))return!0}return!1}var gQ=H(()=>{J1();LJ();u0();l4()});function J_($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function W$($){return $.charAt(0).toUpperCase()+$.slice(1)}function mQ($,J,Q=J+"s"){return $===1?J:Q}function Q_($){let J=$.indexOf(`
|
|
22
|
-
`);return J===-1?$:$.slice(0,J)}function Z_($,J,Q=0){let Z=0,X=$.indexOf(J,Q);while(X!==-1)Z++,X=$.indexOf(J,X+1);return Z}function X_($){return $.replace(/[\uFF10-\uFF19]/g,(J)=>String.fromCharCode(J.charCodeAt(0)-65248))}function q_($){return $.replace(/\u3000/g," ")}function Y_($,J=",",Q=uQ){let X="";for(let q of $){let Y=X?J:"",W=Y+q;if(X.length+W.length<=Q)X+=W;else{let K=Q-X.length-Y.length-14;if(K>0)X+=Y+q.slice(0,K)+"...[truncated]";else X+="...[truncated]";return X}}return X}class gW{maxSize;content="";isTruncated=!1;totalBytesReceived=0;constructor($=uQ){this.maxSize=$}append($){let J=typeof $==="string"?$:$.toString();if(this.totalBytesReceived+=J.length,this.isTruncated&&this.content.length>=this.maxSize)return;if(this.content.length+J.length>this.maxSize){let Q=this.maxSize-this.content.length;if(Q>0)this.content+=J.slice(0,Q);this.isTruncated=!0}else this.content+=J}toString(){if(!this.isTruncated)return this.content;let $=this.totalBytesReceived-this.maxSize,J=Math.round($/1024);return this.content+`
|
|
23
|
-
... [output truncated - ${J}KB removed]`}clear(){this.content="",this.isTruncated=!1,this.totalBytesReceived=0}get length(){return this.content.length}get truncated(){return this.isTruncated}get totalBytes(){return this.totalBytesReceived}}function W_($,J){let Q=$.split(`
|
|
24
|
-
`);if(Q.length<=J)return $;return Q.slice(0,J).join(`
|
|
25
|
-
`)+"\u2026"}var uQ=33554432;var V$=()=>{};function lQ(){return process.env.ANTHROPIC_SMALL_FAST_MODEL||iQ()}function z_($){return $===k().opus40||$===k().opus41||$===k().opus45||$===k().opus46}function i2(){let $,J=cQ();if(J!==void 0)$=J;else{let Q=z0()||{};$=process.env.ANTHROPIC_MODEL||Q.model||void 0}if($&&!pQ($))return;return $}function nQ(){let $=i2();if($!==void 0&&$!==null)return K0($);return rQ()}function mW(){return k1()}function k1(){if(y1())return C1("opus");if(process.env.ANTHROPIC_DEFAULT_OPUS_MODEL)return process.env.ANTHROPIC_DEFAULT_OPUS_MODEL;if(P()!=="firstParty")return k().opus46;return k().opus46}function G$(){if(y1())return C1("sonnet");if(process.env.ANTHROPIC_DEFAULT_SONNET_MODEL)return process.env.ANTHROPIC_DEFAULT_SONNET_MODEL;if(P()!=="firstParty")return k().sonnet45;return k().sonnet46}function iQ(){if(y1())return C1("haiku");if(process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL)return process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL;return k().haiku45}function x_($){let{permissionMode:J,mainLoopModel:Q,exceeds200kTokens:Z=!1}=$;if(i2()==="opusplan"&&J==="plan"&&!Z)return k1();if(i2()==="haiku"&&J==="plan")return G$();return Q}function v1(){if(P()==="azureOpenAI")return"gpt-5.2-codex";if(process.env.USER_TYPE==="ant")return getAntModelOverrideConfig()?.defaultModel??k1()+"[1m]";if(y1())return C1("opus");if(K$())return k1()+(c2()?"[1m]":"");if(B$())return k1()+(c2()?"[1m]":"");return G$()}function rQ(){return K0(v1())}function Q0($){if($=$.toLowerCase(),$.includes("claude-opus-4-7"))return"claude-opus-4-7";if($.includes("claude-opus-4-5"))return"claude-opus-4-5";if($.includes("claude-opus-4-1"))return"claude-opus-4-1";if($.includes("claude-opus-4"))return"claude-opus-4";if($.includes("claude-sonnet-4-6"))return"claude-sonnet-4-6";if($.includes("claude-sonnet-4-5"))return"claude-sonnet-4-5";if($.includes("claude-sonnet-4"))return"claude-sonnet-4";if($.includes("claude-haiku-4-5"))return"claude-haiku-4-5";if($.includes("claude-3-7-sonnet"))return"claude-3-7-sonnet";if($.includes("claude-3-5-sonnet"))return"claude-3-5-sonnet";if($.includes("claude-3-5-haiku"))return"claude-3-5-haiku";if($.includes("claude-3-opus"))return"claude-3-opus";if($.includes("claude-3-sonnet"))return"claude-3-sonnet";if($.includes("claude-3-haiku"))return"claude-3-haiku";let J=$.match(/(claude-(\d+-\d+-)?\w+)/);if(J&&J[1])return J[1];return $}function Z0($){return Q0(c4($))}function uW($=!1){if(y1())return`${oQ(v1())} \xB7 OpenAI/Codex default`;if(K$()||B$()){if(c2())return`Opus 4.7 with 1M context \xB7 Most capable for complex work${$?dQ(!0):""}`;return`Opus 4.7 \xB7 Most capable for complex work${$?dQ(!0):""}`}return"Sonnet 4.6 \xB7 Best for everyday tasks"}function oQ($){if($==="opusplan")return"Opus 4.7 in plan mode, else Sonnet 4.6";return aQ(K0($))}function dQ($){if(P()!=="firstParty")return"";let J=jQ(KJ($));return` \xB7${$?` (${SQ})`:""} ${J}`}function c2(){if(j1()||RJ()||P()!=="firstParty")return!1;if(y()&&d()===null)return!1;return!0}function I_($){if($==="opusplan")return"Opus Plan";if(d0($))return W$($);return aQ($)}function sQ($){let J=YJ($);if(J)return J;switch($){case k().opus46:return"Opus 4.7";case k().opus46+"[1m]":return"Opus 4.7 (1M context)";case k().opus45:return"Opus 4.5";case k().opus41:return"Opus 4.1";case k().opus40:return"Opus 4";case k().sonnet46+"[1m]":return"Sonnet 4.6 (1M context)";case k().sonnet46:return"Sonnet 4.6";case k().sonnet45+"[1m]":return"Sonnet 4.5 (1M context)";case k().sonnet45:return"Sonnet 4.5";case k().sonnet40:return"Sonnet 4";case k().sonnet40+"[1m]":return"Sonnet 4 (1M context)";case k().sonnet37:return"Sonnet 3.7";case k().sonnet35:return"Sonnet 3.5";case k().haiku45:return"Haiku 4.5";case k().haiku35:return"Haiku 3.5";default:return null}}function dW($){let[J="",...Q]=$.split("-");return[J.slice(0,3)+"*".repeat(Math.max(0,J.length-3)),...Q].join("-")}function aQ($){let J=sQ($);if(J)return J;if(process.env.USER_TYPE==="ant"){let Q=K0($),Z=resolveAntModel($);if(Z){let X=Z.model.replace(/\[1m\]$/i,""),q=dW(X),Y=E0(Q)?"[1m]":"";return q+Y}if(Q!==$)return`${$} (${Q})`;return Q}return $}function M_($){let J=sQ($);if(J)return`Claude ${J}`;return`Claude (${$})`}function K0($){let J=$.trim(),Q=J.toLowerCase(),Z=E0(Q),X=Z?Q.replace(/\[1m]$/i,"").trim():Q;if(d0(X))switch(X){case"opusplan":return G$()+(Z?"[1m]":"");case"sonnet":return G$()+(Z?"[1m]":"");case"haiku":return iQ()+(Z?"[1m]":"");case"opus":return k1()+(Z?"[1m]":"");case"best":return mW();default:}if(P()==="firstParty"&&lW(X)&&nW())return k1()+(Z?"[1m]":"");if(process.env.USER_TYPE==="ant"){let q=E0(Q),Y=Q.replace(/\[1m]$/i,"").trim(),W=resolveAntModel(Y);if(W){let K=q?"[1m]":"";return W.model+K}}if(Z)return J.replace(/\[1m\]$/i,"").trim()+"[1m]";return J}function T_($,J){if(E0($)||!E0(J))return $;if(HJ(K0($)))return $+"[1m]";return $}function lW($){return cW.includes($)}function nW(){return!w(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function P_($){if($===null){if(process.env.USER_TYPE==="ant")return`Default for Ants (${oQ(v1())})`;else if(y())return`Default (${uW()})`;return`Default (${rQ()})`}let J=K0($);return $===J?J:`${$} (${J})`}function E_($){let J=YJ($);if(J)return J;if(P()==="foundry")return;let Q=$.toLowerCase().includes("[1m]"),Z=Z0($);if(Z.includes("claude-opus-4-7"))return Q?"Opus 4.7 (with 1M context)":"Opus 4.7";if(Z.includes("claude-opus-4-5"))return"Opus 4.5";if(Z.includes("claude-opus-4-1"))return"Opus 4.1";if(Z.includes("claude-opus-4"))return"Opus 4";if(Z.includes("claude-sonnet-4-6"))return Q?"Sonnet 4.6 (with 1M context)":"Sonnet 4.6";if(Z.includes("claude-sonnet-4-5"))return Q?"Sonnet 4.5 (with 1M context)":"Sonnet 4.5";if(Z.includes("claude-sonnet-4"))return Q?"Sonnet 4 (with 1M context)":"Sonnet 4";if(Z.includes("claude-3-7-sonnet"))return"Claude 3.7 Sonnet";if(Z.includes("claude-3-5-sonnet"))return"Claude 3.5 Sonnet";if(Z.includes("claude-haiku-4-5"))return"Haiku 4.5";if(Z.includes("claude-3-5-haiku"))return"Claude 3.5 Haiku";return}function A_($){return $.replace(/\[(1|2)m\]/gi,"")}var cW;var u0=H(()=>{i();$0();UJ();j();l4();yQ();J1();b0();BJ();gQ();LJ();u2();V$();cW=["claude-opus-4-20250514","claude-opus-4-1-20250805","claude-opus-4-0","claude-opus-4-1"]});function v_($){let J=$.entrypoint??"unknown",Q=$.workload?` cc_workload=${$.workload};`:"";return`x-anthropic-billing-header: cc_version=2.1.92.${$.fingerprint}; cc_entrypoint=${J}; cch=00000;${Q}`}var tQ="2.1.92",wJ="x-anthropic-billing-header:";var _J=()=>{};function JZ($){return sW($,aW)}function sW($,J){if(!$.includes(wJ)||!$.includes(iW))return $;let Q;try{Q=JSON.parse($)}catch{return $}if(NJ($)!==1)return $;let Z=J(Q);if(Z.reduce((B,R)=>B+NJ(R),0)!==1)return $;let q=Z.find((B)=>NJ(B)===1);if(!q)return $;let Y=JSON.stringify(q);if(eW($,Y)!==1)return $;let W=$5($),K=q.replace(ZZ,`cch=${W};`);return $.replace(Y,JSON.stringify(K))}function YZ($){if(typeof $==="string")return JZ($);if($ instanceof Uint8Array){let J=oW.decode($),Q=JZ(J);return Q===J?$:qZ.encode(Q)}return $}function aW($){if(!WZ($))return[];let{system:J}=$;if(typeof J==="string")return QZ(J)?[J]:[];if(!Array.isArray(J))return[];return J.flatMap((Q)=>tW(Q)&&QZ(Q.text)?[Q.text]:[])}function QZ($){return $.startsWith(wJ)}function tW($){return WZ($)&&$.type==="text"&&typeof $.text==="string"}function WZ($){return!!$&&typeof $==="object"&&!Array.isArray($)}function NJ($){return $.match(ZZ)?.length??0}function eW($,J){let Q=0,Z=$.indexOf(J);while(Z!==-1)Q+=1,Z=$.indexOf(J,Z+J.length);return Q}function $5($){return(J5(qZ.encode($),rW)&0xfffffn).toString(16).padStart(5,"0")}function J5($,J){let Q=0,Z,X=new DataView($.buffer,$.byteOffset,$.byteLength);if($.length>=32){let q=$.length-32,Y=J+S1+o2&m,W=J+o2&m,K=J&m,B=J-S1&m;while(Q<=q)Y=X2(Y,r2(X,Q)),Q+=8,W=X2(W,r2(X,Q)),Q+=8,K=X2(K,r2(X,Q)),Q+=8,B=X2(B,r2(X,Q)),Q+=8;Z=U1(Y,1n)+U1(W,7n)+U1(K,12n)+U1(B,18n)&m,Z=L$(Z,Y),Z=L$(Z,W),Z=L$(Z,K),Z=L$(Z,B)}else Z=J+$Z&m;Z=Z+BigInt($.length)&m;while(Q+8<=$.length){let q=X2(0n,r2(X,Q));Z^=q,Z=U1(Z,27n)*S1+XZ&m,Q+=8}if(Q+4<=$.length)Z^=BigInt(Q5(X,Q))*S1&m,Z=U1(Z,23n)*o2+eQ&m,Q+=4;while(Q<$.length)Z^=BigInt($[Q])*$Z&m,Z=U1(Z,11n)*S1&m,Q+=1;return Z^=Z>>33n,Z=Z*o2&m,Z^=Z>>29n,Z=Z*eQ&m,Z^=Z>>32n,Z&m}function X2($,J){return U1($+J*o2&m,31n)*S1&m}function L$($,J){return $^=X2(0n,J),$*S1+XZ&m}function U1($,J){return($<<J|$>>64n-J)&m}function r2($,J){return $.getBigUint64(J,!0)}function Q5($,J){return $.getUint32(J,!0)}var iW="cch=00000;",ZZ,rW=0x6E52736AC806831En,m=0xffffffffffffffffn,S1=11400714785074694791n,o2=14029467366897019727n,eQ=1609587929392839161n,XZ=9650029242287828579n,$Z=2870177450012600261n,qZ,oW;var VZ=H(()=>{_J();ZZ=/\bcch=00000;/g,qZ=new TextEncoder,oW=new TextDecoder});import{createHash as Z5,randomBytes as GZ}from"crypto";function DJ($){return $.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function f_(){return DJ(GZ(32))}function KZ($){let J=Z5("sha256");return J.update($),DJ(J.digest())}function b_(){return DJ(GZ(32))}var BZ=()=>{};import{randomBytes as LZ}from"crypto";function wZ(){return LZ(32).toString("hex")}function _Z(){return LZ(64).toString("hex")}function NZ($){let J=new URLSearchParams({response_type:"code",client_id:s2,redirect_uri:$.redirectUri,scope:"openid profile email offline_access",code_challenge:KZ($.codeVerifier),code_challenge_method:"S256",id_token_add_organizations:"true",codex_cli_simplified_flow:"true",state:$.state});return`${OJ}/oauth/authorize?${J.toString()}`}async function DZ($){let J=await fetch(`${OJ}/oauth/token`,{method:"POST",headers:RZ,body:new URLSearchParams({grant_type:"authorization_code",code:$.code,redirect_uri:$.redirectUri,client_id:s2,code_verifier:$.codeVerifier}).toString()});if(!J.ok)throw await OZ("exchange",J);return await J.json()}async function zJ($){let J=await fetch(`${OJ}/oauth/token`,{method:"POST",headers:RZ,body:new URLSearchParams({grant_type:"refresh_token",refresh_token:$,client_id:s2,scope:"openid profile email"}).toString()});if(!J.ok)throw await OZ("refresh",J);return await J.json()}async function OZ($,J){let Q=await J.text().catch(()=>""),Z=Y5(Q),X=Z?`: ${Z}`:"";return Error(`OpenAI token ${$} failed: ${J.status}${X}`)}function Y5($){return $.replace(/"((?:access_token|refresh_token|id_token|code|code_verifier))"\s*:\s*"[^"]*"/gi,'"$1":"[redacted]"').replace(/\b(access_token|refresh_token|id_token|code|code_verifier)=([^&\s]+)/gi,"$1=[redacted]").slice(0,q5)}function H$($){if(!$)return;let J=$.split(".");if(J.length!==3)return;try{return JSON.parse(Buffer.from(J[1],"base64url").toString())}catch{return}}function FZ($){if(!$)return;return $.chatgpt_account_id||$["https://api.openai.com/auth"]?.chatgpt_account_id||$.organizations?.[0]?.id}function zZ($){let J=H$($.id_token)??H$($.access_token);if(!$.refresh_token)throw Error("OpenAI OAuth response did not include a refresh token");return{accessToken:$.access_token,refreshToken:$.refresh_token,expiresAt:Date.now()+($.expires_in??3600)*1000,idToken:$.id_token,accountId:FZ(J),email:J?.email,clientId:s2}}function xJ($){return $-Date.now()<=300000}function IJ($,J){let Q=H$(J.id_token)??H$(J.access_token);return{accessToken:J.access_token,refreshToken:J.refresh_token??$.refreshToken,expiresAt:Date.now()+(J.expires_in??3600)*1000,idToken:J.id_token??$.idToken,accountId:FZ(Q)??$.accountId,email:Q?.email??$.email,clientId:$.clientId??s2}}var OJ="https://auth.openai.com",s2="app_EMoamEEZ73f0CkXaXp7hrann",HZ="https://chatgpt.com/backend-api/codex/responses",UZ=1455,FJ="/auth/callback",X5="codex-cli/0.91.0",q5=500,RZ;var MJ=H(()=>{BZ();RZ={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":X5}});import{createServer as W5}from"http";class TJ{localServer;port=0;promiseResolver=null;promiseRejecter=null;expectedState=null;pendingResponse=null;callbackPath;constructor($="/callback"){this.localServer=W5(),this.callbackPath=$}async start($){return new Promise((J,Q)=>{this.localServer.once("error",(Z)=>{Q(Error(`Failed to start OAuth callback server: ${Z.message}`))}),this.localServer.listen($??0,"localhost",()=>{let Z=this.localServer.address();this.port=Z.port,J(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization($,J){return new Promise((Q,Z)=>{this.promiseResolver=Q,this.promiseRejecter=Z,this.expectedState=$,this.startLocalListener(J)})}handleSuccessRedirect($,J){if(!this.pendingResponse)return;if(J){J(this.pendingResponse,$),this.pendingResponse=null,F("tengu_oauth_automatic_redirect",{custom_handler:!0});return}let Q=L1($)?f().CLAUDEAI_SUCCESS_URL:f().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:Q}),this.pendingResponse.end(),this.pendingResponse=null,F("tengu_oauth_automatic_redirect",{})}handleErrorRedirect(){if(!this.pendingResponse)return;let $=f().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:$}),this.pendingResponse.end(),this.pendingResponse=null,F("tengu_oauth_automatic_redirect_error",{})}startLocalListener($){this.localServer.on("request",this.handleRedirect.bind(this)),this.localServer.on("error",this.handleError.bind(this)),$()}handleRedirect($,J){let Q=new URL($.url||"",`http://${$.headers.host||"localhost"}`);if(Q.pathname!==this.callbackPath){J.writeHead(404),J.end();return}let Z=Q.searchParams.get("code")??void 0,X=Q.searchParams.get("state")??void 0;this.validateAndRespond(Z,X,J)}validateAndRespond($,J,Q){if(!$){Q.writeHead(400),Q.end("Authorization code not found"),this.reject(Error("No authorization code received"));return}if(J!==this.expectedState){Q.writeHead(400),Q.end("Invalid state parameter"),this.reject(Error("Invalid state parameter"));return}this.pendingResponse=Q,this.resolve($)}handleError($){D($),this.close(),this.reject($)}resolve($){if(this.promiseResolver)this.promiseResolver($),this.promiseResolver=null,this.promiseRejecter=null}reject($){if(this.promiseRejecter)this.promiseRejecter($),this.promiseResolver=null,this.promiseRejecter=null}close(){if(this.pendingResponse)this.handleErrorRedirect();if(this.localServer)this.localServer.removeAllListeners(),this.localServer.close()}}var xZ=H(()=>{V1();M0();t();t4()});class B5{codeVerifier;authCodeListener=null;port=null;manualAuthCodeResolver=null;constructor(){this.codeVerifier=_Z()}async startOAuthFlow($,J){this.authCodeListener=new TJ(FJ),this.port=await this.authCodeListener.start(UZ);let Q=wZ(),Z=`http://localhost:${this.port}${FJ}`,X=NZ({redirectUri:Z,codeVerifier:this.codeVerifier,state:Q}),q=await this.waitForAuthorizationCode(Q,async()=>{if(J?.skipBrowserOpen)await $(X,X);else await $(X),await IZ(X)});try{let Y=await DZ({code:q,redirectUri:Z,codeVerifier:this.codeVerifier}),W=zZ(Y),K=s4(W);if(!K.success)throw Error(K.warning??"Failed to persist OpenAI OAuth tokens");return this.authCodeListener?.handleSuccessRedirect([],(B)=>{B.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),B.end(G5)}),W}catch(Y){throw this.authCodeListener?.handleSuccessRedirect([],(W)=>{W.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),W.end(K5)}),Y}finally{this.cleanup()}}async waitForAuthorizationCode($,J){return new Promise((Q,Z)=>{this.manualAuthCodeResolver=Q,this.authCodeListener?.waitForAuthorization($,J).then((X)=>{this.manualAuthCodeResolver=null,Q(X)}).catch((X)=>{this.manualAuthCodeResolver=null,Z(X)})})}handleManualAuthCodeInput($){if(this.manualAuthCodeResolver)this.manualAuthCodeResolver($.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close()}async ensureFreshTokens(){B1();let $=await r8();if(!$)return null;if(!xJ($.expiresAt))return $;let J=await zJ($.refreshToken),Q=IJ($,J),Z=s4(Q);if(!Z.success)throw Error(Z.warning??"Failed to persist refreshed OpenAI tokens");return Q}async ensureFreshAccessToken(){return(await this.ensureFreshTokens())?.accessToken??null}logout(){return B1(),n9()}cleanup(){this.authCodeListener?.close(),this.authCodeListener=null,this.port=null,this.manualAuthCodeResolver=null}}async function MZ(){B1();let $=await r8();if(!$)return null;if(!xJ($.expiresAt))return $;try{let J=await zJ($.refreshToken),Q=IJ($,J),Z=s4(Q);if(!Z.success)throw Error(Z.warning??"Failed to persist refreshed OpenAI tokens");return Q}catch{return null}}var G5=`<!doctype html>
|
|
26
|
-
<html>
|
|
27
|
-
<head>
|
|
28
|
-
<meta charset="utf-8">
|
|
29
|
-
<title>cc-haha OpenAI Authorization Successful</title>
|
|
30
|
-
<style>
|
|
31
|
-
body { font-family: system-ui, -apple-system, sans-serif; display:flex; justify-content:center; align-items:center; height:100vh; margin:0; background:#131010; color:#f1ecec; }
|
|
32
|
-
.container { text-align:center; padding:2rem; }
|
|
33
|
-
p { color:#b7b1b1; }
|
|
34
|
-
</style>
|
|
35
|
-
</head>
|
|
36
|
-
<body>
|
|
37
|
-
<div class="container">
|
|
38
|
-
<h1>Authorization Successful</h1>
|
|
39
|
-
<p>You can close this window and return to Claude Code Haha.</p>
|
|
40
|
-
</div>
|
|
41
|
-
<script>setTimeout(() => window.close(), 2000)</script>
|
|
42
|
-
</body>
|
|
43
|
-
</html>`,K5=`<!doctype html>
|
|
44
|
-
<html>
|
|
45
|
-
<head>
|
|
46
|
-
<meta charset="utf-8">
|
|
47
|
-
<title>cc-haha OpenAI Authorization Failed</title>
|
|
48
|
-
</head>
|
|
49
|
-
<body>
|
|
50
|
-
<h1>Authorization Failed</h1>
|
|
51
|
-
<p>You can close this window and return to Claude Code Haha.</p>
|
|
52
|
-
</body>
|
|
53
|
-
</html>`;var TZ=H(()=>{V5();xZ();MJ();a4()});function PZ($){let J=[];for(let Z of $.messages)L5(Z,J);let Q={model:$.model,input:J,stream:$.stream,store:!1};if($.system){if(typeof $.system==="string")Q.instructions=$.system;else if(Array.isArray($.system))Q.instructions=$.system.map((Z)=>Z.text).join(`
|
|
54
|
-
`)}if($.temperature!==void 0)Q.temperature=$.temperature;if($.top_p!==void 0)Q.top_p=$.top_p;if($.tools&&$.tools.length>0)Q.tools=$.tools.filter((Z)=>Z.name!=="BatchTool").map((Z)=>({type:"function",name:Z.name,description:Z.description,parameters:Z.input_schema}));if($.tool_choice!==void 0)Q.tool_choice=H5($.tool_choice);if($.thinking){let Z=$.thinking.budget_tokens;if(Z!==void 0)if(Z<=1024)Q.reasoning={effort:"low"};else if(Z<=8192)Q.reasoning={effort:"medium"};else Q.reasoning={effort:"high"};else if($.thinking.type==="enabled")Q.reasoning={effort:"high"}}return Q}function L5($,J){let Q=$.content;if(typeof Q==="string"){J.push({type:"message",role:$.role,content:Q});return}if(!Array.isArray(Q)||Q.length===0){J.push({type:"message",role:$.role,content:""});return}let Z=[];for(let X of Q)if(X.type==="text")Z.push(X.text);else if(X.type==="image")Z.push({type:"image_url",image_url:{url:`data:${X.source.media_type};base64,${X.source.data}`}});else if(X.type==="tool_use"){if(Z.length>0){let q=Z.length===1&&typeof Z[0]==="string"?Z[0]:Z.map((Y)=>typeof Y==="string"?Y:"").join("");if(q)J.push({type:"message",role:$.role,content:q});Z.length=0}J.push({type:"function_call",call_id:X.id,name:X.name,arguments:typeof X.input==="string"?X.input:JSON.stringify(X.input)})}else if(X.type==="tool_result"){let q=typeof X.content==="string"?X.content:Array.isArray(X.content)?X.content.filter((Y)=>Y.type==="text").map((Y)=>Y.text).join(`
|
|
55
|
-
`):"";J.push({type:"function_call_output",call_id:X.tool_use_id,output:q})}if(Z.length>0){let X=Z.length===1&&typeof Z[0]==="string"?Z[0]:Z.map((q)=>typeof q==="string"?q:"").join("");if(X)J.push({type:"message",role:$.role,content:X})}}function H5($){if(typeof $==="string")return $;if(typeof $==="object"&&$!==null){let J=$;if(J.type==="auto")return"auto";if(J.type==="any")return"required";if(J.type==="none")return"none";if(J.type==="tool"&&typeof J.name==="string")return{type:"function",function:{name:J.name}}}return"auto"}var EZ=()=>{};function AZ($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function U$($){if($==null||$==="")return{};if(typeof $==="string")try{let J=JSON.parse($);return AZ(J)?J:{raw:J}}catch{return{raw:$}}if(AZ($))return $;return{raw:$}}function R$($){if($==null||$==="")return"";return typeof $==="string"?$:JSON.stringify($)}var a2=()=>{};function w$($,J){let Q=[],Z=!1;for(let X of $.output||[])if(U5(X,Q),X.type==="function_call")Z=!0;if(Q.length===0)Q.push({type:"text",text:""});return{id:$.id||`msg_${Date.now()}`,type:"message",role:"assistant",content:Q,model:$.model||J,stop_reason:R5($.status,Z),stop_sequence:null,usage:{input_tokens:$.usage?.input_tokens??$.usage?.prompt_tokens??0,output_tokens:$.usage?.output_tokens??$.usage?.completion_tokens??0}}}function U5($,J){switch($.type){case"message":{for(let Q of $.content||[])if(Q.type==="output_text"||Q.type==="text")J.push({type:"text",text:Q.text||""});else if(Q.type==="refusal")J.push({type:"text",text:Q.refusal||"[Refusal]"});break}case"function_call":{J.push({type:"tool_use",id:$.call_id,name:$.name,input:U$($.arguments)});break}case"reasoning":{if($.summary){for(let Q of $.summary)if(Q.text)J.push({type:"thinking",thinking:Q.text})}break}}}function R5($,J){switch($){case"completed":return J?"tool_use":"end_turn";case"failed":return"end_turn";case"cancelled":return"end_turn";case"incomplete":return"max_tokens";default:return"end_turn"}}var PJ=H(()=>{a2()});function x0($,J){return`event: ${$}
|
|
56
|
-
data: ${JSON.stringify(J)}
|
|
57
|
-
|
|
58
|
-
`}function CZ($,J){let Q=new TextEncoder,Z=new TextDecoder,X="",q={nextContentIndex:0,indexByKey:new Map,toolIndexByItemId:new Map,model:J,messageStarted:!1,messageStopped:!1};return new ReadableStream({async start(Y){let W=$.getReader(),K="";try{while(!0){let{done:B,value:R}=await W.read();if(B)break;X+=Z.decode(R,{stream:!0});let U=X.split(`
|
|
59
|
-
`);X=U.pop()||"";for(let z of U){let _=z.trim();if(_.startsWith("event: ")){K=_.slice(7).trim();continue}if(_.startsWith("data: ")){let T=_.slice(6);if(T==="[DONE]"){if(!q.messageStopped){if(q.messageStopped=!0,!q.messageStarted)_$(q,Y,Q,J);Y.enqueue(Q.encode(x0("message_stop",{type:"message_stop"})))}continue}let v;try{v=JSON.parse(T)}catch{continue}w5(K,v,q,Y,Q),K="";continue}if(_==="")K=""}}}catch(B){Y.error(B);return}Y.close()}})}function _$($,J,Q,Z){$.messageStarted=!0,J.enqueue(Q.encode(x0("message_start",{type:"message_start",message:{id:`msg_${Date.now()}`,type:"message",role:"assistant",content:[],model:Z,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0}}})))}function w5($,J,Q,Z,X){switch($){case"response.created":{let q=J;Q.model=q.model||Q.model,_$(Q,Z,X,Q.model);break}case"response.output_item.added":{if(!Q.messageStarted)_$(Q,Z,X,Q.model);let q=J.item;if(!q)break;if(q.type==="function_call"){let Y=Q.nextContentIndex++,W=q.call_id||q.id||"",K=q.name||"";Q.toolIndexByItemId.set(q.id||W,Y),Z.enqueue(X.encode(x0("content_block_start",{type:"content_block_start",index:Y,content_block:{type:"tool_use",id:W,name:K,input:{}}})))}break}case"response.content_part.added":{if(!Q.messageStarted)_$(Q,Z,X,Q.model);if(!J.part)break;let Y=J.content_index??0,K=`${J.output_index??0}:${Y}`,B=Q.nextContentIndex++;Q.indexByKey.set(K,B),Z.enqueue(X.encode(x0("content_block_start",{type:"content_block_start",index:B,content_block:{type:"text",text:""}})));break}case"response.output_text.delta":{let q=J.content_index??0,W=`${J.output_index??0}:${q}`,K=Q.indexByKey.get(W);if(K===void 0)break;let B=J.delta||"";Z.enqueue(X.encode(x0("content_block_delta",{type:"content_block_delta",index:K,delta:{type:"text_delta",text:B}})));break}case"response.refusal.delta":{let q=J.content_index??0,W=`${J.output_index??0}:${q}`,K=Q.indexByKey.get(W);if(K===void 0)break;let B=J.delta||"";Z.enqueue(X.encode(x0("content_block_delta",{type:"content_block_delta",index:K,delta:{type:"text_delta",text:B}})));break}case"response.function_call_arguments.delta":{let q=J.item_id||"",Y=Q.toolIndexByItemId.get(q);if(Y===void 0)break;let W=R$(J.delta);Z.enqueue(X.encode(x0("content_block_delta",{type:"content_block_delta",index:Y,delta:{type:"input_json_delta",partial_json:W}})));break}case"response.output_text.done":case"response.refusal.done":{let q=J.content_index??0,W=`${J.output_index??0}:${q}`,K=Q.indexByKey.get(W);if(K===void 0)break;Z.enqueue(X.encode(x0("content_block_stop",{type:"content_block_stop",index:K})));break}case"response.function_call_arguments.done":{let q=J.item_id||"",Y=Q.toolIndexByItemId.get(q);if(Y===void 0)break;Z.enqueue(X.encode(x0("content_block_stop",{type:"content_block_stop",index:Y})));break}case"response.completed":{let q=J.response,Y=q?.status||"completed",W=q?.usage,K=Q.toolIndexByItemId.size>0,B=Y==="completed"?K?"tool_use":"end_turn":Y==="incomplete"?"max_tokens":"end_turn";if(Z.enqueue(X.encode(x0("message_delta",{type:"message_delta",delta:{stop_reason:B,stop_sequence:null},usage:{input_tokens:W?.input_tokens??0,output_tokens:W?.output_tokens??0}}))),!Q.messageStopped)Q.messageStopped=!0,Z.enqueue(X.encode(x0("message_stop",{type:"message_stop"})));break}}}var vZ=H(()=>{a2()});async function kZ($,J){let Q=new TextDecoder,Z=$.getReader(),X="",q="",Y=null,W={id:`resp_${Date.now()}`,createdAt:Math.floor(Date.now()/1000),model:J,status:"completed",textByKey:new Map,usage:void 0};while(!0){let{done:K,value:B}=await Z.read();if(K)break;X+=Q.decode(B,{stream:!0});let R=X.split(`
|
|
60
|
-
`);X=R.pop()||"";for(let U of R){let z=U.trim();if(z.startsWith("event: ")){q=z.slice(7).trim();continue}if(!z.startsWith("data: ")){if(z==="")q="";continue}let _=z.slice(6);if(_==="[DONE]"){q="";continue}let T;try{T=JSON.parse(_)}catch{q="";continue}if(q==="response.completed"){let v=T.response;if(D5(v))Y=v}else _5(q,T,W);q=""}}return w$(Y??N5(W),J)}function _5($,J,Q){if($==="response.created"){if(typeof J.id==="string")Q.id=J.id;if(typeof J.created_at==="number")Q.createdAt=J.created_at;if(typeof J.model==="string")Q.model=J.model;if(typeof J.status==="string")Q.status=J.status;return}if($==="response.output_text.delta"){let Z=EJ(J),X=typeof J.delta==="string"?J.delta:"";Q.textByKey.set(Z,(Q.textByKey.get(Z)??"")+X);return}if($==="response.output_text.done"){let Z=typeof J.text==="string"?J.text:null;if(Z!==null)Q.textByKey.set(EJ(J),Z);return}if($==="response.refusal.delta"){let Z=EJ(J),X=typeof J.delta==="string"?J.delta:"";Q.textByKey.set(Z,(Q.textByKey.get(Z)??"")+X)}}function N5($){let J=[...$.textByKey.entries()].sort(([Q],[Z])=>Q.localeCompare(Z)).map(([,Q])=>Q).join("");return{id:$.id,object:"response",created_at:$.createdAt,model:$.model,status:$.status,output:[{type:"message",role:"assistant",content:[{type:"output_text",text:J}]}],usage:$.usage}}function EJ($){let J=typeof $.output_index==="number"?$.output_index:0,Q=typeof $.content_index==="number"?$.content_index:0;return`${J}:${Q}`}function D5($){return!!$&&typeof $==="object"&&!Array.isArray($)&&Array.isArray($.output)}var jZ=H(()=>{PJ()});import{randomUUID as O5}from"crypto";function SZ(){return!!p2()?.refreshToken}function fZ($,J){let Q=$??globalThis.fetch;return async(Z,X)=>{let q=Z instanceof Request?new URL(Z.url):new URL(String(Z));if(!q.pathname.endsWith("/v1/messages"))return Q(Z,X);let Y=await z5(Z,X),W=C1(Y.model),K=PZ({...Y,model:W}),B={...K,stream:!0},R=await MZ();if(!R)throw Error("OpenAI OAuth token is missing or expired. Run claude auth login --openai again.");let U=new Headers;if(U.set("Content-Type","application/json"),U.set("Authorization",`Bearer ${R.accessToken}`),R.accountId)U.set("ChatGPT-Account-Id",R.accountId);L(`[API REQUEST] ${q.pathname} remapped_to=OpenAI/Codex model=${W} source=${J??"unknown"} request_id=${O5()}`);let z=await Q(HZ,{method:"POST",headers:U,body:JSON.stringify(B),signal:X?.signal});if(!z.ok){let T=await z.text().catch(()=>"");return Response.json({type:"error",error:{type:"api_error",message:`OpenAI upstream returned HTTP ${z.status}: ${T.slice(0,500)}`}},{status:z.status})}if(K.stream){if(!z.body)return Response.json({type:"error",error:{type:"api_error",message:"OpenAI upstream returned no body for stream"}},{status:502});return new Response(CZ(z.body,W),{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}if(z.body&&F5(z)){let T=await kZ(z.body,W);return Response.json(T)}let _=await z.json();return Response.json(w$(_,W))}}function F5($){return($.headers.get("Content-Type")??"").toLowerCase().includes("text/event-stream")}async function z5($,J){let Q=J?.body;if(typeof Q==="string")return JSON.parse(Q);if(Q instanceof Uint8Array||Q instanceof ArrayBuffer)return JSON.parse(Buffer.from(Q).toString("utf8"));if($ instanceof Request)return await $.clone().json();throw Error("Unable to read Anthropic request body for OpenAI/Codex transformation")}var yZ="openai-oauth-dummy-key";var bZ=H(()=>{MJ();TZ();u2();a4();EZ();PJ();vZ();jZ();p()});function hZ($,J={}){let Q=[];if($.system){if(typeof $.system==="string")Q.push({role:"system",content:$.system});else if(Array.isArray($.system)){let X=$.system.map((q)=>q.text).join(`
|
|
61
|
-
`);Q.push({role:"system",content:X})}}for(let X of $.messages)x5(X,Q,J);let Z={model:$.model,messages:Q,stream:$.stream};if($.temperature!==void 0)Z.temperature=$.temperature;if($.top_p!==void 0)Z.top_p=$.top_p;if($.stop_sequences&&$.stop_sequences.length>0)Z.stop=$.stop_sequences;if($.tools&&$.tools.length>0)Z.tools=$.tools.filter((X)=>X.name!=="BatchTool").map((X)=>({type:"function",function:{name:X.name,description:X.description,parameters:X.input_schema}}));if($.tool_choice!==void 0)Z.tool_choice=T5($.tool_choice);if($.thinking){let X=$.thinking.budget_tokens;if(X!==void 0)if(X<=1024)Z.reasoning_effort="low";else if(X<=8192)Z.reasoning_effort="medium";else Z.reasoning_effort="high";else if($.thinking.type==="enabled")Z.reasoning_effort="high";if(J.passThinkingToggle)Z.thinking={type:$.thinking.type}}return Z}function x5($,J,Q){let Z=$.content;if(typeof Z==="string"){J.push({role:$.role,content:Z});return}if(!Array.isArray(Z)||Z.length===0){J.push({role:$.role,content:""});return}if($.role==="user")I5(Z,J);else M5(Z,J,Q)}function I5($,J){let Q=[];for(let Z of $)if(Z.type==="text")Q.push({type:"text",text:Z.text});else if(Z.type==="image"){let X=`data:${Z.source.media_type};base64,${Z.source.data}`;Q.push({type:"image_url",image_url:{url:X}})}else if(Z.type==="tool_result"){let X=typeof Z.content==="string"?Z.content:Array.isArray(Z.content)?Z.content.filter((q)=>q.type==="text").map((q)=>q.text).join(`
|
|
62
|
-
`):"";J.push({role:"tool",tool_call_id:Z.tool_use_id,content:X})}if(Q.length>0)J.push({role:"user",content:Q.length===1&&Q[0].type==="text"?Q[0].text:Q})}function M5($,J,Q){let Z="",X="",q=[];for(let W of $)if(W.type==="text")Z+=W.text;else if(W.type==="thinking"&&Q.roundTripReasoningContent)X+=W.thinking;else if(W.type==="tool_use")q.push({id:W.id,type:"function",function:{name:W.name,arguments:typeof W.input==="string"?W.input:JSON.stringify(W.input)}});let Y={role:"assistant",content:Z||null};if(q.length>0)Y.tool_calls=q;if(X)Y.reasoning_content=X;J.push(Y)}function T5($){if(typeof $==="string")return $;if(typeof $==="object"&&$!==null){let J=$;if(J.type==="auto")return"auto";if(J.type==="any")return"required";if(J.type==="none")return"none";if(J.type==="tool"&&typeof J.name==="string")return{type:"function",function:{name:J.name}}}return"auto"}var pZ=()=>{};function gZ($,J){let Q=$.choices?.[0];if(!Q)return E5($,J);let Z=[],X=Q.message;if(typeof X.reasoning_content==="string"&&X.reasoning_content)Z.push({type:"thinking",thinking:X.reasoning_content});else if(typeof X.reasoning==="string"&&X.reasoning)Z.push({type:"thinking",thinking:X.reasoning});else if(Array.isArray(X.thinking_blocks)){for(let q of X.thinking_blocks)if(q.type==="thinking"&&typeof q.thinking==="string")Z.push({type:"thinking",thinking:q.thinking,signature:q.signature})}if(Q.message.content)Z.push({type:"text",text:Q.message.content});if(Q.message.tool_calls)for(let q of Q.message.tool_calls)Z.push({type:"tool_use",id:q.id,name:q.function.name,input:U$(q.function.arguments)});if(Z.length===0)Z.push({type:"text",text:""});return{id:$.id||`msg_${Date.now()}`,type:"message",role:"assistant",content:Z,model:$.model||J,stop_reason:P5(Q.finish_reason),stop_sequence:null,usage:mZ($.usage)}}function P5($){switch($){case"stop":return"end_turn";case"tool_calls":return"tool_use";case"length":return"max_tokens";case"content_filter":return"end_turn";default:return"end_turn"}}function mZ($){if(!$)return{input_tokens:0,output_tokens:0};return{input_tokens:$.prompt_tokens||0,output_tokens:$.completion_tokens||0,cache_read_input_tokens:$.prompt_tokens_details?.cached_tokens||0}}function E5($,J){return{id:$.id||`msg_${Date.now()}`,type:"message",role:"assistant",content:[{type:"text",text:""}],model:$.model||J,stop_reason:"end_turn",stop_sequence:null,usage:mZ($.usage)}}var uZ=H(()=>{a2()});function A5($,J){return`event: ${$}
|
|
63
|
-
data: ${JSON.stringify(J)}
|
|
64
|
-
|
|
65
|
-
`}function C5($){return{queue:[],currentBlockType:"text",currentBlockIndex:-1,nextContentIndex:0,blockStartSent:!1,blockStopSent:!1,toolBlocks:new Map,model:$,messageStartSent:!1,messageDeltaSent:!1,messageStopSent:!1,heldMessageDelta:null}}function cZ($,J){let Q=new TextEncoder,Z=new TextDecoder,X="",q=C5(J);return new ReadableStream({async start(Y){let W=$.getReader(),K=!1;try{while(!0){let{done:B,value:R}=await W.read();if(B)break;X+=Z.decode(R,{stream:!0});let U=X.split(`
|
|
66
|
-
`);X=U.pop()||"";for(let z of U){let _=z.trim();if(!_||_.startsWith(":"))continue;if(_==="data: [DONE]"){dZ(q),AJ(q,Y,Q);continue}if(!_.startsWith("data: "))continue;let T=_.slice(6),v;try{v=JSON.parse(T)}catch{continue}k5(v,q),AJ(q,Y,Q)}}}catch(B){K=!0,Y.error(B)}finally{if(!K)dZ(q),AJ(q,Y,Q),Y.close()}}})}function R1($,J,Q){$.queue.push({event:J,data:Q})}function AJ($,J,Q){for(let Z of $.queue)J.enqueue(Q.encode(A5(Z.event,Z.data)));$.queue.length=0}function lZ($,J){if($.messageStartSent)return;$.messageStartSent=!0,R1($,"message_start",{type:"message_start",message:{id:J||`msg_${Date.now()}`,type:"message",role:"assistant",content:[],model:$.model,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0}}})}function nZ($,J,Q){let Z=$.nextContentIndex++;return $.currentBlockType=J,$.currentBlockIndex=Z,$.blockStartSent=!0,$.blockStopSent=!1,R1($,"content_block_start",{type:"content_block_start",index:Z,content_block:Q}),Z}function t2($,J,Q){R1($,"content_block_delta",{type:"content_block_delta",index:J,delta:Q})}function iZ($){if(!$.blockStartSent||$.blockStopSent)return;$.blockStopSent=!0,R1($,"content_block_stop",{type:"content_block_stop",index:$.currentBlockIndex})}function rZ($){for(let[,J]of $.toolBlocks)if(J.started)R1($,"content_block_stop",{type:"content_block_stop",index:J.anthropicIndex});if($.toolBlocks.clear(),$.currentBlockType==="tool_use")$.blockStopSent=!0}function oZ($){if($.currentBlockType!=="tool_use")iZ($);rZ($)}function sZ($){if(typeof $.reasoning_content==="string"&&$.reasoning_content)return{thinking:$.reasoning_content,signature:""};if(typeof $.reasoning==="string"&&$.reasoning)return{thinking:$.reasoning,signature:""};let J=$.thinking_blocks;if(Array.isArray(J)&&J.length>0){let Q=J[0];if(Q.type==="thinking"){let Z=Q.thinking||"",X=Q.signature||"";if(Z||X)return{thinking:Z,signature:X}}}return null}function v5($,J){if($.tool_calls&&$.tool_calls.length>0){let Z=$.tool_calls[0];return{type:"tool_use",isNew:J.currentBlockType!=="tool_use"||!!Z.function?.name}}if($.content!=null&&$.content!=="")return{type:"text",isNew:J.currentBlockType!=="text"||!J.blockStartSent};if(sZ($))return{type:"thinking",isNew:J.currentBlockType!=="thinking"||!J.blockStartSent};return null}function k5($,J){let Q=$.choices?.[0];if(!Q){if($.usage&&J.heldMessageDelta)b5(J,$.usage);return}J.model=$.model||J.model,lZ(J,$.id);let Z=Q.delta,X=v5(Z,J);if(X){if(X.isNew&&J.blockStartSent&&!J.blockStopSent){if(J.currentBlockType==="tool_use"&&X.type!=="tool_use")rZ(J);else if(J.currentBlockType!=="tool_use")iZ(J)}switch(X.type){case"thinking":j5(Z,J);break;case"text":y5(Z,J);break;case"tool_use":S5(Z,J);break}}if(Q.finish_reason)f5(Q.finish_reason,$,J)}function j5($,J){let Q=sZ($);if(!Q)return;if(J.currentBlockType!=="thinking"||!J.blockStartSent)nZ(J,"thinking",{type:"thinking",thinking:""});if(Q.thinking)t2(J,J.currentBlockIndex,{type:"thinking_delta",thinking:Q.thinking});if(Q.signature)t2(J,J.currentBlockIndex,{type:"signature_delta",signature:Q.signature})}function y5($,J){if($.content==null||$.content==="")return;if(J.currentBlockType!=="text"||!J.blockStartSent)nZ(J,"text",{type:"text",text:""});t2(J,J.currentBlockIndex,{type:"text_delta",text:$.content})}function S5($,J){if(!$.tool_calls)return;for(let Q of $.tool_calls){let Z=Q.index;if(!J.toolBlocks.has(Z))J.toolBlocks.set(Z,{id:"",name:"",argsBuffer:"",started:!1,anthropicIndex:-1});let X=J.toolBlocks.get(Z);if(Q.id)X.id=Q.id;if(Q.function?.name)X.name+=Q.function.name;let q=R$(Q.function?.arguments);if(q)X.argsBuffer+=q;if(!X.started&&X.id&&X.name){if(X.started=!0,X.anthropicIndex=J.nextContentIndex++,J.currentBlockType="tool_use",J.currentBlockIndex=X.anthropicIndex,J.blockStartSent=!0,J.blockStopSent=!1,R1(J,"content_block_start",{type:"content_block_start",index:X.anthropicIndex,content_block:{type:"tool_use",id:X.id,name:X.name,input:{}}}),X.argsBuffer)t2(J,X.anthropicIndex,{type:"input_json_delta",partial_json:X.argsBuffer})}else if(X.started&&q)t2(J,X.anthropicIndex,{type:"input_json_delta",partial_json:q})}}function f5($,J,Q){if(Q.messageDeltaSent)return;oZ(Q);let Z=h5($),X=J.usage?{output_tokens:J.usage.completion_tokens||0}:{output_tokens:0},q={event:"message_delta",data:{type:"message_delta",delta:{stop_reason:Z,stop_sequence:null},usage:X}};if(J.usage)Q.messageDeltaSent=!0,Q.queue.push(q);else Q.heldMessageDelta=q}function b5($,J){if(!$.heldMessageDelta)return;let Q=$.heldMessageDelta.data;Q.usage={output_tokens:J.completion_tokens||0},$.messageDeltaSent=!0,$.queue.push($.heldMessageDelta),$.heldMessageDelta=null}function dZ($){if($.messageStopSent)return;if($.messageStopSent=!0,lZ($),oZ($),$.heldMessageDelta&&!$.messageDeltaSent)$.messageDeltaSent=!0,$.queue.push($.heldMessageDelta),$.heldMessageDelta=null;if(!$.messageDeltaSent)$.messageDeltaSent=!0,R1($,"message_delta",{type:"message_delta",delta:{stop_reason:"end_turn",stop_sequence:null},usage:{output_tokens:0}});R1($,"message_stop",{type:"message_stop"})}function h5($){switch($){case"stop":return"end_turn";case"tool_calls":return"tool_use";case"length":return"max_tokens";case"content_filter":return"end_turn";default:return"end_turn"}}var aZ=H(()=>{a2()});function p5($){let J=$.trim().replace(/\/$/,"");if(!/^https?:\/\//i.test(J))return`https://${J}`;return J}function xN($){let J=$||process.env.UNIEAI_STUDIO_URL||"https://studio.unieai.com";return p5(J)}function q2($){let J=$.trim().replace(/\/+$/,"");if(!/^https?:\/\//i.test(J))return`https://${J}`;return J}function g5($){try{let J=new URL(q2($)),Q=J.hostname.startsWith("studio.")?`api.${J.hostname.slice(7)}`:J.hostname,Z=J.port?`:${J.port}`:"";return`${J.protocol}//${Q}${Z}/v1`}catch{return"https://api.unieai.com/v1"}}function IN($){let J=process.env.UNIEAI_GATEWAY_URL?.trim();if(J)return q2(J);if($.userGatewayUrl&&$.userGatewayUrl.trim())return q2($.userGatewayUrl);if($.configBaseURL&&/^https?:\/\/(?!runtime:|localhost|127\.)/i.test($.configBaseURL))return q2($.configBaseURL);return g5($.studioUrl)}async function e2($,J){if(!$.ok){let Q=await $.text().catch(()=>"");throw Error(`${J} failed: HTTP ${$.status}${Q?` \u2014 ${Q.slice(0,300)}`:""}`)}return await $.json()}async function MN($){let J=await fetch(`${$}/auth/device/code`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({client_id:"opencode-cli"})});return e2(J,"device code request")}async function TN($,J){let Q=await fetch(`${$}/auth/device/token`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:J,client_id:"opencode-cli"})});if(Q.ok)return{kind:"success",tokens:await Q.json()};let Z=await Q.json().catch(()=>null),X=Z?.error||`http_${Q.status}`;switch(X){case"authorization_pending":return{kind:"pending"};case"slow_down":return{kind:"slow_down"};case"expired_token":return{kind:"expired"};case"access_denied":return{kind:"denied"};default:return{kind:"error",error:X,description:Z?.error_description}}}async function PN($,J){let Q=await fetch(`${$}/auth/device/token`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:J,client_id:"opencode-cli"})});return e2(Q,"token refresh")}async function EN($,J,Q){try{let Z=await fetch(`${$}/api/user-api-keys/${encodeURIComponent(Q)}`,{method:"DELETE",headers:{Accept:"application/json",Authorization:`Bearer ${J}`}});return Z.ok||Z.status===404}catch{return!1}}async function AN($,J){let Q=await fetch(`${$}/auth/device/revoke`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({refresh_token:J,client_id:"opencode-cli"})});if(!Q.ok){let Z=await Q.text().catch(()=>"");throw Error(`token revoke failed: HTTP ${Q.status}${Z?` \u2014 ${Z.slice(0,300)}`:""}`)}}function CJ($,J){return{Accept:"application/json",Authorization:`Bearer ${$}`,...J??{}}}async function CN($,J){let Q=await fetch(`${$}/api/user`,{headers:CJ(J)});return e2(Q,"fetch user")}async function vN($,J){let Q=await fetch(`${$}/api/orgs`,{headers:CJ(J)});return e2(Q,"fetch orgs")}async function kN($,J,Q){let Z=await fetch(`${$}/api/config`,{headers:CJ(J,{"x-org-id":Q})});if(Z.status===404)return null;return(await e2(Z,"fetch config")).config??null}var tZ="https://api.unieai.com/v1";var eZ=()=>{};import{existsSync as $3,mkdirSync as m5,readFileSync as u5,writeFileSync as d5,chmodSync as c5,unlinkSync as l5}from"fs";import{homedir as n5}from"os";import{dirname as i5,join as J3}from"path";import r5 from"lodash-es/memoize.js";function o5(){return process.env.CLAUDE_CONFIG_DIR||J3(n5(),".claude")}function vJ(){return J3(o5(),"unieai-auth.json")}function gN($){try{let J=vJ();m5(i5(J),{recursive:!0}),d5(J,JSON.stringify($,null,2),{encoding:"utf8"});try{c5(J,384)}catch{}return Q3(),{success:!0}}catch(J){return D(J),{success:!1,warning:`Failed to save UnieAI Studio tokens: ${c(J)}`}}}async function mN(){return $4()}function Q3(){$4.cache?.clear?.()}function uN(){try{let $=vJ();if($3($))l5($);return Q3(),!0}catch($){return D($),!1}}var $4;var Z3=H(()=>{H0();t();$4=r5(()=>{try{let $=vJ();if(!$3($))return null;let J=u5($,"utf8");return JSON.parse(J)}catch($){return D($),null}})});import{randomUUID as s5}from"crypto";function q3(){return!!$4()?.gatewayApiKey}function Y3($,J){let Q=$??globalThis.fetch;return async(Z,X)=>{let q=Z instanceof Request?new URL(Z.url):new URL(String(Z));if(!q.pathname.endsWith("/v1/messages"))return Q(Z,X);let Y=$4();if(!Y?.gatewayApiKey)throw Error("UnieAI Studio gateway credentials are missing. Run `unieai login` again.");let W=await a5(Z,X),K=Y.availableModelIds??[];if(!K.includes(W.model)){let v=i2();if(typeof v==="string"&&K.includes(v))W.model=v;else if(K.length>0)W.model=K[0]}let B=process.env.UNIEAI_GATEWAY_URL?.trim(),R=(B?q2(B):Y.gatewayBaseURL??tZ).replace(/\/$/,""),U=hZ(W),z=new Headers;z.set("Content-Type","application/json"),z.set("Accept",U.stream?"text/event-stream":"application/json"),z.set("Authorization",`Bearer ${Y.gatewayApiKey}`),L(`[API REQUEST] ${q.pathname} routed_to=UnieAI/Studio model=${W.model} source=${J??"unknown"} request_id=${s5()}`);let _=await Q(`${R}/chat/completions`,{method:"POST",headers:z,body:JSON.stringify(U),signal:X?.signal});if(!_.ok){let v=await _.text().catch(()=>"");return Response.json({type:"error",error:{type:"api_error",message:`UnieAI Studio gateway returned HTTP ${_.status}: ${v.slice(0,500)}`}},{status:_.status})}if(U.stream){if(!_.body)return Response.json({type:"error",error:{type:"api_error",message:"UnieAI Studio gateway returned no body for stream"}},{status:502});return new Response(cZ(_.body,W.model),{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}let T=await _.json();return Response.json(gZ(T,W.model))}}async function a5($,J){let Q=J?.body;if(typeof Q==="string")return JSON.parse(Q);if(Q instanceof Uint8Array||Q instanceof ArrayBuffer)return JSON.parse(Buffer.from(Q).toString("utf8"));if($ instanceof Request)return await $.clone().json();throw Error("Unable to read Anthropic request body for UnieAI Studio routing")}var X3="unieai-studio-dummy-key";var W3=H(()=>{pZ();uZ();aZ();p();u0();eZ();Z3()});import t5 from"@anthropic-ai/sdk";import{randomUUID as e5}from"crypto";function N$(){return{error:($,...J)=>console.error("[Anthropic SDK ERROR]",$,...J),warn:($,...J)=>console.error("[Anthropic SDK WARN]",$,...J),info:($,...J)=>console.error("[Anthropic SDK INFO]",$,...J),debug:($,...J)=>console.error("[Anthropic SDK DEBUG]",$,...J)}}function $V({explicitApiKey:$,envAuthToken:J=process.env.ANTHROPIC_AUTH_TOKEN,envApiKey:Q=process.env.ANTHROPIC_API_KEY,getFallbackApiKey:Z=U0}){if(J&&!$&&!Q)return null;return $||Z()}function JV({hasOpenAIAuth:$,isClaudeSubscriber:J,forceOpenAICodex:Q,isOpenAIModel:Z,hasAnthropicAuthToken:X,hasExplicitApiKey:q,hasFallbackApiKey:Y}){return $&&(!J||Q)&&(Z||!X&&!q&&!Y)}async function K3({apiKey:$,maxRetries:J,model:Q,fetchOverride:Z,source:X}){let q=process.env.CLAUDE_CODE_CONTAINER_ID,Y=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,W=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,K=ZV(),B={"x-app":"cli","User-Agent":L3(),"X-Claude-Code-Session-Id":A0(),...K,...q?{"x-claude-remote-container-id":q}:{},...Y?{"x-claude-remote-session-id":Y}:{},...W?{"x-client-app":W}:{}};if(L(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!K.Authorization}`),w(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION))B["x-anthropic-additional-protection"]="true";L("[API:auth] OAuth token check starting"),await A1(),L("[API:auth] OAuth token check complete");let U=Q?qJ(Q):!1,z=q3(),_=y(),T=w(process.env.CC_HAHA_OPENAI_OAUTH_PROVIDER),v=SZ(),F1=v&&!process.env.ANTHROPIC_AUTH_TOKEN&&!$&&!!U0(),z1=!z&&JV({hasOpenAIAuth:v,isClaudeSubscriber:_,forceOpenAICodex:T,isOpenAIModel:U,hasAnthropicAuthToken:!!process.env.ANTHROPIC_AUTH_TOKEN,hasExplicitApiKey:!!$,hasFallbackApiKey:F1});if(!_&&!z1&&!z)await QV(B,u());let F2=z?Y3(Z,X):z1?fZ(Z,X):XV(Z,X),x1={defaultHeaders:B,maxRetries:J,timeout:parseInt(process.env.API_TIMEOUT_MS||String(600000),10),dangerouslyAllowBrowser:!0,fetchOptions:G3({forAnthropicAPI:!0}),...F2&&{fetch:F2}};if(w(process.env.CLAUDE_CODE_USE_BEDROCK)){let{AnthropicBedrock:I1}=await import("@anthropic-ai/bedrock-sdk"),h=Q===lQ()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:S2(),L0={...x1,awsRegion:h,...w(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...J4()&&{logger:N$()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)L0.skipAuth=!0,L0.defaultHeaders={...L0.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!w(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let t0=await G1();if(t0)L0.awsAccessKey=t0.accessKeyId,L0.awsSecretKey=t0.secretAccessKey,L0.awsSessionToken=t0.sessionToken}return new I1(L0)}if(w(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:I1}=await import("@anthropic-ai/foundry-sdk"),h;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(w(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))h=()=>Promise.resolve("");else{let{DefaultAzureCredential:t0,getBearerTokenProvider:G8}=await import("@azure/identity");h=G8(new t0,"https://cognitiveservices.azure.com/.default")}let L0={...x1,...h&&{azureADTokenProvider:h},...J4()&&{logger:N$()}};return new I1(L0)}if(w(process.env.CLAUDE_CODE_USE_VERTEX)){if(!w(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH))await Q4();let[{AnthropicVertex:I1},{GoogleAuth:h}]=await Promise.all([import("@anthropic-ai/vertex-sdk"),import("google-auth-library")]),L0=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,t0=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,G8=w(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new h({scopes:["https://www.googleapis.com/auth/cloud-platform"],...L0||t0?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}}),J7={...x1,region:V3(Q),googleAuth:G8,...J4()&&{logger:N$()}};return new I1(J7)}let V8={apiKey:z?X3:z1?yZ:_?null:$V({explicitApiKey:$}),authToken:!z&&_&&!z1?C()?.accessToken:void 0,...process.env.USER_TYPE==="ant"&&w(process.env.USE_STAGING_OAUTH)?{baseURL:f().BASE_API_URL}:{},...x1,...J4()&&{logger:N$()}};return new t5(V8)}async function QV($,J){let Q=process.env.ANTHROPIC_AUTH_TOKEN||await O$(J);if(Q)$.Authorization=`Bearer ${Q}`}function ZV(){let $={},J=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!J)return $;let Q=J.split(/\n|\r\n/);for(let Z of Q){if(!Z.trim())continue;let X=Z.indexOf(":");if(X===-1)continue;let q=Z.slice(0,X).trim(),Y=Z.slice(X+1).trim();if(q)$[q]=Y}return $}function XV($,J){let Q=$??globalThis.fetch,Z=P()==="firstParty"&&f0();return(X,q)=>{let Y=new Headers(q?.headers);if(Z&&!Y.has(D$))Y.set(D$,e5());try{let W=X instanceof Request?X.url:String(X),K=Y.get(D$);L(`[API REQUEST] ${new URL(W).pathname}${K?` ${D$}=${K}`:""} source=${J??"unknown"}`)}catch{}return Q(X,{...q,headers:Y,body:YZ(q?.body)})}}var D$="x-client-request-id";var B3=H(()=>{$0();VZ();F$();u0();b0();w9();i();M0();bZ();u2();W3();p();j()});import{readFileSync as qV}from"fs";import{mkdir as YV,writeFile as WV}from"fs/promises";import VV from"lodash-es/isEqual.js";import GV from"lodash-es/memoize.js";import{join as H3}from"path";import{z as f1}from"zod/v4";function R3(){return H3(b(),"cache")}function w3(){return H3(R3(),"model-capabilities.json")}function _3(){if(process.env.USER_TYPE!=="ant")return!1;if(P()!=="firstParty")return!1;if(!f0())return!1;return!0}function BV($){return[...$].sort((J,Q)=>Q.id.length-J.id.length||J.id.localeCompare(Q.id))}function jJ($){if(!_3())return;let J=kJ(w3());if(!J||J.length===0)return;let Q=$.toLowerCase(),Z=J.find((X)=>X.id.toLowerCase()===Q);if(Z)return Z;return J.find((X)=>Q.includes(X.id.toLowerCase()))}async function vD(){if(!_3())return;if(X$())return;try{let $=await K3({maxRetries:1}),J=y()?[P0]:void 0,Q=[];for await(let q of $.models.list({betas:J})){let Y=U3().safeParse(q);if(Y.success)Q.push(Y.data)}if(Q.length===0)return;let Z=w3(),X=BV(Q);if(VV(kJ(Z),X)){L("[modelCapabilities] cache unchanged, skipping write");return}await YV(R3(),{recursive:!0}),await WV(Z,A({models:X,timestamp:Date.now()}),{encoding:"utf-8",mode:384}),kJ.cache.delete(Z),L(`[modelCapabilities] cached ${X.length} models`)}catch($){L(`[modelCapabilities] fetch failed: ${$ instanceof Error?$.message:"unknown"}`)}}var U3,KV,kJ;var N3=H(()=>{M0();B3();$0();p();j();k2();b1();b4();X0();b0();U3=O(()=>f1.object({id:f1.string(),max_input_tokens:f1.number().optional(),max_tokens:f1.number().optional()}).strip()),KV=O(()=>f1.object({models:f1.array(U3()),timestamp:f1.number()}));kJ=GV(($)=>{try{let J=qV($,"utf-8"),Q=KV().safeParse(V0(J,!1));return Q.success?Q.data.models:null}catch{return null}},($)=>$)});function yJ($){return $.trim().replace(/\[1m\]$/i,"").replace(/:1m$/i,"").toLowerCase()}function UV($){if(typeof $!=="number"||!Number.isInteger($))return;if($<16000||$>1e7)return;return $}function RV(){let $=process.env.CLAUDE_CODE_MODEL_CONTEXT_WINDOWS;if(!$?.trim())return{};try{let J=JSON.parse($);if(!J||typeof J!=="object"||Array.isArray(J))return{};let Q={};for(let[Z,X]of Object.entries(J)){let q=UV(X);if(q!==void 0)Q[yJ(Z)]=q}return Q}catch{return{}}}function wV($){let J=RV(),Q=yJ($),Z=J[Q];if(Z!==void 0)return Z;for(let[X,q]of Object.entries(J))if(Q.endsWith(`/${X}`)||Q.endsWith(`:${X}`))return q;return}function _V($){let J=yJ($),Q=LV[J];if(Q!==void 0)return Q;for(let[Z,X]of HV)if(Z.test(J))return X;return}function D3($){return wV($)??_V($)}var jD="CLAUDE_CODE_MODEL_CONTEXT_WINDOWS",LV,HV;var O3=H(()=>{LV={"claude-opus-4-7":1e6,"claude-sonnet-4-6":200000,"claude-haiku-4-5":200000,"deepseek-v4-pro":1e6,"deepseek-v4-flash":1e6,"deepseek-chat":1e6,"deepseek-reasoner":1e6,"kimi-k2.6":262144,"kimi-k2.5":262144,"kimi-k2-0905-preview":262144,"kimi-k2-turbo-preview":262144,"kimi-k2-thinking":262144,"kimi-k2-thinking-turbo":262144,"minimax-m2.7":204800,"minimax-m2.7-highspeed":204800,"minimax-m2.5":204800,"minimax-m2.5-highspeed":204800,"minimax-m2.1":204800,"minimax-m2.1-highspeed":204800,"minimax-m2":204800,"glm-5.1":200000,"glm-5":200000,"glm-5-turbo":200000,"glm-4.7":200000,"glm-4.6":200000,"glm-4.5":128000,"glm-4.5-air":128000},HV=[[/^anthropic\/claude-opus-4\.7\b/i,1e6],[/^anthropic\/claude-sonnet-4\.6\b/i,200000],[/^anthropic\/claude-haiku-4\.5\b/i,200000],[/^openai\/gpt-4\.1\b/i,1047576],[/^openai\/gpt-5(?:[.-]\d+)?\b/i,400000],[/^google\/gemini-(?:2\.0|2\.5|3)/i,1048576],[/^gemini-(?:2\.0|2\.5|3)/i,1048576],[/^qwen\/qwen3\.5-(?:plus|flash)\b/i,1e6],[/^qwen3\.5-(?:plus|flash)\b/i,1e6],[/^qwen\/qwen3-max\b/i,262144],[/^qwen3-max\b/i,262144],[/qwen-long/i,1e7]]});function j1(){return w(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function E0($){if(j1())return!1;return/\[1m\]/i.test($)||/:1m$/i.test($)}function HJ($){if(j1())return!1;let J=Z0($);return J.includes("claude-sonnet-4")||J.includes("opus-4-6")}function lD($,J){if(process.env.USER_TYPE==="ant"&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let q=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(q)&&q>0)return q}if(E0($))return 1e6;let Q=D3($);if(Q!==void 0){if(Q>Z4&&j1())return Z4;return Q}let Z=DQ($);if(Z)return Z;let X=jJ($);if(X?.max_input_tokens&&X.max_input_tokens>=1e5){if(X.max_input_tokens>Z4&&j1())return Z4;return X.max_input_tokens}if(J?.includes(m2)&&HJ($))return 1e6;if(NV($))return 1e6;if(process.env.USER_TYPE==="ant"){let q=resolveAntModel($);if(q?.contextWindow)return q.contextWindow}return Z4}function NV($){if(j1())return!1;if(E0($))return!1;if(!Z0($).includes("sonnet-4-6"))return!1;return I().clientDataCache?.coral_reef_sonnet==="true"}function nD($,J){if(!$)return{used:null,remaining:null};let Q=$.input_tokens+$.cache_creation_input_tokens+$.cache_read_input_tokens,Z=Math.round(Q/J*100),X=Math.min(100,Math.max(0,Z));return{used:X,remaining:100-X}}function iD($,J,Q){if(!J)return $;let Z=J.input_tokens+J.cache_creation_input_tokens+J.cache_read_input_tokens+(J.output_tokens??0),X=Math.max($,Z);return Q!==void 0?Math.min(X,Q):X}function DV($){let J,Q;if(process.env.USER_TYPE==="ant"){let q=resolveAntModel($.toLowerCase());if(q)return J=q.defaultMaxTokens??F3,Q=q.upperMaxTokensLimit??z3,{default:J,upperLimit:Q}}let Z=Z0($);if(Z.includes("opus-4-6"))J=64000,Q=128000;else if(Z.includes("sonnet-4-6"))J=32000,Q=128000;else if(Z.includes("opus-4-5")||Z.includes("sonnet-4")||Z.includes("haiku-4"))J=32000,Q=64000;else if(Z.includes("opus-4-1")||Z.includes("opus-4"))J=32000,Q=32000;else if(Z.includes("claude-3-opus"))J=4096,Q=4096;else if(Z.includes("claude-3-sonnet"))J=8192,Q=8192;else if(Z.includes("claude-3-haiku"))J=4096,Q=4096;else if(Z.includes("3-5-sonnet")||Z.includes("3-5-haiku"))J=8192,Q=8192;else if(Z.includes("3-7-sonnet"))J=32000,Q=64000;else J=F3,Q=z3;let X=jJ($);if(X?.max_tokens&&X.max_tokens>=4096)Q=X.max_tokens,J=Math.min(J,Q);return{default:J,upperLimit:Q}}function rD($){return DV($).upperLimit-1}var Z4=200000,uD=20000,F3=32000,z3=64000,dD=8000,cD=64000;var UJ=H(()=>{XJ();u2();D0();j();u0();N3();O3()});import OV from"lodash-es/memoize.js";var FV,x3;var I3=H(()=>{b0();FV=[{modelEnvVar:"ANTHROPIC_DEFAULT_OPUS_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES"},{modelEnvVar:"ANTHROPIC_DEFAULT_SONNET_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES"},{modelEnvVar:"ANTHROPIC_DEFAULT_HAIKU_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES"}],x3=OV(($,J)=>{if(P()==="firstParty"&&f0())return;let Q=$.toLowerCase();for(let Z of FV){let X=process.env[Z.modelEnvVar],q=process.env[Z.capabilitiesEnvVar];if(!X||q===void 0)continue;if(Q!==X.toLowerCase())continue;return q.toLowerCase().split(",").map((Y)=>Y.trim()).includes(J)}return},($,J)=>`${$.toLowerCase()}:${J}`)});import SJ from"lodash-es/memoize.js";function zV($){let J=[],Q=[];for(let Z of $)if(E3.includes(Z))J.push(Z);else Q.push(Z);return{allowed:J,disallowed:Q}}function LO($){if(!$||$.length===0)return;if(y()){console.warn("Warning: Custom betas are only available for API key users. Ignoring provided betas.");return}let{allowed:J,disallowed:Q}=zV($);for(let Z of Q)console.warn(`Warning: Beta header '${Z}' is not allowed. Only the following betas are supported: ${E3.join(", ")}`);return J.length>0?J:void 0}function M3($){let J=x3($,"interleaved_thinking");if(J!==void 0)return J;let Q=Z0($),Z=P();if(Z==="foundry")return!0;if(Z==="firstParty")return!Q.includes("claude-3-");return Q.includes("claude-opus-4")||Q.includes("claude-sonnet-4")}function xV($){let J=Z0($);return J.includes("claude-opus-4")||J.includes("claude-sonnet-4")||J.includes("claude-haiku-4")}function IV($){let J=Z0($),Q=P();if(Q==="foundry")return!0;if(Q==="firstParty")return!J.includes("claude-3-");return J.includes("claude-opus-4")||J.includes("claude-sonnet-4")||J.includes("claude-haiku-4")}function MV($){let J=Z0($),Q=P();if(Q!=="firstParty"&&Q!=="foundry")return!1;return J.includes("claude-sonnet-4-6")||J.includes("claude-sonnet-4-5")||J.includes("claude-opus-4-1")||J.includes("claude-opus-4-5")||J.includes("claude-opus-4-7")||J.includes("claude-haiku-4-5")}function HO($){return!1}function UO(){let $=P();if($==="vertex"||$==="bedrock")return RQ;return UQ}function T3(){return(P()==="firstParty"||P()==="foundry")&&(P()!=="firstParty"||f0())&&!w(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function RO(){return P()==="firstParty"&&!w(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function wO($,J){if(P()==="firstParty"&&!f0())return[];let Q=[...z$($)];if(J?.isAgenticQuery){if(!Q.includes(Q$))Q.push(Q$);if(process.env.USER_TYPE==="ant"&&process.env.CLAUDE_CODE_ENTRYPOINT==="cli"&&J2&&!Q.includes(J2))Q.push(J2)}let Z=P3();if(!Z||Z.length===0)return Q;return[...Q,...Z.filter((X)=>!Q.includes(X))]}function A3(){fJ.cache?.clear?.(),z$.cache?.clear?.(),TV.cache?.clear?.()}var E3,fJ,z$,TV;var bJ=H(()=>{Q1();i();XJ();M0();$0();UJ();j();u0();I3();b0();J1();E3=[m2];fJ=SJ(($)=>{let J=[],Q=Z0($).includes("haiku"),Z=P(),X=T3();if(!Q){if(J.push(Q$),process.env.USER_TYPE==="ant"&&process.env.CLAUDE_CODE_ENTRYPOINT==="cli"){if(J2)J.push(J2)}}if(y())J.push(P0);if(E0($))J.push(m2);if(!w(process.env.DISABLE_INTERLEAVED_THINKING)&&M3($))J.push(BQ);if(X&&M3($)&&!u()&&N0().showThinkingSummaries!==!0)J.push(_Q);if(QJ&&process.env.USER_TYPE==="ant"&&X&&!C4(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION)&&(w(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION)||q0("tengu_slate_prism",!1)))J.push(QJ);let q=w(process.env.USE_API_CONTEXT_MANAGEMENT)&&process.env.USER_TYPE==="ant",Y=IV($);if(T3()&&(q||Y))J.push(LQ);let W=C3("tengu_tool_pear"),K=!W&&q0("tengu_amber_json_tools",!1);if(X&&MV($)&&W)J.push(HQ);if(process.env.USER_TYPE==="ant"&&X&&K)J.push(NQ);if(Z==="vertex"&&xV($))J.push(JJ);if(Z==="foundry")J.push(JJ);if(X)J.push(wQ);if(process.env.ANTHROPIC_BETAS)J.push(...process.env.ANTHROPIC_BETAS.split(",").map((B)=>B.trim()).filter(Boolean));return J}),z$=SJ(($)=>{let J=fJ($);if(P()==="bedrock")return J.filter((Q)=>!ZJ.has(Q));return J}),TV=SJ(($)=>{return fJ($).filter((Q)=>ZJ.has(Q))})});import{execFile as PV}from"child_process";function v3($){return new Promise((J)=>{PV("security",["find-generic-password","-a",h0(),"-w","-s",$],{encoding:"utf-8",timeout:EV},(Q,Z)=>{J({stdout:Q?null:Z?.trim()||null,timedOut:Boolean(Q&&"killed"in Q&&Q.killed)})})})}function FO(){if(process.platform!=="darwin"||x$||C0())return;let $=v3(G0(P1)),J=v3(G0());x$=Promise.all([$,J]).then(([Q,Z])=>{if(!Q.timedOut)y9(Q.stdout);if(!Z.timedOut)hJ={stdout:Z.stdout}})}async function zO(){if(x$)await x$}function k3(){return hJ}function pJ(){hJ=null}var EV=1e4,hJ=null,x$=null;var j3=H(()=>{j();b2()});function IO(){return y3}function S3(){y3.clear()}var y3;var f3=H(()=>{y3=new Map});var _G={};AV(_G,{validateForceLoginOrg:()=>wG,saveOAuthTokensIfNeeded:()=>t3,saveApiKey:()=>a8,removeApiKey:()=>$G,refreshGcpCredentialsIfNeeded:()=>Q4,refreshGcpAuth:()=>s3,refreshAwsAuth:()=>r3,refreshAndGetAwsCredentials:()=>G1,prefetchGcpCredentialsIfSafe:()=>sV,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>aV,prefetchApiKeyFromApiKeyHelperIfSafe:()=>pV,isUsing3PServices:()=>A$,isTeamSubscriber:()=>WG,isTeamPremiumSubscriber:()=>B$,isProSubscriber:()=>RJ,isOverageProvisioningAllowed:()=>qG,isOtelHeadersHelperFromProjectOrLocalSettings:()=>JX,isOpenAIAuthActive:()=>y1,isMaxSubscriber:()=>K$,isGcpAuthRefreshFromProjectSettings:()=>sJ,isEnterpriseSubscriber:()=>VG,isCustomApiKeyApproved:()=>eV,isConsumerSubscriber:()=>LG,isClaudeAISubscriber:()=>y,isAwsCredentialExportFromProjectSettings:()=>rJ,isAwsAuthRefreshFromProjectSettings:()=>nJ,isAnthropicAuthEnabled:()=>W2,is1PApiCustomer:()=>XG,hasProfileScope:()=>g0,hasOpusAccess:()=>YG,hasOpenAIAuthLogin:()=>UG,hasAnthropicApiKeyAuth:()=>SV,handleOAuth401Error:()=>l2,getSubscriptionType:()=>d,getSubscriptionName:()=>e3,getRateLimitTier:()=>E$,getOtelHeadersFromHelper:()=>KG,getOpenAISubscriptionName:()=>QX,getOpenAIAuthOverrideWarning:()=>HG,getOauthAccountInfo:()=>_1,getConfiguredApiKeyHelper:()=>w1,getClaudeAIOAuthTokensAsync:()=>q4,getClaudeAIOAuthTokens:()=>C,getAuthTokenSource:()=>T1,getApiKeyHelperElapsedMs:()=>fV,getApiKeyFromConfigOrMacOSKeychain:()=>T$,getApiKeyFromApiKeyHelperCached:()=>mJ,getApiKeyFromApiKeyHelper:()=>O$,getAnthropicApiKeyWithSource:()=>h1,getAnthropicApiKey:()=>U0,getAccountInformation:()=>RG,clearStoredClaudeAIOAuthTokens:()=>JG,clearOAuthTokenCache:()=>P$,clearGcpCredentialsCache:()=>oV,clearAwsCredentialsCache:()=>cV,clearApiKeyHelperCache:()=>hV,checkGcpCredentialsValid:()=>o3,checkAndRefreshOAuthTokenIfNeeded:()=>A1,calculateApiKeyHelperTTL:()=>i3});import v0 from"chalk";import{exec as c3}from"child_process";import{execa as cJ}from"execa";import{mkdir as vV,stat as kV}from"fs/promises";import l3 from"lodash-es/memoize.js";import{join as jV}from"path";function M$(){return w(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT==="claude-desktop"}function W2(){if(C0())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let $=w(process.env.CLAUDE_CODE_USE_BEDROCK)||w(process.env.CLAUDE_CODE_USE_VERTEX)||w(process.env.CLAUDE_CODE_USE_FOUNDRY)||w(process.env.CLAUDE_CODE_USE_AZURE_OPENAI),Q=(z0()||{}).apiKeyHelper,Z=process.env.ANTHROPIC_AUTH_TOKEN||Q||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:X}=h1({skipRetrievingKeyFromApiKeyHelper:!0}),q=X==="ANTHROPIC_API_KEY"||X==="apiKeyHelper";return!($||Z&&!M$()||q&&!M$())}function T1(){if(C0()){if(w1())return{source:"apiKeyHelper",hasToken:!0};return{source:"none",hasToken:!1}}if(process.env.ANTHROPIC_AUTH_TOKEN&&!M$())return{source:"ANTHROPIC_AUTH_TOKEN",hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:"CLAUDE_CODE_OAUTH_TOKEN",hasToken:!0};if($$()){if(process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)return{source:"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",hasToken:!0};return{source:"CCR_OAUTH_TOKEN_FILE",hasToken:!0}}if(w1()&&!M$())return{source:"apiKeyHelper",hasToken:!0};let Q=C();if(L1(Q?.scopes)&&Q?.accessToken)return{source:"claude.ai",hasToken:!0};return{source:"none",hasToken:!1}}function U0(){let{key:$}=h1();return $}function SV(){let{key:$,source:J}=h1({skipRetrievingKeyFromApiKeyHelper:!0});return $!==null&&J!=="none"}function h1($={}){if(C0()){if(process.env.ANTHROPIC_API_KEY)return{key:process.env.ANTHROPIC_API_KEY,source:"ANTHROPIC_API_KEY"};if(w1())return{key:$.skipRetrievingKeyFromApiKeyHelper?null:mJ(),source:"apiKeyHelper"};return{key:null,source:"none"}}let J=g3()?void 0:process.env.ANTHROPIC_API_KEY;if(Z$()&&J)return{key:J,source:"ANTHROPIC_API_KEY"};if(w(process.env.CI)){let q=t8();if(q)return{key:q,source:"ANTHROPIC_API_KEY"};if(!J&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error("ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required");if(J)return{key:J,source:"ANTHROPIC_API_KEY"};return{key:null,source:"none"}}if(J&&I().customApiKeyResponses?.approved?.includes(J$(J)))return{key:J,source:"ANTHROPIC_API_KEY"};let Q=t8();if(Q)return{key:Q,source:"ANTHROPIC_API_KEY"};if(w1()){if($.skipRetrievingKeyFromApiKeyHelper)return{key:null,source:"apiKeyHelper"};return{key:mJ(),source:"apiKeyHelper"}}let X=T$();if(X)return X;return{key:null,source:"none"}}function w1(){if(C0())return S("flagSettings")?.apiKeyHelper;return(z0()||{}).apiKeyHelper}function n3(){let $=w1();if(!$)return!1;let J=S("projectSettings"),Q=S("localSettings");return J?.apiKeyHelper===$||Q?.apiKeyHelper===$}function lJ(){return(z0()||{}).awsAuthRefresh}function nJ(){let $=lJ();if(!$)return!1;let J=S("projectSettings"),Q=S("localSettings");return J?.awsAuthRefresh===$||Q?.awsAuthRefresh===$}function iJ(){return(z0()||{}).awsCredentialExport}function rJ(){let $=iJ();if(!$)return!1;let J=S("projectSettings"),Q=S("localSettings");return J?.awsCredentialExport===$||Q?.awsCredentialExport===$}function i3(){let $=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if($){let J=parseInt($,10);if(!Number.isNaN(J)&&J>=0)return J;L(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${$}`,{level:"error"})}return yV}function fV(){let $=c0?.startedAt;return $?Date.now()-$:0}async function O$($){if(!w1())return null;let J=i3();if(B0){if(Date.now()-B0.timestamp<J)return B0.value;if(!c0)c0={promise:b3($,!1,Y2),startedAt:null};return B0.value}if(c0)return c0.promise;return c0={promise:b3($,!0,Y2),startedAt:Date.now()},c0.promise}async function b3($,J,Q){try{let Z=await bV($);if(Q!==Y2)return Z;if(Z!==null)B0={value:Z,timestamp:Date.now()};return Z}catch(Z){if(Q!==Y2)return" ";let X=Z instanceof Error?Z.message:String(Z);if(console.error(v0.red(`apiKeyHelper failed: ${X}`)),L(`Error getting API key from apiKeyHelper: ${X}`,{level:"error"}),!J&&B0&&B0.value!==" ")return B0={...B0,timestamp:Date.now()},B0.value;return B0={value:" ",timestamp:Date.now()}," "}finally{if(Q===Y2)c0=null}}async function bV($){let J=w1();if(!J)return null;if(n3()){if(!e()&&!$){let q=Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return Y4("apiKeyHelper invoked before trust check",q),F("tengu_apiKeyHelper_missing_trust11",{}),null}}let Q=await cJ(J,{shell:!0,timeout:600000,reject:!1});if(Q.failed){let X=Q.timedOut?"timed out":`exited ${Q.exitCode}`,q=Q.stderr?.trim();throw Error(q?`${X}: ${q}`:X)}let Z=Q.stdout?.trim();if(!Z)throw Error("did not return a value");return Z}function mJ(){return B0?.value??null}function hV(){Y2++,B0=null,c0=null}function pV($){if(n3()&&!e())return;O$($)}async function mV(){let $=lJ();if(!$)return!1;if(nJ()){if(!e()&&!u()){let Q=Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return Y4("awsAuthRefresh invoked before trust check",Q),F("tengu_awsAuthRefresh_missing_trust",{}),!1}}try{return L("Fetching AWS caller identity for AWS auth refresh command"),await e8(),L("Fetched AWS caller identity, skipping AWS auth refresh command"),!1}catch{return r3($)}}function r3($){L("Running AWS auth refresh command");let J=O0.getInstance();return J.startAuthentication(),new Promise((Q)=>{let Z=c3($,{timeout:uV});Z.stdout.on("data",(X)=>{let q=X.toString().trim();if(q)J.addOutput(q),L(q,{level:"debug"})}),Z.stderr.on("data",(X)=>{let q=X.toString().trim();if(q)J.setError(q),L(q,{level:"error"})}),Z.on("close",(X,q)=>{if(X===0)L("AWS auth refresh completed successfully"),J.endAuthentication(!0),Q(!0);else{let W=q==="SIGTERM"?v0.red("AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal."):v0.red("Error running awsAuthRefresh (in settings or ~/.claude.json):");console.error(W),J.endAuthentication(!1),Q(!1)}})})}async function dV(){let $=iJ();if(!$)return null;if(rJ()){if(!e()&&!u()){let Q=Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return Y4("awsCredentialExport invoked before trust check",Q),F("tengu_awsCredentialExport_missing_trust",{}),null}}try{return L("Fetching AWS caller identity for credential export command"),await e8(),L("Fetched AWS caller identity, skipping AWS credential export command"),null}catch{try{L("Running AWS credential export command");let J=await cJ($,{shell:!0,reject:!1});if(J.exitCode!==0||!J.stdout)throw Error("awsCredentialExport did not return a valid value");let Q=a(J.stdout.trim());if(!WQ(Q))throw Error("awsCredentialExport did not return valid AWS STS output structure");return L("AWS credentials retrieved from awsCredentialExport"),{accessKeyId:Q.Credentials.AccessKeyId,secretAccessKey:Q.Credentials.SecretAccessKey,sessionToken:Q.Credentials.SessionToken}}catch(J){let Q=v0.red("Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):");if(J instanceof Error)console.error(Q,J.message);else console.error(Q,J);return null}}}function cV(){G1.cache.clear()}function oJ(){return(z0()||{}).gcpAuthRefresh}function sJ(){let $=oJ();if(!$)return!1;let J=S("projectSettings"),Q=S("localSettings");return J?.gcpAuthRefresh===$||Q?.gcpAuthRefresh===$}async function o3(){try{let{GoogleAuth:$}=await import("google-auth-library"),J=new $({scopes:["https://www.googleapis.com/auth/cloud-platform"]}),Q=(async()=>{await(await J.getClient()).getAccessToken()})(),Z=W4(lV).then(()=>{throw new XX("GCP credentials check timed out")});return await Promise.race([Q,Z]),!0}catch{return!1}}async function iV(){let $=oJ();if(!$)return!1;if(sJ()){if(!e()&&!u()){let Q=Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return Y4("gcpAuthRefresh invoked before trust check",Q),F("tengu_gcpAuthRefresh_missing_trust",{}),!1}}try{if(L("Checking GCP credentials validity for auth refresh"),await o3())return L("GCP credentials are valid, skipping auth refresh command"),!1}catch{}return s3($)}function s3($){L("Running GCP auth refresh command");let J=O0.getInstance();return J.startAuthentication(),new Promise((Q)=>{let Z=c3($,{timeout:rV});Z.stdout.on("data",(X)=>{let q=X.toString().trim();if(q)J.addOutput(q),L(q,{level:"debug"})}),Z.stderr.on("data",(X)=>{let q=X.toString().trim();if(q)J.setError(q),L(q,{level:"error"})}),Z.on("close",(X,q)=>{if(X===0)L("GCP auth refresh completed successfully"),J.endAuthentication(!0),Q(!0);else{let W=q==="SIGTERM"?v0.red("GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal."):v0.red("Error running gcpAuthRefresh (in settings or ~/.claude.json):");console.error(W),J.endAuthentication(!1),Q(!1)}})})}function oV(){Q4.cache.clear()}function sV(){if(!oJ())return;if(sJ()){if(!e()&&!u())return}Q4()}function aV(){let $=lJ(),J=iJ();if(!$&&!J)return;if(nJ()||rJ()){if(!e()&&!u())return}G1(),k()}function tV($){return/^[a-zA-Z0-9-_]+$/.test($)}async function a8($){if(!tV($))throw Error("Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.");await a3();let J=!1;if(process.platform==="darwin")try{let Z=G0(),X=h0(),q=Buffer.from($,"utf-8").toString("hex"),Y=`add-generic-password -U -a "${X}" -s "${Z}" -X "${q}"
|
|
67
|
-
`;await cJ("security",["-i"],{input:Y,reject:!1}),F("tengu_api_key_saved_to_keychain",{}),J=!0}catch(Z){D(Z),F("tengu_api_key_keychain_error",{error:c(Z)}),F("tengu_api_key_saved_to_config",{})}else F("tengu_api_key_saved_to_config",{});let Q=J$($);n((Z)=>{let X=Z.customApiKeyResponses?.approved??[];return{...Z,primaryApiKey:J?Z.primaryApiKey:$,customApiKeyResponses:{...Z.customApiKeyResponses,approved:X.includes(Q)?X:[...X,Q],rejected:Z.customApiKeyResponses?.rejected??[]}}}),T$.cache.clear?.(),pJ()}function eV($){let J=I(),Q=J$($);return J.customApiKeyResponses?.approved?.includes(Q)??!1}async function $G(){await a3(),n(($)=>({...$,primaryApiKey:void 0})),T$.cache.clear?.(),pJ()}function JG(){try{let $=T0(),J=$.read()||{};if("claudeAiOauth"in J)delete J.claudeAiOauth;let Q=$.update(J);return P$(),Q}catch($){return D($),{success:!1,warning:"Failed to clear stored Claude OAuth tokens"}}}async function a3(){try{await qQ()}catch($){D($)}}function t3($){if(!L1($.scopes))return F("tengu_oauth_tokens_not_claude_ai",{}),{success:!0};if(!$.refreshToken||!$.expiresAt)return F("tengu_oauth_tokens_inference_only",{}),{success:!0};let J=T0(),Q=J.name;try{let Z=J.read()||{},X=Z.claudeAiOauth;Z.claudeAiOauth={accessToken:$.accessToken,refreshToken:$.refreshToken,expiresAt:$.expiresAt,scopes:$.scopes,subscriptionType:$.subscriptionType??X?.subscriptionType??null,rateLimitTier:$.rateLimitTier??X?.rateLimitTier??null};let q=J.update(Z);if(q.success)F("tengu_oauth_tokens_saved",{storageBackend:Q});else F("tengu_oauth_tokens_save_failed",{storageBackend:Q});return C.cache?.clear?.(),A3(),S3(),q}catch(Z){return D(Z),F("tengu_oauth_tokens_save_exception",{storageBackend:Q,error:c(Z)}),{success:!1,warning:"Failed to save OAuth tokens"}}}function P$(){C.cache?.clear?.(),p0()}async function QG(){try{let{mtimeMs:$}=await kV(jV(b(),".credentials.json"));if($!==h3)h3=$,P$()}catch{C.cache?.clear?.()}}function l2($){let J=gJ.get($);if(J)return J;let Q=ZG($).finally(()=>{gJ.delete($)});return gJ.set($,Q),Q}async function ZG($){P$();let J=await q4();if(!J?.refreshToken)return!1;if(J.accessToken!==$)return F("tengu_oauth_401_recovered_from_keychain",{}),!0;return A1(0,!0)}async function q4(){if(C0())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||$$())return C();try{let Q=(await T0().readAsync())?.claudeAiOauth;if(!Q?.accessToken)return null;return Q}catch($){return D($),null}}function A1($=0,J=!1){if($===0&&!J){if(X4)return X4;return X4=uJ($,J).finally(()=>{X4=null}),X4}return uJ($,J)}async function uJ($,J){await QG();let Z=C();if(!J){if(!Z?.refreshToken||!E1(Z.expiresAt))return!1}if(!Z?.refreshToken)return!1;if(!L1(Z.scopes))return!1;C.cache?.clear?.(),p0();let X=await q4();if(!X?.refreshToken||!E1(X.expiresAt))return!1;let q=b();await vV(q,{recursive:!0});let Y;try{F("tengu_oauth_token_refresh_lock_acquiring",{}),Y=await u3(q),F("tengu_oauth_token_refresh_lock_acquired",{})}catch(W){if(W.code==="ELOCKED"){if($<5)return F("tengu_oauth_token_refresh_lock_retry",{retryCount:$+1}),await W4(1000+Math.random()*1000),uJ($+1,J);return F("tengu_oauth_token_refresh_lock_retry_limit_reached",{maxRetries:5}),!1}return D(W),F("tengu_oauth_token_refresh_lock_error",{error:c(W)}),!1}try{C.cache?.clear?.(),p0();let W=await q4();if(!W?.refreshToken||!E1(W.expiresAt))return F("tengu_oauth_token_refresh_race_resolved",{}),!1;F("tengu_oauth_token_refresh_starting",{});let K=await a9(W.refreshToken,{scopes:L1(W.scopes)?void 0:W.scopes});return t3(K),C.cache?.clear?.(),p0(),!0}catch(W){D(W),C.cache?.clear?.(),p0();let K=await q4();if(K&&!E1(K.expiresAt))return F("tengu_oauth_token_refresh_race_recovered",{}),!0;return!1}finally{F("tengu_oauth_token_refresh_lock_releasing",{}),await Y(),F("tengu_oauth_token_refresh_lock_released",{})}}function y(){if(!W2())return!1;return L1(C()?.scopes)}function g0(){return C()?.scopes?.includes(m3)??!1}function XG(){if(w(process.env.CLAUDE_CODE_USE_BEDROCK)||w(process.env.CLAUDE_CODE_USE_VERTEX)||w(process.env.CLAUDE_CODE_USE_FOUNDRY)||w(process.env.CLAUDE_CODE_USE_AZURE_OPENAI))return!1;if(y())return!1;return!0}function _1(){return W2()?I().oauthAccount:void 0}function qG(){let J=_1()?.billingType;if(!y()||!J)return!1;if(J!=="stripe_subscription"&&J!=="stripe_subscription_contracted"&&J!=="apple_subscription"&&J!=="google_play_subscription")return!1;return!0}function YG(){let $=d();return $==="max"||$==="enterprise"||$==="team"||$==="pro"||$===null}function d(){if(C9())return A9();if(!W2())return null;let $=C();if(!$)return null;return $.subscriptionType??null}function K$(){return d()==="max"}function WG(){return d()==="team"}function B$(){return d()==="team"&&E$()==="default_claude_max_5x"}function VG(){return d()==="enterprise"}function RJ(){return d()==="pro"}function E$(){if(!W2())return null;let $=C();if(!$)return null;return $.rateLimitTier??null}function e3(){switch(d()){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro";default:return"Claude API"}}function A$(){return!!(w(process.env.CLAUDE_CODE_USE_BEDROCK)||w(process.env.CLAUDE_CODE_USE_VERTEX)||w(process.env.CLAUDE_CODE_USE_FOUNDRY)||w(process.env.CLAUDE_CODE_USE_AZURE_OPENAI))}function $X(){return(z0()||{}).otelHeadersHelper}function JX(){let $=$X();if(!$)return!1;let J=S("projectSettings"),Q=S("localSettings");return J?.otelHeadersHelper===$||Q?.otelHeadersHelper===$}function KG(){let $=$X();if(!$)return{};let J=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||GG.toString());if(I$&&Date.now()-p3<J)return I$;if(JX()){if(!e())return{}}try{let Q=K1($,{timeout:30000})?.toString().trim();if(!Q)throw Error("otelHeadersHelper did not return a valid value");let Z=a(Q);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw Error("otelHeadersHelper must return a JSON object with string key-value pairs");for(let[X,q]of Object.entries(Z))if(typeof q!=="string")throw Error(`otelHeadersHelper returned non-string value for key "${X}": ${typeof q}`);return I$=Z,p3=Date.now(),I$}catch(Q){throw D(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${c(Q)}`)),Q}}function BG($){return $==="max"||$==="pro"}function LG(){let $=d();return y()&&$!==null&&BG($)}function QX(){return"ChatGPT Pro/Plus"}function HG(){if(A$())return"OpenAI login is saved, but this shell is configured for a third-party provider.";let{source:$}=T1();if($!=="none")return`OpenAI login is saved, but this shell is still using ${$} for Anthropic-compatible auth.`;let{source:J}=h1({skipRetrievingKeyFromApiKeyHelper:!0});if(J!=="none")return`OpenAI login is saved, but this shell is still using ${J} for Anthropic-compatible auth.`;return null}function UG(){return!!p2()?.refreshToken&&!A$()}function y1(){return ZX()!==void 0}function ZX($){let J=p2();if(!J?.refreshToken||A$())return;let Q=$?.authTokenSource??T1().source,Z=$?.apiKeySource??h1().source;if(Q!=="none"||Z!=="none")return;return{provider:"openai",subscription:QX(),tokenSource:"OpenAI OAuth",email:J.email,accountId:J.accountId}}function RG(){if(P()!=="firstParty")return;let{source:J}=T1(),{key:Q,source:Z}=h1(),X=ZX({authTokenSource:J,apiKeySource:Z});if(X)return X;let q={};if(q.provider="anthropic",J==="CLAUDE_CODE_OAUTH_TOKEN"||J==="CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR")q.tokenSource=J;else if(y())q.subscription=e3();else q.tokenSource=J;if(Q)q.apiKeySource=Z;if(J==="claude.ai"||Z==="/login managed key"){let W=_1()?.organizationName;if(W)q.organization=W}let Y=_1()?.emailAddress;if((J==="claude.ai"||Z==="/login managed key")&&Y)q.email=Y;return q}async function wG(){if(process.env.ANTHROPIC_UNIX_SOCKET)return{valid:!0};if(!W2())return{valid:!0};let $=S("policySettings")?.forceLoginOrgUUID;if(!$)return{valid:!0};await A1();let J=C();if(!J)return{valid:!0};let{source:Q}=T1(),Z=Q==="CLAUDE_CODE_OAUTH_TOKEN"||Q==="CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",X=await $2(J.accessToken);if(!X)return{valid:!1,message:`Unable to verify organization for the current authentication token.
|
|
68
|
-
This machine requires organization ${$} but the profile could not be fetched.
|
|
69
|
-
This may be a network error, or the token may lack the user:profile scope required for
|
|
70
|
-
verification (tokens from 'claude setup-token' do not include this scope).
|
|
71
|
-
Try again, or obtain a full-scope token via 'claude auth login'.`};let q=X.organization.uuid;if(q===$)return{valid:!0};if(Z)return{valid:!1,message:`The ${Q==="CLAUDE_CODE_OAUTH_TOKEN"?"CLAUDE_CODE_OAUTH_TOKEN":"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR"} environment variable provides a token for a
|
|
72
|
-
different organization than required by this machine's managed settings.
|
|
73
|
-
|
|
74
|
-
Required organization: ${$}
|
|
75
|
-
Token organization: ${q}
|
|
76
|
-
|
|
77
|
-
Remove the environment variable or obtain a token for the correct organization.`};return{valid:!1,message:`Your authentication token belongs to organization ${q},
|
|
78
|
-
but this machine requires organization ${$}.
|
|
79
|
-
|
|
80
|
-
Please log in with the correct organization: claude auth login`}}var yV=300000,B0=null,c0=null,Y2=0,gV=3600000,uV=180000,G1,lV=5000,nV=3600000,rV=180000,Q4,T$,C,h3=0,gJ,X4=null,I$=null,p3=0,GG=1740000,XX;var $0=H(()=>{M0();V1();l4();b0();i();v9();a4();t4();o8();XQ();YQ();GQ();KQ();bJ();D0();p();j();H0();h2();G9();t();CV();l8();j3();b2();J1();d3();X0();f3();G1=dJ(async()=>{let $=await mV(),J=await dV();if($||J)await VQ();return J},gV);Q4=dJ(async()=>{return await iV()},nV);T$=l3(()=>{if(C0())return null;if(process.platform==="darwin"){let J=k3();if(J){if(J.stdout)return{key:J.stdout,source:"/login managed key"}}else{let Q=G0();try{let Z=K1(`security find-generic-password -a $USER -w -s "${Q}"`);if(Z)return{key:Z,source:"/login managed key"}}catch(Z){D(Z)}}}let $=I();if(!$.primaryApiKey)return null;return{key:$.primaryApiKey,source:"/login managed key"}});C=l3(()=>{if(C0())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:["user:inference"],subscriptionType:null,rateLimitTier:null};let $=$$();if($)return{accessToken:$,refreshToken:null,expiresAt:null,scopes:["user:inference"],subscriptionType:null,rateLimitTier:null};try{let Z=T0().read()?.claudeAiOauth;if(!Z?.accessToken)return null;return Z}catch(J){return D(J),null}});gJ=new Map;XX=class XX extends Error{}});function C$(){return`claude-code/${MACRO.VERSION}`}var aJ=()=>{};import{AsyncLocalStorage as NG}from"async_hooks";function YX(){return qX.getStore()?.workload}function VF($,J){return qX.run({workload:$},J)}var qX;var WX=H(()=>{qX=new NG});import DG from"axios";function L3(){let $=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:"",J=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:"",Q=YX(),Z=Q?`, workload/${Q}`:"";return`claude-cli/${tQ} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??"cli"}${$}${J}${Z})`}function wF(){let $=[];if(process.env.CLAUDE_CODE_ENTRYPOINT)$.push(process.env.CLAUDE_CODE_ENTRYPOINT);if(process.env.CLAUDE_AGENT_SDK_VERSION)$.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`);if(process.env.CLAUDE_AGENT_SDK_CLIENT_APP)$.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);let J=$.length>0?` (${$.join(", ")})`:"";return`claude-code/${MACRO.VERSION}${J}`}function _F(){return`Claude-User (${C$()}; +https://support.anthropic.com/)`}function V4(){if(y()){let J=C();if(!J?.accessToken)return{headers:{},error:"No OAuth token available"};return{headers:{Authorization:`Bearer ${J.accessToken}`,"anthropic-beta":P0}}}let $=U0();if(!$)return{headers:{},error:"No API key available"};return{headers:{"x-api-key":$}}}async function NF($,J){try{return await $()}catch(Q){if(!DG.isAxiosError(Q))throw Q;let Z=Q.response?.status;if(!(Z===401||J?.also403Revoked&&Z===403&&typeof Q.response?.data==="string"&&Q.response.data.includes("OAuth token has been revoked")))throw Q;let q=C()?.accessToken;if(!q)throw Q;return await l2(q),await $()}}var F$=H(()=>{M0();$0();_J();aJ();WX()});import{execa as OG}from"execa";import VX from"lodash-es/memoize.js";async function EF(){if(K4===null&&!G4)G4=zG(),K4=await G4,G4=null,V2.cache.clear?.()}function AF(){K4=null,G4=null,V2.cache.clear?.(),KX.cache.clear?.()}function GX(){return V2(!0)}function FG(){if(K4!==null)return K4;let $=_1();if($?.emailAddress)return $.emailAddress;if(process.env.USER_TYPE!=="ant")return;if(process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`;return}async function zG(){let $=_1();if($?.emailAddress)return $.emailAddress;if(process.env.USER_TYPE!=="ant")return;if(process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`;return KX()}var K4=null,G4=null,V2,KX;var tJ=H(()=>{i();$0();D0();h4();j2();j();V2=VX(($)=>{let J=y2(),Q=I(),Z,X,q;if($){if(Z=d()??void 0,X=E$()??void 0,Z&&Q.claudeCodeFirstTokenDate){let B=new Date(Q.claudeCodeFirstTokenDate).getTime();if(!isNaN(B))q=B}}let Y=_1(),W=Y?.organizationUuid,K=Y?.accountUuid;return{deviceId:J,sessionId:A0(),email:FG(),appVersion:MACRO.VERSION,platform:v$(),organizationUuid:W,accountUuid:K,userType:process.env.USER_TYPE,subscriptionType:Z,rateLimitTier:X,firstTokenTime:q,...w(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}});KX=VX(async()=>{let $=await OG("git config --get user.email",{shell:!0,reject:!1,cwd:S0()});return $.exitCode===0&&$.stdout?$.stdout.trim():void 0})});function BX(){return w(process.env.CLAUDE_CODE_USE_BEDROCK)||w(process.env.CLAUDE_CODE_USE_VERTEX)||w(process.env.CLAUDE_CODE_USE_FOUNDRY)||w(process.env.CLAUDE_CODE_USE_AZURE_OPENAI)||eJ()}function jF(){return eJ()}var LX=H(()=>{j();b4()});function xG(){return{seconds:0,nanos:0}}function HX($){return $!==null&&$!==void 0}var B4;var $6=H(()=>{B4={fromJSON($){return{seconds:HX($.seconds)?globalThis.Number($.seconds):0,nanos:HX($.nanos)?globalThis.Number($.nanos):0}},toJSON($){let J={};if($.seconds!==void 0)J.seconds=Math.round($.seconds);if($.nanos!==void 0)J.nanos=Math.round($.nanos);return J},create($){return B4.fromPartial($??{})},fromPartial($){let J=xG();return J.seconds=$.seconds??0,J.nanos=$.nanos??0,J}}});function IG(){return{account_id:0,organization_uuid:"",account_uuid:""}}function J6($){return $!==null&&$!==void 0}var l0;var Q6=H(()=>{l0={fromJSON($){return{account_id:J6($.account_id)?globalThis.Number($.account_id):0,organization_uuid:J6($.organization_uuid)?globalThis.String($.organization_uuid):"",account_uuid:J6($.account_uuid)?globalThis.String($.account_uuid):""}},toJSON($){let J={};if($.account_id!==void 0)J.account_id=Math.round($.account_id);if($.organization_uuid!==void 0)J.organization_uuid=$.organization_uuid;if($.account_uuid!==void 0)J.account_uuid=$.account_uuid;return J},create($){return l0.fromPartial($??{})},fromPartial($){let J=IG();return J.account_id=$.account_id??0,J.organization_uuid=$.organization_uuid??"",J.account_uuid=$.account_uuid??"",J}}});function MG(){return{actor_id:"",repository_id:"",repository_owner_id:""}}function TG(){return{platform:"",node_version:"",terminal:"",package_managers:"",runtimes:"",is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:"",github_event_name:"",github_actions_runner_environment:"",github_actions_runner_os:"",github_action_ref:"",wsl_version:"",github_actions_metadata:void 0,arch:"",is_claude_code_remote:!1,remote_environment_type:"",claude_code_container_id:"",claude_code_remote_session_id:"",tags:[],deployment_environment:"",is_conductor:!1,version_base:"",coworker_type:"",build_time:"",is_local_agent_mode:!1,linux_distro_id:"",linux_distro_version:"",linux_kernel:"",vcs:"",platform_raw:""}}function PG(){return{slack_team_id:"",is_enterprise_install:!1,trigger:"",creation_method:""}}function EG(){return{event_name:"",client_timestamp:void 0,model:"",session_id:"",user_type:"",betas:"",env:void 0,entrypoint:"",agent_sdk_version:"",is_interactive:!1,client_type:"",process:"",additional_metadata:"",auth:void 0,server_timestamp:void 0,event_id:"",device_id:"",swe_bench_run_id:"",swe_bench_instance_id:"",swe_bench_task_id:"",email:"",agent_id:"",parent_session_id:"",agent_type:"",slack:void 0,team_name:"",skill_name:"",plugin_name:"",marketplace_name:""}}function AG($){let J=($.seconds||0)*1000;return J+=($.nanos||0)/1e6,new globalThis.Date(J)}function UX($){if($ instanceof globalThis.Date)return $;else if(typeof $==="string")return new globalThis.Date($);else return AG(B4.fromJSON($))}function N($){return $!==null&&$!==void 0}var k$,j$,y$,S$;var RX=H(()=>{$6();Q6();k$={fromJSON($){return{actor_id:N($.actor_id)?globalThis.String($.actor_id):"",repository_id:N($.repository_id)?globalThis.String($.repository_id):"",repository_owner_id:N($.repository_owner_id)?globalThis.String($.repository_owner_id):""}},toJSON($){let J={};if($.actor_id!==void 0)J.actor_id=$.actor_id;if($.repository_id!==void 0)J.repository_id=$.repository_id;if($.repository_owner_id!==void 0)J.repository_owner_id=$.repository_owner_id;return J},create($){return k$.fromPartial($??{})},fromPartial($){let J=MG();return J.actor_id=$.actor_id??"",J.repository_id=$.repository_id??"",J.repository_owner_id=$.repository_owner_id??"",J}};j$={fromJSON($){return{platform:N($.platform)?globalThis.String($.platform):"",node_version:N($.node_version)?globalThis.String($.node_version):"",terminal:N($.terminal)?globalThis.String($.terminal):"",package_managers:N($.package_managers)?globalThis.String($.package_managers):"",runtimes:N($.runtimes)?globalThis.String($.runtimes):"",is_running_with_bun:N($.is_running_with_bun)?globalThis.Boolean($.is_running_with_bun):!1,is_ci:N($.is_ci)?globalThis.Boolean($.is_ci):!1,is_claubbit:N($.is_claubbit)?globalThis.Boolean($.is_claubbit):!1,is_github_action:N($.is_github_action)?globalThis.Boolean($.is_github_action):!1,is_claude_code_action:N($.is_claude_code_action)?globalThis.Boolean($.is_claude_code_action):!1,is_claude_ai_auth:N($.is_claude_ai_auth)?globalThis.Boolean($.is_claude_ai_auth):!1,version:N($.version)?globalThis.String($.version):"",github_event_name:N($.github_event_name)?globalThis.String($.github_event_name):"",github_actions_runner_environment:N($.github_actions_runner_environment)?globalThis.String($.github_actions_runner_environment):"",github_actions_runner_os:N($.github_actions_runner_os)?globalThis.String($.github_actions_runner_os):"",github_action_ref:N($.github_action_ref)?globalThis.String($.github_action_ref):"",wsl_version:N($.wsl_version)?globalThis.String($.wsl_version):"",github_actions_metadata:N($.github_actions_metadata)?k$.fromJSON($.github_actions_metadata):void 0,arch:N($.arch)?globalThis.String($.arch):"",is_claude_code_remote:N($.is_claude_code_remote)?globalThis.Boolean($.is_claude_code_remote):!1,remote_environment_type:N($.remote_environment_type)?globalThis.String($.remote_environment_type):"",claude_code_container_id:N($.claude_code_container_id)?globalThis.String($.claude_code_container_id):"",claude_code_remote_session_id:N($.claude_code_remote_session_id)?globalThis.String($.claude_code_remote_session_id):"",tags:globalThis.Array.isArray($?.tags)?$.tags.map((J)=>globalThis.String(J)):[],deployment_environment:N($.deployment_environment)?globalThis.String($.deployment_environment):"",is_conductor:N($.is_conductor)?globalThis.Boolean($.is_conductor):!1,version_base:N($.version_base)?globalThis.String($.version_base):"",coworker_type:N($.coworker_type)?globalThis.String($.coworker_type):"",build_time:N($.build_time)?globalThis.String($.build_time):"",is_local_agent_mode:N($.is_local_agent_mode)?globalThis.Boolean($.is_local_agent_mode):!1,linux_distro_id:N($.linux_distro_id)?globalThis.String($.linux_distro_id):"",linux_distro_version:N($.linux_distro_version)?globalThis.String($.linux_distro_version):"",linux_kernel:N($.linux_kernel)?globalThis.String($.linux_kernel):"",vcs:N($.vcs)?globalThis.String($.vcs):"",platform_raw:N($.platform_raw)?globalThis.String($.platform_raw):""}},toJSON($){let J={};if($.platform!==void 0)J.platform=$.platform;if($.node_version!==void 0)J.node_version=$.node_version;if($.terminal!==void 0)J.terminal=$.terminal;if($.package_managers!==void 0)J.package_managers=$.package_managers;if($.runtimes!==void 0)J.runtimes=$.runtimes;if($.is_running_with_bun!==void 0)J.is_running_with_bun=$.is_running_with_bun;if($.is_ci!==void 0)J.is_ci=$.is_ci;if($.is_claubbit!==void 0)J.is_claubbit=$.is_claubbit;if($.is_github_action!==void 0)J.is_github_action=$.is_github_action;if($.is_claude_code_action!==void 0)J.is_claude_code_action=$.is_claude_code_action;if($.is_claude_ai_auth!==void 0)J.is_claude_ai_auth=$.is_claude_ai_auth;if($.version!==void 0)J.version=$.version;if($.github_event_name!==void 0)J.github_event_name=$.github_event_name;if($.github_actions_runner_environment!==void 0)J.github_actions_runner_environment=$.github_actions_runner_environment;if($.github_actions_runner_os!==void 0)J.github_actions_runner_os=$.github_actions_runner_os;if($.github_action_ref!==void 0)J.github_action_ref=$.github_action_ref;if($.wsl_version!==void 0)J.wsl_version=$.wsl_version;if($.github_actions_metadata!==void 0)J.github_actions_metadata=k$.toJSON($.github_actions_metadata);if($.arch!==void 0)J.arch=$.arch;if($.is_claude_code_remote!==void 0)J.is_claude_code_remote=$.is_claude_code_remote;if($.remote_environment_type!==void 0)J.remote_environment_type=$.remote_environment_type;if($.claude_code_container_id!==void 0)J.claude_code_container_id=$.claude_code_container_id;if($.claude_code_remote_session_id!==void 0)J.claude_code_remote_session_id=$.claude_code_remote_session_id;if($.tags?.length)J.tags=$.tags;if($.deployment_environment!==void 0)J.deployment_environment=$.deployment_environment;if($.is_conductor!==void 0)J.is_conductor=$.is_conductor;if($.version_base!==void 0)J.version_base=$.version_base;if($.coworker_type!==void 0)J.coworker_type=$.coworker_type;if($.build_time!==void 0)J.build_time=$.build_time;if($.is_local_agent_mode!==void 0)J.is_local_agent_mode=$.is_local_agent_mode;if($.linux_distro_id!==void 0)J.linux_distro_id=$.linux_distro_id;if($.linux_distro_version!==void 0)J.linux_distro_version=$.linux_distro_version;if($.linux_kernel!==void 0)J.linux_kernel=$.linux_kernel;if($.vcs!==void 0)J.vcs=$.vcs;if($.platform_raw!==void 0)J.platform_raw=$.platform_raw;return J},create($){return j$.fromPartial($??{})},fromPartial($){let J=TG();return J.platform=$.platform??"",J.node_version=$.node_version??"",J.terminal=$.terminal??"",J.package_managers=$.package_managers??"",J.runtimes=$.runtimes??"",J.is_running_with_bun=$.is_running_with_bun??!1,J.is_ci=$.is_ci??!1,J.is_claubbit=$.is_claubbit??!1,J.is_github_action=$.is_github_action??!1,J.is_claude_code_action=$.is_claude_code_action??!1,J.is_claude_ai_auth=$.is_claude_ai_auth??!1,J.version=$.version??"",J.github_event_name=$.github_event_name??"",J.github_actions_runner_environment=$.github_actions_runner_environment??"",J.github_actions_runner_os=$.github_actions_runner_os??"",J.github_action_ref=$.github_action_ref??"",J.wsl_version=$.wsl_version??"",J.github_actions_metadata=$.github_actions_metadata!==void 0&&$.github_actions_metadata!==null?k$.fromPartial($.github_actions_metadata):void 0,J.arch=$.arch??"",J.is_claude_code_remote=$.is_claude_code_remote??!1,J.remote_environment_type=$.remote_environment_type??"",J.claude_code_container_id=$.claude_code_container_id??"",J.claude_code_remote_session_id=$.claude_code_remote_session_id??"",J.tags=$.tags?.map((Q)=>Q)||[],J.deployment_environment=$.deployment_environment??"",J.is_conductor=$.is_conductor??!1,J.version_base=$.version_base??"",J.coworker_type=$.coworker_type??"",J.build_time=$.build_time??"",J.is_local_agent_mode=$.is_local_agent_mode??!1,J.linux_distro_id=$.linux_distro_id??"",J.linux_distro_version=$.linux_distro_version??"",J.linux_kernel=$.linux_kernel??"",J.vcs=$.vcs??"",J.platform_raw=$.platform_raw??"",J}};y$={fromJSON($){return{slack_team_id:N($.slack_team_id)?globalThis.String($.slack_team_id):"",is_enterprise_install:N($.is_enterprise_install)?globalThis.Boolean($.is_enterprise_install):!1,trigger:N($.trigger)?globalThis.String($.trigger):"",creation_method:N($.creation_method)?globalThis.String($.creation_method):""}},toJSON($){let J={};if($.slack_team_id!==void 0)J.slack_team_id=$.slack_team_id;if($.is_enterprise_install!==void 0)J.is_enterprise_install=$.is_enterprise_install;if($.trigger!==void 0)J.trigger=$.trigger;if($.creation_method!==void 0)J.creation_method=$.creation_method;return J},create($){return y$.fromPartial($??{})},fromPartial($){let J=PG();return J.slack_team_id=$.slack_team_id??"",J.is_enterprise_install=$.is_enterprise_install??!1,J.trigger=$.trigger??"",J.creation_method=$.creation_method??"",J}};S$={fromJSON($){return{event_name:N($.event_name)?globalThis.String($.event_name):"",client_timestamp:N($.client_timestamp)?UX($.client_timestamp):void 0,model:N($.model)?globalThis.String($.model):"",session_id:N($.session_id)?globalThis.String($.session_id):"",user_type:N($.user_type)?globalThis.String($.user_type):"",betas:N($.betas)?globalThis.String($.betas):"",env:N($.env)?j$.fromJSON($.env):void 0,entrypoint:N($.entrypoint)?globalThis.String($.entrypoint):"",agent_sdk_version:N($.agent_sdk_version)?globalThis.String($.agent_sdk_version):"",is_interactive:N($.is_interactive)?globalThis.Boolean($.is_interactive):!1,client_type:N($.client_type)?globalThis.String($.client_type):"",process:N($.process)?globalThis.String($.process):"",additional_metadata:N($.additional_metadata)?globalThis.String($.additional_metadata):"",auth:N($.auth)?l0.fromJSON($.auth):void 0,server_timestamp:N($.server_timestamp)?UX($.server_timestamp):void 0,event_id:N($.event_id)?globalThis.String($.event_id):"",device_id:N($.device_id)?globalThis.String($.device_id):"",swe_bench_run_id:N($.swe_bench_run_id)?globalThis.String($.swe_bench_run_id):"",swe_bench_instance_id:N($.swe_bench_instance_id)?globalThis.String($.swe_bench_instance_id):"",swe_bench_task_id:N($.swe_bench_task_id)?globalThis.String($.swe_bench_task_id):"",email:N($.email)?globalThis.String($.email):"",agent_id:N($.agent_id)?globalThis.String($.agent_id):"",parent_session_id:N($.parent_session_id)?globalThis.String($.parent_session_id):"",agent_type:N($.agent_type)?globalThis.String($.agent_type):"",slack:N($.slack)?y$.fromJSON($.slack):void 0,team_name:N($.team_name)?globalThis.String($.team_name):"",skill_name:N($.skill_name)?globalThis.String($.skill_name):"",plugin_name:N($.plugin_name)?globalThis.String($.plugin_name):"",marketplace_name:N($.marketplace_name)?globalThis.String($.marketplace_name):""}},toJSON($){let J={};if($.event_name!==void 0)J.event_name=$.event_name;if($.client_timestamp!==void 0)J.client_timestamp=$.client_timestamp.toISOString();if($.model!==void 0)J.model=$.model;if($.session_id!==void 0)J.session_id=$.session_id;if($.user_type!==void 0)J.user_type=$.user_type;if($.betas!==void 0)J.betas=$.betas;if($.env!==void 0)J.env=j$.toJSON($.env);if($.entrypoint!==void 0)J.entrypoint=$.entrypoint;if($.agent_sdk_version!==void 0)J.agent_sdk_version=$.agent_sdk_version;if($.is_interactive!==void 0)J.is_interactive=$.is_interactive;if($.client_type!==void 0)J.client_type=$.client_type;if($.process!==void 0)J.process=$.process;if($.additional_metadata!==void 0)J.additional_metadata=$.additional_metadata;if($.auth!==void 0)J.auth=l0.toJSON($.auth);if($.server_timestamp!==void 0)J.server_timestamp=$.server_timestamp.toISOString();if($.event_id!==void 0)J.event_id=$.event_id;if($.device_id!==void 0)J.device_id=$.device_id;if($.swe_bench_run_id!==void 0)J.swe_bench_run_id=$.swe_bench_run_id;if($.swe_bench_instance_id!==void 0)J.swe_bench_instance_id=$.swe_bench_instance_id;if($.swe_bench_task_id!==void 0)J.swe_bench_task_id=$.swe_bench_task_id;if($.email!==void 0)J.email=$.email;if($.agent_id!==void 0)J.agent_id=$.agent_id;if($.parent_session_id!==void 0)J.parent_session_id=$.parent_session_id;if($.agent_type!==void 0)J.agent_type=$.agent_type;if($.slack!==void 0)J.slack=y$.toJSON($.slack);if($.team_name!==void 0)J.team_name=$.team_name;if($.skill_name!==void 0)J.skill_name=$.skill_name;if($.plugin_name!==void 0)J.plugin_name=$.plugin_name;if($.marketplace_name!==void 0)J.marketplace_name=$.marketplace_name;return J},create($){return S$.fromPartial($??{})},fromPartial($){let J=EG();return J.event_name=$.event_name??"",J.client_timestamp=$.client_timestamp??void 0,J.model=$.model??"",J.session_id=$.session_id??"",J.user_type=$.user_type??"",J.betas=$.betas??"",J.env=$.env!==void 0&&$.env!==null?j$.fromPartial($.env):void 0,J.entrypoint=$.entrypoint??"",J.agent_sdk_version=$.agent_sdk_version??"",J.is_interactive=$.is_interactive??!1,J.client_type=$.client_type??"",J.process=$.process??"",J.additional_metadata=$.additional_metadata??"",J.auth=$.auth!==void 0&&$.auth!==null?l0.fromPartial($.auth):void 0,J.server_timestamp=$.server_timestamp??void 0,J.event_id=$.event_id??"",J.device_id=$.device_id??"",J.swe_bench_run_id=$.swe_bench_run_id??"",J.swe_bench_instance_id=$.swe_bench_instance_id??"",J.swe_bench_task_id=$.swe_bench_task_id??"",J.email=$.email??"",J.agent_id=$.agent_id??"",J.parent_session_id=$.parent_session_id??"",J.agent_type=$.agent_type??"",J.slack=$.slack!==void 0&&$.slack!==null?y$.fromPartial($.slack):void 0,J.team_name=$.team_name??"",J.skill_name=$.skill_name??"",J.plugin_name=$.plugin_name??"",J.marketplace_name=$.marketplace_name??"",J}}});function CG(){return{event_id:"",timestamp:void 0,experiment_id:"",variation_id:0,environment:"",user_attributes:"",experiment_metadata:"",device_id:"",auth:void 0,session_id:"",anonymous_id:"",event_metadata_vars:""}}function vG($){let J=($.seconds||0)*1000;return J+=($.nanos||0)/1e6,new globalThis.Date(J)}function kG($){if($ instanceof globalThis.Date)return $;else if(typeof $==="string")return new globalThis.Date($);else return vG(B4.fromJSON($))}function R0($){return $!==null&&$!==void 0}var Z6;var wX=H(()=>{$6();Q6();Z6={fromJSON($){return{event_id:R0($.event_id)?globalThis.String($.event_id):"",timestamp:R0($.timestamp)?kG($.timestamp):void 0,experiment_id:R0($.experiment_id)?globalThis.String($.experiment_id):"",variation_id:R0($.variation_id)?globalThis.Number($.variation_id):0,environment:R0($.environment)?globalThis.String($.environment):"",user_attributes:R0($.user_attributes)?globalThis.String($.user_attributes):"",experiment_metadata:R0($.experiment_metadata)?globalThis.String($.experiment_metadata):"",device_id:R0($.device_id)?globalThis.String($.device_id):"",auth:R0($.auth)?l0.fromJSON($.auth):void 0,session_id:R0($.session_id)?globalThis.String($.session_id):"",anonymous_id:R0($.anonymous_id)?globalThis.String($.anonymous_id):"",event_metadata_vars:R0($.event_metadata_vars)?globalThis.String($.event_metadata_vars):""}},toJSON($){let J={};if($.event_id!==void 0)J.event_id=$.event_id;if($.timestamp!==void 0)J.timestamp=$.timestamp.toISOString();if($.experiment_id!==void 0)J.experiment_id=$.experiment_id;if($.variation_id!==void 0)J.variation_id=Math.round($.variation_id);if($.environment!==void 0)J.environment=$.environment;if($.user_attributes!==void 0)J.user_attributes=$.user_attributes;if($.experiment_metadata!==void 0)J.experiment_metadata=$.experiment_metadata;if($.device_id!==void 0)J.device_id=$.device_id;if($.auth!==void 0)J.auth=l0.toJSON($.auth);if($.session_id!==void 0)J.session_id=$.session_id;if($.anonymous_id!==void 0)J.anonymous_id=$.anonymous_id;if($.event_metadata_vars!==void 0)J.event_metadata_vars=$.event_metadata_vars;return J},create($){return Z6.fromPartial($??{})},fromPartial($){let J=CG();return J.event_id=$.event_id??"",J.timestamp=$.timestamp??void 0,J.experiment_id=$.experiment_id??"",J.variation_id=$.variation_id??0,J.environment=$.environment??"",J.user_attributes=$.user_attributes??"",J.experiment_metadata=$.experiment_metadata??"",J.device_id=$.device_id??"",J.auth=$.auth!==void 0&&$.auth!==null?l0.fromPartial($.auth):void 0,J.session_id=$.session_id??"",J.anonymous_id=$.anonymous_id??"",J.event_metadata_vars=$.event_metadata_vars??"",J}}});function cF($){if($<=1)return!1;try{return process.kill($,0),!0}catch{return!1}}async function lF($,J=10){if(process.platform==="win32"){let X=`
|
|
81
|
-
$pid = ${String($)}
|
|
82
|
-
$ancestors = @()
|
|
83
|
-
for ($i = 0; $i -lt ${J}; $i++) {
|
|
84
|
-
$proc = Get-CimInstance Win32_Process -Filter "ProcessId=$pid" -ErrorAction SilentlyContinue
|
|
85
|
-
if (-not $proc -or -not $proc.ParentProcessId -or $proc.ParentProcessId -eq 0) { break }
|
|
86
|
-
$pid = $proc.ParentProcessId
|
|
87
|
-
$ancestors += $pid
|
|
88
|
-
}
|
|
89
|
-
$ancestors -join ','
|
|
90
|
-
`.trim(),q=await p1("powershell.exe",["-NoProfile","-Command",X],{timeout:3000});if(q.code!==0||!q.stdout?.trim())return[];return q.stdout.trim().split(",").filter(Boolean).map((Y)=>parseInt(Y,10)).filter((Y)=>!isNaN(Y))}let Q=`pid=${String($)}; for i in $(seq 1 ${J}); do ppid=$(ps -o ppid= -p $pid 2>/dev/null | tr -d ' '); if [ -z "$ppid" ] || [ "$ppid" = "0" ] || [ "$ppid" = "1" ]; then break; fi; echo $ppid; pid=$ppid; done`,Z=await p1("sh",["-c",Q],{timeout:3000});if(Z.code!==0||!Z.stdout?.trim())return[];return Z.stdout.trim().split(`
|
|
91
|
-
`).filter(Boolean).map((X)=>parseInt(X,10)).filter((X)=>!isNaN(X))}function nF($){try{let J=String($),Q=process.platform==="win32"?`powershell.exe -NoProfile -Command "(Get-CimInstance Win32_Process -Filter \\"ProcessId=${J}\\").CommandLine"`:`ps -o command= -p ${J}`,Z=K1(Q,{timeout:1000});return Z?Z.trim():null}catch{return null}}async function _X($,J=10){if(process.platform==="win32"){let X=`
|
|
92
|
-
$currentPid = ${String($)}
|
|
93
|
-
$commands = @()
|
|
94
|
-
for ($i = 0; $i -lt ${J}; $i++) {
|
|
95
|
-
$proc = Get-CimInstance Win32_Process -Filter "ProcessId=$currentPid" -ErrorAction SilentlyContinue
|
|
96
|
-
if (-not $proc) { break }
|
|
97
|
-
if ($proc.CommandLine) { $commands += $proc.CommandLine }
|
|
98
|
-
if (-not $proc.ParentProcessId -or $proc.ParentProcessId -eq 0) { break }
|
|
99
|
-
$currentPid = $proc.ParentProcessId
|
|
100
|
-
}
|
|
101
|
-
$commands -join [char]0
|
|
102
|
-
`.trim(),q=await p1("powershell.exe",["-NoProfile","-Command",X],{timeout:3000});if(q.code!==0||!q.stdout?.trim())return[];return q.stdout.split("\x00").filter(Boolean)}let Q=`currentpid=${String($)}; for i in $(seq 1 ${J}); do cmd=$(ps -o command= -p $currentpid 2>/dev/null); if [ -n "$cmd" ]; then printf '%s\\0' "$cmd"; fi; ppid=$(ps -o ppid= -p $currentpid 2>/dev/null | tr -d ' '); if [ -z "$ppid" ] || [ "$ppid" = "0" ] || [ "$ppid" = "1" ]; then break; fi; currentpid=$ppid; done`,Z=await p1("sh",["-c",Q],{timeout:3000});if(Z.code!==0||!Z.stdout?.trim())return[];return Z.stdout.split("\x00").filter(Boolean)}var NX=H(()=>{h2()});import{stat as yG}from"fs/promises";import SG from"lodash-es/memoize.js";function bG(){return process.platform==="linux"&&w(process.env.CLAUDE_CODE_BUBBLEWRAP)}function hG(){if(process.platform!=="linux")return!1;return X6??!1}async function OX(){if(g1!==void 0)return g1;if(process.platform==="darwin")return g1=null,null;try{let $=await _X(process.pid,10);for(let J of $){let Q=J.toLowerCase();for(let Z of DX)if(Q.includes(Z))return g1=Z,Z}}catch{}return g1=null,null}async function pG(){if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"){if(s.platform!=="darwin")return await OX()||"pycharm"}return s.terminal}function gG(){if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"){if(s.platform!=="darwin"){if(g1!==void 0)return g1||"pycharm";return"pycharm"}}return s.terminal}async function mG(){if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm")await OX()}var fG,X6=null,g1,FX;var zX=H(()=>{j2();j();h2();NX();fG=SG(async()=>{if(process.platform!=="linux")return!1;let{code:$}=await r4("test",["-f","/.dockerenv"]);return $===0});if(process.platform==="linux"){let $=process.arch==="x64"?"x86_64":"aarch64";yG(`/lib/libc.musl-${$}.so.1`).then(()=>{X6=!0},()=>{X6=!1})}FX={...s,terminal:gG(),getIsDocker:fG,getIsBubblewrapSandbox:bG,isMuslEnvironment:hG,getTerminalWithJetBrainsDetectionAsync:pG,initJetBrainsDetection:mG}});import uG from"axios";function dG($){try{let J=new URL($);return J.search="",J.toString().replace(/\/$/,"")}catch{return}}async function Xz(){if(process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)return;try{let $=await uG.get("https://api.anthropic.com/mcp-registry/v0/servers?version=latest&visibility=commercial",{timeout:5000}),J=new Set;for(let Q of $.data.servers)for(let Z of Q.server.remotes??[]){let X=dG(Z.url);if(X)J.add(X)}xX=J,L(`[mcp-registry] Loaded ${J.size} official MCP URLs`)}catch($){L(`Failed to fetch MCP registry: ${c($)}`,{level:"error"})}}function IX($){return xX?.has($)??!1}var xX=void 0;var MX=H(()=>{p();H0()});function cG(){return process.argv.includes("--agent-teams")}function lG(){if(process.env.USER_TYPE==="ant")return!0;if(!w(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)&&!cG())return!1;if(!q0("tengu_amber_flint",!0))return!1;return!0}var TX=H(()=>{Q1();j()});import{AsyncLocalStorage as nG}from"async_hooks";function f$(){return PX.getStore()}function Bz($,J){return PX.run($,J)}function iG($){return $?.agentType==="subagent"}function Lz(){let $=f$();if(!iG($)||!$.subagentName)return;return $.isBuiltIn?$.subagentName:"user-defined"}function Hz(){let $=f$();if(!$?.invokingRequestId||$.invocationEmitted)return;return $.invocationEmitted=!0,{invokingRequestId:$.invokingRequestId,invocationKind:$.invocationKind}}var PX;var EX=H(()=>{TX();PX=new nG});import{extname as tG}from"path";import mX from"lodash-es/memoize.js";function vz($){if($.startsWith("mcp__"))return"mcp_tool";return $}function eG(){return w(process.env.OTEL_LOG_TOOL_DETAILS)}function $K($,J){if(process.env.CLAUDE_CODE_ENTRYPOINT==="local-agent")return!0;if($==="claudeai-proxy")return!0;if(J&&IX(J))return!0;return!1}function kz($,J,Q){let Z=QK($);if(!Z)return{};if(!JK.has(Z.serverName)&&!$K(J,Q))return{};return{mcpServerName:Z.serverName,mcpToolName:Z.mcpToolName}}function QK($){if(!$.startsWith("mcp__"))return;let J=$.split("__");if(J.length<3)return;let Q=J[1],Z=J.slice(2).join("__");if(!Q||!Z)return;return{serverName:Q,mcpToolName:Z}}function jz($,J){if($!=="Skill")return;if(typeof J==="object"&&J!==null&&"skill"in J&&typeof J.skill==="string")return J.skill;return}function Y6($,J=0){if(typeof $==="string"){if($.length>ZK)return`${$.slice(0,XK)}\u2026[${$.length} chars]`;return $}if(typeof $==="number"||typeof $==="boolean"||$===null||$===void 0)return $;if(J>=qK)return"<nested>";if(Array.isArray($)){let Q=$.slice(0,b$).map((Z)=>Y6(Z,J+1));if($.length>b$)Q.push(`\u2026[${$.length} items]`);return Q}if(typeof $==="object"){let Q=Object.entries($).filter(([X])=>!X.startsWith("_")),Z=Q.slice(0,b$).map(([X,q])=>[X,Y6(q,J+1)]);if(Q.length>b$)Z.push(["\u2026",`${Q.length} keys`]);return Object.fromEntries(Z)}return String($)}function yz($){if(!eG())return;let J=Y6($),Q=A(J);if(Q.length>AX)Q=Q.slice(0,AX)+"\u2026[truncated]";return Q}function CX($){let J=tG($).toLowerCase();if(!J||J===".")return;let Q=J.slice(1);if(Q.length>YK)return"other";return Q}function Sz($,J){if(!$.includes(".")&&!J)return;let Q,Z=new Set;if(J){let X=CX(J);if(X)Z.add(X),Q=X}for(let X of $.split(VK)){if(!X)continue;let q=X.split(GK);if(q.length<2)continue;let Y=q[0],W=Y.lastIndexOf("/"),K=W>=0?Y.slice(W+1):Y;if(!WK.has(K))continue;for(let B=1;B<q.length;B++){let R=q[B];if(R.charCodeAt(0)===45)continue;let U=CX(R);if(U&&!Z.has(U))Z.add(U),Q=Q?Q+","+U:U}}if(!Q)return;return Q}function KK(){let $=f$();if($){let W={agentId:$.agentId,parentSessionId:$.parentSessionId,agentType:$.agentType};if($.agentType==="teammate")W.teamName=$.teamName;return W}let J=hX(),Q=bX(),Z=pX(),q=gX()?"teammate":J?"standalone":void 0;if(J||q||Q||Z)return{...J?{agentId:J}:{},...q?{agentType:q}:{},...Q?{parentSessionId:Q}:{},...Z?{teamName:Z}:{}};let Y=vX();if(Y)return{parentSessionId:Y};return{}}function HK(){try{let $=process.memoryUsage(),J=process.cpuUsage(),Q=Date.now(),Z;if(h$&&q6){let X=Q-q6;if(X>0){let q=J.user-h$.user,Y=J.system-h$.system;Z=(q+Y)/(X*1000)*100}}return h$=J,q6=Q,{uptime:process.uptime(),rss:$.rss,heapTotal:$.heapTotal,heapUsed:$.heapUsed,external:$.external,arrayBuffers:$.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:J,cpuPercent:Z}}catch{return}}async function dX($={}){let J=$.model?String($.model):nQ(),Q=typeof $.betas==="string"?$.betas:z$(J).join(","),[Z,X]=await Promise.all([LK(),fX()]),q=HK();return{model:J,sessionId:A0(),userType:process.env.USER_TYPE||"",...Q.length>0?{betas:Q}:{},envContext:Z,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(kX()),clientType:jX(),...q&&{processMetrics:q},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||"",sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||"",sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||"",...KK(),...d()&&{subscriptionType:d()},...{},...X&&{rh:X}}}function cX($,J,Q={}){let{envContext:Z,processMetrics:X,rh:q,kairosActive:Y,skillMode:W,observerMode:K,...B}=$,R={platform:Z.platform,platform_raw:Z.platformRaw,arch:Z.arch,node_version:Z.nodeVersion,terminal:Z.terminal||"unknown",package_managers:Z.packageManagers,runtimes:Z.runtimes,is_running_with_bun:Z.isRunningWithBun,is_ci:Z.isCi,is_claubbit:Z.isClaubbit,is_claude_code_remote:Z.isClaudeCodeRemote,is_local_agent_mode:Z.isLocalAgentMode,is_conductor:Z.isConductor,is_github_action:Z.isGithubAction,is_claude_code_action:Z.isClaudeCodeAction,is_claude_ai_auth:Z.isClaudeAiAuth,version:Z.version,build_time:Z.buildTime,deployment_environment:Z.deploymentEnvironment};if(Z.remoteEnvironmentType)R.remote_environment_type=Z.remoteEnvironmentType;if(Z.claudeCodeContainerId)R.claude_code_container_id=Z.claudeCodeContainerId;if(Z.claudeCodeRemoteSessionId)R.claude_code_remote_session_id=Z.claudeCodeRemoteSessionId;if(Z.tags)R.tags=Z.tags.split(",").map((_)=>_.trim()).filter(Boolean);if(Z.githubEventName)R.github_event_name=Z.githubEventName;if(Z.githubActionsRunnerEnvironment)R.github_actions_runner_environment=Z.githubActionsRunnerEnvironment;if(Z.githubActionsRunnerOs)R.github_actions_runner_os=Z.githubActionsRunnerOs;if(Z.githubActionRef)R.github_action_ref=Z.githubActionRef;if(Z.wslVersion)R.wsl_version=Z.wslVersion;if(Z.linuxDistroId)R.linux_distro_id=Z.linuxDistroId;if(Z.linuxDistroVersion)R.linux_distro_version=Z.linuxDistroVersion;if(Z.linuxKernel)R.linux_kernel=Z.linuxKernel;if(Z.vcs)R.vcs=Z.vcs;if(Z.versionBase)R.version_base=Z.versionBase;let U={session_id:B.sessionId,model:B.model,user_type:B.userType,is_interactive:B.isInteractive==="true",client_type:B.clientType};if(B.betas)U.betas=B.betas;if(B.entrypoint)U.entrypoint=B.entrypoint;if(B.agentSdkVersion)U.agent_sdk_version=B.agentSdkVersion;if(B.sweBenchRunId)U.swe_bench_run_id=B.sweBenchRunId;if(B.sweBenchInstanceId)U.swe_bench_instance_id=B.sweBenchInstanceId;if(B.sweBenchTaskId)U.swe_bench_task_id=B.sweBenchTaskId;if(B.agentId)U.agent_id=B.agentId;if(B.parentSessionId)U.parent_session_id=B.parentSessionId;if(B.agentType)U.agent_type=B.agentType;if(B.teamName)U.team_name=B.teamName;if(J.githubActionsMetadata){let _=J.githubActionsMetadata;R.github_actions_metadata={actor_id:_.actorId,repository_id:_.repositoryId,repository_owner_id:_.repositoryOwnerId}}let z;if(J.accountUuid||J.organizationUuid)z={account_uuid:J.accountUuid,organization_uuid:J.organizationUuid};return{env:R,...X&&{process:Buffer.from(A(X)).toString("base64")},...z&&{auth:z},core:U,additional:{...q&&{rh:q},...Y&&{is_assistant_mode:!0},...W&&{skill_mode:W},...K&&{observer_mode:K},...Q}}}var JK,ZK=512,XK=128,AX=4096,b$=20,qK=2,YK=10,WK,VK,GK,BK,LK,h$=null,q6=null;var W6=H(()=>{j2();zX();bJ();u0();i();j();MX();$0();k4();T2();EX();X0();oG();JK=new Set([(aG(),rG(sG)).COMPUTER_USE_MCP_SERVER_NAME]);WK=new Set(["rm","mv","cp","touch","mkdir","chmod","chown","cat","head","tail","sort","stat","diff","wc","grep","rg","sed"]),VK=/\s*(?:&&|\|\||[;|])\s*/,GK=/\s+/;BK=mX(()=>{let $=MACRO.VERSION.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return $?$[0]:void 0}),LK=mX(async()=>{let[$,J,Q,Z]=await Promise.all([s.getPackageManagers(),s.getRuntimes(),yX(),SX()]);return{platform:v$(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:s.arch,nodeVersion:s.nodeVersion,terminal:FX.terminal,packageManagers:$.join(","),runtimes:J.join(","),isRunningWithBun:s.isRunningWithBun(),isCi:w(process.env.CI),isClaubbit:w(process.env.CLAUBBIT),isClaudeCodeRemote:w(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT==="local-agent",isConductor:s.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...{},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:w(process.env.GITHUB_ACTIONS),isClaudeCodeAction:w(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:y(),version:MACRO.VERSION,versionBase:BK(),buildTime:MACRO.BUILD_TIME,deploymentEnvironment:s.detectDeploymentEnvironment(),...w(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes("claude-code-action/")?process.env.GITHUB_ACTION_PATH.split("claude-code-action/")[1]:void 0},...L4()&&{wslVersion:L4()},...Q??{},...Z.length>0?{vcs:Z.join(",")}:{}}})});import{ExportResultCode as m1}from"@opentelemetry/core";import p$ from"axios";import{randomUUID as UK}from"crypto";import{appendFile as RK,mkdir as lX,readdir as wK,unlink as nX,writeFile as _K}from"fs/promises";import*as g$ from"path";function H4(){return g$.join(b(),"telemetry")}class V6{endpoint;timeout;maxBatchSize;skipAuth;batchDelayMs;baseBackoffDelayMs;maxBackoffDelayMs;maxAttempts;isKilled;pendingExports=[];isShutdown=!1;schedule;cancelBackoff=null;attempts=0;isRetrying=!1;lastExportErrorContext;constructor($={}){let J=$.baseUrl||(process.env.ANTHROPIC_BASE_URL==="https://api-staging.anthropic.com"?"https://api-staging.anthropic.com":"https://api.anthropic.com");this.endpoint=`${J}${$.path||"/api/event_logging/batch"}`,this.timeout=$.timeout||1e4,this.maxBatchSize=$.maxBatchSize||200,this.skipAuth=$.skipAuth??!1,this.batchDelayMs=$.batchDelayMs||100,this.baseBackoffDelayMs=$.baseBackoffDelayMs||500,this.maxBackoffDelayMs=$.maxBackoffDelayMs||30000,this.maxAttempts=$.maxAttempts??8,this.isKilled=$.isKilled??(()=>!1),this.schedule=$.schedule??((Q,Z)=>{let X=setTimeout(Q,Z);return()=>clearTimeout(X)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return g$.join(H4(),`${rX}${A0()}.${iX}.json`)}async loadEventsFromFile($){try{return await sX($)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile($,J){try{if(J.length===0)try{await nX($)}catch{}else{await lX(H4(),{recursive:!0});let Q=J.map((Z)=>A(Z)).join(`
|
|
103
|
-
`)+`
|
|
104
|
-
`;await _K($,Q,"utf8")}}catch(Q){D(Q)}}async appendEventsToFile($,J){if(J.length===0)return;try{await lX(H4(),{recursive:!0});let Q=J.map((Z)=>A(Z)).join(`
|
|
105
|
-
`)+`
|
|
106
|
-
`;await RK($,Q,"utf8")}catch(Q){D(Q)}}async deleteFile($){try{await nX($)}catch{}}async retryPreviousBatches(){try{let $=`${rX}${A0()}.`,J;try{J=(await wK(H4())).filter((Q)=>Q.startsWith($)&&Q.endsWith(".json")).filter((Q)=>!Q.includes(iX))}catch(Q){if(m$(Q))return;throw Q}for(let Q of J){let Z=g$.join(H4(),Q);this.retryFileInBackground(Z)}}catch($){D($)}}async retryFileInBackground($){if(this.attempts>=this.maxAttempts){await this.deleteFile($);return}let J=await this.loadEventsFromFile($);if(J.length===0){await this.deleteFile($);return}if(process.env.USER_TYPE==="ant")L(`1P event logging: retrying ${J.length} events from previous batch`);let Q=await this.sendEventsInBatches(J);if(Q.length===0){if(await this.deleteFile($),process.env.USER_TYPE==="ant")L("1P event logging: previous batch retry succeeded")}else if(await this.saveEventsToFile($,Q),process.env.USER_TYPE==="ant")L(`1P event logging: previous batch retry failed, ${Q.length} events remain`)}async export($,J){if(this.isShutdown){if(process.env.USER_TYPE==="ant")L("1P event logging export failed: Exporter has been shutdown");J({code:m1.FAILED,error:Error("Exporter has been shutdown")});return}let Q=this.doExport($,J);this.pendingExports.push(Q),Q.finally(()=>{let Z=this.pendingExports.indexOf(Q);if(Z>-1)this.pendingExports.splice(Z,1)})}async doExport($,J){try{let Q=$.filter((q)=>q.instrumentationScope?.name==="com.anthropic.claude_code.events");if(Q.length===0){J({code:m1.SUCCESS});return}let Z=this.transformLogsToEvents(Q).events;if(Z.length===0){J({code:m1.SUCCESS});return}if(this.attempts>=this.maxAttempts){J({code:m1.FAILED,error:Error(`Dropped ${Z.length} events: max attempts (${this.maxAttempts}) reached`)});return}let X=await this.sendEventsInBatches(Z);if(this.attempts++,X.length>0){await this.queueFailedEvents(X),this.scheduleBackoffRetry();let q=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:"";J({code:m1.FAILED,error:Error(`Failed to export ${X.length} events${q}`)});return}if(this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying)this.retryFailedEvents();J({code:m1.SUCCESS})}catch(Q){if(process.env.USER_TYPE==="ant")L(`1P event logging export failed: ${c(Q)}`);D(Q),J({code:m1.FAILED,error:u1(Q)})}}async sendEventsInBatches($){let J=[];for(let X=0;X<$.length;X+=this.maxBatchSize)J.push($.slice(X,X+this.maxBatchSize));if(process.env.USER_TYPE==="ant")L(`1P event logging: exporting ${$.length} events in ${J.length} batch(es)`);let Q=[],Z;for(let X=0;X<J.length;X++){let q=J[X];try{await this.sendBatchWithRetry({events:q})}catch(Y){Z=NK(Y);for(let W=X;W<J.length;W++)Q.push(...J[W]);if(process.env.USER_TYPE==="ant"){let W=J.length-1-X;L(`1P event logging: batch ${X+1}/${J.length} failed (${Z}); short-circuiting ${W} remaining batch(es)`)}break}if(X<J.length-1&&this.batchDelayMs>0)await W4(this.batchDelayMs)}if(Q.length>0&&Z)this.lastExportErrorContext=Z;return Q}async queueFailedEvents($){let J=this.getCurrentBatchFilePath();await this.appendEventsToFile(J,$);let Q=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:"",Z=`1P event logging: ${$.length} events failed to export${Q}`;D(Error(Z))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let $=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);if(process.env.USER_TYPE==="ant")L(`1P event logging: scheduling backoff retry in ${$}ms (attempt ${this.attempts})`);this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},$)}async retryFailedEvents(){let $=this.getCurrentBatchFilePath();while(!this.isShutdown){let J=await this.loadEventsFromFile($);if(J.length===0)break;if(this.attempts>=this.maxAttempts){if(process.env.USER_TYPE==="ant")L(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${J.length} events`);await this.deleteFile($),this.resetBackoff();return}if(this.isRetrying=!0,await this.deleteFile($),process.env.USER_TYPE==="ant")L(`1P event logging: retrying ${J.length} failed events (attempt ${this.attempts+1})`);let Q=await this.sendEventsInBatches(J);if(this.attempts++,this.isRetrying=!1,Q.length>0){await this.saveEventsToFile($,Q),this.scheduleBackoffRetry();return}if(this.resetBackoff(),process.env.USER_TYPE==="ant")L("1P event logging: backoff retry succeeded")}}resetBackoff(){if(this.attempts=0,this.cancelBackoff)this.cancelBackoff(),this.cancelBackoff=null}async sendBatchWithRetry($){if(this.isKilled())throw Error("firstParty sink killswitch active");let J={"Content-Type":"application/json","User-Agent":C$(),"x-service-name":"claude-code"},Q=e()||u();if(process.env.USER_TYPE==="ant"&&!Q)L("1P event logging: Trust not accepted");let Z=this.skipAuth||!Q;if(!Z&&y()){let W=C();if(!g0())Z=!0;else if(W&&E1(W.expiresAt)){if(Z=!0,process.env.USER_TYPE==="ant")L("1P event logging: OAuth token expired, skipping auth to avoid 401")}}let X=Z?{headers:{},error:"trust not established or Oauth token expired"}:V4(),q=!X.error;if(!q&&process.env.USER_TYPE==="ant")L("1P event logging: auth not available, sending without auth");let Y=q?{...J,...X.headers}:J;try{let W=await p$.post(this.endpoint,$,{timeout:this.timeout,headers:Y});this.logSuccess($.events.length,q,W.data);return}catch(W){if(q&&p$.isAxiosError(W)&&W.response?.status===401){if(process.env.USER_TYPE==="ant")L("1P event logging: 401 auth error, retrying without auth");let K=await p$.post(this.endpoint,$,{timeout:this.timeout,headers:J});this.logSuccess($.events.length,!1,K.data);return}throw W}}logSuccess($,J,Q){if(process.env.USER_TYPE==="ant")L(`1P event logging: ${$} events exported successfully${J?" (with auth)":" (without auth)"}`),L(`API Response: ${A(Q,null,2)}`)}hrTimeToDate($){let[J,Q]=$;return new Date(J*1000+Q/1e6)}transformLogsToEvents($){let J=[];for(let Q of $){let Z=Q.attributes||{};if(Z.event_type==="GrowthbookExperimentEvent"){let T=this.hrTimeToDate(Q.hrTime),v=Z.account_uuid,F1=Z.organization_uuid;J.push({event_type:"GrowthbookExperimentEvent",event_data:Z6.toJSON({event_id:Z.event_id,timestamp:T,experiment_id:Z.experiment_id,variation_id:Z.variation_id,environment:Z.environment,user_attributes:Z.user_attributes,experiment_metadata:Z.experiment_metadata,device_id:Z.device_id,session_id:Z.session_id,auth:v||F1?{account_uuid:v,organization_uuid:F1}:void 0})});continue}let X=Z.event_name||Q.body||"unknown",q=Z.core_metadata,Y=Z.user_metadata,W=Z.event_metadata||{};if(!q){if(process.env.USER_TYPE==="ant")L(`1P event logging: core_metadata missing for event ${X}`);J.push({event_type:"ClaudeCodeInternalEvent",event_data:S$.toJSON({event_id:Z.event_id,event_name:X,client_timestamp:this.hrTimeToDate(Q.hrTime),session_id:A0(),additional_metadata:Buffer.from(A({transform_error:"core_metadata attribute is missing"})).toString("base64")})});continue}let K=cX(q,Y,W),{_PROTO_skill_name:B,_PROTO_plugin_name:R,_PROTO_marketplace_name:U,...z}=K.additional,_=oX(z);J.push({event_type:"ClaudeCodeInternalEvent",event_data:S$.toJSON({event_id:Z.event_id,event_name:X,client_timestamp:this.hrTimeToDate(Q.hrTime),device_id:Z.user_id,email:Y?.email,auth:K.auth,...K.core,env:K.env,process:K.process,skill_name:typeof B==="string"?B:void 0,plugin_name:typeof R==="string"?R:void 0,marketplace_name:typeof U==="string"?U:void 0,additional_metadata:Object.keys(_).length>0?Buffer.from(A(_)).toString("base64"):void 0})})}return{events:J}}async shutdown(){if(this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE==="ant")L("1P event logging exporter shutdown complete")}async forceFlush(){if(await Promise.all(this.pendingExports),process.env.USER_TYPE==="ant")L("1P event logging exporter flush complete")}}function NK($){if(!p$.isAxiosError($))return c($);let J=[],Q=$.response?.headers?.["request-id"];if(Q)J.push(`request-id=${Q}`);if($.response?.status)J.push(`status=${$.response.status}`);if($.code)J.push(`code=${$.code}`);if($.message)J.push($.message);return J.join(", ")}var iX,rX="1p_failed_events.";var aX=H(()=>{i();RX();wX();$0();D0();p();j();H0();F$();k2();t();d3();X0();aJ();t4();V1();W6();iX=UK()});function u$($){return U4(DK,{})?.[$]===!0}var DK="tengu_frond_boric";var tX=H(()=>{Q1()});import{resourceFromAttributes as OK}from"@opentelemetry/resources";import{BatchLogRecordProcessor as FK,LoggerProvider as zK}from"@opentelemetry/sdk-logs";import{ATTR_SERVICE_NAME as xK,ATTR_SERVICE_VERSION as IK}from"@opentelemetry/semantic-conventions";import{randomUUID as eX}from"crypto";import{isEqual as MK}from"lodash-es";function PK(){return U4(TK,{})}function Ix($){let Q=PK()[$];if(!Q)return null;let Z=Q.sample_rate;if(typeof Z!=="number"||Z<0||Z>1)return null;if(Z>=1)return null;if(Z<=0)return 0;return Math.random()<Z?Z:0}function Jq(){return U4($q,{})}async function Mx(){if(!N1)return;try{if(await N1.shutdown(),process.env.USER_TYPE==="ant")L("1P event logging: final shutdown complete")}catch{}}function G2(){return!BX()}async function EK($,J,Q={}){try{let Z=await dX({model:Q.model,betas:Q.betas}),X={event_name:J,event_id:eX(),core_metadata:Z,user_metadata:V2(!0),event_metadata:Q},q=y2();if(q)X.user_id=q;if(process.env.USER_TYPE==="ant")L(`[ANT-ONLY] 1P event: ${J} ${A(Q,null,0)}`);$.emit({body:J,attributes:X})}catch(Z){throw Z}}function Tx($,J={}){if(!G2())return;if(!D1||u$("firstParty"))return;EK(D1,$,J)}function AK(){return"production"}function Zq($){if(!G2())return;if(!D1||u$("firstParty"))return;let J=y2(),{accountUuid:Q,organizationUuid:Z}=V2(!0),X={event_type:"GrowthbookExperimentEvent",event_id:eX(),experiment_id:$.experimentId,variation_id:$.variationId,...J&&{device_id:J},...Q&&{account_uuid:Q},...Z&&{organization_uuid:Z},...$.userAttributes&&{session_id:$.userAttributes.sessionId,user_attributes:A($.userAttributes)},...$.experimentMetadata&&{experiment_metadata:A($.experimentMetadata)},environment:AK()};if(process.env.USER_TYPE==="ant")L(`[ANT-ONLY] 1P GrowthBook experiment: ${$.experimentId} variation=${$.variationId}`);D1.emit({body:"growthbook_experiment",attributes:X})}function jK(){if(n0("1p_event_logging_start"),!G2()){if(process.env.USER_TYPE==="ant")L("1P event logging not enabled");return}let J=Jq();Qq=J,n0("1p_event_after_growthbook_config");let Q=J.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||CK.toString()),Z=J.maxExportBatchSize||vK,X=J.maxQueueSize||kK,q=j0(),Y={[xK]:"claude-code",[IK]:MACRO.VERSION};if(q==="wsl"){let B=L4();if(B)Y["wsl.version"]=B}let W=OK(Y),K=new V6({maxBatchSize:Z,skipAuth:J.skipAuth,maxAttempts:J.maxAttempts,path:J.path,baseUrl:J.baseUrl,isKilled:()=>u$("firstParty")});N1=new zK({resource:W,processors:[new FK(K,{scheduledDelayMillis:Q,maxExportBatchSize:Z,maxQueueSize:X})]}),D1=N1.getLogger("com.anthropic.claude_code.events",MACRO.VERSION)}async function Px(){if(!G2()||!N1)return;let $=Jq();if(MK($,Qq))return;if(process.env.USER_TYPE==="ant")L(`1P event logging: ${$q} changed, reinitializing`);let J=N1,Q=D1;D1=null;try{await J.forceFlush()}catch{}N1=null;try{jK()}catch(Z){N1=J,D1=Q,D(Z);return}J.shutdown().catch(()=>{})}var TK="tengu_event_sampling_config",$q="tengu_1p_event_batch_config",D1=null,N1=null,Qq=null,CK=1e4,vK=200,kK=8192;var Xq=H(()=>{D0();p();t();T2();X0();G6();tJ();LX();aX();Q1();W6();tX()});import{GrowthBook as yK}from"@growthbook/growthbook";import{isEqual as Yq,memoize as Wq}from"lodash-es";function qq($){try{Promise.resolve($()).catch((J)=>{D(J)})}catch(J){D(J)}}function ux($){let J=!0,Q=L2.subscribe(()=>qq($));if(w0.size>0)queueMicrotask(()=>{if(J&&w0.size>0)qq($)});return()=>{J=!1,Q()}}function H2(){if(!B6){if(B6=!0,process.env.USER_TYPE==="ant"){let $=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if($)try{R4=JSON.parse($),L(`GrowthBook: Using env var overrides for ${Object.keys(R4).length} features: ${Object.keys(R4).join(", ")}`)}catch{D(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${$}`))}}}return R4}function dx($){let J=H2();return J!==null&&$ in J}function U2(){if(process.env.USER_TYPE!=="ant")return;try{return I().growthBookOverrides}catch{return}}function cx(){if(w0.size>0)return Object.fromEntries(w0);return I().cachedGrowthBookFeatures??{}}function lx(){return U2()??{}}function nx($,J){if(process.env.USER_TYPE!=="ant")return;try{n((Q)=>{let Z=Q.growthBookOverrides??{};if(J===void 0){if(!($ in Z))return Q;let{[$]:X,...q}=Z;if(Object.keys(q).length===0){let{growthBookOverrides:Y,...W}=Q;return W}return{...Q,growthBookOverrides:q}}if(Yq(Z[$],J))return Q;return{...Q,growthBookOverrides:{...Z,[$]:J}}}),L2.emit()}catch(Q){D(Q)}}function ix(){if(process.env.USER_TYPE!=="ant")return;try{n(($)=>{if(!$.growthBookOverrides||Object.keys($.growthBookOverrides).length===0)return $;let{growthBookOverrides:J,...Q}=$;return Q}),L2.emit()}catch($){D($)}}function D4($){if(K6.has($))return;let J=c1.get($);if(J)K6.add($),Zq({experimentId:J.experimentId,variationId:J.variationId,userAttributes:Kq(),experimentMetadata:{feature_id:$}})}async function Vq($){let J=$.getPayload();if(!J?.features||Object.keys(J.features).length===0)return!1;c1.clear();let Q={};for(let[Z,X]of Object.entries(J.features)){let q=X;if("value"in q&&!("defaultValue"in q))Q[Z]={...q,defaultValue:q.value};else Q[Z]=q;if(q.source==="experiment"&&q.experimentResult){let{experimentResult:Y,experiment:W}=q;if(W?.key&&Y.variationId!==void 0)c1.set(Z,{experimentId:W.key,variationId:Y.variationId})}}await $.setPayload({...J,features:Q}),w0.clear();for(let[Z,X]of Object.entries(Q)){let q="value"in X?X.value:X.defaultValue;if(q!==void 0)w0.set(Z,q)}return!0}function Gq(){let $=Object.fromEntries(w0),J=I();if(Yq(J.cachedGrowthBookFeatures,$))return;n((Q)=>({...Q,cachedGrowthBookFeatures:$}))}function r0(){if(!H8())return!1;return G2()}function SK(){let $=process.env.ANTHROPIC_BASE_URL;if(!$)return;try{let J=new URL($).host;if(J==="api.anthropic.com")return;return J}catch{return}}function Kq(){let $=GX(),J=$.email;if(!J&&process.env.USER_TYPE==="ant")J=I().oauthAccount?.emailAddress;let Q=SK();return{id:$.deviceId,sessionId:$.sessionId,deviceID:$.deviceId,platform:$.platform,...Q&&{apiBaseUrlHost:Q},...$.organizationUuid&&{organizationUUID:$.organizationUuid},...$.accountUuid&&{accountUUID:$.accountUuid},...$.userType&&{userType:$.userType},...$.subscriptionType&&{subscriptionType:$.subscriptionType},...$.rateLimitTier&&{rateLimitTier:$.rateLimitTier},...$.firstTokenTime&&{firstTokenTime:$.firstTokenTime},...J&&{email:J},...$.appVersion&&{appVersion:$.appVersion},...$.githubActionsMetadata&&{githubActionsMetadata:$.githubActionsMetadata}}}async function Bq($,J,Q){let Z=H2();if(Z&&$ in Z)return Z[$];let X=U2();if(X&&$ in X)return X[$];if(!r0())return J;let q=await d$();if(!q)return J;let Y;if(w0.has($))Y=w0.get($);else Y=q.getFeatureValue($,J);if(Q)D4($);if(process.env.USER_TYPE==="ant")L(`GrowthBook: getFeatureValue("${$}") = ${A(Y)}`);return Y}async function fK($,J){return Bq($,J,!0)}function q0($,J){let Q=H2();if(Q&&$ in Q)return Q[$];let Z=U2();if(Z&&$ in Z)return Z[$];if(!r0())return J;if(c1.has($))D4($);else B2.add($);if(w0.has($))return w0.get($);try{let X=I().cachedGrowthBookFeatures?.[$];return X!==void 0?X:J}catch{return J}}function rx($,J,Q){return q0($,J)}function C3($){let J=H2();if(J&&$ in J)return Boolean(J[$]);let Q=U2();if(Q&&$ in Q)return Boolean(Q[$]);if(!r0())return!1;if(c1.has($))D4($);else B2.add($);let Z=I(),X=Z.cachedGrowthBookFeatures?.[$];if(X!==void 0)return Boolean(X);return Z.cachedStatsigGates?.[$]??!1}async function ox($){let J=H2();if(J&&$ in J)return Boolean(J[$]);let Q=U2();if(Q&&$ in Q)return Boolean(Q[$]);if(!r0())return!1;if(N4)await N4;let Z=I(),X=Z.cachedStatsigGates?.[$];if(X!==void 0)return Boolean(X);let q=Z.cachedGrowthBookFeatures?.[$];if(q!==void 0)return Boolean(q);return!1}async function sx($){let J=H2();if(J&&$ in J)return Boolean(J[$]);let Q=U2();if(Q&&$ in Q)return Boolean(Q[$]);if(!r0())return!1;if(I().cachedGrowthBookFeatures?.[$]===!0){if(c1.has($))D4($);else B2.add($);return!0}return Bq($,!1,!0)}function ax(){if(!r0())return;try{Lq(),L2.emit(),N4=d$().catch(($)=>{return D(u1($)),null}).finally(()=>{N4=null})}catch($){throw $}}function Lq(){if(Hq(),w4)process.off("beforeExit",w4),w4=null;if(_4)process.off("exit",_4),_4=null;i0?.destroy(),i0=null,H6=!1,N4=null,c1.clear(),B2.clear(),K6.clear(),w0.clear(),L6.cache?.clear?.(),d$.cache?.clear?.(),R4=null,B6=!1}async function hK(){if(!r0())return;try{let $=await d$();if(!$)return;if(await $.refreshFeatures(),$!==i0){if(process.env.USER_TYPE==="ant")L("GrowthBook: Skipping refresh processing for replaced client");return}let J=await Vq($);if($!==i0)return;if(process.env.USER_TYPE==="ant")L("GrowthBook: Light refresh completed");if(J)Gq(),L2.emit()}catch($){throw $}}function pK(){if(!r0())return;if(d1)clearInterval(d1);if(d1=setInterval(()=>{hK()},bK),d1.unref?.(),!K2)K2=()=>{Hq()},process.once("beforeExit",K2)}function Hq(){if(d1)clearInterval(d1),d1=null;if(K2)process.removeListener("beforeExit",K2),K2=null}async function tx($,J){return fK($,J)}function U4($,J){return q0($,J)}var i0=null,w4=null,_4=null,H6=!1,c1,w0,B2,K6,N4=null,L2,R4=null,B6=!1,L6,d$,bK,d1=null,K2=null;var Q1=H(()=>{i();o6();D0();p();H0();F$();t();$J();X0();tJ();Xq();c1=new Map,w0=new Map,B2=new Set,K6=new Set,L2=m0();L6=Wq(()=>{if(!r0())return null;let $=Kq(),J=H8();if(process.env.USER_TYPE==="ant")L(`GrowthBook: Creating client with clientKey=${J}, attributes: ${A($)}`);let Q=process.env.USER_TYPE==="ant"?process.env.CLAUDE_CODE_GB_BASE_URL||"https://api.anthropic.com/":"https://api.anthropic.com/",X=e()||v2()||u()?V4():{headers:{},error:"trust not established"},q=!X.error;H6=q;let Y=new yK({apiHost:Q,clientKey:J,attributes:$,remoteEval:!0,cacheKeyAttributes:["id","organizationUUID"],...X.error?{}:{apiHostRequestHeaders:X.headers},...process.env.USER_TYPE==="ant"?{log:(K,B)=>{L(`GrowthBook: ${K} ${A(B)}`)}}:{}});if(i0=Y,!q)return{client:Y,initialized:Promise.resolve()};let W=Y.init({timeout:5000}).then(async(K)=>{if(i0!==Y){if(process.env.USER_TYPE==="ant")L("GrowthBook: Skipping init callback for replaced client");return}if(process.env.USER_TYPE==="ant")L(`GrowthBook initialized successfully, source: ${K.source}, success: ${K.success}`);let B=await Vq(Y);if(i0!==Y)return;if(B){for(let R of B2)D4(R);B2.clear(),Gq(),L2.emit()}if(process.env.USER_TYPE==="ant"){let R=Y.getFeatures();if(R){let U=Object.keys(R);L(`GrowthBook loaded ${U.length} features: ${U.slice(0,10).join(", ")}${U.length>10?"...":""}`)}}}).catch((K)=>{if(process.env.USER_TYPE==="ant")D(u1(K))});return w4=()=>i0?.destroy(),_4=()=>i0?.destroy(),process.on("beforeExit",w4),process.on("exit",_4),{client:Y,initialized:W}}),d$=Wq(async()=>{let $=L6();if(!$)return null;if(!H6){if(e()||v2()||u()){if(!V4().error){if(process.env.USER_TYPE==="ant")L("GrowthBook: Auth became available after client creation, reinitializing");if(Lq(),$=L6(),!$)return null}}}return await $.initialized,pK(),$.client});bK=process.env.USER_TYPE!=="ant"?21600000:1200000});class Uq{cache=new Map;maxCacheSize=1000;readFile($){let J=x(),Q;try{Q=J.statSync($)}catch(W){throw this.cache.delete($),W}let Z=$,X=this.cache.get(Z);if(X&&X.mtime===Q.mtimeMs)return{content:X.content,encoding:X.encoding};let q=_q($),Y=J.readFileSync($,{encoding:q}).replaceAll(`\r
|
|
107
|
-
`,`
|
|
108
|
-
`);if(this.cache.set(Z,{content:Y,encoding:q,mtime:Q.mtimeMs}),this.cache.size>this.maxCacheSize){let W=this.cache.keys().next().value;if(W)this.cache.delete(W)}return{content:Y,encoding:q}}clear(){this.cache.clear()}invalidate($){this.cache.delete($)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}}var Rq;var wq=H(()=>{p4();$1();Rq=new Uq});import{chmodSync as gK,writeFileSync as Nq}from"fs";import{realpath as mK,stat as zq}from"fs/promises";import{homedir as xq}from"os";import{basename as U6,dirname as c$,extname as Dq,isAbsolute as uK,join as R2,normalize as dK,relative as Iq,resolve as cK,sep as O4}from"path";async function NI($){try{return await zq($),!0}catch{return!1}}function DI($){try{return x().readFileSync($,{encoding:"utf8"})}catch(J){return D(J),null}}function OI($){let J=x();return Math.floor(J.statSync($).mtimeMs)}async function FI($){let J=await x().stat($);return Math.floor(J.mtimeMs)}function zI($,J,Q,Z){let X=J;if(Z==="CRLF")X=J.replaceAll(`\r
|
|
109
|
-
`,`
|
|
110
|
-
`).split(`
|
|
111
|
-
`).join(`\r
|
|
112
|
-
`);i1($,X,{encoding:Q})}function _q($){try{let J=x(),{resolvedPath:Q}=e0(J,$);return K8(Q)}catch(J){if(m$(J))L(`detectFileEncoding failed for expected reason: ${J.code}`,{level:"debug"});else D(J);return"utf8"}}function xI($,J="utf8"){try{let Q=x(),{resolvedPath:Z}=e0(Q,$),{buffer:X,bytesRead:q}=Q.readSync(Z,{length:4096}),Y=X.toString(J,0,q);return B8(Y)}catch(Q){return D(Q),"LF"}}function II($){if(!$.includes("\t"))return $;return $.replace(/^\t+/gm,(J)=>" ".repeat(J.length))}function nK($){let J=$?Fq($):void 0,Q=J?Iq(S0(),J):void 0;return{absolutePath:J,relativePath:Q}}function MI($){let{relativePath:J}=nK($);if(J&&!J.startsWith(".."))return J;let Q=xq();if($.startsWith(Q+O4))return"~"+$.slice(Q.length);return $}function TI($){let J=x();try{let Q=c$($),Z=U6($,Dq($)),Y=J.readdirSync(Q).filter((W)=>U6(W.name,Dq(W.name))===Z&&R2(Q,W.name)!==$)[0];if(Y)return Y.name;return}catch(Q){if(!H1(Q))D(Q);return}}async function EI($){let J=S0(),Q=c$(J),Z=$;try{let W=await mK(c$($));Z=R2(W,U6($))}catch{}let X=Q===O4?O4:Q+O4;if(!Z.startsWith(X)||Z.startsWith(J+O4)||Z===J)return;let q=Iq(Q,Z),Y=R2(J,q);try{return await zq(Y),Y}catch{return}}function iK(){return!q0("tengu_compact_line_prefix_killswitch",!1)}function AI({content:$,startLine:J}){if(!$)return"";let Q=$.split(/\r?\n/);if(iK())return Q.map((Z,X)=>`${X+J} ${Z}`).join(`
|
|
113
|
-
`);return Q.map((Z,X)=>{let q=String(X+J);if(q.length>=6)return`${q}\u2192${Z}`;return`${q.padStart(6," ")}\u2192${Z}`}).join(`
|
|
114
|
-
`)}function CI($){return $.match(/^\s*\d+[\u2192\t](.*)$/)?.[1]??$}function vI($){try{return x().isDirEmptySync($)}catch(J){return H1(J)}}function kI($){let{content:J}=Rq.readFile($);return J}function i1($,J,Q={encoding:"utf-8"}){let Z=x(),X=$;try{let K=Z.readlinkSync($);X=uK(K)?K:cK(c$($),K),L(`Writing through symlink: ${$} -> ${X}`)}catch{}let q=`${X}.tmp.${process.pid}.${Date.now()}`,Y,W=!1;try{Y=Z.statSync(X).mode,W=!0,L(`Preserving file permissions: ${Y.toString(8)}`)}catch(K){if(!H1(K))throw K;if(Q.mode!==void 0)Y=Q.mode,L(`Setting permissions for new file: ${Y.toString(8)}`)}try{L(`Writing to temp file: ${q}`);let K={encoding:Q.encoding,flush:!0};if(!W&&Q.mode!==void 0)K.mode=Q.mode;if(Nq(q,J,K),L(`Temp file written successfully, size: ${J.length} bytes`),W&&Y!==void 0)gK(q,Y),L("Applied original permissions to temp file");L(`Renaming ${q} to ${X}`),Z.renameSync(q,X),L(`File ${X} written atomically`)}catch(K){L(`Failed to write file atomically: ${K}`,{level:"error"}),F("tengu_atomic_write_error",{});try{L(`Cleaning up temp file: ${q}`),Z.unlinkSync(q)}catch(B){L(`Failed to clean up temp file: ${B}`)}L(`Falling back to non-atomic write for ${X}`);try{let B={encoding:Q.encoding,flush:!0};if(!W&&Q.mode!==void 0)B.mode=Q.mode;Nq(X,J,B),L(`File ${X} written successfully with non-atomic fallback`)}catch(B){throw L(`Non-atomic write also failed: ${B}`),B}}}function jI(){let $=j0(),J=xq();if($==="macos")return R2(J,"Desktop");if($==="windows"){let Z=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,"/"):null;if(Z){let q=`/mnt/c${Z.replace(/^[A-Z]:/,"")}/Desktop`;if(x().existsSync(q))return q}try{let q=x().readdirSync("/mnt/c/Users");for(let Y of q){if(Y.name==="Public"||Y.name==="Default"||Y.name==="Default User"||Y.name==="All Users")continue;let W=R2("/mnt/c/Users",Y.name,"Desktop");if(x().existsSync(W))return W}}catch(X){D(X)}}let Q=R2(J,"Desktop");if(x().existsSync(Q))return Q;return J}function yI($,J=lK){try{return x().statSync($).size<=J}catch{return!1}}function Oq($){let J=dK($);if(j0()==="windows")J=J.replace(/\//g,"\\").toLowerCase();return J}function SI($,J){return Oq($)===Oq(J)}var lK=262144,PI="Note: your current working directory is";var p4=H(()=>{V1();Q1();h4();p();H0();z2();wq();$1();t();R8();T2()});import{appendFile as rK,mkdir as oK,readFile as sK,writeFile as aK}from"fs/promises";import{homedir as tK}from"os";import{dirname as eK,join as $B}from"path";async function JB($,J){let{code:Q}=await p1("git",["check-ignore",$],{preserveOutputOnError:!1,cwd:J});return Q===0}function QB(){return $B(tK(),".config","git","ignore")}async function Tq($,J=S0()){try{if(!await Mq(J))return;let Q=`**/${$}`,Z=$.endsWith("/")?`${$}sample-file.txt`:$;if(await JB(Z,J))return;let X=QB(),q=eK(X);await oK(q,{recursive:!0});try{if((await sK(X,{encoding:"utf-8"})).includes(Q))return;await rK(X,`
|
|
115
|
-
${Q}
|
|
116
|
-
`)}catch(Y){if(W0(Y)==="ENOENT")await aK(X,`${Q}
|
|
117
|
-
`,"utf-8");else throw Y}}catch(Q){D(Q)}}var Pq=H(()=>{h4();H0();h2();k4();t()});function rI($){switch($){case"userSettings":return"user";case"projectSettings":return"project";case"localSettings":return"project, gitignored";case"flagSettings":return"cli flag";case"policySettings":return"managed"}}function oI($){switch($){case"userSettings":return"User";case"projectSettings":return"Project";case"localSettings":return"Local";case"flagSettings":return"Flag";case"policySettings":return"Managed";case"plugin":return"Plugin";case"built-in":return"Built-in"}}function sI($){switch($){case"userSettings":return"user settings";case"projectSettings":return"shared project settings";case"localSettings":return"project local settings";case"flagSettings":return"command line arguments";case"policySettings":return"enterprise managed settings";case"cliArg":return"CLI argument";case"command":return"command configuration";case"session":return"current session"}}function aI($){switch($){case"userSettings":return"User settings";case"projectSettings":return"Shared project settings";case"localSettings":return"Project local settings";case"flagSettings":return"Command line arguments";case"policySettings":return"Enterprise managed settings";case"cliArg":return"CLI argument";case"command":return"Command configuration";case"session":return"Current session"}}function tI($){if($==="")return[];let J=$.split(",").map((Z)=>Z.trim()),Q=[];for(let Z of J)switch(Z){case"user":Q.push("userSettings");break;case"project":Q.push("projectSettings");break;case"local":Q.push("localSettings");break;default:throw Error(`Invalid setting source: ${Z}. Valid options are: user, project, local`)}return Q}function F4(){let $=Eq(),J=new Set($);return J.add("policySettings"),J.add("flagSettings"),Array.from(J)}function eI($){return F4().includes($)}var iI,$M,Aq="https://json.schemastore.org/claude-code-settings.json";var R6=H(()=>{i();iI=["userSettings","projectSettings","localSettings","flagSettings","policySettings"];$M=["localSettings","projectSettings","userSettings"]});function Cq($){l$.set($,Date.now())}function QM($,J){let Q=l$.get($);if(Q!==void 0&&Date.now()-Q<J)return l$.delete($),!0;return!1}function ZM(){l$.clear()}var l$;var vq=H(()=>{l$=new Map});import{z as E}from"zod/v4";var ZB,XB,kq;var jq=H(()=>{b1();ZB=O(()=>E.object({allowedDomains:E.array(E.string()).optional(),allowManagedDomainsOnly:E.boolean().optional().describe("When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources."),allowUnixSockets:E.array(E.string()).optional().describe("macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path)."),allowAllUnixSockets:E.boolean().optional().describe("If true, allow all Unix sockets (disables blocking on both platforms)."),allowLocalBinding:E.boolean().optional(),httpProxyPort:E.number().optional(),socksProxyPort:E.number().optional()}).optional()),XB=O(()=>E.object({allowWrite:E.array(E.string()).optional().describe("Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules."),denyWrite:E.array(E.string()).optional().describe("Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules."),denyRead:E.array(E.string()).optional().describe("Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules."),allowRead:E.array(E.string()).optional().describe("Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths."),allowManagedReadPathsOnly:E.boolean().optional().describe("When true (set in managed settings), only allowRead paths from policySettings are used.")}).optional()),kq=O(()=>E.object({enabled:E.boolean().optional(),failIfUnavailable:E.boolean().optional().describe("Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies, unsupported platform, or platform not in enabledPlatforms). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate."),autoAllowBashIfSandboxed:E.boolean().optional(),allowUnsandboxedCommands:E.boolean().optional().describe("Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."),network:ZB(),filesystem:XB(),ignoreViolations:E.record(E.string(),E.array(E.string())).optional(),enableWeakerNestedSandbox:E.boolean().optional(),enableWeakerNetworkIsolation:E.boolean().optional().describe("macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. "+"**Reduces security** \u2014 opens a potential data exfiltration vector through the trustd service. Default: false"),excludedCommands:E.array(E.string()).optional(),ripgrep:E.object({command:E.string(),args:E.array(E.string()).optional()}).optional().describe("Custom ripgrep configuration for bundled ripgrep support")}).passthrough())});var z4,qB,w6;var yq=H(()=>{z4=["acceptEdits","bypassPermissions","default","dontAsk","plan"],qB=[...z4,...[]],w6=qB});import fq from"zod/v4";function _M($){if(process.env.USER_TYPE!=="ant")return!0;return $!=="auto"&&$!=="bubble"}function n$($){return Sq[$]??Sq.default}function NM($){return n$($).external}function DM($){return w6.includes($)?$:"default"}function OM($){return n$($).title}function FM($){return $==="default"||$===void 0}function zM($){return n$($).symbol}function xM($){return n$($).color}var RM,wM,Sq;var bq=H(()=>{BJ();yq();b1();RM=O(()=>fq.enum(w6)),wM=O(()=>fq.enum(z4)),Sq={default:{title:"Default",shortTitle:"Default",symbol:"",color:"text",external:"default"},plan:{title:"Plan Mode",shortTitle:"Plan",symbol:fQ,color:"planMode",external:"plan"},acceptEdits:{title:"Accept edits",shortTitle:"Accept",symbol:"\u23F5\u23F5",color:"autoAccept",external:"acceptEdits"},bypassPermissions:{title:"Bypass Permissions",shortTitle:"Bypass",symbol:"\u23F5\u23F5",color:"error",external:"bypassPermissions"},dontAsk:{title:"Don't Ask",shortTitle:"DontAsk",symbol:"\u23F5\u23F5",color:"error",external:"dontAsk"},...{}}});var hq=()=>{};var pq;var gq=H(()=>{hq();pq=["PreToolUse","PostToolUse","PostToolUseFailure","Notification","UserPromptSubmit","SessionStart","SessionEnd","Stop","StopFailure","SubagentStart","SubagentStop","PreCompact","PostCompact","PermissionRequest","PermissionDenied","Setup","TeammateIdle","TaskCreated","TaskCompleted","Elicitation","ElicitationResult","ConfigChange","WorktreeCreate","WorktreeRemove","InstructionsLoaded","CwdChanged","FileChanged"]});var mq=()=>{};var uq=()=>{};var dq=H(()=>{gq();mq();uq()});var cq,vM="bash";var lq=H(()=>{cq=["bash","powershell"]});import{z as M}from"zod/v4";function YB(){let $=M.object({type:M.literal("command").describe("Shell command hook type"),command:M.string().describe("Shell command to execute"),if:i$(),shell:M.enum(cq).optional().describe("Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash."),timeout:M.number().positive().optional().describe("Timeout in seconds for this specific command"),statusMessage:M.string().optional().describe("Custom status message to display in spinner while hook runs"),once:M.boolean().optional().describe("If true, hook runs once and is removed after execution"),async:M.boolean().optional().describe("If true, hook runs in background without blocking"),asyncRewake:M.boolean().optional().describe("If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async.")}),J=M.object({type:M.literal("prompt").describe("LLM prompt hook type"),prompt:M.string().describe("Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON."),if:i$(),timeout:M.number().positive().optional().describe("Timeout in seconds for this specific prompt evaluation"),model:M.string().optional().describe('Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.'),statusMessage:M.string().optional().describe("Custom status message to display in spinner while hook runs"),once:M.boolean().optional().describe("If true, hook runs once and is removed after execution")}),Q=M.object({type:M.literal("http").describe("HTTP hook type"),url:M.string().url().describe("URL to POST the hook input JSON to"),if:i$(),timeout:M.number().positive().optional().describe("Timeout in seconds for this specific request"),headers:M.record(M.string(),M.string()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:M.array(M.string()).optional().describe("Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work."),statusMessage:M.string().optional().describe("Custom status message to display in spinner while hook runs"),once:M.boolean().optional().describe("If true, hook runs once and is removed after execution")}),Z=M.object({type:M.literal("agent").describe("Agentic verifier hook type"),prompt:M.string().describe('Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.'),if:i$(),timeout:M.number().positive().optional().describe("Timeout in seconds for agent execution (default 60)"),model:M.string().optional().describe('Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.'),statusMessage:M.string().optional().describe("Custom status message to display in spinner while hook runs"),once:M.boolean().optional().describe("If true, hook runs once and is removed after execution")});return{BashCommandHookSchema:$,PromptHookSchema:J,HttpHookSchema:Q,AgentHookSchema:Z}}var i$,nq,iq,l1;var r$=H(()=>{dq();b1();lq();i$=O(()=>M.string().optional().describe('Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.'));nq=O(()=>{let{BashCommandHookSchema:$,PromptHookSchema:J,AgentHookSchema:Q,HttpHookSchema:Z}=YB();return M.discriminatedUnion("type",[$,J,Q,Z])}),iq=O(()=>M.object({matcher:M.string().optional().describe('String pattern to match (e.g. tool names like "Write")'),hooks:M.array(nq()).describe("List of hooks to execute when the matcher matches")})),l1=O(()=>M.partialRecord(M.enum(pq),M.array(iq())))});import{z as V}from"zod/v4";function uM($,J){let Q=$.toLowerCase();return J.autoUpdate??(a$.has(Q)&&!VB.has(Q))}function BB($){if(a$.has($.toLowerCase()))return!1;if(KB.test($))return!0;return GB.test($)}function dM($,J){let Q=$.toLowerCase();if(!a$.has(Q))return null;if(J.source==="github"){if(!(J.repo||"").toLowerCase().startsWith(`${o$}/`))return`The name '${$}' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/${o$}/' can use this name.`;return null}if(J.source==="git"&&J.url){let Z=J.url.toLowerCase(),X=Z.includes("github.com/anthropics/"),q=Z.includes("git@github.com:anthropics/");if(X||q)return null;return`The name '${$}' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/${o$}/' can use this name.`}return`The name '${$}' is reserved for official Anthropic marketplaces and can only be used with GitHub sources from the '${o$}' organization.`}function lM($){return typeof $==="string"&&$.startsWith("./")}function nM($){return $.source==="file"||$.source==="directory"}var a$,VB,GB,KB,o$="anthropics",o0,w2,rq,D6,O6,aq,F6,LB,cM,HB,UB,RB,wB,_B,NB,oq,DB,OB,tq,FB,zB,sq,xB,eq,IB,MB,x4,_6,$Y,TB,PB,iM,s$,EB,AB,rM,CB,vB,kB,jB,yB,oM,SB,sM;var JY=H(()=>{r$();WB();b1();a$=new Set(["claude-code-marketplace","claude-code-plugins","claude-plugins-official","anthropic-marketplace","anthropic-plugins","agent-skills","life-sciences","knowledge-work-plugins"]),VB=new Set(["knowledge-work-plugins"]);GB=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,KB=/[^\u0020-\u007E]/;o0=O(()=>V.string().startsWith("./")),w2=O(()=>o0().endsWith(".json")),rq=O(()=>V.union([o0().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB file path must end with .mcpb or .dxt"}).describe("Path to MCPB file relative to plugin root"),V.string().url().refine(($)=>$.endsWith(".mcpb")||$.endsWith(".dxt"),{message:"MCPB URL must end with .mcpb or .dxt"}).describe("URL to MCPB file")])),D6=O(()=>o0().endsWith(".md")),O6=O(()=>V.union([D6(),o0()])),aq=O(()=>V.string().min(1,"Marketplace must have a name").refine(($)=>!$.includes(" "),{message:'Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")'}).refine(($)=>!$.includes("/")&&!$.includes("\\")&&!$.includes("..")&&$!==".",{message:'Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."'}).refine(($)=>!BB($),{message:"Marketplace name impersonates an official Anthropic/Claude marketplace"}).refine(($)=>$.toLowerCase()!=="inline",{message:'Marketplace name "inline" is reserved for --plugin-dir session plugins'}).refine(($)=>$.toLowerCase()!=="builtin",{message:'Marketplace name "builtin" is reserved for built-in plugins'})),F6=O(()=>V.object({name:V.string().min(1,"Author name cannot be empty").describe("Display name of the plugin author or organization"),email:V.string().optional().describe("Contact email for support or feedback"),url:V.string().optional().describe("Website, GitHub profile, or organization URL")})),LB=O(()=>V.object({name:V.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier for the plugin, used for namespacing (prefer kebab-case)"),version:V.string().optional().describe("Semantic version (e.g., 1.2.3) following semver.org specification"),description:V.string().optional().describe("Brief, user-facing explanation of what the plugin provides"),author:F6().optional().describe("Information about the plugin creator or maintainer"),homepage:V.string().url().optional().describe("Plugin homepage or documentation URL"),repository:V.string().optional().describe("Source code repository URL"),license:V.string().optional().describe("SPDX license identifier (e.g., MIT, Apache-2.0)"),keywords:V.array(V.string()).optional().describe("Tags for plugin discovery and categorization"),dependencies:V.array(AB()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),cM=O(()=>V.object({description:V.string().optional().describe("Brief, user-facing explanation of what these hooks provide"),hooks:V.lazy(()=>l1()).describe("The hooks provided by the plugin, in the same format as the one used for settings")})),HB=O(()=>V.object({hooks:V.union([w2().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),V.lazy(()=>l1()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)"),V.array(V.union([w2().describe("Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root"),V.lazy(()=>l1()).describe("Additional hooks (in addition to those in hooks/hooks.json, if it exists)")]))])})),UB=O(()=>V.object({source:O6().optional().describe("Path to command markdown file, relative to plugin root"),content:V.string().optional().describe("Inline markdown content for the command"),description:V.string().optional().describe("Command description override"),argumentHint:V.string().optional().describe('Hint for command arguments (e.g., "[file]")'),model:V.string().optional().describe("Default model for this command"),allowedTools:V.array(V.string()).optional().describe("Tools allowed when command runs")}).refine(($)=>$.source&&!$.content||!$.source&&$.content,{message:'Command must have either "source" (file path) or "content" (inline markdown), but not both'})),RB=O(()=>V.object({commands:V.union([O6().describe("Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root"),V.array(O6().describe("Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root")).describe("List of paths to additional command files or skill directories"),V.record(V.string(),UB()).describe('Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" \u2192 "/plugin:about")')])})),wB=O(()=>V.object({agents:V.union([D6().describe("Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root"),V.array(D6().describe("Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root")).describe("List of paths to additional agent files")])})),_B=O(()=>V.object({skills:V.union([o0().describe("Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root"),V.array(o0().describe("Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root")).describe("List of paths to additional skill directories")])})),NB=O(()=>V.object({outputStyles:V.union([o0().describe("Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root"),V.array(o0().describe("Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root")).describe("List of paths to additional output styles directories or files")])})),oq=O(()=>V.string().min(1)),DB=O(()=>V.string().min(2).refine(($)=>$.startsWith("."),{message:'File extensions must start with dot (e.g., ".ts", not "ts")'})),OB=O(()=>V.object({mcpServers:V.union([w2().describe("MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)"),rq().describe("Path or URL to MCPB file containing MCP server configuration"),V.record(V.string(),N6()).describe("MCP server configurations keyed by server name"),V.array(V.union([w2().describe("Path to MCP servers configuration file"),rq().describe("Path or URL to MCPB file"),V.record(V.string(),N6()).describe("Inline MCP server configurations")])).describe("Array of MCP server configurations (paths, MCPB files, or inline definitions)")])})),tq=O(()=>V.object({type:V.enum(["string","number","boolean","directory","file"]).describe("Type of the configuration value"),title:V.string().describe("Human-readable label shown in the config dialog"),description:V.string().describe("Help text shown beneath the field in the config dialog"),required:V.boolean().optional().describe("If true, validation fails when this field is empty"),default:V.union([V.string(),V.number(),V.boolean(),V.array(V.string())]).optional().describe("Default value used when the user provides nothing"),multiple:V.boolean().optional().describe("For string type: allow an array of strings"),sensitive:V.boolean().optional().describe("If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json"),min:V.number().optional().describe("Minimum value (number type only)"),max:V.number().optional().describe("Maximum value (number type only)")}).strict()),FB=O(()=>V.object({userConfig:V.record(V.string().regex(/^[A-Za-z_]\w*$/,"Option keys must be valid identifiers (letters, digits, underscore; no leading digit) \u2014 they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks"),tq()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage (macOS keychain or .credentials.json). Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. "+"Note: sensitive values share a single keychain entry with OAuth tokens \u2014 keep "+"secret counts small to stay under the ~2KB stdin-safe limit (see INC-3028).")})),zB=O(()=>V.object({channels:V.array(V.object({server:V.string().min(1).describe("Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers."),displayName:V.string().optional().describe('Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.'),userConfig:V.record(V.string(),tq()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe("Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.")})),sq=O(()=>V.strictObject({command:V.string().min(1).refine(($)=>{if($.includes(" ")&&!$.startsWith("/"))return!1;return!0},{message:"Command should not contain spaces. Use args array for arguments."}).describe('Command to execute the LSP server (e.g., "typescript-language-server")'),args:V.array(oq()).optional().describe("Command-line arguments to pass to the server"),extensionToLanguage:V.record(DB(),oq()).refine(($)=>Object.keys($).length>0,{message:"extensionToLanguage must have at least one mapping"}).describe("Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."),transport:V.enum(["stdio","socket"]).default("stdio").describe("Communication transport mechanism"),env:V.record(V.string(),V.string()).optional().describe("Environment variables to set when starting the server"),initializationOptions:V.unknown().optional().describe("Initialization options passed to the server during initialization"),settings:V.unknown().optional().describe("Settings passed to the server via workspace/didChangeConfiguration"),workspaceFolder:V.string().optional().describe("Workspace folder path to use for the server"),startupTimeout:V.number().int().positive().optional().describe("Maximum time to wait for server startup (milliseconds)"),shutdownTimeout:V.number().int().positive().optional().describe("Maximum time to wait for graceful shutdown (milliseconds)"),restartOnCrash:V.boolean().optional().describe("Whether to restart the server if it crashes"),maxRestarts:V.number().int().nonnegative().optional().describe("Maximum number of restart attempts before giving up")})),xB=O(()=>V.object({lspServers:V.union([w2().describe("Path to .lsp.json configuration file relative to plugin root"),V.record(V.string(),sq()).describe("LSP server configurations keyed by server name"),V.array(V.union([w2().describe("Path to LSP configuration file"),V.record(V.string(),sq()).describe("Inline LSP server configurations")])).describe("Array of LSP server configurations (paths or inline definitions)")])})),eq=O(()=>V.string().refine(($)=>!$.includes("..")&&!$.includes("//"),"Package name cannot contain path traversal patterns").refine(($)=>{let J=/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/,Q=/^[a-z0-9][a-z0-9-._]*$/;return J.test($)||Q.test($)},"Invalid npm package name format")),IB=O(()=>V.object({settings:V.record(V.string(),V.unknown()).optional().describe("Settings to merge when plugin is enabled. Only allowlisted keys are kept (currently: agent)")})),MB=O(()=>V.object({...LB().shape,...HB().partial().shape,...RB().partial().shape,...wB().partial().shape,..._B().partial().shape,...NB().partial().shape,...zB().partial().shape,...OB().partial().shape,...xB().partial().shape,...IB().partial().shape,...FB().partial().shape})),x4=O(()=>V.discriminatedUnion("source",[V.object({source:V.literal("url"),url:V.string().url().describe("Direct URL to marketplace.json file"),headers:V.record(V.string(),V.string()).optional().describe("Custom HTTP headers (e.g., for authentication)")}),V.object({source:V.literal("github"),repo:V.string().describe("GitHub repository in owner/repo format"),ref:V.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:V.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:V.array(V.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),V.object({source:V.literal("git"),url:V.string().describe("Full git repository URL"),ref:V.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),path:V.string().optional().describe("Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"),sparsePaths:V.array(V.string()).optional().describe('Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.')}),V.object({source:V.literal("npm"),package:eq().describe("NPM package containing marketplace.json")}),V.object({source:V.literal("file"),path:V.string().describe("Local file path to marketplace.json")}),V.object({source:V.literal("directory"),path:V.string().describe("Local directory containing .claude-plugin/marketplace.json")}),V.object({source:V.literal("hostPattern"),hostPattern:V.string().describe('Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')}),V.object({source:V.literal("pathPattern"),pathPattern:V.string().describe('Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.')}),V.object({source:V.literal("settings"),name:aq().refine(($)=>!a$.has($.toLowerCase()),{message:"Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false."}).describe("Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation "+"as PluginMarketplaceSchema plus reserved-name rejection \u2014 "+"validateOfficialNameSource runs after the disk write, too late to clean up."),plugins:V.array(TB()).describe("Plugin entries declared inline in settings.json"),owner:F6().optional()}).describe("Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).")])),_6=O(()=>V.string().length(40).regex(/^[a-f0-9]{40}$/,"Must be a full 40-character lowercase git commit SHA")),$Y=O(()=>V.union([o0().describe("Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)"),V.object({source:V.literal("npm"),package:eq().or(V.string()).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:V.string().optional().describe("Specific version or version range (e.g., ^1.0.0, ~2.1.0)"),registry:V.string().url().optional().describe("Custom NPM registry URL (defaults to using system default, likely npmjs.org)")}).describe("NPM package as plugin source"),V.object({source:V.literal("pip"),package:V.string().describe("Python package name as it appears on PyPI"),version:V.string().optional().describe("Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)"),registry:V.string().url().optional().describe("Custom PyPI registry URL (defaults to using system default, likely pypi.org)")}).describe("Python package as plugin source"),V.object({source:V.literal("url"),url:V.string().describe("Full git repository URL (https:// or git@)"),ref:V.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:_6().optional().describe("Specific commit SHA to use")}),V.object({source:V.literal("github"),repo:V.string().describe("GitHub repository in owner/repo format"),ref:V.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:_6().optional().describe("Specific commit SHA to use")}),V.object({source:V.literal("git-subdir"),url:V.string().describe("Git repository: GitHub owner/repo shorthand, https://, or git@ URL"),path:V.string().min(1).describe('Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.'),ref:V.string().optional().describe('Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.'),sha:_6().optional().describe("Specific commit SHA to use")}).describe("Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded.")])),TB=O(()=>V.object({name:V.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Plugin name as it appears in the target repository"),source:$Y().describe("Where to fetch the plugin from. Must be a remote source \u2014 relative "+"paths have no marketplace repository to resolve against."),description:V.string().optional(),version:V.string().optional(),strict:V.boolean().optional()}).refine(($)=>typeof $.source!=="string",{message:'Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, pip). Relative-path sources like "./foo" have no marketplace repository to resolve against.'}));PB=O(()=>MB().partial().extend({name:V.string().min(1,"Plugin name cannot be empty").refine(($)=>!$.includes(" "),{message:'Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")'}).describe("Unique identifier matching the plugin name"),source:$Y().describe("Where to fetch the plugin from"),category:V.string().optional().describe('Category for organizing plugins (e.g., "productivity", "development")'),tags:V.array(V.string()).optional().describe("Tags for searchability and discovery"),strict:V.boolean().optional().default(!0).describe("Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest.")})),iM=O(()=>V.object({name:aq(),owner:F6().describe("Marketplace maintainer or curator information"),plugins:V.array(PB()).describe("Collection of available plugins in this marketplace"),forceRemoveDeletedPlugins:V.boolean().optional().describe("When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users"),metadata:V.object({pluginRoot:V.string().optional().describe("Base path for relative plugin sources"),version:V.string().optional().describe("Marketplace version"),description:V.string().optional().describe("Marketplace description")}).optional().describe("Optional marketplace metadata"),allowCrossMarketplaceDependenciesOn:V.array(V.string()).optional().describe("Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies \u2014 no transitive trust.")})),s$=O(()=>V.string().regex(/^[a-z0-9][-a-z0-9._]*@[a-z0-9][-a-z0-9._]*$/i,"Plugin ID must be in format: plugin@marketplace")),EB=/^[a-z0-9][-a-z0-9._]*(@[a-z0-9][-a-z0-9._]*)?(@\^[^@]*)?$/i,AB=O(()=>V.union([V.string().regex(EB,"Dependency must be a plugin name, optionally qualified with @marketplace").transform(($)=>$.replace(/@\^[^@]*$/,"")),V.object({name:V.string().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i),marketplace:V.string().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i).optional()}).loose().transform(($)=>$.marketplace?`${$.name}@${$.marketplace}`:$.name)])),rM=O(()=>V.union([s$(),V.object({id:s$().describe('Plugin identifier (e.g., "formatter@tools")'),version:V.string().optional().describe('Version constraint (e.g., "^2.0.0")'),required:V.boolean().optional().describe("If true, cannot be disabled"),config:V.record(V.string(),V.unknown()).optional().describe("Plugin-specific configuration")})])),CB=O(()=>V.object({version:V.string().describe("Currently installed version"),installedAt:V.string().describe("ISO 8601 timestamp of installation"),lastUpdated:V.string().optional().describe("ISO 8601 timestamp of last update"),installPath:V.string().describe("Absolute path to the installed plugin directory"),gitCommitSha:V.string().optional().describe("Git commit SHA for git-based plugins (for version tracking)")})),vB=O(()=>V.object({version:V.literal(1).describe("Schema version 1"),plugins:V.record(s$(),CB()).describe("Map of plugin IDs to their installation metadata")})),kB=O(()=>V.enum(["managed","user","project","local"])),jB=O(()=>V.object({scope:kB().describe("Installation scope"),projectPath:V.string().optional().describe("Project path (required for project/local scopes)"),installPath:V.string().describe("Absolute path to the versioned plugin directory"),version:V.string().optional().describe("Currently installed version"),installedAt:V.string().optional().describe("ISO 8601 timestamp of installation"),lastUpdated:V.string().optional().describe("ISO 8601 timestamp of last update"),gitCommitSha:V.string().optional().describe("Git commit SHA for git-based plugins")})),yB=O(()=>V.object({version:V.literal(2).describe("Schema version 2"),plugins:V.record(s$(),V.array(jB())).describe("Map of plugin IDs to arrays of installation entries")})),oM=O(()=>V.union([vB(),yB()])),SB=O(()=>V.object({source:x4().describe("Where to fetch the marketplace from"),installLocation:V.string().describe("Local cache path where marketplace manifest is stored"),lastUpdated:V.string().describe("ISO 8601 timestamp of last marketplace refresh"),autoUpdate:V.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),sM=O(()=>V.record(V.string(),SB()))});var z6,tM;var QY=H(()=>{z6=["auto","claude","beast","gpt","codex","copilot-gpt-5","gemini","kimi","trinity","anthropic","default"],tM=[{value:"auto",label:"Auto",description:"Detect by model ID (Claude \u2192 native, GPT \u2192 beast/gpt, etc.)"},{value:"claude",label:"Claude (native)",description:"Use cc-haha's native system prompt (no provider override)"},{value:"beast",label:"Beast",description:"Autonomous, thorough \u2014 keep going until problem is solved"},{value:"gpt",label:"GPT",description:"Pragmatic, direct senior engineer style"},{value:"codex",label:"Codex",description:"OpenAI Codex / gpt-*-codex style"},{value:"copilot-gpt-5",label:"Copilot GPT-5",description:"Copilot gpt-5 variant"},{value:"gemini",label:"Gemini",description:"Rigorous, minimal changes, convention-following"},{value:"kimi",label:"Kimi",description:"General purpose, parallel tool calls encouraged"},{value:"trinity",label:"Trinity",description:"Trinity model base prompt"},{value:"anthropic",label:"Anthropic (opencode)",description:"opencode's Claude-family prompt (even on non-Claude models)"},{value:"default",label:"Default (minimal)",description:"Minimal, concise \u2014 for simple or restricted models"}]});function $T($){switch($){case"untrusted":case"on-request":return"default";case"on-failure":return"acceptEdits";case"never":return"bypassPermissions";default:return}}function JT($){switch($){case"read-only":case"workspace-write":return!0;case"danger-full-access":return!1;default:return}}var ZY,XY;var qY=H(()=>{ZY=["untrusted","on-request","on-failure","never"],XY=["read-only","workspace-write","danger-full-access"]});function YY($){let J=$.split("__"),[Q,Z,...X]=J;if(Q!=="mcp"||!Z)return null;let q=X.length>0?X.join("__"):void 0;return{serverName:Z,toolName:q}}function bB($){return`mcp__${t$($)}__`}function hB($,J){return`${bB($)}${t$(J)}`}function XT($){return $.mcpInfo?hB($.mcpInfo.serverName,$.mcpInfo.toolName):$.name}function qT($,J){let Q=`mcp__${t$(J)}__`;return $.replace(Q,"")}function YT($){let J=$.replace(/\s*\(MCP\)\s*$/,"");J=J.trim();let Q=J.indexOf(" - ");if(Q!==-1)return J.substring(Q+3).trim();return J}var WY=H(()=>{fB()});var VY="Agent",VT="Task",GT="verification",KT;var GY=H(()=>{KT=new Set(["Explore","Plan"])});var x6="TaskOutput";var KY=()=>{};var BY="TaskStop",HT=`
|
|
118
|
-
- Stops a running background task by its ID
|
|
119
|
-
- Takes a task_id parameter identifying the task to stop
|
|
120
|
-
- Returns a success or failure status
|
|
121
|
-
- Use this tool only when the user explicitly asks to cancel/stop a task, or when
|
|
122
|
-
the task is clearly runaway, harmful, duplicative, or no longer useful.
|
|
123
|
-
- Do not stop a background agent merely because you have already read enough of
|
|
124
|
-
its output. Prefer waiting for the automatic completion notification or
|
|
125
|
-
leaving it running while you summarize available progress.
|
|
126
|
-
`;var LY=()=>{};function _2($){return HY[$]??$}function NT($){let J=[];for(let[Q,Z]of Object.entries(HY))if(Z===$)J.push(Q);return J}function gB($){return $.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")}function mB($){return $.replace(/\\\(/g,"(").replace(/\\\)/g,")").replace(/\\\\/g,"\\")}function UY($){let J=uB($,"(");if(J===-1)return{toolName:_2($)};let Q=dB($,")");if(Q===-1||Q<=J)return{toolName:_2($)};if(Q!==$.length-1)return{toolName:_2($)};let Z=$.substring(0,J),X=$.substring(J+1,Q);if(!Z)return{toolName:_2($)};if(X===""||X==="*")return{toolName:_2(Z)};let q=mB(X);return{toolName:_2(Z),ruleContent:q}}function DT($){if(!$.ruleContent)return $.toolName;let J=gB($.ruleContent);return`${$.toolName}(${J})`}function uB($,J){for(let Q=0;Q<$.length;Q++)if($[Q]===J){let Z=0,X=Q-1;while(X>=0&&$[X]==="\\")Z++,X--;if(Z%2===0)return Q}return-1}function dB($,J){for(let Q=$.length-1;Q>=0;Q--)if($[Q]===J){let Z=0,X=Q-1;while(X>=0&&$[X]==="\\")Z++,X--;if(Z%2===0)return Q}return-1}var HY;var RY=H(()=>{GY();KY();LY();HY={Task:VY,KillShell:BY,AgentOutputTool:x6,BashOutputTool:x6,...{}}});function wY($){return I6.filePatternTools.includes($)}function _Y($){return I6.bashPrefixTools.includes($)}function NY($){return I6.customValidation[$]}var I6;var DY=H(()=>{I6={filePatternTools:["Read","Write","Edit","Glob","NotebookRead","NotebookEdit"],bashPrefixTools:["Bash"],customValidation:{WebSearch:($)=>{if($.includes("*")||$.includes("?"))return{valid:!1,error:"WebSearch does not support wildcards",suggestion:"Use exact search terms without * or ?",examples:["WebSearch(claude ai)","WebSearch(typescript tutorial)"]};return{valid:!0}},WebFetch:($)=>{if($.includes("://")||$.startsWith("http"))return{valid:!1,error:"WebFetch permissions use domain format, not URLs",suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:github.com)"]};if(!$.startsWith("domain:"))return{valid:!1,error:'WebFetch permissions must use "domain:" prefix',suggestion:'Use "domain:hostname" format',examples:["WebFetch(domain:example.com)","WebFetch(domain:*.google.com)"]};return{valid:!0}}}}});import{z as OY}from"zod/v4";function FY($,J){let Q=0,Z=J-1;while(Z>=0&&$[Z]==="\\")Q++,Z--;return Q%2!==0}function M6($,J){let Q=0;for(let Z=0;Z<$.length;Z++)if($[Z]===J&&!FY($,Z))Q++;return Q}function cB($){for(let J=0;J<$.length-1;J++)if($[J]==="("&&$[J+1]===")"){if(!FY($,J))return!0}return!1}function T6($){if(!$||$.trim()==="")return{valid:!1,error:"Permission rule cannot be empty"};let J=M6($,"("),Q=M6($,")");if(J!==Q)return{valid:!1,error:"Mismatched parentheses",suggestion:"Ensure all opening parentheses have matching closing parentheses"};if(cB($)){let Y=$.substring(0,$.indexOf("("));if(!Y)return{valid:!1,error:"Empty parentheses with no tool name",suggestion:"Specify a tool name before the parentheses"};return{valid:!1,error:"Empty parentheses",suggestion:`Either specify a pattern or use just "${Y}" without parentheses`,examples:[`${Y}`,`${Y}(some-pattern)`]}}let Z=UY($),X=YY(Z.toolName);if(X){if(Z.ruleContent!==void 0||M6($,"(")>0)return{valid:!1,error:"MCP rules do not support patterns in parentheses",suggestion:`Use "${Z.toolName}" without parentheses, or use "mcp__${X.serverName}__*" for all tools`,examples:[`mcp__${X.serverName}`,`mcp__${X.serverName}__*`,X.toolName&&X.toolName!=="*"?`mcp__${X.serverName}__${X.toolName}`:void 0].filter(Boolean)};return{valid:!0}}if(!Z.toolName||Z.toolName.length===0)return{valid:!1,error:"Tool name cannot be empty"};if(Z.toolName[0]!==Z.toolName[0]?.toUpperCase())return{valid:!1,error:"Tool names must start with uppercase",suggestion:`Use "${W$(String(Z.toolName))}"`};let q=NY(Z.toolName);if(q&&Z.ruleContent!==void 0){let Y=q(Z.ruleContent);if(!Y.valid)return Y}if(_Y(Z.toolName)&&Z.ruleContent!==void 0){let Y=Z.ruleContent;if(Y.includes(":*")&&!Y.endsWith(":*"))return{valid:!1,error:"The :* pattern must be at the end",suggestion:"Move :* to the end for prefix matching, or use * for wildcard matching",examples:["Bash(npm run:*) - prefix matching (legacy)","Bash(npm run *) - wildcard matching"]};if(Y===":*")return{valid:!1,error:"Prefix cannot be empty before :*",suggestion:"Specify a command prefix before :*",examples:["Bash(npm:*)","Bash(git:*)"]}}if(wY(Z.toolName)&&Z.ruleContent!==void 0){let Y=Z.ruleContent;if(Y.includes(":*"))return{valid:!1,error:'The ":*" syntax is only for Bash prefix rules',suggestion:'Use glob patterns like "*" or "**" for file matching',examples:[`${Z.toolName}(*.ts) - matches .ts files`,`${Z.toolName}(src/**) - matches all files in src`,`${Z.toolName}(**/*.test.ts) - matches test files`]};if(Y.includes("*")&&!Y.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!Y.includes("**"))return{valid:!1,error:"Wildcard placement might be incorrect",suggestion:"Wildcards are typically used at path boundaries",examples:[`${Z.toolName}(*.js) - all .js files`,`${Z.toolName}(src/*) - all files directly in src`,`${Z.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var e$;var P6=H(()=>{WY();b1();RY();V$();DY();e$=O(()=>OY.string().superRefine(($,J)=>{let Q=T6($);if(!Q.valid){let Z=Q.error;if(Q.suggestion)Z+=`. ${Q.suggestion}`;if(Q.examples&&Q.examples.length>0)Z+=`. Examples: ${Q.examples.join(", ")}`;J.addIssue({code:OY.ZodIssueCode.custom,message:Z,params:{received:$}})}}))});import{z as G}from"zod/v4";function uT($){return"serverName"in $&&$.serverName!==void 0}function dT($){return"serverCommand"in $&&$.serverCommand!==void 0}function cT($){return"serverUrl"in $&&$.serverUrl!==void 0}var lB,nB,iB,rB,oB,zY,_0;var I4=H(()=>{jq();j();b1();bq();JY();QY();qY();R6();P6();r$();r$();xY();lB=O(()=>G.record(G.string(),G.coerce.string())),nB=O(()=>G.object({allow:G.array(e$()).optional().describe("List of permission rules for allowed operations"),deny:G.array(e$()).optional().describe("List of permission rules for denied operations"),ask:G.array(e$()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:G.enum(z4).optional().describe("Default permission mode when Claude Code needs access"),disableBypassPermissionsMode:G.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...{},additionalDirectories:G.array(G.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough()),iB=O(()=>G.object({source:x4().describe("Where to fetch the marketplace from"),installLocation:G.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:G.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")})),rB=O(()=>G.object({serverName:G.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:G.array(G.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:G.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(($)=>{return E6([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),oB=O(()=>G.object({serverName:G.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:G.array(G.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:G.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(($)=>{return E6([$.serverName!==void 0,$.serverCommand!==void 0,$.serverUrl!==void 0],Boolean)===1},{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'})),zY=["skills","agents","hooks","mcp"],_0=O(()=>G.object({$schema:G.literal(Aq).optional().describe("JSON Schema reference for Claude Code settings"),apiKeyHelper:G.string().optional().describe("Path to a script that outputs authentication values"),awsCredentialExport:G.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:G.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:G.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),...w(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:G.object({issuer:G.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:G.string().describe("Claude Code's client_id registered at the IdP"),callbackPort:G.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")}:{},fileSuggestion:G.object({type:G.literal("command"),command:G.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:G.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),cleanupPeriodDays:G.number().nonnegative().int().optional().describe("Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup."),env:lB().optional().describe("Environment variables to set for Claude Code sessions"),attribution:G.object({commit:G.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:G.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set."),includeCoAuthoredBy:G.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),includeGitInstructions:G.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),permissions:nB().optional().describe("Tool usage permissions configuration"),model:G.string().optional().describe("Override the default model used by Claude Code"),availableModels:G.array(G.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),modelOverrides:G.record(G.string(),G.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-7") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:G.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:G.array(G.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:G.array(G.string()).optional().describe("List of rejected MCP servers from .mcp.json"),allowedMcpServers:G.array(rB()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:G.array(oB()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:l1().optional().describe("Custom commands to run before/after tool executions"),worktree:G.object({symlinkDirectories:G.array(G.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:G.array(G.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). "+"Dramatically faster in large monorepos \u2014 only the listed paths are written to disk.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:G.boolean().optional().describe("Disable all hooks and statusLine execution"),defaultShell:G.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:G.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:G.array(G.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:G.array(G.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:G.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:G.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),strictPluginOnlyCustomization:G.preprocess(($)=>Array.isArray($)?$.filter((J)=>zY.includes(J)):$,G.union([G.boolean(),G.array(G.enum(zY))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. '+"Composes with strictKnownMarketplaces for end-to-end admin control \u2014 plugins gated by "+"marketplace allowlist, everything else blocked here."),statusLine:G.object({type:G.literal("command"),command:G.string(),padding:G.number().optional()}).optional().describe("Custom status line display configuration"),enabledPlugins:G.record(G.string(),G.union([G.array(G.string()),G.boolean(),G.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.'),extraKnownMarketplaces:G.record(G.string(),iB()).check(($)=>{for(let[J,Q]of Object.entries($.value))if(Q.source.source==="settings"&&Q.source.name!==J)$.issues.push({code:"custom",input:Q.source.name,path:[J,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${J}" but source.name "${Q.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:G.array(x4()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. "+"Note: this is a policy gate only \u2014 it does NOT register marketplaces. "+"To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:G.array(x4()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),forceLoginMethod:G.enum(["claudeai","console"]).optional().describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing'),forceLoginOrgUUID:G.string().optional().describe("Organization UUID to use for OAuth login"),otelHeadersHelper:G.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:G.string().optional().describe("Controls the output style for assistant responses"),providerPromptStyle:G.enum(z6).optional().describe("Base system prompt style for non-Claude models. One of: "+z6.join(", ")),approvalPolicy:G.enum(ZY).optional().describe("Codex-style approval policy, mapped onto permissions.defaultMode when that is unset. One of: untrusted, on-request, on-failure, never"),sandboxMode:G.enum(XY).optional().describe("Codex-style sandbox mode, mapped onto sandbox.enabled when that is unset. One of: read-only, workspace-write, danger-full-access"),language:G.string().optional().describe('Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")'),skipWebFetchPreflight:G.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),webSearch:G.object({mode:G.enum(["auto","anthropic","tavily","brave","disabled"]).optional().describe("WebSearch backend selection. auto uses native Claude web search for Claude model names, then Tavily, then Brave."),tavilyApiKey:G.string().optional().describe("Tavily API key for WebSearch fallback"),braveApiKey:G.string().optional().describe("Brave Search API key for WebSearch fallback")}).optional().describe("Configures native and external WebSearch backends"),sandbox:kq().optional(),feedbackSurveyRate:G.number().min(0).max(1).optional().describe("Probability (0\u20131) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:G.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:G.object({mode:G.enum(["append","replace"]),verbs:G.array(G.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:G.object({excludeDefault:G.boolean().optional(),tips:G.array(G.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:G.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:G.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:G.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:G.enum(process.env.USER_TYPE==="ant"?["low","medium","high","max"]:["low","medium","high"]).optional().catch(void 0).describe("Persisted effort level for supported models."),advisorModel:G.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:G.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:G.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:G.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),showClearContextOnPlanAccept:G.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:G.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:G.array(G.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:G.record(G.string(),G.object({mcpServers:G.record(G.string(),G.record(G.string(),G.union([G.string(),G.number(),G.boolean(),G.array(G.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:G.record(G.string(),G.union([G.string(),G.number(),G.boolean(),G.array(G.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:G.object({defaultEnvironmentId:G.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:G.enum(["latest","stable"]).optional().describe("Release channel for auto-updates (latest or stable)"),...{},minimumVersion:G.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),plansDirectory:G.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/"),...process.env.USER_TYPE==="ant"?{classifierPermissionsEnabled:G.boolean().optional().describe("Enable AI-based classification for Bash(prompt:...) permission rules")}:{},...{},...{},...{},channelsEnabled:G.boolean().optional().describe("Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:G.array(G.object({marketplace:G.string(),plugin:G.string()})).optional().describe("Teams/Enterprise allowlist of channel plugins. When set, "+"replaces the default Anthropic allowlist \u2014 admins decide which "+"plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),...{},prefersReducedMotion:G.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),autoMemoryEnabled:G.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:G.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:G.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:G.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),skipDangerousModePermissionPrompt:G.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),...{},disableAutoMode:G.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:G.array(G.object({id:G.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:G.string().describe("Display name for the SSH connection"),sshHost:G.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:G.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:G.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:G.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMdExcludes:G.array(G.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:G.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").')}).passthrough())});import{toJSONSchema as sB}from"zod/v4";function A6(){let $=sB(_0(),{unrepresentable:"any"});return A($,null,2)}var IY=H(()=>{X0();I4()});function MY($){let J=aB.find((Z)=>Z.matches($));if(!J)return null;let Q={...J.tip};if($.code==="invalid_value"&&$.enumValues&&!Q.suggestion)Q.suggestion=`Valid values: ${$.enumValues.map((Z)=>`"${Z}"`).join(", ")}`;if(!Q.docLink&&$.path){let Z=$.path.split(".")[0];if(Z)Q.docLink=tB[Z]}return Q}var aB,tB;var TY=H(()=>{aB=[{matches:($)=>$.path==="permissions.defaultMode"&&$.code==="invalid_value",tip:{suggestion:'Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)',docLink:"https://code.claude.com/docs/en/iam#permission-modes"}},{matches:($)=>$.path==="apiKeyHelper"&&$.code==="invalid_type",tip:{suggestion:'Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"'}},{matches:($)=>$.path==="cleanupPeriodDays"&&$.code==="too_small"&&$.expected==="0",tip:{suggestion:"Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup."}},{matches:($)=>$.path.startsWith("env.")&&$.code==="invalid_type",tip:{suggestion:'Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"',docLink:"https://code.claude.com/docs/en/settings#environment-variables"}},{matches:($)=>($.path==="permissions.allow"||$.path==="permissions.deny")&&$.code==="invalid_type"&&$.expected==="array",tip:{suggestion:'Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.'}},{matches:($)=>$.path.includes("hooks")&&$.code==="invalid_type",tip:{suggestion:'Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}'}},{matches:($)=>$.code==="invalid_type"&&$.expected==="boolean",tip:{suggestion:'Use true or false without quotes. Example: "includeCoAuthoredBy": true'}},{matches:($)=>$.code==="unrecognized_keys",tip:{suggestion:"Check for typos or refer to the documentation for valid fields",docLink:"https://code.claude.com/docs/en/settings"}},{matches:($)=>$.code==="invalid_value"&&$.enumValues!==void 0,tip:{suggestion:void 0}},{matches:($)=>$.code==="invalid_type"&&$.expected==="object"&&$.received===null&&$.path==="",tip:{suggestion:"Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error."}},{matches:($)=>$.path==="permissions.additionalDirectories"&&$.code==="invalid_type",tip:{suggestion:'Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command',docLink:"https://code.claude.com/docs/en/iam#working-directories"}}],tB={permissions:"https://code.claude.com/docs/en/iam#configuring-permissions",env:"https://code.claude.com/docs/en/settings#environment-variables",hooks:"https://code.claude.com/docs/en/hooks"}});function PY($){return $.code==="invalid_type"}function EY($){return $.code==="invalid_value"}function eB($){return $.code==="unrecognized_keys"}function AY($){return $.code==="too_small"}function C6($){if($===null)return"null";if($===void 0)return"undefined";if(Array.isArray($))return"array";return typeof $}function CY($){let J=$.match(/received (\w+)/);return J?J[1]:void 0}function N2($,J){return $.issues.map((Q)=>{let Z=Q.path.map(String).join("."),X=Q.message,q,Y,W,K,B;if(EY(Q))Y=Q.values.map((U)=>String(U)),W=Y.join(" | "),K=void 0,B=void 0;else if(PY(Q)){W=Q.expected;let U=CY(Q.message);K=U??C6(Q.input),B=U??C6(Q.input)}else if(AY(Q))W=String(Q.minimum);else if(Q.code==="custom"&&"params"in Q)K=Q.params.received,B=K;let R=MY({path:Z,code:Q.code,expected:W,received:K,enumValues:Y,message:Q.message,value:K});if(EY(Q))q=Y?.map((U)=>`"${U}"`).join(", "),X=`Invalid value. Expected one of: ${q}`;else if(PY(Q)){let U=CY(Q.message)??C6(Q.input);if(Q.expected==="object"&&U==="null"&&Z==="")X="Invalid or malformed JSON";else X=`Expected ${Q.expected}, but received ${U}`}else if(eB(Q)){let U=Q.keys.join(", ");X=`Unrecognized ${mQ(Q.keys.length,"field")}: ${U}`}else if(AY(Q))X=`Number must be greater than or equal to ${Q.minimum}`,q=String(Q.minimum);return{file:J,path:Z,message:X,expected:q,invalidValue:B,suggestion:R?.suggestion,docLink:R?.docLink}})}function XP($){try{let J=a($),Q=_0().strict().safeParse(J);if(Q.success)return{isValid:!0};return{isValid:!1,error:`Settings validation failed:
|
|
127
|
-
`+N2(Q.error,"settings").map((q)=>`- ${q.path}: ${q.message}`).join(`
|
|
128
|
-
`),fullSchema:A6()}}catch(J){return{isValid:!1,error:`Invalid JSON: ${J instanceof Error?J.message:"Unknown parsing error"}`,fullSchema:A6()}}}function $8($,J){if(!$||typeof $!=="object")return[];let Q=$;if(!Q.permissions||typeof Q.permissions!=="object")return[];let Z=Q.permissions,X=[];for(let q of["allow","deny","ask"]){let Y=Z[q];if(!Array.isArray(Y))continue;Z[q]=Y.filter((W)=>{if(typeof W!=="string")return X.push({file:J,path:`permissions.${q}`,message:`Non-string value in ${q} array was removed`,invalidValue:W}),!1;let K=T6(W);if(!K.valid){let B=`Invalid permission rule "${W}" was skipped`;if(K.error)B+=`: ${K.error}`;if(K.suggestion)B+=`. ${K.suggestion}`;return X.push({file:J,path:`permissions.${q}`,message:B,invalidValue:W}),!1}return!0})}return X}var v6=H(()=>{X0();V$();P6();IY();I4();TY()});import{homedir as $L,userInfo as JL}from"os";import{join as QL}from"path";function yY(){let $="";try{$=JL().username}catch{}let J=[];if($)J.push({path:`/Library/Managed Preferences/${$}/${k6}.plist`,label:"per-user managed preferences"});if(J.push({path:`/Library/Managed Preferences/${k6}.plist`,label:"device-level managed preferences"}),process.env.USER_TYPE==="ant")J.push({path:QL($L(),"Library","Preferences",`${k6}.plist`),label:"user preferences (ant-only)"});return J}var k6="com.anthropic.claudecode",J8="HKLM\\SOFTWARE\\Policies\\ClaudeCode",Q8="HKCU\\SOFTWARE\\Policies\\ClaudeCode",D2="Settings",vY="/usr/bin/plutil",kY,jY=5000;var j6=H(()=>{kY=["-convert","json","-o","-","--"]});import{execFile as ZL}from"child_process";import{existsSync as XL}from"fs";function y6($,J){return new Promise((Q)=>{ZL($,J,{encoding:"utf-8",timeout:jY},(Z,X)=>{Q({stdout:X??"",code:Z?1:0})})})}function Z8(){return(async()=>{if(process.platform==="darwin"){let $=yY(),Q=(await Promise.all($.map(async({path:Z,label:X})=>{if(!XL(Z))return{stdout:"",label:X,ok:!1};let{stdout:q,code:Y}=await y6(vY,[...kY,Z]);return{stdout:q,label:X,ok:Y===0&&!!q}}))).find((Z)=>Z.ok);return{plistStdouts:Q?[{stdout:Q.stdout,label:Q.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform==="win32"){let[$,J]=await Promise.all([y6("reg",["query",J8,"/v",D2]),y6("reg",["query",Q8,"/v",D2])]);return{plistStdouts:null,hklmStdout:$.code===0?$.stdout:null,hkcuStdout:J.code===0?J.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function LP(){if(S6)return;S6=Z8()}function SY(){return S6}var S6=null;var fY=H(()=>{j6()});import{join as bY}from"path";function qL(){if(X8)return;X8=(async()=>{n0("mdm_load_start");let $=Date.now(),J=SY()??Z8(),{mdm:Q,hkcu:Z}=pY(await J);b6=Q,h6=Z,n0("mdm_load_end");let X=Date.now()-$;if(L(`MDM settings load completed in ${X}ms`),Object.keys(Q.settings).length>0){L(`MDM settings found: ${Object.keys(Q.settings).join(", ")}`);try{Y1("info","mdm_settings_loaded",{duration_ms:X,key_count:Object.keys(Q.settings).length,error_count:Q.errors.length})}catch{}}})()}async function TP(){if(!X8)qL();await X8}function q8(){return b6??a0}function Y8(){return h6??a0}function PP($,J){b6=$,h6=J}async function EP(){let $=await Z8();return pY($)}function f6($,J){let Q=V0($,!1);if(!Q||typeof Q!=="object")return{settings:{},errors:[]};let Z=$8(Q,J),X=_0().safeParse(Q);if(!X.success){let q=N2(X.error,J);return{settings:{},errors:[...Z,...q]}}return{settings:X.data,errors:Z}}function hY($,J="Settings"){let Q=$.split(/\r?\n/),Z=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`^\\s+${Z}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,"i");for(let q of Q){let Y=q.match(X);if(Y&&Y[1])return Y[1].trimEnd()}return null}function pY($){if($.plistStdouts&&$.plistStdouts.length>0){let{stdout:J,label:Q}=$.plistStdouts[0],Z=f6(J,Q);if(Object.keys(Z.settings).length>0)return{mdm:Z,hkcu:a0}}if($.hklmStdout){let J=hY($.hklmStdout);if(J){let Q=f6(J,`Registry: ${J8}\\${D2}`);if(Object.keys(Q.settings).length>0)return{mdm:Q,hkcu:a0}}}if(YL())return{mdm:a0,hkcu:a0};if($.hkcuStdout){let J=hY($.hkcuStdout);if(J){let Q=f6(J,`Registry: ${Q8}\\${D2}`);return{mdm:a0,hkcu:Q}}}return{mdm:a0,hkcu:a0}}function YL(){try{let $=bY(Z1(),"managed-settings.json"),J=k0($),Q=V0(J,!1);if(Q&&typeof Q==="object"&&Object.keys(Q).length>0)return!0}catch{}try{let $=P2(),J=x().readdirSync($);for(let Q of J){if(!(Q.isFile()||Q.isSymbolicLink())||!Q.name.endsWith(".json")||Q.name.startsWith("."))continue;try{let Z=k0(bY($,Q.name)),X=V0(Z,!1);if(X&&typeof X==="object"&&Object.keys(X).length>0)return!0}catch{}}}catch{}return!1}var a0,b6=null,h6=null,X8=null;var gY=H(()=>{p();F8();z2();$1();k2();G6();j4();I4();v6();j6();fY();a0=Object.freeze({settings:{},errors:[]})});import O1 from"lodash-es/mergeWith.js";import{dirname as aY,join as O2,resolve as M4}from"path";import"zod/v4";function c6(){return O2(Z1(),"managed-settings.json")}function l6(){let $=[],J={},Q=!1,{settings:Z,errors:X}=T4(c6());if($.push(...X),Z&&Object.keys(Z).length>0)J=O1(J,Z,n1),Q=!0;let q=P2();try{let Y=x().readdirSync(q).filter((W)=>(W.isFile()||W.isSymbolicLink())&&W.name.endsWith(".json")&&!W.name.startsWith(".")).map((W)=>W.name).sort();for(let W of Y){let{settings:K,errors:B}=T4(O2(q,W));if($.push(...B),K&&Object.keys(K).length>0)J=O1(J,K,n1),Q=!0}}catch(Y){let W=W0(Y);if(W!=="ENOENT"&&W!=="ENOTDIR")D(Y)}return{settings:Q?J:null,errors:$}}function ZE(){let{settings:$}=T4(c6()),J=!!$&&Object.keys($).length>0,Q=!1,Z=P2();try{Q=x().readdirSync(Z).some((X)=>(X.isFile()||X.isSymbolicLink())&&X.name.endsWith(".json")&&!X.name.startsWith("."))}catch{}return{hasBase:J,hasDropIns:Q}}function tY($,J){if(typeof $==="object"&&$&&"code"in $&&$.code==="ENOENT")L(`Broken symlink or missing file encountered for settings.json at path: ${J}`);else D($)}function T4($){let J=nY($);if(J)return{settings:J.settings?g6(J.settings):null,errors:J.errors};let Q=WL($);return iY($,Q),{settings:Q.settings?g6(Q.settings):null,errors:Q.errors}}function WL($){try{let{resolvedPath:J}=e0(x(),$),Q=k0(J);if(Q.trim()==="")return{settings:{},errors:[]};let Z=V0(Q,!1),X=$8(Z,$),q=_0().safeParse(Z);if(!q.success){let Y=N2(q.error,$);return{settings:null,errors:[...X,...Y]}}return{settings:q.data,errors:X}}catch(J){return tY(J,$),{settings:null,errors:[]}}}function mY($){switch($){case"userSettings":return M4(b());case"policySettings":case"projectSettings":case"localSettings":return M4(q1());case"flagSettings":{let J=m6();return J?aY(M4(J)):M4(q1())}}}function VL(){if(oY()||w(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS))return"cowork_settings.json";return"settings.json"}function W8($){switch($){case"userSettings":return O2(mY($),VL());case"projectSettings":case"localSettings":return O2(mY($),eY($));case"policySettings":return c6();case"flagSettings":return m6()}}function eY($){switch($){case"projectSettings":return O2(".claude","settings.json");case"localSettings":return O2(".claude","settings.local.json")}}function S($){let J=cY($);if(J!==void 0)return J;let Q=$7($);return lY($,Q),Q}function $7($){if($==="policySettings"){let Z=P4();if(Z&&Object.keys(Z).length>0)return Z;let X=q8();if(Object.keys(X.settings).length>0)return X.settings;let{settings:q}=l6();if(q)return q;let Y=Y8();if(Object.keys(Y.settings).length>0)return Y.settings;return null}let J=W8($),{settings:Q}=J?T4(J):{settings:null};if($==="flagSettings"){let Z=u6();if(Z){let X=_0().safeParse(Z);if(X.success)return O1(Q||{},X.data,n1)}}return Q}function XE(){let $=P4();if($&&Object.keys($).length>0)return"remote";let J=q8();if(Object.keys(J.settings).length>0)return j0()==="macos"?"plist":"hklm";let{settings:Q}=l6();if(Q)return"file";let Z=Y8();if(Object.keys(Z.settings).length>0)return"hkcu";return null}function q$($,J){if($==="policySettings"||$==="flagSettings")return{error:null};let Q=W8($);if(!Q)return{error:null};try{x().mkdirSync(aY(Q));let Z=$7($);if(!Z){let q=null;try{q=k0(Q)}catch(Y){if(!H1(Y))throw Y}if(q!==null){let Y=V0(q);if(Y===null)return{error:Error(`Invalid JSON syntax in settings file at ${Q}`)};if(Y&&typeof Y==="object")Z=Y,L(`Using raw settings from ${Q} due to validation failure`)}}let X=O1(Z||{},J,(q,Y,W,K)=>{if(Y===void 0&&K&&typeof W==="string"){delete K[W];return}if(Array.isArray(Y))return Y;return});if(Cq(Q),i1(Q,A(X,null,2)+`
|
|
129
|
-
`),I2(),$==="localSettings")Tq(eY("localSettings"),q1())}catch(Z){let X=Error(`Failed to read raw settings from ${Q}: ${Z}`);return D(X),{error:X}}return{error:null}}function GL($,J){return sY([...$,...J])}function n1($,J){if(Array.isArray($)&&Array.isArray(J))return GL($,J);return}function qE($){let J=_0().strip().parse($),Q=["permissions","sandbox","hooks"],Z=[],X={permissions:new Set(["allow","deny","ask","defaultMode","disableBypassPermissionsMode",...[],"additionalDirectories"]),sandbox:new Set(["enabled","failIfUnavailable","allowUnsandboxedCommands","network","filesystem","ignoreViolations","excludedCommands","autoAllowBashIfSandboxed","enableWeakerNestedSandbox","enableWeakerNetworkIsolation","ripgrep"]),hooks:new Set(["PreToolUse","PostToolUse","Notification","UserPromptSubmit","SessionStart","SessionEnd","Stop","SubagentStop","PreCompact","PostCompact","TeammateIdle","TaskCreated","TaskCompleted"])};for(let q of Object.keys(J))if(Q.includes(q)&&J[q]&&typeof J[q]==="object"){let Y=J[q],W=X[q];if(W){for(let K of Object.keys(Y))if(W.has(K))Z.push(`${q}.${K}`)}}else Z.push(q);return Z.sort()}function KL(){if(p6)return{settings:{},errors:[]};let $=Date.now();n0("loadSettingsFromDisk_start"),Y1("info","settings_load_started"),p6=!0;try{let J=rY(),Q={};if(J)Q=O1(Q,J,n1);let Z=[],X=new Set,q=new Set;for(let Y of F4()){if(Y==="policySettings"){let K=null,B=[],R=P4();if(R&&Object.keys(R).length>0){let U=_0().safeParse(R);if(U.success)K=U.data;else B.push(...N2(U.error,"remote managed settings"))}if(!K){let U=q8();if(Object.keys(U.settings).length>0)K=U.settings;B.push(...U.errors)}if(!K){let{settings:U,errors:z}=l6();if(U)K=U;B.push(...z)}if(!K){let U=Y8();if(Object.keys(U.settings).length>0)K=U.settings;B.push(...U.errors)}if(K)Q=O1(Q,K,n1);for(let U of B){let z=`${U.file}:${U.path}:${U.message}`;if(!X.has(z))X.add(z),Z.push(U)}continue}let W=W8(Y);if(W){let K=M4(W);if(!q.has(K)){q.add(K);let{settings:B,errors:R}=T4(W);for(let U of R){let z=`${U.file}:${U.path}:${U.message}`;if(!X.has(z))X.add(z),Z.push(U)}if(B)Q=O1(Q,B,n1)}}if(Y==="flagSettings"){let K=u6();if(K){let B=_0().safeParse(K);if(B.success)Q=O1(Q,B.data,n1)}}}return Y1("info","settings_load_completed",{duration_ms:Date.now()-$,source_count:q.size,error_count:Z.length}),{settings:Q,errors:Z}}finally{p6=!1}}function N0(){let{settings:$}=BL();return $||{}}function YE(){I2();let $=[];for(let J of F4()){let Q=S(J);if(Q&&Object.keys(Q).length>0)$.push({source:J,settings:Q})}return{effective:N0(),sources:$}}function BL(){let $=uY();if($!==null)return $;let J=KL();return n0("loadSettingsFromDisk_end"),dY(J),J}function WE(){return!!(S("userSettings")?.skipDangerousModePermissionPrompt||S("localSettings")?.skipDangerousModePermissionPrompt||S("flagSettings")?.skipDangerousModePermissionPrompt||S("policySettings")?.skipDangerousModePermissionPrompt)}function VE(){return!1}function GE(){return!0}function KE(){return}function BE($){for(let J of F4()){if(J==="policySettings")continue;let Q=W8(J);if(!Q)continue;try{let{resolvedPath:Z}=e0(x(),Q),X=k0(Z);if(!X.trim())continue;let q=V0(X,!1);if(q&&typeof q==="object"&&$ in q)return!0}catch(Z){tY(Z,Q)}}return!1}var p6=!1,z0;var J1=H(()=>{i();r6();xY();p();F8();j();H0();p4();z2();$1();Pq();k2();t();T2();X0();G6();R6();vq();j4();gY();n6();I4();v6();z0=N0});
|
|
130
|
-
export{U9 as tT,R9 as uT,K8 as vT,Q7 as wT,k0 as xT,z2 as yT,FL as zT,zL as AT,xL as BT,q7 as CT,P4 as DT,r6 as ET,NI as FT,lK as GT,DI as HT,OI as IT,FI as JT,zI as KT,_q as LT,xI as MT,II as NT,MI as OT,TI as PT,PI as QT,EI as RT,iK as ST,AI as TT,CI as UT,vI as VT,kI as WT,jI as XT,yI as YT,Oq as ZT,SI as _T,p4 as $T,JB as aU,Pq as bU,iI as cU,rI as dU,oI as eU,sI as fU,aI as gU,tI as hU,F4 as iU,eI as jU,$M as kU,R6 as lU,QM as mU,ZM as nU,vq as oU,Z1 as pU,P2 as qU,j4 as rU,jw as sU,yw as tU,Sw as uU,fw as vU,SQ as wU,bw as xU,hw as yU,pw as zU,gw as AU,mw as BU,uw as CU,dw as DU,cw as EU,lw as FU,nw as GU,iw as HU,BJ as IU,z4 as JU,w6 as KU,yq as LU,RM as MU,wM as NU,_M as OU,NM as PU,DM as QU,OM as RU,FM as SU,zM as TU,xM as UU,bq as VU,pq as WU,gq as XU,dq as YU,vM as ZU,lq as _U,l1 as $U,a$ as aV,uM as bV,dM as cV,cM as dV,sq as eV,MB as fV,lM as gV,nM as hV,PB as iV,iM as jV,s$ as kV,vB as lV,yB as mV,sM as nV,JY as oV,z6 as pV,tM as qV,QY as rV,$T as sV,JT as tV,qY as uV,YY as vV,bB as wV,hB as xV,XT as yV,qT as zV,YT as AV,WY as BV,VY as CV,VT as DV,GT as EV,KT as FV,GY as GV,x6 as HV,KY as IV,BY as JV,HT as KV,LY as LV,_2 as MV,NT as NV,UY as OV,DT as PV,RY as QV,J_ as RV,W$ as SV,mQ as TV,Q_ as UV,Z_ as VV,X_ as WV,q_ as XV,Y_ as YV,gW as ZV,W_ as _V,V$ as $V,zY as aW,_0 as bW,uT as cW,dT as dW,cT as eW,I4 as fW,XP as gW,v6 as hW,LP as iW,fY as jW,TP as kW,q8 as lW,Y8 as mW,PP as nW,EP as oW,gY as pW,l6 as qW,ZE as rW,T4 as sW,mY as tW,W8 as uW,eY as vW,S as wW,XE as xW,q$ as yW,n1 as zW,qE as AW,N0 as BW,z0 as CW,YE as DW,BL as EW,WE as FW,VE as GW,GE as HW,KE as IW,BE as JW,J1 as KW,iH as LW,rH as MW,y7 as NW,b7 as OW,oH as PW,F9 as QW,m4 as RW,r1 as SW,p8 as TW,P as UW,$U as VW,f0 as WW,b0 as XW,k as YW,GU as ZW,l4 as _W,UU as $W,RU as aX,P9 as bX,NU as cX,l7 as dX,DU as eX,OU as fX,FU as gX,zU as hX,v9 as iX,p0 as jX,b2 as kX,fU as lX,f9 as mX,T0 as nX,l8 as oX,p2 as pX,a4 as qX,qR as rX,$2 as sX,o8 as tX,L1 as uX,VW as vX,UR as wX,RR as xX,a9 as yX,wR as zX,_R as AX,E1 as BX,GW as CX,NR as DX,DR as EX,r9 as FX,t4 as GX,PR as HX,UW as IX,t9 as JX,XQ as KX,J$ as LX,YQ as MX,jR as NX,GQ as OX,O0 as PX,KQ as QX,m2 as RX,LQ as SX,HQ as TX,bR as UX,hR as VX,wQ as WX,pR as XX,_Q as YX,gR as ZX,mR as _X,uR as $X,XJ as aY,cR as bY,lR as cY,nR as dY,iR as eY,qJ as fY,DQ as gY,u2 as hY,F0 as iY,xQ as jY,zW as kY,Kw as lY,Bw as mY,Lw as nY,IQ as oY,Hw as pY,Uw as qY,xW as rY,Rw as sY,ww as tY,_w as uY,Nw as vY,Dw as wY,TW as xY,Ow as yY,Fw as zY,zw as AY,xw as BY,EQ as CY,n2 as DY,CW as EY,vW as FY,KJ as GY,CQ as HY,Cw as IY,jQ as JY,yQ as KY,fW as LY,LJ as MY,pQ as NY,gQ as OY,lQ as PY,z_ as QY,i2 as RY,nQ as SY,mW as TY,k1 as UY,G$ as VY,iQ as WY,x_ as XY,v1 as YY,rQ as ZY,Q0 as _Y,Z0 as $Y,uW as aZ,oQ as bZ,dQ as cZ,c2 as dZ,I_ as eZ,sQ as fZ,aQ as gZ,M_ as hZ,K0 as iZ,T_ as jZ,nW as kZ,P_ as lZ,E_ as mZ,A_ as nZ,u0 as oZ,tQ as pZ,v_ as qZ,_J as rZ,f_ as sZ,KZ as tZ,b_ as uZ,BZ as vZ,HZ as wZ,UZ as xZ,FJ as yZ,wZ as zZ,_Z as AZ,NZ as BZ,DZ as CZ,zJ as DZ,zZ as EZ,xJ as FZ,IJ as GZ,MJ as HZ,TJ as IZ,xZ as JZ,B5 as KZ,TZ as LZ,xN as MZ,q2 as NZ,g5 as OZ,IN as PZ,MN as QZ,TN as RZ,PN as SZ,EN as TZ,AN as UZ,CN as VZ,vN as WZ,kN as XZ,eZ as YZ,gN as ZZ,$4 as _Z,mN as $Z,Q3 as a0,uN as b0,Z3 as c0,K3 as d0,D$ as e0,B3 as f0,vD as g0,N3 as h0,jD as i0,O3 as j0,uD as k0,dD as l0,cD as m0,j1 as n0,E0 as o0,lD as p0,NV as q0,nD as r0,iD as s0,DV as t0,rD as u0,UJ as v0,x3 as w0,I3 as x0,LO as y0,MV as z0,HO as A0,UO as B0,T3 as C0,RO as D0,z$ as E0,TV as F0,wO as G0,A3 as H0,bJ as I0,FO as J0,zO as K0,j3 as L0,IO as M0,S3 as N0,f3 as O0,W2 as P0,T1 as Q0,U0 as R0,SV as S0,h1 as T0,w1 as U0,nJ as V0,rJ as W0,i3 as X0,fV as Y0,O$ as Z0,mJ as _0,hV as $0,pV as a1,r3 as b1,G1 as c1,cV as d1,sJ as e1,o3 as f1,s3 as g1,Q4 as h1,oV as i1,sV as j1,aV as k1,T$ as l1,a8 as m1,eV as n1,$G as o1,JG as p1,t3 as q1,C as r1,P$ as s1,l2 as t1,q4 as u1,A1 as v1,y as w1,g0 as x1,XG as y1,_1 as z1,qG as A1,YG as B1,d as C1,K$ as D1,WG as E1,B$ as F1,VG as G1,RJ as H1,E$ as I1,e3 as J1,A$ as K1,JX as L1,KG as M1,LG as N1,QX as O1,HG as P1,UG as Q1,y1 as R1,RG as S1,wG as T1,_G as U1,$0 as V1,C$ as W1,aJ as X1,YX as Y1,VF as Z1,WX as _1,L3 as $1,wF as a2,_F as b2,V4 as c2,NF as d2,F$ as e2,EF as f2,AF as g2,KX as h2,tJ as i2,BX as j2,jF as k2,LX as l2,cF as m2,lF as n2,nF as o2,NX as p2,mG as q2,FX as r2,zX as s2,Xz as t2,MX as u2,lG as v2,TX as w2,f$ as x2,Bz as y2,Lz as z2,Hz as A2,EX as B2,vz as C2,eG as D2,kz as E2,QK as F2,jz as G2,yz as H2,CX as I2,Sz as J2,dX as K2,W6 as L2,u$ as M2,tX as N2,PK as O2,Ix as P2,Mx as Q2,G2 as R2,Tx as S2,Zq as T2,jK as U2,Px as V2,Xq as W2,ux as X2,dx as Y2,cx as Z2,lx as _2,nx as $2,ix as a3,SK as b3,d$ as c3,fK as d3,q0 as e3,rx as f3,C3 as g3,ox as h3,sx as i3,ax as j3,Lq as k3,hK as l3,pK as m3,Hq as n3,tx as o3,U4 as p3,Q1 as q3,fL as r3,K7 as s3,bL as t3,$9 as u3,J9 as v3,hL as w3,Q9 as x3,w7 as y3,_7 as z3,cL as A3,X9 as B3,I8 as C3,M7 as D3,_H as E3,T7 as F3,NH as G3,e as H3,DH as I3,zH as J3,n as K3,xH as L3,IH as M3,I as N3,MH as O3,TH as P3,PH as Q3,P8 as R3,EH as S3,AH as T3,k7 as U3,CH as V3,vH as W3,j7 as X3,y2 as Y3,kH as Z3,jH as _3,yH as $3,SH as a4,fH as b4,bH as c4,hH as d4,D0 as e4};
|