#!/usr/bin/env node
import'./chunk-XHJ27CER.js';import {Router}from'express';import c from'chalk';var m={component(s){let o=c.magenta(`#${s}`);return {info:r=>console.log(`${c.blue("i")} ${o} ${r}`),success:r=>console.log(`${c.green("+")} ${o} ${r}`),warn:r=>console.log(`${c.yellow("!")} ${o} ${r}`),error:r=>console.error(`${c.red("x")} ${o} ${r}`)}}};async function O(s,o){try{let w=function(t,u){let b={type:"sentinel:log",entry:t};u&&!u.known&&(b.validation=u),o(b),(t.symbolType==="signal"||t.symbolType==="gate"||t.symbolType==="flow")&&o({type:"sentinel:flow_event",flowId:t.symbolType==="flow"?t.symbol:void 0,nodeSymbol:t.symbol,event:t.symbolType,timestamp:t.timestamp,service:t.service});},y=function(t){o({type:"sentinel:event",event:t});};var r=w,B=y;let g=await import('./server-AIXFROYL.js'),{SentinelStorage:R,loadServerConfig:f,loadSymbolIndex:p,PARADIGM_SCHEMA:S,SYMPHONY_SCHEMA:v,createLogsRouter:$,createServicesRouter:h,createStateRouter:k,createMetricsRouter:A,createTracesRouter:C,createSchemasRouter:I,createEventsRouter:M,createSymbolsRouter:T,createInfoRouter:x,createCommitsRouter:P,createIncidentsRouter:L,createPatternsRouter:E,createAuthMiddleware:H,createRateLimiter:_}=g,n=new R;await n.ensureReady(),n.registerSchema(S),n.registerSchema(v),m.component("sentinel-bridge").info("Registered builtin schemas");let l=f(s),d=[];try{d=await p(s);}catch{m.component("sentinel-bridge").warn("Could not load symbol index");}let e=Router(),i=H(l.auth),a=_(l.rateLimit);return e.use("/logs",a,i("write"),$({storage:n,serverConfig:l,onLogReceived:w,symbolIndex:d})),e.use("/services",a,i("write"),h({storage:n})),e.use("/state",a,i("write"),k({storage:n})),e.use("/metrics",a,i("write"),A({storage:n,serverConfig:l})),e.use("/traces",a,i("write"),C({storage:n})),e.use("/schemas",a,i("write"),I({storage:n})),e.use("/events",a,i("write"),M({storage:n,serverConfig:l,onEventReceived:y})),e.use("/symbols",T(s)),e.use("/info",x(s)),e.use("/commits",P(s)),e.use("/incidents",L(s)),e.use("/patterns",E(s)),e}catch{return m.component("sentinel-bridge").warn("Sentinel package not available \u2014 skipping"),null}}export{O as createSentinelBridge};