@qqbrowser/openclaw-qbot 0.0.88 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-Dxk5oWw_.js → agents-BBYlUP5T.js} +1 -1
- package/dist/{agents.config-CXoN8qvY.js → agents.config-CoZtnyKH.js} +1 -1
- package/dist/{agents.config-D6kg-4Ct.js → agents.config-Dyqz-Sk-.js} +1 -1
- package/dist/{auth-choice-COKpi33u.js → auth-choice-CVvPBerD.js} +1 -1
- package/dist/{auth-choice-K5eGX1sj.js → auth-choice-DSNX3Hdu.js} +1 -1
- package/dist/{banner-DsZegXc3.js → banner-C4Bgn_Gf.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-BU9Qf5Cq.js → channel-options-9lP0IBR0.js} +1 -1
- package/dist/{channel-options-C-h17ZYO.js → channel-options-C9PHeVlU.js} +1 -1
- package/dist/{channel-web-DmmMXUdc.js → channel-web-DhNCVKla.js} +1 -1
- package/dist/{channel-web-C2Z4xKq3.js → channel-web-NeSGV-e7.js} +1 -1
- package/dist/{channels-cli-WBY_CB2-.js → channels-cli-CWu-PrIl.js} +1 -1
- package/dist/{channels-cli-DM6DIc_P.js → channels-cli-DHD8V6-q.js} +1 -1
- package/dist/{cli-DXZKyKLK.js → cli-BWE7sLVx.js} +1 -1
- package/dist/{cli-RLbxgNsy.js → cli-DF5ZcuuX.js} +1 -1
- package/dist/{command-registry-CIBlcDrG.js → command-registry-DIOnYWDt.js} +1 -1
- package/dist/{compact-BfHim3cA.js → compact-DgbuvsDF.js} +6 -6
- package/dist/{compact.runtime-C_urV0W5.js → compact.runtime-B5zaMKSa.js} +1 -1
- package/dist/{compact.runtime-eUr8DtWw.js → compact.runtime-B6qfwW6l.js} +1 -1
- package/dist/{compact.runtime-DtLl0dZ5.js → compact.runtime-BofMQvNu.js} +1 -1
- package/dist/{compact.runtime-BpYpUiXf.js → compact.runtime-C-OsuZNM.js} +1 -1
- package/dist/{completion-cli-BYf6ef-t.js → completion-cli-CckNzelT.js} +1 -1
- package/dist/{completion-cli-Dsi5-gGE.js → completion-cli-F60ntV7X.js} +1 -1
- package/dist/{config-cli-GwzrxUR-.js → config-cli-1Ut82gjz.js} +1 -1
- package/dist/{config-cli-IpFnLniP.js → config-cli-BVtPmTcO.js} +1 -1
- package/dist/{configure-Cx7WvgVM.js → configure-3Kgwf3gj.js} +1 -1
- package/dist/{configure-DIVEkxxF.js → configure-Bpy51qkb.js} +1 -1
- package/dist/{deps-send-whatsapp.runtime-CdAcLrxO.js → deps-send-whatsapp.runtime-CI4UsY0E.js} +1 -1
- package/dist/{deps-send-whatsapp.runtime-Dj_dh7mb.js → deps-send-whatsapp.runtime-CJbg_i22.js} +1 -1
- package/dist/{deps-send-whatsapp.runtime-DJOAewju.js → deps-send-whatsapp.runtime-CPhSRgv3.js} +1 -1
- package/dist/{deps-send-whatsapp.runtime-BfuHSQxE.js → deps-send-whatsapp.runtime-DLRNnLUS.js} +1 -1
- package/dist/{doctor-completion-BcvWFszV.js → doctor-completion-CucfTzWR.js} +1 -1
- package/dist/{doctor-completion-CQMvGm9I.js → doctor-completion-D76qqYqG.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-CBK9IHgW.js → gateway-cli-BKWQlBHk.js} +2 -2
- package/dist/{gateway-cli-BUcUT6It.js → gateway-cli-DtqcCdL7.js} +2 -2
- package/dist/{health-CiTej6rM.js → health-BXDoFh4Q.js} +1 -1
- package/dist/{health-Pqtl8jCk.js → health-xCl2atiY.js} +1 -1
- package/dist/{hooks-cli-C6nsAzQh.js → hooks-cli-B2j44Nvk.js} +1 -1
- package/dist/{hooks-cli-BR-m9Vxi.js → hooks-cli-DT0Hmbz-.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/llm-slug-generator.js +1 -1
- package/dist/{models-CxaUXLzo.js → models-DhX1F_Pj.js} +1 -1
- package/dist/{models-cli-DuamSrQA.js → models-cli-B-kAey2t.js} +1 -1
- package/dist/{models-cli-DM55mW-t.js → models-cli-B53yy1mw.js} +1 -1
- package/dist/{npm-resolution-CKwFeFIB.js → npm-resolution-BIifLd1f.js} +1 -1
- package/dist/{npm-resolution-9bO0TPQF.js → npm-resolution-C2Ow0mqR.js} +1 -1
- package/dist/{onboard-BU0gG29k.js → onboard-D9IefEER.js} +2 -2
- package/dist/{onboard-channels-CsKyM82H.js → onboard-channels-B8JZHEaQ.js} +1 -1
- package/dist/{onboard-channels-BK5KINY9.js → onboard-channels-ByD6UdVu.js} +1 -1
- package/dist/{onboard-BlGJhhEF.js → onboard-qMIhLeRM.js} +2 -2
- package/dist/{onboarding-CM_9Fyo2.js → onboarding-CddGtlY5.js} +1 -1
- package/dist/{onboarding-Kz5K9mKB.js → onboarding-CgqsAteJ.js} +1 -1
- package/dist/{onboarding.finalize-DstFPCVD.js → onboarding.finalize-BgCWB7kF.js} +1 -1
- package/dist/{onboarding.finalize-C96gv5GP.js → onboarding.finalize-CkHWKgcF.js} +1 -1
- package/dist/{pi-embedded-BHryO0s2.js → pi-embedded-C6L57IhI.js} +6 -6
- package/dist/{pi-embedded-D_03X4gB.js → pi-embedded-CN25rQwp.js} +6 -6
- package/dist/{plugin-registry-DyreKTxc.js → plugin-registry-Cido8VxT.js} +1 -1
- package/dist/{plugin-registry-Dsb86j5r.js → plugin-registry-CpPyaWT0.js} +1 -1
- package/dist/plugin-sdk/{channel-web-BDO73YAY.js → channel-web-DgBEXyWx.js} +1 -1
- package/dist/plugin-sdk/{channel-web-C0hljM9U.js → channel-web-T7e1VB_g.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-B-jUdCSu.js → compact.runtime-B0qhTLAN.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-iEjcWTOi.js → compact.runtime-C5aI5KIg.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-BspLSIc1.js → compact.runtime-Da9JL-Re.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-CMWw2lwa.js → compact.runtime-DuWXCPO4.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-HnqzVAl7.js → compact.runtime-F35snTaz.js} +1 -1
- package/dist/plugin-sdk/{compact.runtime-C2keFFLA.js → compact.runtime-kL8PhhSi.js} +1 -1
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-BRm24Qy-.js → deps-send-whatsapp.runtime-BWVV9ImJ.js} +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-Bw9eegUO.js → deps-send-whatsapp.runtime-BdOLZ0P3.js} +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-DdS9G3TR.js → deps-send-whatsapp.runtime-DMD-mrgL.js} +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-ClvlojBM.js → deps-send-whatsapp.runtime-DNaHPuYl.js} +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-DjAB5JP0.js → deps-send-whatsapp.runtime-DkmDJ3eX.js} +1 -1
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-yd5qmNGP.js → deps-send-whatsapp.runtime-nRQWODTL.js} +1 -1
- package/dist/plugin-sdk/{dispatch-BtGxkC47.js → dispatch--4Vuy9oL.js} +6 -6
- package/dist/plugin-sdk/{dispatch-BO5EIrCx.js → dispatch-DPafUBvi.js} +6 -6
- package/dist/plugin-sdk/{dispatch-DABpoSJj.js → dispatch-DzdnDix3.js} +6 -6
- package/dist/plugin-sdk/{dispatch-DfBUhUa2.js → dispatch-_3aPMKVc.js} +6 -6
- package/dist/plugin-sdk/{dispatch-BFVL83hy.js → dispatch-v8f5j6tA.js} +6 -6
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/irc.js +1 -1
- package/dist/plugin-sdk/matrix.js +1 -1
- package/dist/plugin-sdk/msteams.js +1 -1
- package/dist/plugin-sdk/nextcloud-talk.js +1 -1
- package/dist/plugin-sdk/{reply-0QJVop5g.js → reply-FZOMaPdT.js} +6 -6
- package/dist/plugin-sdk/{slash-dispatch.runtime-I6_T20Yd.js → slash-dispatch.runtime-CV3coyWo.js} +1 -1
- package/dist/plugin-sdk/{slash-dispatch.runtime-BwEZoF7O.js → slash-dispatch.runtime-CYrhiT19.js} +1 -1
- package/dist/plugin-sdk/{slash-dispatch.runtime-W9VRo3lf.js → slash-dispatch.runtime-CkVpd9xh.js} +1 -1
- package/dist/plugin-sdk/{slash-dispatch.runtime-CaemgmaW.js → slash-dispatch.runtime-CzBVRyba.js} +1 -1
- package/dist/plugin-sdk/{slash-dispatch.runtime-B4nePbcc.js → slash-dispatch.runtime-DjGJDpWI.js} +1 -1
- package/dist/plugin-sdk/{slash-dispatch.runtime-ByQEhvcx.js → slash-dispatch.runtime-WIHCc0nP.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-pjzgZyiw.js → subagent-registry-runtime-4o_8yfyB.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-ikSo08Bh.js → subagent-registry-runtime-BJxZkq6N.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-BPHOIYnR.js → subagent-registry-runtime-BRl0zIp-.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-C2TUyWmj.js → subagent-registry-runtime-C-2UF0IM.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-Co3rxlYB.js → subagent-registry-runtime-bCP-yDZd.js} +1 -1
- package/dist/plugin-sdk/{subagent-registry-runtime-Wu14xqj_.js → subagent-registry-runtime-lM2A6bas.js} +1 -1
- package/dist/plugin-sdk/{web-Bgl0ILbD.js → web--MzzmLKe.js} +1 -1
- package/dist/plugin-sdk/{web-BzRQSS8R.js → web-BoQezxCE.js} +1 -1
- package/dist/plugin-sdk/{web-CK9n5ZfK.js → web-CgFT-LB5.js} +1 -1
- package/dist/plugin-sdk/{web-3TYyfPQG.js → web-CskfGkR8.js} +1 -1
- package/dist/plugin-sdk/{web-WIpdyZZQ.js → web-KZ3WEX08.js} +1 -1
- package/dist/plugin-sdk/{web-BCOXLnUB.js → web-sUKMDnvE.js} +1 -1
- package/dist/plugin-sdk/whatsapp.js +1 -1
- package/dist/{plugins-cli-B_m-0xTz.js → plugins-cli-7Rom2MRn.js} +1 -1
- package/dist/{plugins-cli-fpI_fBTE.js → plugins-cli-ULYhpcRr.js} +1 -1
- package/dist/{program-B52FJo5X.js → program-C8M8kVC0.js} +2 -2
- package/dist/{program-context-9FmjmgRi.js → program-context-DNheupaq.js} +1 -1
- package/dist/{prompt-select-styled-7bpPt2PG.js → prompt-select-styled-BfSAWDfm.js} +1 -1
- package/dist/{prompt-select-styled-bL9scez3.js → prompt-select-styled-Qtie1Z5m.js} +1 -1
- package/dist/{provider-auth-helpers-CatlYQ1x.js → provider-auth-helpers-PSez6fyE.js} +1 -1
- package/dist/{provider-auth-helpers-DgQEZQZm.js → provider-auth-helpers-fIKVMJmj.js} +1 -1
- package/dist/{push-apns-Bc0uTUFe.js → push-apns-CZ3x5b7S.js} +1 -1
- package/dist/{push-apns-Dq1z7GKZ.js → push-apns-D4QwEU4o.js} +1 -1
- package/dist/{register.agent-Cjvn_JC_.js → register.agent-CQCSZoM3.js} +1 -1
- package/dist/{register.agent-DZ68nNV_.js → register.agent-CkdmFMol.js} +1 -1
- package/dist/{register.configure-DAq-OZQ_.js → register.configure-CY7jH_t-.js} +1 -1
- package/dist/{register.configure-DNeVIlZk.js → register.configure-jvsFtsEY.js} +1 -1
- package/dist/{register.maintenance-Cx5TbFUH.js → register.maintenance-Cn2-JBxc.js} +1 -1
- package/dist/{register.maintenance-BGD-EdYb.js → register.maintenance-DbdyMqnN.js} +1 -1
- package/dist/{register.message-BVBF2xBA.js → register.message-8Pxm1wyr.js} +1 -1
- package/dist/{register.message-BahjRagK.js → register.message-DxNX0-7A.js} +1 -1
- package/dist/{register.onboard-BYsU9URi.js → register.onboard-BeuVHdxu.js} +1 -1
- package/dist/{register.onboard-CsUvw9JY.js → register.onboard-D9LNxSOp.js} +1 -1
- package/dist/{register.setup-DUGQ3LjU.js → register.setup-AyriKZAD.js} +1 -1
- package/dist/{register.setup-Czz8kiz8.js → register.setup-D6sjApkR.js} +1 -1
- package/dist/{register.status-health-sessions-DwQDXdjY.js → register.status-health-sessions-C3YEi9ej.js} +1 -1
- package/dist/{register.status-health-sessions-C-6pt1vC.js → register.status-health-sessions-DLibm4n2.js} +1 -1
- package/dist/{register.subclis-nr-J0DsM.js → register.subclis-DMwBX73g.js} +1 -1
- package/dist/{reply-Bv0w_dst.js → reply-JaJmymld.js} +6 -6
- package/dist/{run-main-C9SR6tqO.js → run-main-BtJ9Rvkf.js} +1 -1
- package/dist/{server-node-events-DBU3p4Am.js → server-node-events-B1xc0xHC.js} +1 -1
- package/dist/{server-node-events-duTsLOu5.js → server-node-events-DkYb_tMY.js} +1 -1
- package/dist/{slash-dispatch.runtime-BKW0b-z4.js → slash-dispatch.runtime-5FhvH4vs.js} +1 -1
- package/dist/{slash-dispatch.runtime-Dllhj5El.js → slash-dispatch.runtime-8bdhjt7e.js} +1 -1
- package/dist/{slash-dispatch.runtime-BykVo525.js → slash-dispatch.runtime-BSGNAoT3.js} +1 -1
- package/dist/{slash-dispatch.runtime-CwKA-3Mz.js → slash-dispatch.runtime-DzFzghS8.js} +1 -1
- package/dist/{status-BUdDRE9f.js → status-Ln-hRgxh.js} +1 -1
- package/dist/{status-QCEyD_DK.js → status-XJoKJIPd.js} +1 -1
- package/dist/{subagent-registry-runtime-ANqbVbfo.js → subagent-registry-runtime-CMgr0_UE.js} +1 -1
- package/dist/{subagent-registry-runtime-CWrWUjll.js → subagent-registry-runtime-DA3RtD85.js} +1 -1
- package/dist/{subagent-registry-runtime-CA_UwsAM.js → subagent-registry-runtime-DDF1mHS2.js} +1 -1
- package/dist/{subagent-registry-runtime-DjLSmsYn.js → subagent-registry-runtime-DTliYOy2.js} +1 -1
- package/dist/{update-cli-2Prf30Co.js → update-cli-DhZZ9nIA.js} +1 -1
- package/dist/{update-cli-BZ7xaJXP.js → update-cli-T5qjfgGh.js} +1 -1
- package/dist/{update-runner-Dmea_7oZ.js → update-runner-C6Z9RGJ6.js} +1 -1
- package/dist/{update-runner-CzyTP7xB.js → update-runner-DThdoQ9_.js} +1 -1
- package/dist/{web-BYWPQTzp.js → web-BinddLZf.js} +1 -1
- package/dist/{web-B90WZv9Y.js → web-CWJIsRZO.js} +1 -1
- package/dist/{web-DTS3rwm1.js → web-D995jmBq.js} +1 -1
- package/dist/{web-BvZz642s.js → web-F5nE_LwQ.js} +1 -1
- package/package.json +1 -1
package/dist/plugin-sdk/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Bt as e,E as t,L as n,Lt as r,O as i,Ut as a,Wt as o,_t as s,bt as c,c as l,d as u,f as d,h as f,k as p,l as m,m as ee,p as te,u as h,w as ne,yt as re}from"./paths-CSbOOCsu.js";import{$c as ie,$i as ae,$l as g,$t as oe,A as se,Aa as ce,Ai as le,Al as ue,B as de,Ba as fe,Bi as pe,Ca as me,Ci as he,Co as ge,Di as _e,Dl as ve,Do as ye,Ds as be,Ea as xe,Ei as Se,Eo as Ce,F as we,Fa as Te,Ga as Ee,Gi as De,Gl as _,H as Oe,Ha as ke,Hi as Ae,I as je,Ia as Me,Ja as Ne,Ji as Pe,Ka as Fe,Ki as Ie,Ks as Le,L as Re,La as ze,Lo as Be,M as Ve,Ma as v,Mi as He,Ml as Ue,Mo as We,N as Ge,Na as Ke,Nl as y,No as b,Oi as qe,Ol as Je,P as Ye,Pa as Xe,Qi as Ze,R as Qe,Ra as $e,Rs as et,Sa as tt,So as nt,Ta as x,Ti as rt,To as it,U as at,Ua as ot,Ui as st,Ul as ct,V as lt,Va as ut,Vc as dt,Vi as ft,Wi as pt,Wl as mt,Xi as ht,Xs as gt,Yi as _t,Ys as vt,Zi as yt,Zl as bt,Zs as xt,_ as St,_a as Ct,_l as wt,_o as Tt,as as Et,ba as Dt,bo as Ot,co as kt,d as At,da as jt,do as Mt,ea as Nt,eu as Pt,f as Ft,fo as It,g as Lt,go as Rt,h as zt,ho as Bt,is as Vt,j as Ht,ja as Ut,ji as Wt,k as Gt,ki as Kt,kl as qt,ko as Jt,ks as Yt,la as Xt,lo as Zt,m as Qt,mo as $t,mu as en,na as tn,nu as nn,oa as rn,os as an,p as on,po as sn,qa as cn,qi as ln,ra as un,ru as dn,sl as fn,ta as pn,tu as mn,ua as hn,uo as gn,v as _n,va as vn,vo as yn,wa as bn,wi as xn,wo as Sn,xa as Cn,xo as wn,yo as Tn,z as En,za as Dn,zo as On}from"./config-B-UcenbQ.js";import{$t as kn,A as An,At as jn,B as Mn,Bt as Nn,C as Pn,Cn as Fn,D as In,Dt as Ln,Et as Rn,F as zn,Ft as Bn,G as Vn,H as Hn,Ht as Un,It as Wn,J as Gn,Jt as Kn,K as qn,Kt as Jn,L as Yn,Lt as Xn,M as Zn,Mt as Qn,N as $n,O as er,Ot as tr,P as nr,Pt as rr,Qt as ir,R as ar,Rt as or,S as sr,Sn as cr,T as lr,Tt as ur,U as dr,Ut as fr,V as pr,Vt as mr,W as hr,Wt as gr,Xt as _r,Yt as vr,Zt as yr,_ as br,_n as xr,an as Sr,b as Cr,bn as wr,cn as Tr,dn as Er,dt as Dr,en as Or,f as S,fn as kr,ft as Ar,g as jr,gn as Mr,gt as Nr,h as Pr,hn as Fr,in as Ir,j as Lr,jt as Rr,k as zr,kt as Br,ln as Vr,lt as Hr,mn as Ur,n as Wr,nn as Gr,on as Kr,ot as qr,pn as Jr,pt as Yr,q as Xr,qt as C,rn as Zr,sn as Qr,t as $r,tn as w,un as ei,ut as ti,v as ni,vn as ri,w as ii,x as T,xn as ai,y as oi,yn as si,yt as ci,z as li,zt as ui}from"./dispatch-DABpoSJj.js";import"./paths-BZu7pylC.js";import"./github-copilot-token-CZKe5l5K.js";import{C as E,O as di,Q as fi,b as D,j as pi,m as mi,p as hi,q as gi,s as _i,v as vi,w as yi}from"./logger-C9qBS3pT.js";import{r as bi}from"./proxy-env-CPkJIzpH.js";import{At as xi,Bt as Si,Dt as Ci,Et as wi,Ft as Ti,Ht as Ei,It as Di,Mt as Oi,Nt as ki,Ot as Ai,Pt as ji,Tt as Mi,Ut as Ni,Vt as Pi,Wt as Fi,at as Ii,dt as Li,jt as Ri,kt as zi}from"./send-Cm3DUp7B.js";import"./fetch-DBRI0sKI.js";import"./channel-activity-BmtBYQiY.js";import{t as Bi}from"./fetch-guard-DFkrvefb.js";import"./local-roots-CJmQubXD.js";import{p as Vi,v as Hi}from"./ir-CtV16xaT.js";import"./render-DGmfCIRG.js";import"./tables-BSCz74OW.js";import{X as Ui,Y as Wi,it as Gi,rt as Ki}from"./send-BZLHNxgv.js";import{d as O,f as qi,h as k,l as Ji,n as Yi,o as Xi}from"./target-errors-IUyUVvTY.js";import{s as Zi}from"./send-DEXJLpyz.js";import{h as Qi}from"./deliver-C_gmqump.js";import{g as $i,h as ea,m as ta}from"./diagnostic-BjNsv_MZ.js";import"./pi-model-discovery-KbgCHo1f.js";import{d as na,f as ra}from"./audio-transcription-runner-CDEClJ7w.js";import"./image-Bkivxhr_.js";import"./api-key-rotation-C2RTMqbG.js";import"./proxy-fetch-zQZYbMVb.js";import{i as ia,n as aa}from"./tokens-BzJXWHOV.js";import"./commands-registry-DueC2CXY.js";import{n as oa,r as sa}from"./targets-CVEYTFPQ.js";import"./send-NZQ7cj5i.js";import"./outbound-attachment-Diu_o1ga.js";import{c as ca,d as la,f as ua,l as da,m as fa,o as pa,p as ma,u as ha}from"./send-_fKv95OZ.js";import"./sqlite-9K32c8mU.js";import{i as ga,n as _a,r as va}from"./fetch-DMcdYoAa.js";import{c as ya,l as ba,n as xa,o as Sa,s as Ca}from"./skill-commands-B06QVSkm.js";import"./manager-DDgXS0Q8.js";import{t as wa}from"./resolve-outbound-target-CTyYBRiK.js";import{r as Ta}from"./channel-web-C0hljM9U.js";import"./outbound-RGOrt1pb.js";import"./session-DfMpA14O.js";import{t as Ea}from"./login-CnJL85zg.js";import Da,{constants as A,createWriteStream as Oa}from"node:fs";import j from"node:path";import ka from"node:os";import M from"node:fs/promises";import{createHash as Aa,randomBytes as ja,randomUUID as Ma}from"node:crypto";import{format as Na}from"node:util";import{pipeline as Pa}from"node:stream/promises";import{request as Fa}from"node:https";import{z as N}from"zod";import{Readable as Ia,Transform as La}from"node:stream";import Ra from"jszip";import*as za from"tar";function Ba(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Va(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?Ba(`expected config object`):Object.keys(e).length>0?Ba(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function Ha(e){return e.map(e=>({input:e.input,resolved:e.resolved,id:e.id,name:e.name,note:e.note}))}async function Ua(e){let t=[];for(let n of e.inputs)t.push(await e.mapInput(n));return t}function Wa(e){return typeof e==`string`?e:e instanceof URL?e.toString():typeof e==`object`&&e&&`url`in e&&typeof e.url==`string`?e.url:``}function Ga(e){return{verbose:!1,replyTo:e.replyToId??void 0,accountId:e.accountId??void 0,silent:e.silent??void 0}}function Ka(e){return{...Ga(e),mediaUrl:e.mediaUrl,mediaLocalRoots:e.mediaLocalRoots}}function qa(e){return{channel:`discord`,...e}}function P(e){let t=e.trim();if(!t)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return n.length>1&&n.endsWith(`/`)?n.slice(0,-1):n}function Ja(e){let t=e.webhookPath?.trim();if(t)return P(t);if(e.webhookUrl?.trim())try{return P(new URL(e.webhookUrl).pathname||`/`)}catch{return null}return e.defaultPath??null}const Ya=Object.freeze({preAuth:{maxBytes:64*1024,timeoutMs:5e3},postAuth:{maxBytes:1024*1024,timeoutMs:3e4}}),Xa=Object.freeze({maxInFlightPerKey:8,maxTrackedKeys:4096});function Za(e){let t=e.profile===`pre-auth`?Ya.preAuth:Ya.postAuth;return{maxBytes:typeof e.maxBytes==`number`&&Number.isFinite(e.maxBytes)&&e.maxBytes>0?Math.floor(e.maxBytes):t.maxBytes,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0?Math.floor(e.timeoutMs):t.timeoutMs}}function Qa(e){let{res:t,code:n,invalidMessage:r}=e;return n===`PAYLOAD_TOO_LARGE`?(t.statusCode=413,t.end(w(`PAYLOAD_TOO_LARGE`)),{ok:!1}):n===`REQUEST_BODY_TIMEOUT`?(t.statusCode=408,t.end(w(`REQUEST_BODY_TIMEOUT`)),{ok:!1}):n===`CONNECTION_CLOSED`?(t.statusCode=400,t.end(w(`CONNECTION_CLOSED`)),{ok:!1}):(t.statusCode=400,t.end(r??`Bad Request`),{ok:!1})}function $a(e){let t=Math.max(1,Math.floor(e?.maxInFlightPerKey??Xa.maxInFlightPerKey)),n=Math.max(1,Math.floor(e?.maxTrackedKeys??Xa.maxTrackedKeys)),r=new Map;return{tryAcquire:e=>{if(!e)return!0;let i=r.get(e)??0;return i>=t?!1:(r.set(e,i+1),C(r,n),!0)},release:e=>{if(!e)return;let t=r.get(e);if(t!==void 0){if(t<=1){r.delete(e);return}r.set(e,t-1)}},size:()=>r.size,clear:()=>r.clear()}}function eo(e){let t=Array.isArray(e)?e[0]:e;if(!t)return!1;let n=t.split(`;`,1)[0]?.trim().toLowerCase();return n===`application/json`||!!n?.endsWith(`+json`)}function to(e){let t=e.allowMethods?.length?e.allowMethods:null;return t&&!t.includes(e.req.method??``)?(e.res.statusCode=405,e.res.setHeader(`Allow`,t.join(`, `)),e.res.end(`Method Not Allowed`),!1):e.rateLimiter&&e.rateLimitKey&&e.rateLimiter.isRateLimited(e.rateLimitKey,e.nowMs??Date.now())?(e.res.statusCode=429,e.res.end(`Too Many Requests`),!1):e.requireJsonContentType&&e.req.method===`POST`&&!eo(e.req.headers[`content-type`])?(e.res.statusCode=415,e.res.end(`Unsupported Media Type`),!1):!0}function no(e){if(!to({req:e.req,res:e.res,allowMethods:e.allowMethods,rateLimiter:e.rateLimiter,rateLimitKey:e.rateLimitKey,nowMs:e.nowMs,requireJsonContentType:e.requireJsonContentType}))return{ok:!1};let t=e.inFlightKey??``,n=e.inFlightLimiter;if(n&&t&&!n.tryAcquire(t))return e.res.statusCode=e.inFlightLimitStatusCode??429,e.res.end(e.inFlightLimitMessage??`Too Many Requests`),{ok:!1};let r=!1;return{ok:!0,release:()=>{r||(r=!0,n&&t&&n.release(t))}}}async function ro(e){let t=Za({maxBytes:e.maxBytes,timeoutMs:e.timeoutMs,profile:e.profile});try{return{ok:!0,value:await Or(e.req,t)}}catch(t){return ir(t)?Qa({res:e.res,code:t.code,invalidMessage:e.invalidBodyMessage}):Qa({res:e.res,code:`INVALID_BODY`,invalidMessage:e.invalidBodyMessage??(t instanceof Error?t.message:String(t))})}}async function io(e){let t=Za({maxBytes:e.maxBytes,timeoutMs:e.timeoutMs,profile:e.profile}),n=await kn(e.req,{maxBytes:t.maxBytes,timeoutMs:t.timeoutMs,emptyObjectOnEmpty:e.emptyObjectOnEmpty});return n.ok?{ok:!0,value:n.value}:Qa({res:e.res,code:n.code,invalidMessage:e.invalidJsonMessage})}function ao(e){return co(e.targetsByPath,e.target,{onFirstPathTarget:({path:t})=>Sr({...e.route,path:t,replaceExisting:e.route.replaceExisting??!0}),onLastPathTargetRemoved:e.onLastPathTargetRemoved})}const oo=new WeakMap;function so(e){let t=e,n=oo.get(t);if(n)return n;let r=new Map;return oo.set(t,r),r}function co(e,t,n){let r=P(t.path),i={...t,path:r},a=e.get(r)??[];if(a.length===0){let t=n?.onFirstPathTarget?.({path:r,target:i});typeof t==`function`&&so(e).set(r,t)}e.set(r,[...a,i]);let o=!0;return{target:i,unregister:()=>{if(!o)return;o=!1;let t=(e.get(r)??[]).filter(e=>e!==i);if(t.length>0){e.set(r,t);return}e.delete(r);let a=so(e).get(r);a&&(so(e).delete(r),a()),n?.onLastPathTargetRemoved?.({path:r})}}}function lo(e,t){let n=P(new URL(e.url??`/`,`http://localhost`).pathname),r=t.get(n);return!r||r.length===0?null:{path:n,targets:r}}async function uo(e){let t=lo(e.req,e.targetsByPath);if(!t)return!1;let n=typeof e.inFlightKey==`function`?e.inFlightKey({req:e.req,path:t.path,targets:t.targets}):e.inFlightKey??`${t.path}:${e.req.socket?.remoteAddress??`unknown`}`,r=no({req:e.req,res:e.res,allowMethods:e.allowMethods,rateLimiter:e.rateLimiter,rateLimitKey:e.rateLimitKey,nowMs:e.nowMs,requireJsonContentType:e.requireJsonContentType,inFlightLimiter:e.inFlightLimiter,inFlightKey:n,inFlightLimitStatusCode:e.inFlightLimitStatusCode,inFlightLimitMessage:e.inFlightLimitMessage});if(!r.ok)return!0;try{return await e.handle(t),!0}finally{r.release()}}function fo(e,t){return e?{ok:!1,result:{kind:`ambiguous`}}:{ok:!0,matched:t}}function po(e){return e?{kind:`single`,target:e}:{kind:`none`}}function mo(e,t){let n;for(let r of e){if(!t(r))continue;let e=fo(n,r);if(!e.ok)return e.result;n=e.matched}return po(n)}async function ho(e,t){let n;for(let r of e){if(!await t(r))continue;let e=fo(n,r);if(!e.ok)return e.result;n=e.matched}return po(n)}async function go(e){return vo(e,await ho(e.targets,async t=>!!await e.isMatch(t)))}function _o(e){return vo(e,mo(e.targets,e.isMatch))}function vo(e,t){return t.kind===`single`?t.target:t.kind===`ambiguous`?(e.res.statusCode=e.ambiguousStatusCode??401,e.res.end(e.ambiguousMessage??`ambiguous webhook target`),null):(e.res.statusCode=e.unauthorizedStatusCode??401,e.res.end(e.unauthorizedMessage??`unauthorized`),null)}function yo(e,t){return e.method===`POST`?!1:(t.statusCode=405,t.setHeader(`Allow`,`POST`),t.end(`Method Not Allowed`),!0)}function bo(e){return t=>{e.setStatus({accountId:e.accountId,...t})}}function xo(e,t){return new Promise((n,r)=>{let i=()=>{Promise.resolve(t?.()).then(()=>n(),r)};if(e){if(e.aborted){i();return}e.addEventListener(`abort`,i,{once:!0})}})}async function So(e){let t=await e.start();try{await xo(e.abortSignal)}finally{await e.stop?.(t),await e.onStop?.()}}async function Co(e){let{server:t,abortSignal:n,onAbort:r}=e,i=Promise.resolve(),a=!1,o=()=>{a||(a=!0,i=Promise.resolve(r?.()).then(()=>void 0))},s=()=>{o()};n&&(n.aborted?o():n.addEventListener(`abort`,s,{once:!0})),await new Promise(e=>{t.once(`close`,()=>e())}),n&&n.removeEventListener(`abort`,s),await i}function wo(e){let t=e[0],n=e.map(e=>e.path),r=e.map(e=>e.contentType).filter(Boolean);return{MediaPath:t?.path,MediaType:t?.contentType??void 0,MediaUrl:t?.path,MediaPaths:n.length>0?n:void 0,MediaUrls:n.length>0?n:void 0,MediaTypes:r.length>0?r:void 0}}function To(e,t){return{accountId:e,running:!1,lastStartAt:null,lastStopAt:null,lastError:null,...t??{}}}function Eo(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function Do(e,t){return{...Eo(e),...t??{},probe:e.probe,lastProbeAt:e.lastProbeAt??null}}function Oo(e){let{account:t,runtime:n,probe:r}=e;return{accountId:t.accountId,name:t.name,enabled:t.enabled,configured:t.configured,...Ao({runtime:n,probe:r}),lastInboundAt:n?.lastInboundAt??null,lastOutboundAt:n?.lastOutboundAt??null}}function ko(e){let{accountId:t,name:n,enabled:r,configured:i,runtime:a,probe:o}=e;return Oo({account:{accountId:t,name:n,enabled:r,configured:i},runtime:a,probe:o})}function Ao(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}function jo(e,t){let n={...Eo(e),tokenSource:e.tokenSource??`none`,probe:e.probe,lastProbeAt:e.lastProbeAt??null};return t?.includeMode===!1?n:{...n,mode:e.mode??null}}function Mo(e,t){return t.flatMap(t=>{let n=typeof t.lastError==`string`?t.lastError.trim():``;return n?[{channel:e,accountId:t.accountId,kind:`runtime`,message:`Channel error: ${n}`}]:[]})}const No={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},Po=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],Fo=[...new Set(Object.values(No).flatMap(e=>e))];[...new Set([...Fo,...Po])];function Io(e){return e instanceof Error&&typeof e.message==`string`&&e.message.trim()?e.message:String(e)}function Lo(e){return No[e]?.find(e=>e.trim().length>0)}function Ro(e){return`/providers/${Ue(e)}/apiKey`}async function zo(e){let t=e.preferredEnvVar??Lo(e.provider)??``,n=Ro(e.provider),r=`env`;for(;;){let i=await e.prompter.select({message:e.copy?.sourceMessage??`Where is this API key stored?`,initialValue:r,options:[{value:`env`,label:`Environment variable`,hint:`Reference a variable from your runtime environment`},{value:`provider`,label:`Configured secret provider`,hint:`Use a configured file or exec secret provider`}]})===`provider`?`provider`:`env`;if(r=i,i===`env`){let n=await e.prompter.text({message:e.copy?.envVarMessage??`Environment variable name`,initialValue:t||void 0,placeholder:e.copy?.envVarPlaceholder??`OPENAI_API_KEY`,validate:t=>{let n=t.trim();if(!mn(n))return e.copy?.envVarFormatError??`Use an env var name like "OPENAI_API_KEY" (uppercase letters, numbers, underscores).`;if(!process.env[n]?.trim())return e.copy?.envVarMissingError?.(n)??`Environment variable "${n}" is missing or empty in this session.`}}),r=String(n??``).trim(),i=r&&mn(r)?r:t;if(!i)throw Error(`No valid environment variable name provided for provider "${e.provider}".`);let a={source:`env`,provider:ue(e.config,`env`,{preferFirstProviderForSource:!0}),id:i},o=await wt(a,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.envValidatedMessage?.(i)??`Validated environment variable ${i}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:a,resolvedValue:o}}let a=Object.entries(e.config.secrets?.providers??{}).filter(([,e])=>e?.source===`file`||e?.source===`exec`);if(a.length===0){await e.prompter.note(e.copy?.noProvidersMessage??`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`,`No providers configured`);continue}let o=ue(e.config,`file`,{preferFirstProviderForSource:!0}),s=await e.prompter.select({message:`Select secret provider`,initialValue:a.find(([e])=>e===o)?.[0]??a[0]?.[0],options:a.map(([e,t])=>({value:e,label:e,hint:t?.source===`exec`?`Exec provider`:`File provider`}))}),c=e.config.secrets?.providers?.[s];if(!c||c.source!==`file`&&c.source!==`exec`){await e.prompter.note(`Provider "${s}" is not a file/exec provider.`,`Invalid provider`);continue}let l=c.source===`file`?`Secret id (JSON pointer for json mode, or 'value' for singleValue mode)`:`Secret id for the exec provider`,u=c.source===`file`?c.mode===`singleValue`?`value`:n:`${e.provider}/apiKey`,d=await e.prompter.text({message:l,initialValue:u,placeholder:c.source===`file`?`/providers/openai/apiKey`:`openai/api-key`,validate:e=>{let t=e.trim();if(!t)return`Secret id cannot be empty.`;if(c.source===`file`&&c.mode!==`singleValue`&&!qt(t))return`Use an absolute JSON pointer like "/providers/openai/apiKey".`;if(c.source===`file`&&c.mode===`singleValue`&&t!==`value`)return`singleValue mode expects id "value".`;if(c.source===`exec`&&!Je(t))return ve()}}),f=String(d??``).trim()||u,p={source:c.source,provider:s,id:f};try{let t=await wt(p,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.providerValidatedMessage?.(s,f,c.source)??`Validated ${c.source} reference ${s}:${f}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:p,resolvedValue:t}}catch(t){await e.prompter.note([`Could not validate provider reference ${s}:${f}.`,Io(t),`Check your provider configuration and try again.`].join(`
|
|
1
|
+
import{Bt as e,E as t,L as n,Lt as r,O as i,Ut as a,Wt as o,_t as s,bt as c,c as l,d as u,f as d,h as f,k as p,l as m,m as ee,p as te,u as h,w as ne,yt as re}from"./paths-CSbOOCsu.js";import{$c as ie,$i as ae,$l as g,$t as oe,A as se,Aa as ce,Ai as le,Al as ue,B as de,Ba as fe,Bi as pe,Ca as me,Ci as he,Co as ge,Di as _e,Dl as ve,Do as ye,Ds as be,Ea as xe,Ei as Se,Eo as Ce,F as we,Fa as Te,Ga as Ee,Gi as De,Gl as _,H as Oe,Ha as ke,Hi as Ae,I as je,Ia as Me,Ja as Ne,Ji as Pe,Ka as Fe,Ki as Ie,Ks as Le,L as Re,La as ze,Lo as Be,M as Ve,Ma as v,Mi as He,Ml as Ue,Mo as We,N as Ge,Na as Ke,Nl as y,No as b,Oi as qe,Ol as Je,P as Ye,Pa as Xe,Qi as Ze,R as Qe,Ra as $e,Rs as et,Sa as tt,So as nt,Ta as x,Ti as rt,To as it,U as at,Ua as ot,Ui as st,Ul as ct,V as lt,Va as ut,Vc as dt,Vi as ft,Wi as pt,Wl as mt,Xi as ht,Xs as gt,Yi as _t,Ys as vt,Zi as yt,Zl as bt,Zs as xt,_ as St,_a as Ct,_l as wt,_o as Tt,as as Et,ba as Dt,bo as Ot,co as kt,d as At,da as jt,do as Mt,ea as Nt,eu as Pt,f as Ft,fo as It,g as Lt,go as Rt,h as zt,ho as Bt,is as Vt,j as Ht,ja as Ut,ji as Wt,k as Gt,ki as Kt,kl as qt,ko as Jt,ks as Yt,la as Xt,lo as Zt,m as Qt,mo as $t,mu as en,na as tn,nu as nn,oa as rn,os as an,p as on,po as sn,qa as cn,qi as ln,ra as un,ru as dn,sl as fn,ta as pn,tu as mn,ua as hn,uo as gn,v as _n,va as vn,vo as yn,wa as bn,wi as xn,wo as Sn,xa as Cn,xo as wn,yo as Tn,z as En,za as Dn,zo as On}from"./config-B-UcenbQ.js";import{$t as kn,A as An,At as jn,B as Mn,Bt as Nn,C as Pn,Cn as Fn,D as In,Dt as Ln,Et as Rn,F as zn,Ft as Bn,G as Vn,H as Hn,Ht as Un,It as Wn,J as Gn,Jt as Kn,K as qn,Kt as Jn,L as Yn,Lt as Xn,M as Zn,Mt as Qn,N as $n,O as er,Ot as tr,P as nr,Pt as rr,Qt as ir,R as ar,Rt as or,S as sr,Sn as cr,T as lr,Tt as ur,U as dr,Ut as fr,V as pr,Vt as mr,W as hr,Wt as gr,Xt as _r,Yt as vr,Zt as yr,_ as br,_n as xr,an as Sr,b as Cr,bn as wr,cn as Tr,dn as Er,dt as Dr,en as Or,f as S,fn as kr,ft as Ar,g as jr,gn as Mr,gt as Nr,h as Pr,hn as Fr,in as Ir,j as Lr,jt as Rr,k as zr,kt as Br,ln as Vr,lt as Hr,mn as Ur,n as Wr,nn as Gr,on as Kr,ot as qr,pn as Jr,pt as Yr,q as Xr,qt as C,rn as Zr,sn as Qr,t as $r,tn as w,un as ei,ut as ti,v as ni,vn as ri,w as ii,x as T,xn as ai,y as oi,yn as si,yt as ci,z as li,zt as ui}from"./dispatch-DzdnDix3.js";import"./paths-BZu7pylC.js";import"./github-copilot-token-CZKe5l5K.js";import{C as E,O as di,Q as fi,b as D,j as pi,m as mi,p as hi,q as gi,s as _i,v as vi,w as yi}from"./logger-C9qBS3pT.js";import{r as bi}from"./proxy-env-CPkJIzpH.js";import{At as xi,Bt as Si,Dt as Ci,Et as wi,Ft as Ti,Ht as Ei,It as Di,Mt as Oi,Nt as ki,Ot as Ai,Pt as ji,Tt as Mi,Ut as Ni,Vt as Pi,Wt as Fi,at as Ii,dt as Li,jt as Ri,kt as zi}from"./send-Cm3DUp7B.js";import"./fetch-DBRI0sKI.js";import"./channel-activity-BmtBYQiY.js";import{t as Bi}from"./fetch-guard-DFkrvefb.js";import"./local-roots-CJmQubXD.js";import{p as Vi,v as Hi}from"./ir-CtV16xaT.js";import"./render-DGmfCIRG.js";import"./tables-BSCz74OW.js";import{X as Ui,Y as Wi,it as Gi,rt as Ki}from"./send-BZLHNxgv.js";import{d as O,f as qi,h as k,l as Ji,n as Yi,o as Xi}from"./target-errors-IUyUVvTY.js";import{s as Zi}from"./send-DEXJLpyz.js";import{h as Qi}from"./deliver-C_gmqump.js";import{g as $i,h as ea,m as ta}from"./diagnostic-BjNsv_MZ.js";import"./pi-model-discovery-KbgCHo1f.js";import{d as na,f as ra}from"./audio-transcription-runner-CDEClJ7w.js";import"./image-Bkivxhr_.js";import"./api-key-rotation-C2RTMqbG.js";import"./proxy-fetch-zQZYbMVb.js";import{i as ia,n as aa}from"./tokens-BzJXWHOV.js";import"./commands-registry-DueC2CXY.js";import{n as oa,r as sa}from"./targets-CVEYTFPQ.js";import"./send-NZQ7cj5i.js";import"./outbound-attachment-Diu_o1ga.js";import{c as ca,d as la,f as ua,l as da,m as fa,o as pa,p as ma,u as ha}from"./send-_fKv95OZ.js";import"./sqlite-9K32c8mU.js";import{i as ga,n as _a,r as va}from"./fetch-DMcdYoAa.js";import{c as ya,l as ba,n as xa,o as Sa,s as Ca}from"./skill-commands-B06QVSkm.js";import"./manager-DDgXS0Q8.js";import{t as wa}from"./resolve-outbound-target-CTyYBRiK.js";import{r as Ta}from"./channel-web-T7e1VB_g.js";import"./outbound-RGOrt1pb.js";import"./session-DfMpA14O.js";import{t as Ea}from"./login-CnJL85zg.js";import Da,{constants as A,createWriteStream as Oa}from"node:fs";import j from"node:path";import ka from"node:os";import M from"node:fs/promises";import{createHash as Aa,randomBytes as ja,randomUUID as Ma}from"node:crypto";import{format as Na}from"node:util";import{pipeline as Pa}from"node:stream/promises";import{request as Fa}from"node:https";import{z as N}from"zod";import{Readable as Ia,Transform as La}from"node:stream";import Ra from"jszip";import*as za from"tar";function Ba(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Va(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?Ba(`expected config object`):Object.keys(e).length>0?Ba(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function Ha(e){return e.map(e=>({input:e.input,resolved:e.resolved,id:e.id,name:e.name,note:e.note}))}async function Ua(e){let t=[];for(let n of e.inputs)t.push(await e.mapInput(n));return t}function Wa(e){return typeof e==`string`?e:e instanceof URL?e.toString():typeof e==`object`&&e&&`url`in e&&typeof e.url==`string`?e.url:``}function Ga(e){return{verbose:!1,replyTo:e.replyToId??void 0,accountId:e.accountId??void 0,silent:e.silent??void 0}}function Ka(e){return{...Ga(e),mediaUrl:e.mediaUrl,mediaLocalRoots:e.mediaLocalRoots}}function qa(e){return{channel:`discord`,...e}}function P(e){let t=e.trim();if(!t)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return n.length>1&&n.endsWith(`/`)?n.slice(0,-1):n}function Ja(e){let t=e.webhookPath?.trim();if(t)return P(t);if(e.webhookUrl?.trim())try{return P(new URL(e.webhookUrl).pathname||`/`)}catch{return null}return e.defaultPath??null}const Ya=Object.freeze({preAuth:{maxBytes:64*1024,timeoutMs:5e3},postAuth:{maxBytes:1024*1024,timeoutMs:3e4}}),Xa=Object.freeze({maxInFlightPerKey:8,maxTrackedKeys:4096});function Za(e){let t=e.profile===`pre-auth`?Ya.preAuth:Ya.postAuth;return{maxBytes:typeof e.maxBytes==`number`&&Number.isFinite(e.maxBytes)&&e.maxBytes>0?Math.floor(e.maxBytes):t.maxBytes,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)&&e.timeoutMs>0?Math.floor(e.timeoutMs):t.timeoutMs}}function Qa(e){let{res:t,code:n,invalidMessage:r}=e;return n===`PAYLOAD_TOO_LARGE`?(t.statusCode=413,t.end(w(`PAYLOAD_TOO_LARGE`)),{ok:!1}):n===`REQUEST_BODY_TIMEOUT`?(t.statusCode=408,t.end(w(`REQUEST_BODY_TIMEOUT`)),{ok:!1}):n===`CONNECTION_CLOSED`?(t.statusCode=400,t.end(w(`CONNECTION_CLOSED`)),{ok:!1}):(t.statusCode=400,t.end(r??`Bad Request`),{ok:!1})}function $a(e){let t=Math.max(1,Math.floor(e?.maxInFlightPerKey??Xa.maxInFlightPerKey)),n=Math.max(1,Math.floor(e?.maxTrackedKeys??Xa.maxTrackedKeys)),r=new Map;return{tryAcquire:e=>{if(!e)return!0;let i=r.get(e)??0;return i>=t?!1:(r.set(e,i+1),C(r,n),!0)},release:e=>{if(!e)return;let t=r.get(e);if(t!==void 0){if(t<=1){r.delete(e);return}r.set(e,t-1)}},size:()=>r.size,clear:()=>r.clear()}}function eo(e){let t=Array.isArray(e)?e[0]:e;if(!t)return!1;let n=t.split(`;`,1)[0]?.trim().toLowerCase();return n===`application/json`||!!n?.endsWith(`+json`)}function to(e){let t=e.allowMethods?.length?e.allowMethods:null;return t&&!t.includes(e.req.method??``)?(e.res.statusCode=405,e.res.setHeader(`Allow`,t.join(`, `)),e.res.end(`Method Not Allowed`),!1):e.rateLimiter&&e.rateLimitKey&&e.rateLimiter.isRateLimited(e.rateLimitKey,e.nowMs??Date.now())?(e.res.statusCode=429,e.res.end(`Too Many Requests`),!1):e.requireJsonContentType&&e.req.method===`POST`&&!eo(e.req.headers[`content-type`])?(e.res.statusCode=415,e.res.end(`Unsupported Media Type`),!1):!0}function no(e){if(!to({req:e.req,res:e.res,allowMethods:e.allowMethods,rateLimiter:e.rateLimiter,rateLimitKey:e.rateLimitKey,nowMs:e.nowMs,requireJsonContentType:e.requireJsonContentType}))return{ok:!1};let t=e.inFlightKey??``,n=e.inFlightLimiter;if(n&&t&&!n.tryAcquire(t))return e.res.statusCode=e.inFlightLimitStatusCode??429,e.res.end(e.inFlightLimitMessage??`Too Many Requests`),{ok:!1};let r=!1;return{ok:!0,release:()=>{r||(r=!0,n&&t&&n.release(t))}}}async function ro(e){let t=Za({maxBytes:e.maxBytes,timeoutMs:e.timeoutMs,profile:e.profile});try{return{ok:!0,value:await Or(e.req,t)}}catch(t){return ir(t)?Qa({res:e.res,code:t.code,invalidMessage:e.invalidBodyMessage}):Qa({res:e.res,code:`INVALID_BODY`,invalidMessage:e.invalidBodyMessage??(t instanceof Error?t.message:String(t))})}}async function io(e){let t=Za({maxBytes:e.maxBytes,timeoutMs:e.timeoutMs,profile:e.profile}),n=await kn(e.req,{maxBytes:t.maxBytes,timeoutMs:t.timeoutMs,emptyObjectOnEmpty:e.emptyObjectOnEmpty});return n.ok?{ok:!0,value:n.value}:Qa({res:e.res,code:n.code,invalidMessage:e.invalidJsonMessage})}function ao(e){return co(e.targetsByPath,e.target,{onFirstPathTarget:({path:t})=>Sr({...e.route,path:t,replaceExisting:e.route.replaceExisting??!0}),onLastPathTargetRemoved:e.onLastPathTargetRemoved})}const oo=new WeakMap;function so(e){let t=e,n=oo.get(t);if(n)return n;let r=new Map;return oo.set(t,r),r}function co(e,t,n){let r=P(t.path),i={...t,path:r},a=e.get(r)??[];if(a.length===0){let t=n?.onFirstPathTarget?.({path:r,target:i});typeof t==`function`&&so(e).set(r,t)}e.set(r,[...a,i]);let o=!0;return{target:i,unregister:()=>{if(!o)return;o=!1;let t=(e.get(r)??[]).filter(e=>e!==i);if(t.length>0){e.set(r,t);return}e.delete(r);let a=so(e).get(r);a&&(so(e).delete(r),a()),n?.onLastPathTargetRemoved?.({path:r})}}}function lo(e,t){let n=P(new URL(e.url??`/`,`http://localhost`).pathname),r=t.get(n);return!r||r.length===0?null:{path:n,targets:r}}async function uo(e){let t=lo(e.req,e.targetsByPath);if(!t)return!1;let n=typeof e.inFlightKey==`function`?e.inFlightKey({req:e.req,path:t.path,targets:t.targets}):e.inFlightKey??`${t.path}:${e.req.socket?.remoteAddress??`unknown`}`,r=no({req:e.req,res:e.res,allowMethods:e.allowMethods,rateLimiter:e.rateLimiter,rateLimitKey:e.rateLimitKey,nowMs:e.nowMs,requireJsonContentType:e.requireJsonContentType,inFlightLimiter:e.inFlightLimiter,inFlightKey:n,inFlightLimitStatusCode:e.inFlightLimitStatusCode,inFlightLimitMessage:e.inFlightLimitMessage});if(!r.ok)return!0;try{return await e.handle(t),!0}finally{r.release()}}function fo(e,t){return e?{ok:!1,result:{kind:`ambiguous`}}:{ok:!0,matched:t}}function po(e){return e?{kind:`single`,target:e}:{kind:`none`}}function mo(e,t){let n;for(let r of e){if(!t(r))continue;let e=fo(n,r);if(!e.ok)return e.result;n=e.matched}return po(n)}async function ho(e,t){let n;for(let r of e){if(!await t(r))continue;let e=fo(n,r);if(!e.ok)return e.result;n=e.matched}return po(n)}async function go(e){return vo(e,await ho(e.targets,async t=>!!await e.isMatch(t)))}function _o(e){return vo(e,mo(e.targets,e.isMatch))}function vo(e,t){return t.kind===`single`?t.target:t.kind===`ambiguous`?(e.res.statusCode=e.ambiguousStatusCode??401,e.res.end(e.ambiguousMessage??`ambiguous webhook target`),null):(e.res.statusCode=e.unauthorizedStatusCode??401,e.res.end(e.unauthorizedMessage??`unauthorized`),null)}function yo(e,t){return e.method===`POST`?!1:(t.statusCode=405,t.setHeader(`Allow`,`POST`),t.end(`Method Not Allowed`),!0)}function bo(e){return t=>{e.setStatus({accountId:e.accountId,...t})}}function xo(e,t){return new Promise((n,r)=>{let i=()=>{Promise.resolve(t?.()).then(()=>n(),r)};if(e){if(e.aborted){i();return}e.addEventListener(`abort`,i,{once:!0})}})}async function So(e){let t=await e.start();try{await xo(e.abortSignal)}finally{await e.stop?.(t),await e.onStop?.()}}async function Co(e){let{server:t,abortSignal:n,onAbort:r}=e,i=Promise.resolve(),a=!1,o=()=>{a||(a=!0,i=Promise.resolve(r?.()).then(()=>void 0))},s=()=>{o()};n&&(n.aborted?o():n.addEventListener(`abort`,s,{once:!0})),await new Promise(e=>{t.once(`close`,()=>e())}),n&&n.removeEventListener(`abort`,s),await i}function wo(e){let t=e[0],n=e.map(e=>e.path),r=e.map(e=>e.contentType).filter(Boolean);return{MediaPath:t?.path,MediaType:t?.contentType??void 0,MediaUrl:t?.path,MediaPaths:n.length>0?n:void 0,MediaUrls:n.length>0?n:void 0,MediaTypes:r.length>0?r:void 0}}function To(e,t){return{accountId:e,running:!1,lastStartAt:null,lastStopAt:null,lastError:null,...t??{}}}function Eo(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function Do(e,t){return{...Eo(e),...t??{},probe:e.probe,lastProbeAt:e.lastProbeAt??null}}function Oo(e){let{account:t,runtime:n,probe:r}=e;return{accountId:t.accountId,name:t.name,enabled:t.enabled,configured:t.configured,...Ao({runtime:n,probe:r}),lastInboundAt:n?.lastInboundAt??null,lastOutboundAt:n?.lastOutboundAt??null}}function ko(e){let{accountId:t,name:n,enabled:r,configured:i,runtime:a,probe:o}=e;return Oo({account:{accountId:t,name:n,enabled:r,configured:i},runtime:a,probe:o})}function Ao(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}function jo(e,t){let n={...Eo(e),tokenSource:e.tokenSource??`none`,probe:e.probe,lastProbeAt:e.lastProbeAt??null};return t?.includeMode===!1?n:{...n,mode:e.mode??null}}function Mo(e,t){return t.flatMap(t=>{let n=typeof t.lastError==`string`?t.lastError.trim():``;return n?[{channel:e,accountId:t.accountId,kind:`runtime`,message:`Channel error: ${n}`}]:[]})}const No={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},Po=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],Fo=[...new Set(Object.values(No).flatMap(e=>e))];[...new Set([...Fo,...Po])];function Io(e){return e instanceof Error&&typeof e.message==`string`&&e.message.trim()?e.message:String(e)}function Lo(e){return No[e]?.find(e=>e.trim().length>0)}function Ro(e){return`/providers/${Ue(e)}/apiKey`}async function zo(e){let t=e.preferredEnvVar??Lo(e.provider)??``,n=Ro(e.provider),r=`env`;for(;;){let i=await e.prompter.select({message:e.copy?.sourceMessage??`Where is this API key stored?`,initialValue:r,options:[{value:`env`,label:`Environment variable`,hint:`Reference a variable from your runtime environment`},{value:`provider`,label:`Configured secret provider`,hint:`Use a configured file or exec secret provider`}]})===`provider`?`provider`:`env`;if(r=i,i===`env`){let n=await e.prompter.text({message:e.copy?.envVarMessage??`Environment variable name`,initialValue:t||void 0,placeholder:e.copy?.envVarPlaceholder??`OPENAI_API_KEY`,validate:t=>{let n=t.trim();if(!mn(n))return e.copy?.envVarFormatError??`Use an env var name like "OPENAI_API_KEY" (uppercase letters, numbers, underscores).`;if(!process.env[n]?.trim())return e.copy?.envVarMissingError?.(n)??`Environment variable "${n}" is missing or empty in this session.`}}),r=String(n??``).trim(),i=r&&mn(r)?r:t;if(!i)throw Error(`No valid environment variable name provided for provider "${e.provider}".`);let a={source:`env`,provider:ue(e.config,`env`,{preferFirstProviderForSource:!0}),id:i},o=await wt(a,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.envValidatedMessage?.(i)??`Validated environment variable ${i}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:a,resolvedValue:o}}let a=Object.entries(e.config.secrets?.providers??{}).filter(([,e])=>e?.source===`file`||e?.source===`exec`);if(a.length===0){await e.prompter.note(e.copy?.noProvidersMessage??`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`,`No providers configured`);continue}let o=ue(e.config,`file`,{preferFirstProviderForSource:!0}),s=await e.prompter.select({message:`Select secret provider`,initialValue:a.find(([e])=>e===o)?.[0]??a[0]?.[0],options:a.map(([e,t])=>({value:e,label:e,hint:t?.source===`exec`?`Exec provider`:`File provider`}))}),c=e.config.secrets?.providers?.[s];if(!c||c.source!==`file`&&c.source!==`exec`){await e.prompter.note(`Provider "${s}" is not a file/exec provider.`,`Invalid provider`);continue}let l=c.source===`file`?`Secret id (JSON pointer for json mode, or 'value' for singleValue mode)`:`Secret id for the exec provider`,u=c.source===`file`?c.mode===`singleValue`?`value`:n:`${e.provider}/apiKey`,d=await e.prompter.text({message:l,initialValue:u,placeholder:c.source===`file`?`/providers/openai/apiKey`:`openai/api-key`,validate:e=>{let t=e.trim();if(!t)return`Secret id cannot be empty.`;if(c.source===`file`&&c.mode!==`singleValue`&&!qt(t))return`Use an absolute JSON pointer like "/providers/openai/apiKey".`;if(c.source===`file`&&c.mode===`singleValue`&&t!==`value`)return`singleValue mode expects id "value".`;if(c.source===`exec`&&!Je(t))return ve()}}),f=String(d??``).trim()||u,p={source:c.source,provider:s,id:f};try{let t=await wt(p,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.providerValidatedMessage?.(s,f,c.source)??`Validated ${c.source} reference ${s}:${f}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:p,resolvedValue:t}}catch(t){await e.prompter.note([`Could not validate provider reference ${s}:${f}.`,Io(t),`Check your provider configuration and try again.`].join(`
|
|
2
2
|
`),`Reference check failed`)}}}async function Bo(e){return e.explicitMode?e.explicitMode:typeof e.prompter.select==`function`&&await e.prompter.select({message:e.copy?.modeMessage??`How do you want to provide this API key?`,initialValue:`plaintext`,options:[{value:`plaintext`,label:e.copy?.plaintextLabel??`Paste API key now`,hint:e.copy?.plaintextHint??`Stores the key directly in OpenClaw config`},{value:`ref`,label:e.copy?.refLabel??`Use external secret provider`,hint:e.copy?.refHint??`Stores a reference to env or configured external secret providers`}]})===`ref`?`ref`:`plaintext`}async function Vo(e){let t=e.listAccountIds(e.cfg),n=e.currentId?.trim()||e.defaultAccountId||`default`,r=await e.prompter.select({message:`${e.label} account`,options:[...t.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:n});if(r!==`__new__`)return o(r);let i=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),a=o(String(i));return String(i).trim()!==a&&await e.prompter.note(`Normalized account id to "${a}".`,`${e.label} account`),a}function Ho(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function Uo(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:Ho(e.cfg,e.channelKey)}function Wo(e){let t=e.name?.trim();if(!t)return e.cfg;let n=o(e.accountId),r=e.cfg.channels?.[e.channelKey],i=typeof r==`object`&&r?r:void 0;if(!Uo({cfg:e.cfg,channelKey:e.channelKey,accountId:n,alwaysUseAccounts:e.alwaysUseAccounts})&&n===`default`){let n=i??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...n,name:t}}}}let a=i?.accounts??{},s=a[n]??{},c=n===`default`?(({name:e,...t})=>t)(i??{}):i??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...a,[n]:{...s,name:t}}}}}}function Go(e){if(e.alwaysUseAccounts)return e.cfg;let t=e.cfg.channels?.[e.channelKey],n=t?.name?.trim();if(!n)return e.cfg;let r={...t?.accounts},i=r.default??{};i.name||(r[a]={...i,name:n});let{name:o,...s}=t??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...s,accounts:r}}}}function Ko(e){return qo({cfg:e.cfg,channelKey:e.channelKey,accountId:e.accountId,patch:e.patch})}function qo(e){let t=o(e.accountId),n=e.cfg.channels?.[e.channelKey],r=typeof n==`object`&&n?n:void 0,i=e.ensureChannelEnabled??!0,a=e.ensureAccountEnabled??i,s=e.patch,c=e.accountPatch??s;if(t===`default`)return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},...s}}};let l=r?.accounts??{},u=l[t]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},accounts:{...l,[t]:{...u,...a?{enabled:typeof u.enabled==`boolean`?u.enabled:!0}:{},...c}}}}}}const Jo=new Set(`name.token.tokenFile.botToken.appToken.account.signalNumber.authDir.cliPath.dbPath.httpUrl.httpHost.httpPort.webhookPath.webhookUrl.webhookSecret.service.region.homeserver.userId.accessToken.password.deviceName.url.code.dmPolicy.allowFrom.groupPolicy.groupAllowFrom.defaultTo`.split(`.`)),Yo={telegram:new Set([`streaming`])};function Xo(e){return Jo.has(e.key)?!0:Yo[e.channelKey]?.has(e.key)??!1}function Zo(e){return e&&typeof e==`object`?structuredClone(e):e}function Qo(e){let t=e.cfg.channels?.[e.channelKey],n=typeof t==`object`&&t?t:void 0;if(!n)return e.cfg;let r=n.accounts??{};if(Object.keys(r).length>0)return e.cfg;let i=Object.entries(n).filter(([t,n])=>t!==`accounts`&&t!==`enabled`&&n!==void 0&&Xo({channelKey:e.channelKey,key:t})).map(([e])=>e),o={};for(let e of i){let t=n[e];o[e]=Zo(t)}let s={...n};for(let e of i)delete s[e];return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...s,accounts:{...r,[a]:o}}}}}const $o=async e=>await Vo(e);function F(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function I(e,t){let n=[...e??[],...t].map(e=>String(e).trim()).filter(Boolean);return[...new Set(n)]}function L(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function es(e,t){let n=L(String(e??``)),r=[];for(let e of n){let n=t(e);if(`error`in n)return{entries:[],error:n.error};r.push(n.value)}return{entries:R(r)}}function ts(e,t){return es(e,e=>e===`*`?{value:`*`}:t(e))}function ns(e){let t=e.value.trim();if(!t)return null;let n=t.match(e.mentionPattern);if(n?.[1])return e.normalizeId?e.normalizeId(n[1]):n[1];let r=e.prefixPattern?t.replace(e.prefixPattern,``):t;return e.idPattern.test(r)?e.normalizeId?e.normalizeId(r):r:null}function R(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean).map(e=>{if(e===`*`)return`*`;if(!t)return e;let n=t(e);return typeof n==`string`?n.trim():``}).filter(Boolean);return[...new Set(n)]}function z(e){return e.accountId?.trim()?o(e.accountId):e.defaultAccountId}async function B(e){let t=e.accountOverride?.trim(),n=t?o(t):e.defaultAccountId;return e.shouldPromptAccountIds&&!t&&(n=await $o({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:n,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),n}function rs(e){let{cfg:t,channel:n,accountId:r,allowFrom:i}=e;return fs({cfg:t,channel:n,accountId:r,patch:{allowFrom:i},ensureEnabled:!1})}function is(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},allowFrom:e.allowFrom}}}}function as(e){let t=e.cfg.channels?.[e.channel]??{},n=e.getAllowFrom?.(e.cfg)??t.allowFrom??void 0,r=e.dmPolicy===`open`?F(n):void 0;return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}}}}function os(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},groupPolicy:e.groupPolicy}}}}function ss(e){let{cfg:t,channel:n,dmPolicy:r}=e,i=r===`open`?F(t.channels?.[n]?.allowFrom):void 0;return{...t,channels:{...t.channels,[n]:{...t.channels?.[n],dmPolicy:r,...i?{allowFrom:i}:{}}}}}function cs(e){let t=e.cfg.channels?.[e.channel]??{allowFrom:void 0,dm:void 0},n=t.allowFrom??t.dm?.allowFrom,r=e.dmPolicy===`open`?F(n):void 0;return ds({cfg:e.cfg,channel:e.channel,patch:{dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}})}function ls(e){return ds({cfg:e.cfg,channel:e.channel,patch:{allowFrom:e.allowFrom}})}function us(e){return H({cfg:e.cfg,channel:e.channel,accountId:e.accountId,patch:{groupPolicy:e.groupPolicy}})}function ds(e){let{cfg:t,channel:n,patch:r}=e,i=t.channels?.[n]??{},a=i.dm??{};return{...t,channels:{...t.channels,[n]:{...i,...r,dm:{...a,enabled:typeof a.enabled==`boolean`?a.enabled:!0}}}}}function V(e,t,n){let r=e.channels?.[t]??{};return{...e,channels:{...e.channels,[t]:{...r,enabled:n}}}}function fs(e){let{cfg:t,channel:n,accountId:r,patch:i,ensureEnabled:a}=e;return qo({cfg:r===`default`?t:Qo({cfg:t,channelKey:n}),channelKey:n,accountId:r,patch:i,ensureChannelEnabled:a,ensureAccountEnabled:a})}function H(e){return fs({...e,ensureEnabled:!0})}function U(e){let t=e.cfg;return e.tokenResult.useEnv&&(t=H({cfg:t,channel:e.channel,accountId:e.accountId,patch:{}})),e.tokenResult.token&&(t=H({cfg:t,channel:e.channel,accountId:e.accountId,patch:{[e.tokenPatchKey]:e.tokenResult.token}})),t}function ps(e){return{accountConfigured:e.accountConfigured,hasConfigToken:e.hasConfigToken,canUseEnv:e.allowEnv&&!!e.envValue?.trim()&&!e.hasConfigToken}}async function ms(e){let t=async()=>String(await e.prompter.text({message:e.inputPrompt,validate:e=>e?.trim()?void 0:`Required`})).trim();return e.canUseEnv?await e.prompter.confirm({message:e.envPrompt,initialValue:!0})?{useEnv:!0,token:null}:{useEnv:!1,token:await t()}:e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0})?{useEnv:!1,token:null}:{useEnv:!1,token:await t()}}async function W(e){let t=ps({accountConfigured:e.accountConfigured,hasConfigToken:e.hasConfigToken,allowEnv:e.allowEnv,envValue:e.envValue});!t.accountConfigured&&e.onMissingConfigured&&await e.onMissingConfigured();let n=await hs({cfg:e.cfg,prompter:e.prompter,providerHint:e.providerHint,credentialLabel:e.credentialLabel,secretInputMode:e.secretInputMode,accountConfigured:t.accountConfigured,canUseEnv:t.canUseEnv,hasConfigToken:t.hasConfigToken,envPrompt:e.envPrompt,keepPrompt:e.keepPrompt,inputPrompt:e.inputPrompt,preferredEnvVar:e.preferredEnvVar});return n.action===`use-env`?{cfg:e.applyUseEnv?await e.applyUseEnv(e.cfg):e.cfg,action:n.action,resolvedValue:e.envValue?.trim()||void 0}:n.action===`set`?{cfg:e.applySet?await e.applySet(e.cfg,n.value,n.resolvedValue):e.cfg,action:n.action,resolvedValue:n.resolvedValue}:{cfg:e.cfg,action:n.action}}async function hs(e){if(await Bo({prompter:e.prompter,explicitMode:e.secretInputMode,copy:{modeMessage:`How do you want to provide this ${e.credentialLabel}?`,plaintextLabel:`Enter ${e.credentialLabel}`,plaintextHint:`Stores the credential directly in OpenClaw config`,refLabel:`Use external secret provider`,refHint:`Stores a reference to env or configured external secret providers`}})===`plaintext`){let t=await ms({prompter:e.prompter,accountConfigured:e.accountConfigured,canUseEnv:e.canUseEnv,hasConfigToken:e.hasConfigToken,envPrompt:e.envPrompt,keepPrompt:e.keepPrompt,inputPrompt:e.inputPrompt});return t.useEnv?{action:`use-env`}:t.token?{action:`set`,value:t.token,resolvedValue:t.token}:{action:`keep`}}if(e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0}))return{action:`keep`};let t=await zo({provider:e.providerHint,config:e.cfg,prompter:e.prompter,preferredEnvVar:e.preferredEnvVar,copy:{sourceMessage:`Where is this ${e.credentialLabel} stored?`,envVarPlaceholder:e.preferredEnvVar??`OPENCLAW_SECRET`,envVarFormatError:`Use an env var name like "OPENCLAW_SECRET" (uppercase letters, numbers, underscores).`,noProvidersMessage:`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`}});return{action:`set`,value:t.ref,resolvedValue:t.resolvedValue}}async function gs(e){let t=z({accountId:e.accountId,defaultAccountId:e.defaultAccountId}),n=e.getExistingAllowFrom({cfg:e.cfg,accountId:t});await e.prompter.note(e.noteLines.join(`
|
|
3
3
|
`),e.noteTitle);let r=await e.prompter.text({message:e.message,placeholder:e.placeholder,initialValue:n[0]?String(n[0]):void 0,validate:t=>{let n=String(t??``).trim();return n?e.parseEntries(n).error:`Required`}}),i=I(void 0,e.parseEntries(String(r)).entries);return rs({cfg:e.cfg,channel:e.channel,accountId:t,allowFrom:i})}async function _s(e){let t=[];for(let n of e.resolvedSections)n.values.length!==0&&t.push(`${n.title}: ${n.values.join(`, `)}`);e.unresolved&&e.unresolved.length>0&&t.push(`Unresolved (kept as typed): ${e.unresolved.join(`, `)}`),t.length>0&&await e.prompter.note(t.join(`
|
|
4
4
|
`),e.label)}async function vs(e){await e.prompter.note(`Channel lookup failed; keeping entries as typed. ${String(e.error)}`,e.label)}async function ys(e){for(;;){let t=await e.prompter.text({message:e.message,placeholder:e.placeholder,initialValue:e.existing[0]?String(e.existing[0]):void 0,validate:e=>String(e??``).trim()?void 0:`Required`}),n=e.parseInputs(String(t));if(!e.token){let t=n.map(e.parseId).filter(Boolean);if(t.length!==n.length){await e.prompter.note(e.invalidWithoutTokenNote,e.label);continue}return I(e.existing,t)}let r=await e.resolveEntries({token:e.token,entries:n}).catch(()=>null);if(!r){await e.prompter.note(`Failed to resolve usernames. Try again.`,e.label);continue}let i=r.filter(e=>!e.resolved||!e.id);if(i.length>0){await e.prompter.note(`Could not resolve: ${i.map(e=>e.input).join(`, `)}`,e.label);continue}let a=r.map(e=>e.id);return I(e.existing,a)}}async function bs(e){await e.prompter.note(e.noteLines.join(`
|
package/dist/plugin-sdk/irc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as e,G as t,H as n,J as r,Q as i,V as a,Z as o,q as s}from"./dispatch-
|
|
1
|
+
import{B as e,G as t,H as n,J as r,Q as i,V as a,Z as o,q as s}from"./dispatch-_3aPMKVc.js";import{Rt as c,zt as l}from"./paths-BMI3JiOI.js";import{Ba as u,Cc as d,Sc as f,ac as p,cc as m,dc as h,io as ee,lc as te,nc as g,oc as _,sc as v,uc as y,vc as b,wc as x}from"./model-auth-BbZAgf5F.js";import"./logger-D7NYTfYR.js";import"./paths-DumT91r9.js";import"./proxy-env-Bz2Z8zYd.js";import"./github-copilot-token-B-n-jIjX.js";import"./send-CbKUBgfD.js";import{At as S,Nt as C,jt as w,kt as T}from"./send-BRcOy7d-.js";import"./send-wZQahIxo.js";import"./deliver-BOhWRuAc.js";import"./diagnostic-DVLBFxSl.js";import"./pi-model-discovery-DPml1ezH.js";import"./audio-transcription-runner-DnUZA3zd.js";import"./image-YjdiaYzj.js";import"./fetch-guard-Ddmjnr9q.js";import"./api-key-rotation-D5VrjOf1.js";import"./local-roots-D2BFeJX5.js";import"./proxy-fetch-nA0PxLDm.js";import"./tokens-CSkDa5HP.js";import"./commands-registry-BmTuvGJF.js";import"./ir-lBa1tN3e.js";import"./render-CC0AV0OP.js";import"./target-errors-D2mtlQc6.js";import"./send-DISaNhwJ.js";import"./outbound-attachment-C-WNUYRe.js";import"./fetch-C-3ngqxG.js";import"./send-B6p34YOy.js";import"./sqlite-C8QKImip.js";import"./channel-activity-CGpLziCG.js";import"./tables-7iwXnKB3.js";import"./fetch-D36SsL31.js";import"./skill-commands-Bv_AgJSD.js";import"./manager-BAawai7j.js";import{z as E}from"zod";import{format as D}from"node:util";const O=E.union([E.string(),E.number()]);E.array(O).optional();function k(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}const A={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},j=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],M=[...new Set(Object.values(A).flatMap(e=>e))];[...new Set([...M,...j])];async function N(e){let t=e.listAccountIds(e.cfg),n=e.currentId?.trim()||e.defaultAccountId||`default`,r=await e.prompter.select({message:`${e.label} account`,options:[...t.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:n});if(r!==`__new__`)return l(r);let i=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),a=l(String(i));return String(i).trim()!==a&&await e.prompter.note(`Normalized account id to "${a}".`,`${e.label} account`),a}function P(e){let t=l(e.accountId),n=e.cfg.channels?.[e.channelKey],r=typeof n==`object`&&n?n:void 0,i=e.ensureChannelEnabled??!0,a=e.ensureAccountEnabled??i,o=e.patch,s=e.accountPatch??o;if(t===`default`)return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},...o}}};let c=r?.accounts??{},u=c[t]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},accounts:{...c,[t]:{...u,...a?{enabled:typeof u.enabled==`boolean`?u.enabled:!0}:{},...s}}}}}}const F=async e=>await N(e);function I(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function L(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}async function R(e){let t=e.accountOverride?.trim(),n=t?l(t):e.defaultAccountId;return e.shouldPromptAccountIds&&!t&&(n=await F({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:n,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),n}function z(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},allowFrom:e.allowFrom}}}}function ne(e){let t=e.cfg.channels?.[e.channel]??{},n=e.getAllowFrom?.(e.cfg)??t.allowFrom??void 0,r=e.dmPolicy===`open`?I(n):void 0;return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}}}}function B(e){return L(String(e??``))}function V(e){return e.map(e=>e.trim()).filter(Boolean).join(`, `)}async function H(e){let t=[{value:`allowlist`,label:`Allowlist (recommended)`}];e.allowOpen!==!1&&t.push({value:`open`,label:`Open (allow all channels)`}),e.allowDisabled!==!1&&t.push({value:`disabled`,label:`Disabled (block all channels)`});let n=e.currentPolicy??`allowlist`;return await e.prompter.select({message:`${e.label} access`,options:t,initialValue:n})}async function U(e){let t=e.currentEntries&&e.currentEntries.length>0?V(e.currentEntries):void 0;return B(await e.prompter.text({message:`${e.label} allowlist (comma-separated)`,placeholder:e.placeholder,initialValue:t}))}async function W(e){let t=(e.currentEntries??[]).length>0,n=e.defaultPrompt??!t;if(!await e.prompter.confirm({message:e.updatePrompt?`Update ${e.label} access?`:`Configure ${e.label} access?`,initialValue:n}))return null;let r=await H({prompter:e.prompter,label:e.label,currentPolicy:e.currentPolicy,allowOpen:e.allowOpen,allowDisabled:e.allowDisabled});return r===`allowlist`?{policy:r,entries:await U({prompter:e.prompter,label:e.label,currentEntries:e.currentEntries,placeholder:e.placeholder})}:{policy:r,entries:[]}}const G=`✅ OpenClaw access approved. Send a message to start chatting.`;function K(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function q(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?K(`expected config object`):Object.keys(e).length>0?K(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function J(e){return t=>{e.setStatus({accountId:e.accountId,...t})}}function Y(e,t){return new Promise((n,r)=>{let i=()=>{Promise.resolve(t?.()).then(()=>n(),r)};if(e){if(e.aborted){i();return}e.addEventListener(`abort`,i,{once:!0})}})}async function X(e){let t=await e.start();try{await Y(e.abortSignal)}finally{await e.stop?.(t),await e.onStop?.()}}function Z(e){let t=l(e.accountId);return{accountId:t,readAllowFromStore:()=>e.core.channel.pairing.readAllowFromStore({channel:e.channel,accountId:t}),readStoreForDmPolicy:(t,n)=>e.core.channel.pairing.readAllowFromStore({channel:t,accountId:l(n)}),upsertPairingRequest:n=>e.core.channel.pairing.upsertPairingRequest({channel:e.channel,accountId:t,...n})}}function re(e){return{text:typeof e.text==`string`?e.text:void 0,mediaUrls:Array.isArray(e.mediaUrls)?e.mediaUrls.filter(e=>typeof e==`string`&&e.length>0):void 0,mediaUrl:typeof e.mediaUrl==`string`?e.mediaUrl:void 0,replyToId:typeof e.replyToId==`string`?e.replyToId:void 0}}function Q(e){return async t=>{await e(t&&typeof t==`object`?re(t):{})}}function ie(e){return e.mediaUrls?.length?e.mediaUrls:e.mediaUrl?[e.mediaUrl]:[]}function ae(e,t){let n=e?.trim()??``;if(!n&&t.length===0)return``;let r=t.length?t.map(e=>`Attachment: ${e}`).join(`
|
|
2
2
|
`):``;return n?r?`${n}\n\n${r}`:n:r}function oe(e){return{cfg:e.cfg,channel:e.channel,accountId:e.accountId,agentId:e.route.agentId,routeSessionKey:e.route.sessionKey,storePath:e.storePath,ctxPayload:e.ctxPayload,recordInboundSession:e.core.channel.session.recordInboundSession,dispatchReplyWithBufferedBlockDispatcher:e.core.channel.reply.dispatchReplyWithBufferedBlockDispatcher}}async function se(e){await ce({...oe(e),deliver:e.deliver,onRecordError:e.onRecordError,onDispatchError:e.onDispatchError,replyOptions:e.replyOptions})}async function ce(e){await e.recordInboundSession({storePath:e.storePath,sessionKey:e.ctxPayload.SessionKey??e.routeSessionKey,ctx:e.ctxPayload,onRecordError:e.onRecordError});let{onModelSelected:t,...n}=r({cfg:e.cfg,agentId:e.agentId,channel:e.channel,accountId:e.accountId}),i=Q(e.deliver);await e.dispatchReplyWithBufferedBlockDispatcher({ctx:e.ctxPayload,cfg:e.cfg,dispatcherOptions:{...n,deliver:i,onError:e.onDispatchError},replyOptions:{...e.replyOptions,onModelSelected:t}})}function le(e){return{log:(...t)=>{e.logger.info(D(...t))},error:(...t)=>{e.logger.error(D(...t))},exit:t=>{throw e.exitError?.(t)??Error(`exit ${t}`)}}}function $(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function ue(e){let{account:t,runtime:n,probe:r}=e;return{accountId:t.accountId,name:t.name,enabled:t.enabled,configured:t.configured,...de({runtime:n,probe:r}),lastInboundAt:n?.lastInboundAt??null,lastOutboundAt:n?.lastOutboundAt??null}}function de(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}export{p as BlockStreamingCoalesceSchema,c as DEFAULT_ACCOUNT_ID,_ as DmConfigSchema,v as DmPolicySchema,T as GROUP_POLICY_BLOCKED_LABEL,m as GroupPolicySchema,te as MarkdownConfigSchema,G as PAIRING_APPROVED_MESSAGE,y as ReplyRuntimeConfigSchemaShape,u as ToolPolicySchema,I as addWildcardAllowFrom,ue as buildBaseAccountStatusSnapshot,$ as buildBaseChannelStatusSummary,k as buildChannelConfigSchema,f as createAccountListHelpers,J as createAccountStatusSink,le as createLoggerBackedRuntime,Q as createNormalizedOutboundDeliverer,r as createReplyPrefixOptions,Z as createScopedPairingAccess,d as deleteAccountFromConfigSection,se as dispatchInboundReplyWithBase,q as emptyPluginConfigSchema,a as formatDocsLink,g as formatPairingApproveHint,ae as formatTextWithAttachmentLinks,ee as getChatChannelMeta,s as isDangerousNameMatchingEnabled,e as issuePairingChallenge,o as logInboundDrop,b as normalizeResolvedSecretInputString,P as patchScopedAccountConfig,F as promptAccountId,W as promptChannelAccessConfig,n as readStoreAllowFromForDmPolicy,h as requireOpenAllowFrom,R as resolveAccountIdForConfigure,S as resolveAllowlistProviderRuntimeGroupPolicy,i as resolveControlCommandGate,w as resolveDefaultGroupPolicy,t as resolveEffectiveAllowFromLists,ie as resolveOutboundMediaUrls,X as runPassiveAccountLifecycle,x as setAccountEnabledInConfigSection,z as setTopLevelChannelAllowFrom,ne as setTopLevelChannelDmPolicyWithAllowFrom,C as warnMissingProviderGroupPolicyFallbackOnce};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Dt as e,Ot as t,ft as n}from"./paths-Ck_GIp7q.js";import"./utils-CfTrvEp0.js";import"./paths-D_Oppcui.js";import{As as r,Bi as i,Cs as a,Ds as o,Es as s,Fs as c,Is as l,Ls as u,Ms as d,Ni as f,Os as p,Ps as m,bc as h,dc as g,ic as _,ks as v,sa as y,sc as ee,uc as te}from"./model-auth-BJBZCtjT.js";import{d as ne,f as re,h as ie,l as ae,o as oe}from"./target-errors-BOqeJ_3F.js";import{$ as b,G as x,H as S,J as C,Q as w,U as T,Y as E,at as D,et as O,it as k,m as A,n as j,nt as M,ot as N,q as P,rt as F,t as I,tt as L}from"./dispatch
|
|
1
|
+
import{Dt as e,Ot as t,ft as n}from"./paths-Ck_GIp7q.js";import"./utils-CfTrvEp0.js";import"./paths-D_Oppcui.js";import{As as r,Bi as i,Cs as a,Ds as o,Es as s,Fs as c,Is as l,Ls as u,Ms as d,Ni as f,Os as p,Ps as m,bc as h,dc as g,ic as _,ks as v,sa as y,sc as ee,uc as te}from"./model-auth-BJBZCtjT.js";import{d as ne,f as re,h as ie,l as ae,o as oe}from"./target-errors-BOqeJ_3F.js";import{$ as b,G as x,H as S,J as C,Q as w,U as T,Y as E,at as D,et as O,it as k,m as A,n as j,nt as M,ot as N,q as P,rt as F,t as I,tt as L}from"./dispatch--4Vuy9oL.js";import{ct as R,lt as z}from"./send-CO2UHcEv.js";import{At as B,Dt as V,It as H,Mt as U,Pt as W,Rt as G,jt as K,kt as q}from"./send-DE5nZ2st.js";import"./proxy-env-BnKSJOGR.js";import"./github-copilot-token-DmcuLuc7.js";import"./send-BUrpCp2y.js";import{t as se}from"./fetch-guard-BSsJgDhB.js";import"./deliver-VMHoHBzn.js";import"./diagnostic-DVzH_MLb.js";import"./pi-model-discovery-Db7ABtcq.js";import"./audio-transcription-runner-DhJf4m1B.js";import"./image-D2kjZFi6.js";import"./api-key-rotation-CDbYWBVm.js";import"./local-roots-BH5tSQLl.js";import"./proxy-fetch-o_y6bhRh.js";import"./tokens-Bh7fgb-2.js";import"./commands-registry-CqcYbN0q.js";import"./ir-BtYOx2uz.js";import"./render-DhTJXP1U.js";import"./send-B31irjnU.js";import"./outbound-attachment-Fq-8ay7E.js";import"./fetch-p43DsBwY.js";import"./send-ITDY5IkL.js";import"./sqlite-DcxSH4wB.js";import"./channel-activity-Dka0S6Hm.js";import"./tables-B-mnbiT0.js";import"./fetch-BmdDzZ-O.js";import"./skill-commands-B75FKFYa.js";import"./manager-uBkiNkiS.js";import{format as J}from"node:util";import{z as Y}from"zod";const ce=Y.union([Y.string(),Y.number()]);Y.array(ce).optional();function le(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}const X={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},ue=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],de=[...new Set(Object.values(X).flatMap(e=>e))];[...new Set([...de,...ue])];function fe(e){return e instanceof Error&&typeof e.message==`string`&&e.message.trim()?e.message:String(e)}function pe(e){return X[e]?.find(e=>e.trim().length>0)}function me(e){return`/providers/${i(e)}/apiKey`}async function he(e){let t=e.preferredEnvVar??pe(e.provider)??``,n=me(e.provider),i=`env`;for(;;){let a=await e.prompter.select({message:e.copy?.sourceMessage??`Where is this API key stored?`,initialValue:i,options:[{value:`env`,label:`Environment variable`,hint:`Reference a variable from your runtime environment`},{value:`provider`,label:`Configured secret provider`,hint:`Use a configured file or exec secret provider`}]})===`provider`?`provider`:`env`;if(i=a,a===`env`){let n=await e.prompter.text({message:e.copy?.envVarMessage??`Environment variable name`,initialValue:t||void 0,placeholder:e.copy?.envVarPlaceholder??`OPENAI_API_KEY`,validate:t=>{let n=t.trim();if(!c(n))return e.copy?.envVarFormatError??`Use an env var name like "OPENAI_API_KEY" (uppercase letters, numbers, underscores).`;if(!process.env[n]?.trim())return e.copy?.envVarMissingError?.(n)??`Environment variable "${n}" is missing or empty in this session.`}}),i=String(n??``).trim(),a=i&&c(i)?i:t;if(!a)throw Error(`No valid environment variable name provided for provider "${e.provider}".`);let o={source:`env`,provider:r(e.config,`env`,{preferFirstProviderForSource:!0}),id:a},s=await f(o,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.envValidatedMessage?.(a)??`Validated environment variable ${a}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:o,resolvedValue:s}}let s=Object.entries(e.config.secrets?.providers??{}).filter(([,e])=>e?.source===`file`||e?.source===`exec`);if(s.length===0){await e.prompter.note(e.copy?.noProvidersMessage??`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`,`No providers configured`);continue}let l=r(e.config,`file`,{preferFirstProviderForSource:!0}),u=await e.prompter.select({message:`Select secret provider`,initialValue:s.find(([e])=>e===l)?.[0]??s[0]?.[0],options:s.map(([e,t])=>({value:e,label:e,hint:t?.source===`exec`?`Exec provider`:`File provider`}))}),d=e.config.secrets?.providers?.[u];if(!d||d.source!==`file`&&d.source!==`exec`){await e.prompter.note(`Provider "${u}" is not a file/exec provider.`,`Invalid provider`);continue}let m=d.source===`file`?`Secret id (JSON pointer for json mode, or 'value' for singleValue mode)`:`Secret id for the exec provider`,h=d.source===`file`?d.mode===`singleValue`?`value`:n:`${e.provider}/apiKey`,g=await e.prompter.text({message:m,initialValue:h,placeholder:d.source===`file`?`/providers/openai/apiKey`:`openai/api-key`,validate:e=>{let t=e.trim();if(!t)return`Secret id cannot be empty.`;if(d.source===`file`&&d.mode!==`singleValue`&&!v(t))return`Use an absolute JSON pointer like "/providers/openai/apiKey".`;if(d.source===`file`&&d.mode===`singleValue`&&t!==`value`)return`singleValue mode expects id "value".`;if(d.source===`exec`&&!p(t))return o()}}),_=String(g??``).trim()||h,y={source:d.source,provider:u,id:_};try{let t=await f(y,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.providerValidatedMessage?.(u,_,d.source)??`Validated ${d.source} reference ${u}:${_}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:y,resolvedValue:t}}catch(t){await e.prompter.note([`Could not validate provider reference ${u}:${_}.`,fe(t),`Check your provider configuration and try again.`].join(`
|
|
2
2
|
`),`Reference check failed`)}}}async function ge(e){return e.explicitMode?e.explicitMode:typeof e.prompter.select==`function`&&await e.prompter.select({message:e.copy?.modeMessage??`How do you want to provide this API key?`,initialValue:`plaintext`,options:[{value:`plaintext`,label:e.copy?.plaintextLabel??`Paste API key now`,hint:e.copy?.plaintextHint??`Stores the key directly in OpenClaw config`},{value:`ref`,label:e.copy?.refLabel??`Use external secret provider`,hint:e.copy?.refHint??`Stores a reference to env or configured external secret providers`}]})===`ref`?`ref`:`plaintext`}function _e(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function ve(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:_e(e.cfg,e.channelKey)}function ye(e){let n=e.name?.trim();if(!n)return e.cfg;let r=t(e.accountId),i=e.cfg.channels?.[e.channelKey],a=typeof i==`object`&&i?i:void 0;if(!ve({cfg:e.cfg,channelKey:e.channelKey,accountId:r,alwaysUseAccounts:e.alwaysUseAccounts})&&r===`default`){let t=a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...t,name:n}}}}let o=a?.accounts??{},s=o[r]??{},c=r===`default`?(({name:e,...t})=>t)(a??{}):a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...o,[r]:{...s,name:n}}}}}}function be(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function xe(e,t){let n=[...e??[],...t].map(e=>String(e).trim()).filter(Boolean);return[...new Set(n)]}function Se(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function Ce(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},groupPolicy:e.groupPolicy}}}}function we(e){return{accountConfigured:e.accountConfigured,hasConfigToken:e.hasConfigToken,canUseEnv:e.allowEnv&&!!e.envValue?.trim()&&!e.hasConfigToken}}async function Te(e){let t=async()=>String(await e.prompter.text({message:e.inputPrompt,validate:e=>e?.trim()?void 0:`Required`})).trim();return e.canUseEnv?await e.prompter.confirm({message:e.envPrompt,initialValue:!0})?{useEnv:!0,token:null}:{useEnv:!1,token:await t()}:e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0})?{useEnv:!1,token:null}:{useEnv:!1,token:await t()}}async function Ee(e){if(await ge({prompter:e.prompter,explicitMode:e.secretInputMode,copy:{modeMessage:`How do you want to provide this ${e.credentialLabel}?`,plaintextLabel:`Enter ${e.credentialLabel}`,plaintextHint:`Stores the credential directly in OpenClaw config`,refLabel:`Use external secret provider`,refHint:`Stores a reference to env or configured external secret providers`}})===`plaintext`){let t=await Te({prompter:e.prompter,accountConfigured:e.accountConfigured,canUseEnv:e.canUseEnv,hasConfigToken:e.hasConfigToken,envPrompt:e.envPrompt,keepPrompt:e.keepPrompt,inputPrompt:e.inputPrompt});return t.useEnv?{action:`use-env`}:t.token?{action:`set`,value:t.token,resolvedValue:t.token}:{action:`keep`}}if(e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0}))return{action:`keep`};let t=await he({provider:e.providerHint,config:e.cfg,prompter:e.prompter,preferredEnvVar:e.preferredEnvVar,copy:{sourceMessage:`Where is this ${e.credentialLabel} stored?`,envVarPlaceholder:e.preferredEnvVar??`OPENCLAW_SECRET`,envVarFormatError:`Use an env var name like "OPENCLAW_SECRET" (uppercase letters, numbers, underscores).`,noProvidersMessage:`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`}});return{action:`set`,value:t.ref,resolvedValue:t.resolvedValue}}function De(e){return Se(String(e??``))}function Oe(e){return e.map(e=>e.trim()).filter(Boolean).join(`, `)}async function ke(e){let t=[{value:`allowlist`,label:`Allowlist (recommended)`}];e.allowOpen!==!1&&t.push({value:`open`,label:`Open (allow all channels)`}),e.allowDisabled!==!1&&t.push({value:`disabled`,label:`Disabled (block all channels)`});let n=e.currentPolicy??`allowlist`;return await e.prompter.select({message:`${e.label} access`,options:t,initialValue:n})}async function Ae(e){let t=e.currentEntries&&e.currentEntries.length>0?Oe(e.currentEntries):void 0;return De(await e.prompter.text({message:`${e.label} allowlist (comma-separated)`,placeholder:e.placeholder,initialValue:t}))}async function je(e){let t=(e.currentEntries??[]).length>0,n=e.defaultPrompt??!t;if(!await e.prompter.confirm({message:e.updatePrompt?`Update ${e.label} access?`:`Configure ${e.label} access?`,initialValue:n}))return null;let r=await ke({prompter:e.prompter,label:e.label,currentPolicy:e.currentPolicy,allowOpen:e.allowOpen,allowDisabled:e.allowDisabled});return r===`allowlist`?{policy:r,entries:await Ae({prompter:e.prompter,label:e.label,currentEntries:e.currentEntries,placeholder:e.placeholder})}:{policy:r,entries:[]}}const Me=`✅ OpenClaw access approved. Send a message to start chatting.`;function Ne(){let e=Y.string().regex(s,`Secret reference provider must match /^[a-z][a-z0-9_-]{0,63}$/ (example: "default").`);return Y.union([Y.string(),Y.discriminatedUnion(`source`,[Y.object({source:Y.literal(`env`),provider:e,id:Y.string().regex(d,`Env secret reference id must match /^[A-Z][A-Z0-9_]{0,127}$/ (example: "OPENAI_API_KEY").`)}),Y.object({source:Y.literal(`file`),provider:e,id:Y.string().refine(v,`File secret reference id must be an absolute JSON pointer (example: "/providers/openai/apiKey"), or "value" for singleValue mode.`)}),Y.object({source:Y.literal(`exec`),provider:e,id:Y.string().refine(p,o())})])])}function Z(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Pe(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?Z(`expected config object`):Object.keys(e).length>0?Z(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function Fe(e){let n=t(e.accountId);return{accountId:n,readAllowFromStore:()=>e.core.channel.pairing.readAllowFromStore({channel:e.channel,accountId:n}),readStoreForDmPolicy:(n,r)=>e.core.channel.pairing.readAllowFromStore({channel:n,accountId:t(r)}),upsertPairingRequest:t=>e.core.channel.pairing.upsertPairingRequest({channel:e.channel,accountId:n,...t})}}function Q(e){if(!(e.resolved.length===0&&e.unresolved.length===0))return[e.resolved.length>0?`Resolved: ${e.resolved.join(`, `)}`:void 0,e.unresolved.length>0?`Unresolved (kept as typed): ${e.unresolved.join(`, `)}`:void 0].filter(Boolean).join(`
|
|
3
3
|
`)}async function Ie(e){let[t]=e.argv;if(!t)return{code:1,stdout:``,stderr:`command is required`};try{let t=await h(e.argv,{timeoutMs:e.timeoutMs,cwd:e.cwd,env:e.env}),n=t.termination===`timeout`||t.termination===`no-output-timeout`;return{code:t.code??1,stdout:t.stdout,stderr:n?t.stderr||`command timed out after ${e.timeoutMs}ms`:t.stderr}}catch(e){return{code:1,stdout:``,stderr:e instanceof Error?e.message:String(e)}}}async function Le(e){return await I({dispatcher:e.dispatcher,onSettled:e.onSettled,run:()=>j({ctx:e.ctxPayload,cfg:e.cfg,dispatcher:e.dispatcher,replyOptions:e.replyOptions})})}function $(e){return{log:(...t)=>{e.logger.info(J(...t))},error:(...t)=>{e.logger.error(J(...t))},exit:t=>{throw e.exitError?.(t)??Error(`exit ${t}`)}}}function Re(e){return e.runtime??$(e)}function ze(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function Be(e,t){return{...ze(e),...t??{},probe:e.probe,lastProbeAt:e.lastProbeAt??null}}function Ve(e,t){return t.flatMap(t=>{let n=typeof t.lastError==`string`?t.lastError.trim():``;return n?[{channel:e,accountId:t.accountId,kind:`runtime`,message:`Channel error: ${n}`}]:[]})}export{e as DEFAULT_ACCOUNT_ID,B as GROUP_POLICY_BLOCKED_LABEL,a as MarkdownConfigSchema,Me as PAIRING_APPROVED_MESSAGE,y as ToolPolicySchema,be as addWildcardAllowFrom,ye as applyAccountNameToChannelSection,le as buildChannelConfigSchema,H as buildChannelKeyCandidates,Be as buildProbeChannelStatusSummary,Ne as buildSecretInputSchema,we as buildSingleChannelSecretPromptState,Ve as collectStatusIssuesFromLastError,F as compileAllowlist,_ as createAccountListHelpers,oe as createActionGate,$ as createLoggerBackedRuntime,E as createReplyPrefixOptions,Fe as createScopedPairingAccess,C as createTypingCallbacks,te as deleteAccountFromConfigSection,Le as dispatchReplyFromConfigWithSettledDispatcher,Pe as emptyPluginConfigSchema,V as evaluateGroupRouteAccessForPolicy,se as fetchWithSsrFGuard,k as formatAllowlistMatchMeta,S as formatDocsLink,R as formatLocationText,ee as formatPairingApproveHint,Q as formatResolvedUnresolvedNote,m as hasConfiguredSecretInput,P as issuePairingChallenge,ae as jsonResult,w as logInboundDrop,b as logTypingFailure,xe as mergeAllowFromEntries,L as mergeAllowlist,t as normalizeAccountId,l as normalizeResolvedSecretInputString,u as normalizeSecretInputString,n as normalizeStringEntries,je as promptChannelAccessConfig,Ee as promptSingleChannelSecretInput,ne as readNumberParam,re as readReactionParams,T as readStoreAllowFromForDmPolicy,ie as readStringParam,D as resolveAllowlistCandidates,N as resolveAllowlistMatchByCandidates,K as resolveAllowlistProviderRuntimeGroupPolicy,G as resolveChannelEntryMatch,O as resolveControlCommandGate,U as resolveDefaultGroupPolicy,x as resolveDmGroupAccessWithLists,A as resolveInboundSessionEnvelopeContext,Re as resolveRuntimeEnv,q as resolveSenderScopedGroupPolicy,Ie as runPluginCommandWithTimeout,g as setAccountEnabledInConfigSection,Ce as setTopLevelChannelGroupPolicy,M as summarizeMapping,z as toLocationContext,W as warnMissingProviderGroupPolicyFallbackOnce};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ft as e,It as t,bt as n,d as r,f as i,u as a}from"./paths-DHIowy7j.js";import"./paths-Ilv7GN3y.js";import{C as o}from"./logger-Bzsdb9ed.js";import{Oi as s,Qn as c,dc as l,gc as ee,lc as te,qa as ne,uc as re,yr as ie}from"./model-auth-m6awkcmr.js";import"./proxy-env-CjA5va0Q.js";import"./send-CJGwOpaf.js";import{At as ae,Bt as u,Lt as d,Mt as f,Nt as p,Rt as m,kt as h,zt as g}from"./send-DfKN3gPU.js";import{$ as _,G as v,H as y,K as b,Q as x,R as S,V as C,W as w,X as T,Z as E,at as D,dt as O,et as k,m as A,n as j,nt as M,ot as N,q as P,rt as F,st as I,t as L,tt as R,ut as z,z as B}from"./dispatch-BO5EIrCx.js";import{i as V,n as H}from"./tokens-D-G23Eih.js";import{P as U}from"./deliver-Cr9WnblM.js";import"./github-copilot-token-DjID6pAD.js";import{t as W}from"./fetch-guard-Ch-GE1q6.js";import{nt as G,rt as oe}from"./send-Jtkjjoez.js";import"./local-roots-cD4rtFUT.js";import{_ as K}from"./ir-C9bnqCN4.js";import"./diagnostic-D_z4RTdJ.js";import"./pi-model-discovery-BoCQComb.js";import"./audio-transcription-runner-C-1wfN5V.js";import"./image-CswbRypx.js";import"./api-key-rotation-ByGrFLLf.js";import"./proxy-fetch-DLkHTNrK.js";import"./commands-registry-sdEAg35R.js";import"./render-CC0AV0OP.js";import"./target-errors-CBtuprlS.js";import"./send-DUpWCxkR.js";import"./outbound-attachment-nHeYVKR0.js";import"./fetch-p43DsBwY.js";import"./send-BvX-weT-.js";import"./sqlite-nOhwJUyO.js";import"./channel-activity-CrUKMrr9.js";import"./tables-tvhhES0m.js";import"./fetch-p-KNjCrj.js";import"./skill-commands-D3NahROf.js";import"./manager-B6qIRY7W.js";import{z as q}from"zod";const se=q.union([q.string(),q.number()]);q.array(se).optional();function ce(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}const le={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},ue=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],de=[...new Set(Object.values(le).flatMap(e=>e))];[...new Set([...de,...ue])];function J(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function fe(e,t){let n=[...e??[],...t].map(e=>String(e).trim()).filter(Boolean);return[...new Set(n)]}function Y(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function pe(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},allowFrom:e.allowFrom}}}}function me(e){let t=e.cfg.channels?.[e.channel]??{},n=e.getAllowFrom?.(e.cfg)??t.allowFrom??void 0,r=e.dmPolicy===`open`?J(n):void 0;return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}}}}function he(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},groupPolicy:e.groupPolicy}}}}function ge(e){return Y(String(e??``))}function _e(e){return e.map(e=>e.trim()).filter(Boolean).join(`, `)}async function ve(e){let t=[{value:`allowlist`,label:`Allowlist (recommended)`}];e.allowOpen!==!1&&t.push({value:`open`,label:`Open (allow all channels)`}),e.allowDisabled!==!1&&t.push({value:`disabled`,label:`Disabled (block all channels)`});let n=e.currentPolicy??`allowlist`;return await e.prompter.select({message:`${e.label} access`,options:t,initialValue:n})}async function ye(e){let t=e.currentEntries&&e.currentEntries.length>0?_e(e.currentEntries):void 0;return ge(await e.prompter.text({message:`${e.label} allowlist (comma-separated)`,placeholder:e.placeholder,initialValue:t}))}async function be(e){let t=(e.currentEntries??[]).length>0,n=e.defaultPrompt??!t;if(!await e.prompter.confirm({message:e.updatePrompt?`Update ${e.label} access?`:`Configure ${e.label} access?`,initialValue:n}))return null;let r=await ve({prompter:e.prompter,label:e.label,currentPolicy:e.currentPolicy,allowOpen:e.allowOpen,allowDisabled:e.allowDisabled});return r===`allowlist`?{policy:r,entries:await ye({prompter:e.prompter,label:e.label,currentEntries:e.currentEntries,placeholder:e.placeholder})}:{policy:r,entries:[]}}const xe=`✅ OpenClaw access approved. Send a message to start chatting.`;function X(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Se(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?X(`expected config object`):Object.keys(e).length>0?X(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}async function Z(e){let{server:t,abortSignal:n,onAbort:r}=e,i=Promise.resolve(),a=!1,o=()=>{a||(a=!0,i=Promise.resolve(r?.()).then(()=>void 0))},s=()=>{o()};n&&(n.aborted?o():n.addEventListener(`abort`,s,{once:!0})),await new Promise(e=>{t.once(`close`,()=>e())}),n&&n.removeEventListener(`abort`,s),await i}async function Ce(e){return await L({dispatcher:e.dispatcher,onSettled:e.onSettled,run:()=>j({ctx:e.ctxPayload,cfg:e.cfg,dispatcher:e.dispatcher,replyOptions:e.replyOptions})})}async function we(e,t={}){return await K(e,{maxBytes:t.maxBytes,localRoots:t.mediaLocalRoots})}function Te(e){let n=t(e.accountId);return{accountId:n,readAllowFromStore:()=>e.core.channel.pairing.readAllowFromStore({channel:e.channel,accountId:n}),readStoreForDmPolicy:(n,r)=>e.core.channel.pairing.readAllowFromStore({channel:n,accountId:t(r)}),upsertPairingRequest:t=>e.core.channel.pairing.upsertPairingRequest({channel:e.channel,accountId:n,...t})}}function Ee(e){let t=e.trim().toLowerCase();return t?t===`*`||t===`*.`?`*`:t.replace(/^\*\.?/,``).replace(/^\.+/,``).replace(/\.+$/,``):``}function De(e,t){if(t.includes(`*`))return!0;let n=e.toLowerCase();return t.some(e=>n===e||n.endsWith(`.${e}`))}function Q(e,t){let n=e&&e.length>0?e:t;if(!n||n.length===0)return[];let r=n.map(Ee).filter(Boolean);return r.includes(`*`)?[`*`]:Array.from(new Set(r))}function Oe(e,t){try{let n=new URL(e);return n.protocol===`https:`?De(n.hostname,t):!1}catch{return!1}}function ke(e){let t=Q(e);if(t.length===0)return;let n=new Set;for(let e of t){if(e===`*`)return;n.add(e),n.add(`*.${e}`)}if(n.size!==0)return{hostnameAllowlist:Array.from(n)}}function Ae(e,t){return{accountId:e,running:!1,lastStartAt:null,lastStopAt:null,lastError:null,...t??{}}}function $(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function je(e,t){return{...$(e),...t??{},probe:e.probe,lastProbeAt:e.lastProbeAt??null}}function Me(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}export{e as DEFAULT_ACCOUNT_ID,F as DEFAULT_GROUP_HISTORY_LIMIT,w as DEFAULT_WEBHOOK_MAX_BODY_BYTES,s as MSTeamsConfigSchema,xe as PAIRING_APPROVED_MESSAGE,H as SILENT_REPLY_TOKEN,J as addWildcardAllowFrom,$ as buildBaseChannelStatusSummary,ce as buildChannelConfigSchema,d as buildChannelKeyCandidates,ke as buildHostnameAllowlistPolicyFromSuffixAllowlist,T as buildMediaPayload,D as buildPendingHistoryContextFromMap,je as buildProbeChannelStatusSummary,Me as buildRuntimeAccountStatusSnapshot,N as clearHistoryEntriesIfEnabled,Ae as createDefaultChannelRuntimeState,P as createReplyPrefixOptions,Te as createScopedPairingAccess,b as createTypingCallbacks,a as detectMime,Ce as dispatchReplyFromConfigWithSettledDispatcher,Se as emptyPluginConfigSchema,h as evaluateSenderGroupAccessForPolicy,r as extensionForMime,c as extractOriginalFilename,W as fetchWithSsrFGuard,z as formatAllowlistMatchMeta,S as formatDocsLink,i as getFileExtension,te as hasConfiguredSecretInput,v as isDangerousNameMatchingEnabled,Oe as isHttpsUrlAllowedByHostnameSuffixAllowlist,ie as isPrivateIpAddress,V as isSilentReplyText,Z as keepHttpServerTaskAlive,we as loadOutboundMediaFromUrl,K as loadWebMedia,x as logInboundDrop,_ as logTypingFailure,fe as mergeAllowFromEntries,R as mergeAllowlist,m as normalizeChannelSlug,Q as normalizeHostnameSuffixAllowlist,re as normalizeResolvedSecretInputString,l as normalizeSecretInputString,n as normalizeStringEntries,be as promptChannelAccessConfig,G as readJsonFileWithFallback,B as readStoreAllowFromForDmPolicy,I as recordPendingHistoryEntryIfEnabled,O as resolveAllowlistMatchSimple,f as resolveAllowlistProviderRuntimeGroupPolicy,g as resolveChannelEntryMatchWithFallback,U as resolveChannelMediaMaxBytes,k as resolveControlCommandGate,p as resolveDefaultGroupPolicy,C as resolveDmGroupAccessWithLists,y as resolveEffectiveAllowFromLists,A as resolveInboundSessionEnvelopeContext,E as resolveMentionGating,u as resolveNestedAllowlistDecision,ae as resolveSenderScopedGroupPolicy,ee as resolveToolsBySender,pe as setTopLevelChannelAllowFrom,me as setTopLevelChannelDmPolicyWithAllowFrom,he as setTopLevelChannelGroupPolicy,o as sleep,Y as splitOnboardingEntries,M as summarizeMapping,ne as withFileLock,oe as writeJsonFileAtomically};
|
|
1
|
+
import{Ft as e,It as t,bt as n,d as r,f as i,u as a}from"./paths-DHIowy7j.js";import"./paths-Ilv7GN3y.js";import{C as o}from"./logger-Bzsdb9ed.js";import{Oi as s,Qn as c,dc as l,gc as ee,lc as te,qa as ne,uc as re,yr as ie}from"./model-auth-m6awkcmr.js";import"./proxy-env-CjA5va0Q.js";import"./send-CJGwOpaf.js";import{At as ae,Bt as u,Lt as d,Mt as f,Nt as p,Rt as m,kt as h,zt as g}from"./send-DfKN3gPU.js";import{$ as _,G as v,H as y,K as b,Q as x,R as S,V as C,W as w,X as T,Z as E,at as D,dt as O,et as k,m as A,n as j,nt as M,ot as N,q as P,rt as F,st as I,t as L,tt as R,ut as z,z as B}from"./dispatch-DPafUBvi.js";import{i as V,n as H}from"./tokens-D-G23Eih.js";import{P as U}from"./deliver-Cr9WnblM.js";import"./github-copilot-token-DjID6pAD.js";import{t as W}from"./fetch-guard-Ch-GE1q6.js";import{nt as G,rt as oe}from"./send-Jtkjjoez.js";import"./local-roots-cD4rtFUT.js";import{_ as K}from"./ir-C9bnqCN4.js";import"./diagnostic-D_z4RTdJ.js";import"./pi-model-discovery-BoCQComb.js";import"./audio-transcription-runner-C-1wfN5V.js";import"./image-CswbRypx.js";import"./api-key-rotation-ByGrFLLf.js";import"./proxy-fetch-DLkHTNrK.js";import"./commands-registry-sdEAg35R.js";import"./render-CC0AV0OP.js";import"./target-errors-CBtuprlS.js";import"./send-DUpWCxkR.js";import"./outbound-attachment-nHeYVKR0.js";import"./fetch-p43DsBwY.js";import"./send-BvX-weT-.js";import"./sqlite-nOhwJUyO.js";import"./channel-activity-CrUKMrr9.js";import"./tables-tvhhES0m.js";import"./fetch-p-KNjCrj.js";import"./skill-commands-D3NahROf.js";import"./manager-B6qIRY7W.js";import{z as q}from"zod";const se=q.union([q.string(),q.number()]);q.array(se).optional();function ce(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}const le={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},ue=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],de=[...new Set(Object.values(le).flatMap(e=>e))];[...new Set([...de,...ue])];function J(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function fe(e,t){let n=[...e??[],...t].map(e=>String(e).trim()).filter(Boolean);return[...new Set(n)]}function Y(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function pe(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},allowFrom:e.allowFrom}}}}function me(e){let t=e.cfg.channels?.[e.channel]??{},n=e.getAllowFrom?.(e.cfg)??t.allowFrom??void 0,r=e.dmPolicy===`open`?J(n):void 0;return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}}}}function he(e){let t=e.cfg.channels?.[e.channel]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,...e.enabled?{enabled:!0}:{},groupPolicy:e.groupPolicy}}}}function ge(e){return Y(String(e??``))}function _e(e){return e.map(e=>e.trim()).filter(Boolean).join(`, `)}async function ve(e){let t=[{value:`allowlist`,label:`Allowlist (recommended)`}];e.allowOpen!==!1&&t.push({value:`open`,label:`Open (allow all channels)`}),e.allowDisabled!==!1&&t.push({value:`disabled`,label:`Disabled (block all channels)`});let n=e.currentPolicy??`allowlist`;return await e.prompter.select({message:`${e.label} access`,options:t,initialValue:n})}async function ye(e){let t=e.currentEntries&&e.currentEntries.length>0?_e(e.currentEntries):void 0;return ge(await e.prompter.text({message:`${e.label} allowlist (comma-separated)`,placeholder:e.placeholder,initialValue:t}))}async function be(e){let t=(e.currentEntries??[]).length>0,n=e.defaultPrompt??!t;if(!await e.prompter.confirm({message:e.updatePrompt?`Update ${e.label} access?`:`Configure ${e.label} access?`,initialValue:n}))return null;let r=await ve({prompter:e.prompter,label:e.label,currentPolicy:e.currentPolicy,allowOpen:e.allowOpen,allowDisabled:e.allowDisabled});return r===`allowlist`?{policy:r,entries:await ye({prompter:e.prompter,label:e.label,currentEntries:e.currentEntries,placeholder:e.placeholder})}:{policy:r,entries:[]}}const xe=`✅ OpenClaw access approved. Send a message to start chatting.`;function X(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Se(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?X(`expected config object`):Object.keys(e).length>0?X(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}async function Z(e){let{server:t,abortSignal:n,onAbort:r}=e,i=Promise.resolve(),a=!1,o=()=>{a||(a=!0,i=Promise.resolve(r?.()).then(()=>void 0))},s=()=>{o()};n&&(n.aborted?o():n.addEventListener(`abort`,s,{once:!0})),await new Promise(e=>{t.once(`close`,()=>e())}),n&&n.removeEventListener(`abort`,s),await i}async function Ce(e){return await L({dispatcher:e.dispatcher,onSettled:e.onSettled,run:()=>j({ctx:e.ctxPayload,cfg:e.cfg,dispatcher:e.dispatcher,replyOptions:e.replyOptions})})}async function we(e,t={}){return await K(e,{maxBytes:t.maxBytes,localRoots:t.mediaLocalRoots})}function Te(e){let n=t(e.accountId);return{accountId:n,readAllowFromStore:()=>e.core.channel.pairing.readAllowFromStore({channel:e.channel,accountId:n}),readStoreForDmPolicy:(n,r)=>e.core.channel.pairing.readAllowFromStore({channel:n,accountId:t(r)}),upsertPairingRequest:t=>e.core.channel.pairing.upsertPairingRequest({channel:e.channel,accountId:n,...t})}}function Ee(e){let t=e.trim().toLowerCase();return t?t===`*`||t===`*.`?`*`:t.replace(/^\*\.?/,``).replace(/^\.+/,``).replace(/\.+$/,``):``}function De(e,t){if(t.includes(`*`))return!0;let n=e.toLowerCase();return t.some(e=>n===e||n.endsWith(`.${e}`))}function Q(e,t){let n=e&&e.length>0?e:t;if(!n||n.length===0)return[];let r=n.map(Ee).filter(Boolean);return r.includes(`*`)?[`*`]:Array.from(new Set(r))}function Oe(e,t){try{let n=new URL(e);return n.protocol===`https:`?De(n.hostname,t):!1}catch{return!1}}function ke(e){let t=Q(e);if(t.length===0)return;let n=new Set;for(let e of t){if(e===`*`)return;n.add(e),n.add(`*.${e}`)}if(n.size!==0)return{hostnameAllowlist:Array.from(n)}}function Ae(e,t){return{accountId:e,running:!1,lastStartAt:null,lastStopAt:null,lastError:null,...t??{}}}function $(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function je(e,t){return{...$(e),...t??{},probe:e.probe,lastProbeAt:e.lastProbeAt??null}}function Me(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}export{e as DEFAULT_ACCOUNT_ID,F as DEFAULT_GROUP_HISTORY_LIMIT,w as DEFAULT_WEBHOOK_MAX_BODY_BYTES,s as MSTeamsConfigSchema,xe as PAIRING_APPROVED_MESSAGE,H as SILENT_REPLY_TOKEN,J as addWildcardAllowFrom,$ as buildBaseChannelStatusSummary,ce as buildChannelConfigSchema,d as buildChannelKeyCandidates,ke as buildHostnameAllowlistPolicyFromSuffixAllowlist,T as buildMediaPayload,D as buildPendingHistoryContextFromMap,je as buildProbeChannelStatusSummary,Me as buildRuntimeAccountStatusSnapshot,N as clearHistoryEntriesIfEnabled,Ae as createDefaultChannelRuntimeState,P as createReplyPrefixOptions,Te as createScopedPairingAccess,b as createTypingCallbacks,a as detectMime,Ce as dispatchReplyFromConfigWithSettledDispatcher,Se as emptyPluginConfigSchema,h as evaluateSenderGroupAccessForPolicy,r as extensionForMime,c as extractOriginalFilename,W as fetchWithSsrFGuard,z as formatAllowlistMatchMeta,S as formatDocsLink,i as getFileExtension,te as hasConfiguredSecretInput,v as isDangerousNameMatchingEnabled,Oe as isHttpsUrlAllowedByHostnameSuffixAllowlist,ie as isPrivateIpAddress,V as isSilentReplyText,Z as keepHttpServerTaskAlive,we as loadOutboundMediaFromUrl,K as loadWebMedia,x as logInboundDrop,_ as logTypingFailure,fe as mergeAllowFromEntries,R as mergeAllowlist,m as normalizeChannelSlug,Q as normalizeHostnameSuffixAllowlist,re as normalizeResolvedSecretInputString,l as normalizeSecretInputString,n as normalizeStringEntries,be as promptChannelAccessConfig,G as readJsonFileWithFallback,B as readStoreAllowFromForDmPolicy,I as recordPendingHistoryEntryIfEnabled,O as resolveAllowlistMatchSimple,f as resolveAllowlistProviderRuntimeGroupPolicy,g as resolveChannelEntryMatchWithFallback,U as resolveChannelMediaMaxBytes,k as resolveControlCommandGate,p as resolveDefaultGroupPolicy,C as resolveDmGroupAccessWithLists,y as resolveEffectiveAllowFromLists,A as resolveInboundSessionEnvelopeContext,E as resolveMentionGating,u as resolveNestedAllowlistDecision,ae as resolveSenderScopedGroupPolicy,ee as resolveToolsBySender,pe as setTopLevelChannelAllowFrom,me as setTopLevelChannelDmPolicyWithAllowFrom,he as setTopLevelChannelGroupPolicy,o as sleep,Y as splitOnboardingEntries,M as summarizeMapping,ne as withFileLock,oe as writeJsonFileAtomically};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,H as r,J as i,K as a,R as o,V as s,Y as c,et as l,q as u,z as d}from"./dispatch-
|
|
1
|
+
import{$ as e,B as t,G as n,H as r,J as i,K as a,R as o,V as s,Y as c,et as l,q as u,z as d}from"./dispatch-v8f5j6tA.js";import{At as f,Ft as p,It as ee,Lt as te,Nt as ne,Ot as re,Rt as m,jt as h,kt as g}from"./send-Bb-c2Wfw.js";import{Rt as _,zt as v}from"./paths-DJeQBg0P.js";import{An as ie,Bn as ae,Dc as y,Ec as oe,Mc as se,Nc as ce,Oc as le,Pc as ue,Sc as b,Ss as de,Wa as fe,bc as x,dc as S,fa as C,fc as w,hc as T,jn as E,kc as D,lc as O,mc as k,oc as A,pc as j,pr as M,uc as N,vc as P,wc as F,xc as I,ya as L,yc as R}from"./model-auth-dsGPdWPW.js";import"./logger-DeJtHfIZ.js";import"./paths-BAheUa28.js";import"./proxy-env-B8lWNmLK.js";import"./github-copilot-token-Be6rNfqm.js";import"./send-B1GxVX6l.js";import{t as z}from"./fetch-guard-PzaEpcQ7.js";import{nt as B,rt as V}from"./send-CwkiYqPX.js";import"./deliver-BxZhcYJx.js";import"./diagnostic-BwtamUsr.js";import"./pi-model-discovery-CqWtTmQH.js";import"./audio-transcription-runner-aZJ9cNlA.js";import"./image-DD04cXIg.js";import"./api-key-rotation-CsGG9jhG.js";import"./local-roots-DUN2ttYv.js";import"./proxy-fetch--DcTyl5K.js";import"./tokens-_Nmie3Ug.js";import"./commands-registry-Dw8t__8o.js";import"./ir-DLYol2vv.js";import"./render-CC0AV0OP.js";import"./target-errors-BTSekDWl.js";import"./send-V3uD9QA4.js";import"./outbound-attachment-nlK2LbIg.js";import"./fetch-rIayI79w.js";import"./send-CRV-DPpI.js";import"./sqlite-DnpnF8rT.js";import"./channel-activity-Bco4vhqQ.js";import"./tables-CsIFrUA3.js";import"./fetch-B0zJKaR8.js";import"./skill-commands-BGdnhkBW.js";import"./manager-Bpp6SEQN.js";import{z as H}from"zod";import{format as U}from"node:util";const pe=H.union([H.string(),H.number()]);H.array(pe).optional();function me(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}const W={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},he=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],ge=[...new Set(Object.values(W).flatMap(e=>e))];[...new Set([...ge,...he])];function _e(e){return e instanceof Error&&typeof e.message==`string`&&e.message.trim()?e.message:String(e)}function ve(e){return W[e]?.find(e=>e.trim().length>0)}function ye(e){return`/providers/${L(e)}/apiKey`}async function be(e){let t=e.preferredEnvVar??ve(e.provider)??``,n=ye(e.provider),r=`env`;for(;;){let i=await e.prompter.select({message:e.copy?.sourceMessage??`Where is this API key stored?`,initialValue:r,options:[{value:`env`,label:`Environment variable`,hint:`Reference a variable from your runtime environment`},{value:`provider`,label:`Configured secret provider`,hint:`Use a configured file or exec secret provider`}]})===`provider`?`provider`:`env`;if(r=i,i===`env`){let n=await e.prompter.text({message:e.copy?.envVarMessage??`Environment variable name`,initialValue:t||void 0,placeholder:e.copy?.envVarPlaceholder??`OPENAI_API_KEY`,validate:t=>{let n=t.trim();if(!y(n))return e.copy?.envVarFormatError??`Use an env var name like "OPENAI_API_KEY" (uppercase letters, numbers, underscores).`;if(!process.env[n]?.trim())return e.copy?.envVarMissingError?.(n)??`Environment variable "${n}" is missing or empty in this session.`}}),r=String(n??``).trim(),i=r&&y(r)?r:t;if(!i)throw Error(`No valid environment variable name provided for provider "${e.provider}".`);let a={source:`env`,provider:b(e.config,`env`,{preferFirstProviderForSource:!0}),id:i},o=await C(a,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.envValidatedMessage?.(i)??`Validated environment variable ${i}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:a,resolvedValue:o}}let a=Object.entries(e.config.secrets?.providers??{}).filter(([,e])=>e?.source===`file`||e?.source===`exec`);if(a.length===0){await e.prompter.note(e.copy?.noProvidersMessage??`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`,`No providers configured`);continue}let o=b(e.config,`file`,{preferFirstProviderForSource:!0}),s=await e.prompter.select({message:`Select secret provider`,initialValue:a.find(([e])=>e===o)?.[0]??a[0]?.[0],options:a.map(([e,t])=>({value:e,label:e,hint:t?.source===`exec`?`Exec provider`:`File provider`}))}),c=e.config.secrets?.providers?.[s];if(!c||c.source!==`file`&&c.source!==`exec`){await e.prompter.note(`Provider "${s}" is not a file/exec provider.`,`Invalid provider`);continue}let l=c.source===`file`?`Secret id (JSON pointer for json mode, or 'value' for singleValue mode)`:`Secret id for the exec provider`,u=c.source===`file`?c.mode===`singleValue`?`value`:n:`${e.provider}/apiKey`,d=await e.prompter.text({message:l,initialValue:u,placeholder:c.source===`file`?`/providers/openai/apiKey`:`openai/api-key`,validate:e=>{let t=e.trim();if(!t)return`Secret id cannot be empty.`;if(c.source===`file`&&c.mode!==`singleValue`&&!I(t))return`Use an absolute JSON pointer like "/providers/openai/apiKey".`;if(c.source===`file`&&c.mode===`singleValue`&&t!==`value`)return`singleValue mode expects id "value".`;if(c.source===`exec`&&!x(t))return R()}}),f=String(d??``).trim()||u,p={source:c.source,provider:s,id:f};try{let t=await C(p,{config:e.config,env:process.env});return await e.prompter.note(e.copy?.providerValidatedMessage?.(s,f,c.source)??`Validated ${c.source} reference ${s}:${f}. OpenClaw will store a reference, not the key value.`,`Reference validated`),{ref:p,resolvedValue:t}}catch(t){await e.prompter.note([`Could not validate provider reference ${s}:${f}.`,_e(t),`Check your provider configuration and try again.`].join(`
|
|
2
2
|
`),`Reference check failed`)}}}async function xe(e){return e.explicitMode?e.explicitMode:typeof e.prompter.select==`function`&&await e.prompter.select({message:e.copy?.modeMessage??`How do you want to provide this API key?`,initialValue:`plaintext`,options:[{value:`plaintext`,label:e.copy?.plaintextLabel??`Paste API key now`,hint:e.copy?.plaintextHint??`Stores the key directly in OpenClaw config`},{value:`ref`,label:e.copy?.refLabel??`Use external secret provider`,hint:e.copy?.refHint??`Stores a reference to env or configured external secret providers`}]})===`ref`?`ref`:`plaintext`}async function Se(e){let t=e.listAccountIds(e.cfg),n=e.currentId?.trim()||e.defaultAccountId||`default`,r=await e.prompter.select({message:`${e.label} account`,options:[...t.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:n});if(r!==`__new__`)return v(r);let i=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),a=v(String(i));return String(i).trim()!==a&&await e.prompter.note(`Normalized account id to "${a}".`,`${e.label} account`),a}function Ce(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function we(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:Ce(e.cfg,e.channelKey)}function Te(e){let t=e.name?.trim();if(!t)return e.cfg;let n=v(e.accountId),r=e.cfg.channels?.[e.channelKey],i=typeof r==`object`&&r?r:void 0;if(!we({cfg:e.cfg,channelKey:e.channelKey,accountId:n,alwaysUseAccounts:e.alwaysUseAccounts})&&n===`default`){let n=i??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...n,name:t}}}}let a=i?.accounts??{},o=a[n]??{},s=n===`default`?(({name:e,...t})=>t)(i??{}):i??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...s,accounts:{...a,[n]:{...o,name:t}}}}}}function Ee(e){let t=v(e.accountId),n=e.cfg.channels?.[e.channelKey],r=typeof n==`object`&&n?n:void 0,i=e.ensureChannelEnabled??!0,a=e.ensureAccountEnabled??i,o=e.patch,s=e.accountPatch??o;if(t===`default`)return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},...o}}};let c=r?.accounts??{},l=c[t]??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...r,...i?{enabled:!0}:{},accounts:{...c,[t]:{...l,...a?{enabled:typeof l.enabled==`boolean`?l.enabled:!0}:{},...s}}}}}}const G=async e=>await Se(e);function K(e){let t=(e??[]).map(e=>String(e).trim()).filter(Boolean);return t.includes(`*`)||t.push(`*`),t}function De(e,t){let n=[...e??[],...t].map(e=>String(e).trim()).filter(Boolean);return[...new Set(n)]}async function Oe(e){let t=e.accountOverride?.trim(),n=t?v(t):e.defaultAccountId;return e.shouldPromptAccountIds&&!t&&(n=await G({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:n,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),n}function ke(e){let t=e.cfg.channels?.[e.channel]??{},n=e.getAllowFrom?.(e.cfg)??t.allowFrom??void 0,r=e.dmPolicy===`open`?K(n):void 0;return{...e.cfg,channels:{...e.cfg.channels,[e.channel]:{...t,dmPolicy:e.dmPolicy,...r?{allowFrom:r}:{}}}}}function q(e){return{accountConfigured:e.accountConfigured,hasConfigToken:e.hasConfigToken,canUseEnv:e.allowEnv&&!!e.envValue?.trim()&&!e.hasConfigToken}}async function Ae(e){let t=async()=>String(await e.prompter.text({message:e.inputPrompt,validate:e=>e?.trim()?void 0:`Required`})).trim();return e.canUseEnv?await e.prompter.confirm({message:e.envPrompt,initialValue:!0})?{useEnv:!0,token:null}:{useEnv:!1,token:await t()}:e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0})?{useEnv:!1,token:null}:{useEnv:!1,token:await t()}}async function je(e){let t=q({accountConfigured:e.accountConfigured,hasConfigToken:e.hasConfigToken,allowEnv:e.allowEnv,envValue:e.envValue});!t.accountConfigured&&e.onMissingConfigured&&await e.onMissingConfigured();let n=await J({cfg:e.cfg,prompter:e.prompter,providerHint:e.providerHint,credentialLabel:e.credentialLabel,secretInputMode:e.secretInputMode,accountConfigured:t.accountConfigured,canUseEnv:t.canUseEnv,hasConfigToken:t.hasConfigToken,envPrompt:e.envPrompt,keepPrompt:e.keepPrompt,inputPrompt:e.inputPrompt,preferredEnvVar:e.preferredEnvVar});return n.action===`use-env`?{cfg:e.applyUseEnv?await e.applyUseEnv(e.cfg):e.cfg,action:n.action,resolvedValue:e.envValue?.trim()||void 0}:n.action===`set`?{cfg:e.applySet?await e.applySet(e.cfg,n.value,n.resolvedValue):e.cfg,action:n.action,resolvedValue:n.resolvedValue}:{cfg:e.cfg,action:n.action}}async function J(e){if(await xe({prompter:e.prompter,explicitMode:e.secretInputMode,copy:{modeMessage:`How do you want to provide this ${e.credentialLabel}?`,plaintextLabel:`Enter ${e.credentialLabel}`,plaintextHint:`Stores the credential directly in OpenClaw config`,refLabel:`Use external secret provider`,refHint:`Stores a reference to env or configured external secret providers`}})===`plaintext`){let t=await Ae({prompter:e.prompter,accountConfigured:e.accountConfigured,canUseEnv:e.canUseEnv,hasConfigToken:e.hasConfigToken,envPrompt:e.envPrompt,keepPrompt:e.keepPrompt,inputPrompt:e.inputPrompt});return t.useEnv?{action:`use-env`}:t.token?{action:`set`,value:t.token,resolvedValue:t.token}:{action:`keep`}}if(e.hasConfigToken&&e.accountConfigured&&await e.prompter.confirm({message:e.keepPrompt,initialValue:!0}))return{action:`keep`};let t=await be({provider:e.providerHint,config:e.cfg,prompter:e.prompter,preferredEnvVar:e.preferredEnvVar,copy:{sourceMessage:`Where is this ${e.credentialLabel} stored?`,envVarPlaceholder:e.preferredEnvVar??`OPENCLAW_SECRET`,envVarFormatError:`Use an env var name like "OPENCLAW_SECRET" (uppercase letters, numbers, underscores).`,noProvidersMessage:`No file/exec secret providers are configured yet. Add one under secrets.providers, or select Environment variable.`}});return{action:`set`,value:t.ref,resolvedValue:t.resolvedValue}}function Me(){let e=H.string().regex(P,`Secret reference provider must match /^[a-z][a-z0-9_-]{0,63}$/ (example: "default").`);return H.union([H.string(),H.discriminatedUnion(`source`,[H.object({source:H.literal(`env`),provider:e,id:H.string().regex(F,`Env secret reference id must match /^[A-Z][A-Z0-9_]{0,127}$/ (example: "OPENAI_API_KEY").`)}),H.object({source:H.literal(`file`),provider:e,id:H.string().refine(I,`File secret reference id must be an absolute JSON pointer (example: "/providers/openai/apiKey"), or "value" for singleValue mode.`)}),H.object({source:H.literal(`exec`),provider:e,id:H.string().refine(x,R())})])])}function Y(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function Ne(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?Y(`expected config object`):Object.keys(e).length>0?Y(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function Pe(e){let t=v(e.accountId);return{accountId:t,readAllowFromStore:()=>e.core.channel.pairing.readAllowFromStore({channel:e.channel,accountId:t}),readStoreForDmPolicy:(t,n)=>e.core.channel.pairing.readAllowFromStore({channel:t,accountId:v(n)}),upsertPairingRequest:n=>e.core.channel.pairing.upsertPairingRequest({channel:e.channel,accountId:t,...n})}}const X={retries:{retries:6,factor:1.35,minTimeout:8,maxTimeout:180,randomize:!0},stale:6e4};function Fe(e){return{stale:e?.stale??X.stale,retries:{retries:e?.retries?.retries??X.retries.retries,factor:e?.retries?.factor??X.retries.factor,minTimeout:e?.retries?.minTimeout??X.retries.minTimeout,maxTimeout:e?.retries?.maxTimeout??X.retries.maxTimeout,randomize:e?.retries?.randomize??X.retries.randomize}}}function Z(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`number`&&Number.isFinite(r)&&r>0&&(t[n]=r);return t}function Q(e,t,n,r){if(n>0)for(let[r,i]of Object.entries(e))t-i>=n&&delete e[r];let i=Object.keys(e);i.length<=r||i.toSorted((t,n)=>e[t]-e[n]).slice(0,i.length-r).forEach(t=>{delete e[t]})}function Ie(e){let t=Math.max(0,Math.floor(e.ttlMs)),n=Math.max(0,Math.floor(e.memoryMaxSize)),r=Math.max(1,Math.floor(e.fileMaxEntries)),i=Fe(e.lockOptions),a=o({ttlMs:t,maxSize:n}),s=new Map;async function c(n,o,s,c,l){if(a.check(s,c))return!1;let u=e.resolveFilePath(o);try{return!await de(u,i,async()=>{let{value:e}=await B(u,{}),i=Z(e),a=i[n];return a!=null&&(t<=0||c-a<t)?!0:(i[n]=c,Q(i,c,t,r),await V(u,i),!1)})}catch(e){return l?.(e),a.check(s,c),!0}}async function l(n=`global`,r){let i=e.resolveFilePath(n),o=Date.now();try{let{value:e}=await B(i,{}),r=Z(e),s=0;for(let[e,i]of Object.entries(r)){if(t>0&&o-i>=t)continue;let r=`${n}:${e}`;a.check(r,i),s++}return s}catch(e){return r?.(e),0}}async function u(t,n){let r=t.trim();if(!r)return!0;let i=n?.namespace?.trim()||`global`,a=`${i}:${r}`;if(s.has(a))return!1;let o=n?.onDiskError??e.onDiskError,l=c(r,i,a,n?.now??Date.now(),o);s.set(a,l);try{return await l}finally{s.delete(a)}}return{checkAndRecord:u,warmup:l,clearMemory:()=>a.clear(),memorySize:()=>a.size()}}function Le(e){return{text:typeof e.text==`string`?e.text:void 0,mediaUrls:Array.isArray(e.mediaUrls)?e.mediaUrls.filter(e=>typeof e==`string`&&e.length>0):void 0,mediaUrl:typeof e.mediaUrl==`string`?e.mediaUrl:void 0,replyToId:typeof e.replyToId==`string`?e.replyToId:void 0}}function $(e){return async t=>{await e(t&&typeof t==`object`?Le(t):{})}}function Re(e){return e.mediaUrls?.length?e.mediaUrls:e.mediaUrl?[e.mediaUrl]:[]}function ze(e,t){let n=e?.trim()??``;if(!n&&t.length===0)return``;let r=t.length?t.map(e=>`Attachment: ${e}`).join(`
|
|
3
3
|
`):``;return n?r?`${n}\n\n${r}`:n:r}function Be(e){return{cfg:e.cfg,channel:e.channel,accountId:e.accountId,agentId:e.route.agentId,routeSessionKey:e.route.sessionKey,storePath:e.storePath,ctxPayload:e.ctxPayload,recordInboundSession:e.core.channel.session.recordInboundSession,dispatchReplyWithBufferedBlockDispatcher:e.core.channel.reply.dispatchReplyWithBufferedBlockDispatcher}}async function Ve(e){await He({...Be(e),deliver:e.deliver,onRecordError:e.onRecordError,onDispatchError:e.onDispatchError,replyOptions:e.replyOptions})}async function He(e){await e.recordInboundSession({storePath:e.storePath,sessionKey:e.ctxPayload.SessionKey??e.routeSessionKey,ctx:e.ctxPayload,onRecordError:e.onRecordError});let{onModelSelected:t,...n}=c({cfg:e.cfg,agentId:e.agentId,channel:e.channel,accountId:e.accountId}),r=$(e.deliver);await e.dispatchReplyWithBufferedBlockDispatcher({ctx:e.ctxPayload,cfg:e.cfg,dispatcherOptions:{...n,deliver:r,onError:e.onDispatchError},replyOptions:{...e.replyOptions,onModelSelected:t}})}function Ue(e){return{log:(...t)=>{e.logger.info(U(...t))},error:(...t)=>{e.logger.error(U(...t))},exit:t=>{throw e.exitError?.(t)??Error(`exit ${t}`)}}}function We(e){return{configured:e.configured??!1,running:e.running??!1,lastStartAt:e.lastStartAt??null,lastStopAt:e.lastStopAt??null,lastError:e.lastError??null}}function Ge(e){let{runtime:t,probe:n}=e;return{running:t?.running??!1,lastStartAt:t?.lastStartAt??null,lastStopAt:t?.lastStopAt??null,lastError:t?.lastError??null,probe:n}}export{O as BlockStreamingCoalesceSchema,_ as DEFAULT_ACCOUNT_ID,N as DmConfigSchema,S as DmPolicySchema,g as GROUP_POLICY_BLOCKED_LABEL,w as GroupPolicySchema,j as MarkdownConfigSchema,k as ReplyRuntimeConfigSchemaShape,fe as ToolPolicySchema,K as addWildcardAllowFrom,Te as applyAccountNameToChannelSection,We as buildBaseChannelStatusSummary,me as buildChannelConfigSchema,p as buildChannelKeyCandidates,Ge as buildRuntimeAccountStatusSnapshot,Me as buildSecretInputSchema,q as buildSingleChannelSecretPromptState,se as clearAccountEntryFields,M as createAccountListHelpers,Ue as createLoggerBackedRuntime,$ as createNormalizedOutboundDeliverer,Ie as createPersistentDedupe,c as createReplyPrefixOptions,Pe as createScopedPairingAccess,ce as deleteAccountFromConfigSection,Ve as dispatchInboundReplyWithBase,Ne as emptyPluginConfigSchema,re as evaluateMatchedGroupAccessForPolicy,z as fetchWithSsrFGuard,t as formatDocsLink,A as formatPairingApproveHint,ze as formatTextWithAttachmentLinks,oe as hasConfiguredSecretInput,a as isRequestBodyLimitError,d as issuePairingChallenge,ie as listConfiguredAccountIds,l as logInboundDrop,ae as mapAllowFromEntries,De as mergeAllowFromEntries,v as normalizeAccountId,ee as normalizeChannelSlug,le as normalizeResolvedSecretInputString,D as normalizeSecretInputString,Ee as patchScopedAccountConfig,G as promptAccountId,J as promptSingleChannelSecretInput,u as readRequestBodyWithLimit,s as readStoreAllowFromForDmPolicy,i as requestBodyErrorToText,T as requireOpenAllowFrom,Oe as resolveAccountIdForConfigure,E as resolveAccountWithDefaultFallback,f as resolveAllowlistProviderRuntimeGroupPolicy,te as resolveChannelEntryMatchWithFallback,h as resolveDefaultGroupPolicy,r as resolveDmGroupAccessWithCommandGate,e as resolveMentionGatingWithBypass,m as resolveNestedAllowlistDecision,Re as resolveOutboundMediaUrls,je as runSingleChannelSecretStep,ue as setAccountEnabledInConfigSection,ke as setTopLevelChannelDmPolicyWithAllowFrom,n as waitForAbortSignal,ne as warnMissingProviderGroupPolicyFallbackOnce};
|