@a-company/sentinel 3.6.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5585,6 +5585,12 @@ Ze.glob = Ze;
5585
5585
  // ../purpose/core/dist/index.js
5586
5586
  var PurposeItemSchema = z.object({
5587
5587
  description: z.string(),
5588
+ // Component type and hierarchy (v4)
5589
+ type: z.string().optional(),
5590
+ parent: z.string().optional(),
5591
+ anchors: z.array(z.string()).optional(),
5592
+ tags: z.array(z.string()).optional(),
5593
+ // Standard fields
5588
5594
  endpoints: z.array(z.string()).optional(),
5589
5595
  tests: z.array(z.string()).optional(),
5590
5596
  rules: z.record(z.unknown()).optional(),
@@ -5596,7 +5602,6 @@ var PurposeItemSchema = z.object({
5596
5602
  states: z.array(z.string()).optional(),
5597
5603
  components: z.array(z.string()).optional(),
5598
5604
  // Extra fields preserved
5599
- tags: z.array(z.string()).optional(),
5600
5605
  location: z.string().optional(),
5601
5606
  locations: z.array(z.string()).optional(),
5602
5607
  uses: z.array(z.string()).optional(),
@@ -6414,6 +6419,7 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6414
6419
  purposeFiles.push(...parsed.map((p) => p.filePath));
6415
6420
  const features = extractFeatures(parsed);
6416
6421
  for (const [id, { item, filePath }] of features) {
6422
+ const featureTags = ["feature", ...item.tags || []];
6417
6423
  symbols.push(createSymbolEntry({
6418
6424
  id: `purpose-feature-${id}`,
6419
6425
  symbol: `#${id}`,
@@ -6422,7 +6428,10 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6422
6428
  filePath,
6423
6429
  data: item,
6424
6430
  description: item.description,
6425
- tags: ["feature"]
6431
+ tags: featureTags,
6432
+ componentType: item.type,
6433
+ parentSymbol: item.parent,
6434
+ anchors: item.anchors?.map((a) => parseAnchorString(a))
6426
6435
  }));
6427
6436
  }
6428
6437
  const components = extractComponents(parsed);
@@ -6434,7 +6443,11 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6434
6443
  source: "purpose",
6435
6444
  filePath,
6436
6445
  data: item,
6437
- description: item.description
6446
+ description: item.description,
6447
+ tags: item.tags,
6448
+ componentType: item.type,
6449
+ parentSymbol: item.parent,
6450
+ anchors: item.anchors?.map((a) => parseAnchorString(a))
6438
6451
  }));
6439
6452
  }
6440
6453
  const gates = extractGates(parsed);
@@ -6600,12 +6613,27 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6600
6613
  }));
6601
6614
  }
6602
6615
  resolveReferences(symbols);
6616
+ const symbolFileMap = /* @__PURE__ */ new Map();
6617
+ for (const sym of symbols) {
6618
+ const files = symbolFileMap.get(sym.symbol) || [];
6619
+ if (!files.includes(sym.filePath)) {
6620
+ files.push(sym.filePath);
6621
+ }
6622
+ symbolFileMap.set(sym.symbol, files);
6623
+ }
6624
+ const duplicateSymbols = [];
6625
+ for (const [symbol, files] of symbolFileMap) {
6626
+ if (files.length > 1) {
6627
+ duplicateSymbols.push({ symbol, files });
6628
+ }
6629
+ }
6603
6630
  return {
6604
6631
  symbols,
6605
6632
  purposeFiles,
6606
6633
  portalFiles,
6607
6634
  errors,
6608
- timestamp: Date.now()
6635
+ timestamp: Date.now(),
6636
+ ...duplicateSymbols.length > 0 ? { duplicateSymbols } : {}
6609
6637
  };
6610
6638
  }
6611
6639
  function createSymbolEntry(partial) {
@@ -6764,10 +6792,33 @@ function searchSymbols(index, query) {
6764
6792
  }
6765
6793
  if (entry.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery))) {
6766
6794
  results.push(entry);
6795
+ continue;
6796
+ }
6797
+ if (entry.componentType?.toLowerCase().includes(lowerQuery)) {
6798
+ results.push(entry);
6799
+ continue;
6767
6800
  }
6768
6801
  }
6769
6802
  return results;
6770
6803
  }
6804
+ function getComponentsByType(index, componentType) {
6805
+ const components = getSymbolsByType(index, "component");
6806
+ return components.filter((c) => c.componentType === componentType);
6807
+ }
6808
+ function getAllComponentTypes(index) {
6809
+ const types = /* @__PURE__ */ new Set();
6810
+ const components = getSymbolsByType(index, "component");
6811
+ for (const comp of components) {
6812
+ if (comp.componentType) {
6813
+ types.add(comp.componentType);
6814
+ }
6815
+ }
6816
+ return Array.from(types).sort();
6817
+ }
6818
+ function getChildComponents(index, parentSymbol) {
6819
+ const components = getSymbolsByType(index, "component");
6820
+ return components.filter((c) => c.parentSymbol === parentSymbol);
6821
+ }
6771
6822
  function getReferencesTo(index, symbol) {
6772
6823
  const entry = getSymbol(index, symbol);
6773
6824
  if (!entry) return [];
@@ -6851,9 +6902,12 @@ export {
6851
6902
  createSnapshot,
6852
6903
  createSymbolIndex,
6853
6904
  createSymbolString,
6905
+ getAllComponentTypes,
6854
6906
  getAllSymbols,
6855
6907
  getAllTags,
6856
6908
  getAutocompleteSuggestions,
6909
+ getChildComponents,
6910
+ getComponentsByType,
6857
6911
  getDefaultPremiseContent,
6858
6912
  getReferencesFrom,
6859
6913
  getReferencesTo,
package/dist/index.d.ts CHANGED
@@ -1,60 +1,11 @@
1
- export { F as FlowTracker, P as PatternMatcher, S as Sentinel } from './sdk-CzFDYYST.js';
2
- export { S as SentinelClient, a as SentinelClientOptions, b as SentinelTransport, c as SpanContext, d as createSentinelClient, e as createSentinelTransport, f as enableSentinel } from './transport-DqamniUy.js';
3
- import { S as SentinelServerConfig, a as SymbolicIncidentRecord, I as IncidentGroup, F as FlowTimeline, b as SentinelStats, c as SymbolHealth, E as EnrichedIncident, d as SymbolEnrichment, e as FailurePattern, P as PatternCandidate, f as PatternExport } from './types-BmVoO1iF.js';
4
- export { A as AppState, g as AuthConfig, h as AuthPermission, i as AuthToken, B as BackupExport, C as ComponentContext, j as CorsConfig, k as CreateGroupInput, l as CreateIncidentInput, m as CreatePatternInput, D as DEFAULT_AUTH_CONFIG, n as DEFAULT_RATE_LIMIT_CONFIG, o as DEFAULT_SERVER_CONFIG, p as DayCount, q as Environment, r as ErrorDetails, s as FlowEvent, t as FlowEventType, u as FlowPosition, H as HistogramBucket, v as IncidentNote, w as IncidentQueryOptions, x as IncidentStatus, L as LogEntry, y as LogEntryInput, z as LogLevel, G as LogQueryOptions, J as LogSymbolType, M as MatchedCriteria, K as MatcherConfig, N as MetricAggregation, O as MetricEntry, Q as MetricInput, R as MetricQueryOptions, T as MetricType, U as PatternConfidence, V as PatternCriteria, W as PatternEffectiveness, X as PatternMatch, Y as PatternPriority, Z as PatternQueryOptions, _ as PatternRecurrence, $ as PatternResolution, a0 as PatternSource, a1 as PatternSymbolCriteria, a2 as PatternTestResult, a3 as PracticeCategory, a4 as PracticeEvent, a5 as PracticeEventInput, a6 as PracticeEventQuery, a7 as PracticeResult, a8 as RateLimitConfig, a9 as RateLimitRule, aa as Resolution, ab as ResolutionQueryOptions, ac as ResolutionRecord, ad as ResolutionStrategy, ae as SentinelConfig, af as ServiceInfo, ag as ServiceRegistration, ah as SymbolHotspot, ai as SymbolIncidentCount, aj as SymbolResolutionTime, ak as SymbolValidationResult, al as SymbolicContext, am as TraceSpan, an as TraceSpanInput, ao as TraceView } from './types-BmVoO1iF.js';
5
- import { S as SentinelStorage, E as EventSchemaDeclaration } from './storage-BKyt7aPJ.js';
6
- export { C as CausalityDeclaration, a as EventFieldDeclaration, b as EventTypeDeclaration, G as GenericEvent, c as GenericEventInput, d as GenericEventQuery, e as ScopeDeclaration, f as ScopeSummary, g as StoredSchema, V as VisualizationHints } from './storage-BKyt7aPJ.js';
7
-
8
- /**
9
- * Sentinel Configuration
10
- *
11
- * Loads and writes .sentinel.yaml config files.
12
- * Provides project-level configuration for the Sentinel SDK and CLI.
13
- */
14
-
15
- interface SentinelYamlConfig {
16
- version: string;
17
- project: string;
18
- environment?: string;
19
- symbols?: {
20
- components?: string[];
21
- gates?: string[];
22
- flows?: string[];
23
- signals?: string[];
24
- };
25
- routes?: Record<string, string>;
26
- scrub?: {
27
- headers?: string[];
28
- fields?: string[];
29
- };
30
- server?: {
31
- port?: number;
32
- maxLogs?: number;
33
- maxBatchSize?: number;
34
- wsMaxSubscribers?: number;
35
- pruneIntervalInserts?: number;
36
- logRetentionDays?: number;
37
- };
38
- }
39
- /**
40
- * Load .sentinel.yaml from a project directory.
41
- *
42
- * @param projectDir - Project root directory
43
- * @returns Parsed config or null if not found
44
- */
45
- declare function loadConfig(projectDir: string): SentinelYamlConfig | null;
46
- /**
47
- * Write .sentinel.yaml to a project directory.
48
- *
49
- * @param projectDir - Project root directory
50
- * @param config - Config to write
51
- */
52
- declare function writeConfig(projectDir: string, config: SentinelYamlConfig): void;
53
- /**
54
- * Load server configuration with resolution order:
55
- * env vars → local .sentinel.yaml → global ~/.paradigm/sentinel.yaml → defaults
56
- */
57
- declare function loadServerConfig(projectDir?: string): SentinelServerConfig;
1
+ export { F as FlowTracker, P as PatternMatcher, S as Sentinel } from './sdk-faJTgu-S.js';
2
+ export { S as SentinelClient, a as SentinelClientOptions, b as SentinelTransport, c as SpanContext, d as createSentinelClient, e as createSentinelTransport, f as enableSentinel } from './transport-Biz9YfoQ.js';
3
+ import { S as SymbolicIncidentRecord, I as IncidentGroup, F as FlowTimeline, a as SentinelStats, b as SymbolHealth, E as EnrichedIncident, c as SymbolEnrichment, d as FailurePattern, P as PatternCandidate, e as PatternExport } from './types-CPU5sxLq.js';
4
+ export { A as AppState, f as AuthConfig, g as AuthPermission, h as AuthToken, B as BackupExport, C as ComponentContext, i as CorsConfig, j as CreateGroupInput, k as CreateIncidentInput, l as CreatePatternInput, D as DEFAULT_AUTH_CONFIG, m as DEFAULT_RATE_LIMIT_CONFIG, n as DEFAULT_SERVER_CONFIG, o as DayCount, p as Environment, q as ErrorDetails, r as FlowEvent, s as FlowEventType, t as FlowPosition, H as HistogramBucket, u as IncidentNote, v as IncidentQueryOptions, w as IncidentStatus, L as LogEntry, x as LogEntryInput, y as LogLevel, z as LogQueryOptions, G as LogSymbolType, M as MatchedCriteria, J as MatcherConfig, K as MetricAggregation, N as MetricEntry, O as MetricInput, Q as MetricQueryOptions, R as MetricType, T as PatternConfidence, U as PatternCriteria, V as PatternEffectiveness, W as PatternMatch, X as PatternPriority, Y as PatternQueryOptions, Z as PatternRecurrence, _ as PatternResolution, $ as PatternSource, a0 as PatternSymbolCriteria, a1 as PatternTestResult, a2 as PracticeCategory, a3 as PracticeEvent, a4 as PracticeEventInput, a5 as PracticeEventQuery, a6 as PracticeResult, a7 as RateLimitConfig, a8 as RateLimitRule, a9 as Resolution, aa as ResolutionQueryOptions, ab as ResolutionRecord, ac as ResolutionStrategy, ad as SentinelConfig, ae as SentinelServerConfig, af as ServiceInfo, ag as ServiceRegistration, ah as SymbolHotspot, ai as SymbolIncidentCount, aj as SymbolResolutionTime, ak as SymbolValidationResult, al as SymbolicContext, am as TraceSpan, an as TraceSpanInput, ao as TraceView } from './types-CPU5sxLq.js';
5
+ import { S as SentinelYamlConfig } from './builtin-symphony-qZiFR8hQ.js';
6
+ export { P as PARADIGM_SCHEMA, a as SYMPHONY_SCHEMA, l as loadConfig, b as loadServerConfig, w as writeConfig } from './builtin-symphony-qZiFR8hQ.js';
7
+ import { S as SentinelStorage } from './storage-8SPPsAJb.js';
8
+ export { C as CausalityDeclaration, E as EventFieldDeclaration, a as EventSchemaDeclaration, b as EventTypeDeclaration, G as GenericEvent, c as GenericEventInput, d as GenericEventQuery, e as ScopeDeclaration, f as ScopeSummary, g as StoredSchema, V as VisualizationHints } from './storage-8SPPsAJb.js';
58
9
 
59
10
  /**
60
11
  * Sentinel Auto-Symbol Detector
@@ -474,13 +425,4 @@ declare function loadParadigmPatterns(): PatternExport;
474
425
  */
475
426
  declare function loadAllSeedPatterns(): PatternExport;
476
427
 
477
- /**
478
- * Built-in Paradigm Schema Declaration
479
- *
480
- * Registers Paradigm's existing log/metric/trace types as an event schema.
481
- * This is informational — existing tables remain untouched.
482
- */
483
-
484
- declare const PARADIGM_SCHEMA: EventSchemaDeclaration;
485
-
486
- export { ContextEnricher, EnrichedIncident, EventSchemaDeclaration, FailurePattern, FlowTimeline, IncidentGroup, IncidentGrouper, PARADIGM_SCHEMA, PatternCandidate, PatternExport, PatternImporter, PatternSuggester, SentinelServerConfig, SentinelStats, SentinelStorage, type SentinelYamlConfig, StatsCalculator, SymbolEnrichment, SymbolHealth, SymbolicIncidentRecord, TimelineBuilder, detectSymbols, generateConfig, loadAllSeedPatterns, loadConfig, loadParadigmPatterns, loadServerConfig, loadUniversalPatterns, writeConfig };
428
+ export { ContextEnricher, EnrichedIncident, FailurePattern, FlowTimeline, IncidentGroup, IncidentGrouper, PatternCandidate, PatternExport, PatternImporter, PatternSuggester, SentinelStats, SentinelStorage, SentinelYamlConfig, StatsCalculator, SymbolEnrichment, SymbolHealth, SymbolicIncidentRecord, TimelineBuilder, detectSymbols, generateConfig, loadAllSeedPatterns, loadParadigmPatterns, loadUniversalPatterns };
package/dist/index.js CHANGED
@@ -9,11 +9,13 @@ import {
9
9
  DEFAULT_AUTH_CONFIG,
10
10
  DEFAULT_RATE_LIMIT_CONFIG,
11
11
  DEFAULT_SERVER_CONFIG,
12
+ PARADIGM_SCHEMA,
13
+ SYMPHONY_SCHEMA,
12
14
  SentinelStorage,
13
15
  loadConfig,
14
16
  loadServerConfig,
15
17
  writeConfig
16
- } from "./chunk-NTX74ZPM.js";
18
+ } from "./chunk-OKYYIAML.js";
17
19
 
18
20
  // src/matcher.ts
19
21
  var DEFAULT_CONFIG = {
@@ -2195,152 +2197,6 @@ var PatternImporter = class {
2195
2197
  };
2196
2198
  }
2197
2199
  };
2198
-
2199
- // src/schema/builtin-paradigm.ts
2200
- var PARADIGM_SCHEMA = {
2201
- id: "paradigm-logger",
2202
- version: "1.0.0",
2203
- name: "Paradigm Logger",
2204
- description: "Structured logs from @a-company/paradigm-logger with symbolic context",
2205
- scope: {
2206
- field: "correlationId",
2207
- type: "string",
2208
- label: "Correlation",
2209
- ordering: "independent",
2210
- sessionField: "sessionId"
2211
- },
2212
- eventTypes: [
2213
- {
2214
- type: "log:debug",
2215
- category: "logs",
2216
- label: "Debug Log",
2217
- severity: "debug",
2218
- frequency: "high",
2219
- fields: [
2220
- { name: "symbol", type: "string", indexed: true, display: true },
2221
- { name: "symbolType", type: "string", indexed: true, display: true },
2222
- { name: "message", type: "string", display: true },
2223
- { name: "service", type: "string", indexed: true, display: true },
2224
- { name: "durationMs", type: "number", display: true }
2225
- ]
2226
- },
2227
- {
2228
- type: "log:info",
2229
- category: "logs",
2230
- label: "Info Log",
2231
- severity: "info",
2232
- frequency: "high",
2233
- fields: [
2234
- { name: "symbol", type: "string", indexed: true, display: true },
2235
- { name: "symbolType", type: "string", indexed: true, display: true },
2236
- { name: "message", type: "string", display: true },
2237
- { name: "service", type: "string", indexed: true, display: true },
2238
- { name: "durationMs", type: "number", display: true }
2239
- ]
2240
- },
2241
- {
2242
- type: "log:warn",
2243
- category: "logs",
2244
- label: "Warning Log",
2245
- severity: "warn",
2246
- frequency: "medium",
2247
- fields: [
2248
- { name: "symbol", type: "string", indexed: true, display: true },
2249
- { name: "symbolType", type: "string", indexed: true, display: true },
2250
- { name: "message", type: "string", display: true },
2251
- { name: "service", type: "string", indexed: true, display: true }
2252
- ]
2253
- },
2254
- {
2255
- type: "log:error",
2256
- category: "logs",
2257
- label: "Error Log",
2258
- severity: "error",
2259
- frequency: "low",
2260
- fields: [
2261
- { name: "symbol", type: "string", indexed: true, display: true },
2262
- { name: "symbolType", type: "string", indexed: true, display: true },
2263
- { name: "message", type: "string", display: true },
2264
- { name: "service", type: "string", indexed: true, display: true }
2265
- ]
2266
- },
2267
- {
2268
- type: "metric:counter",
2269
- category: "metrics",
2270
- label: "Counter Metric",
2271
- severity: "info",
2272
- frequency: "high",
2273
- fields: [
2274
- { name: "name", type: "string", indexed: true, display: true },
2275
- { name: "value", type: "number", display: true },
2276
- { name: "tags", type: "object" }
2277
- ]
2278
- },
2279
- {
2280
- type: "metric:gauge",
2281
- category: "metrics",
2282
- label: "Gauge Metric",
2283
- severity: "info",
2284
- frequency: "medium",
2285
- fields: [
2286
- { name: "name", type: "string", indexed: true, display: true },
2287
- { name: "value", type: "number", display: true },
2288
- { name: "tags", type: "object" }
2289
- ]
2290
- },
2291
- {
2292
- type: "metric:histogram",
2293
- category: "metrics",
2294
- label: "Histogram Metric",
2295
- severity: "info",
2296
- frequency: "medium",
2297
- fields: [
2298
- { name: "name", type: "string", indexed: true, display: true },
2299
- { name: "value", type: "number", display: true },
2300
- { name: "tags", type: "object" }
2301
- ]
2302
- },
2303
- {
2304
- type: "trace:span",
2305
- category: "traces",
2306
- label: "Trace Span",
2307
- severity: "info",
2308
- frequency: "medium",
2309
- fields: [
2310
- { name: "traceId", type: "string", indexed: true, display: true },
2311
- { name: "spanId", type: "string", indexed: true },
2312
- { name: "operation", type: "string", display: true },
2313
- { name: "durationMs", type: "number", display: true },
2314
- { name: "status", type: "string", display: true }
2315
- ]
2316
- },
2317
- {
2318
- type: "incident:recorded",
2319
- category: "incidents",
2320
- label: "Incident Recorded",
2321
- severity: "error",
2322
- frequency: "low",
2323
- fields: [
2324
- { name: "incidentId", type: "string", indexed: true, display: true },
2325
- { name: "errorMessage", type: "string", display: true },
2326
- { name: "symbols", type: "object" },
2327
- { name: "environment", type: "string", display: true }
2328
- ]
2329
- }
2330
- ],
2331
- visualization: {
2332
- defaultView: "table",
2333
- categoryColors: {
2334
- logs: "#3b82f6",
2335
- metrics: "#22c55e",
2336
- traces: "#a855f7",
2337
- incidents: "#ef4444"
2338
- },
2339
- summaryFields: ["symbol", "message", "service"],
2340
- defaultExcluded: ["log:debug"]
2341
- },
2342
- tags: ["builtin", "paradigm"]
2343
- };
2344
2200
  export {
2345
2201
  ContextEnricher,
2346
2202
  DEFAULT_AUTH_CONFIG,
@@ -2352,6 +2208,7 @@ export {
2352
2208
  PatternImporter,
2353
2209
  PatternMatcher,
2354
2210
  PatternSuggester,
2211
+ SYMPHONY_SCHEMA,
2355
2212
  Sentinel,
2356
2213
  SentinelClient,
2357
2214
  SentinelStorage,
package/dist/mcp.js CHANGED
@@ -604,6 +604,19 @@ var SentinelStorage = class {
604
604
  );
605
605
  this.save();
606
606
  }
607
+ resolveIncident(id, options) {
608
+ this.updateIncident(id, {
609
+ status: "resolved",
610
+ resolvedAt: (/* @__PURE__ */ new Date()).toISOString()
611
+ });
612
+ if (options?.notes) {
613
+ this.addIncidentNote(id, {
614
+ author: "system",
615
+ content: options.notes,
616
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
617
+ });
618
+ }
619
+ }
607
620
  addIncidentNote(incidentId, note) {
608
621
  this.initializeSync();
609
622
  const incident = this.getIncident(incidentId);
@@ -1,5 +1,5 @@
1
- import { S as SentinelStorage } from './storage-BKyt7aPJ.js';
2
- import { a as SymbolicIncidentRecord, K as MatcherConfig, X as PatternMatch, e as FailurePattern, a2 as PatternTestResult, ae as SentinelConfig, C as ComponentContext, al as SymbolicContext, u as FlowPosition } from './types-BmVoO1iF.js';
1
+ import { S as SentinelStorage } from './storage-8SPPsAJb.js';
2
+ import { S as SymbolicIncidentRecord, J as MatcherConfig, W as PatternMatch, d as FailurePattern, a1 as PatternTestResult, ad as SentinelConfig, C as ComponentContext, al as SymbolicContext, t as FlowPosition } from './types-CPU5sxLq.js';
3
3
 
4
4
  /**
5
5
  * Paradigm Sentinel - Pattern Matching Engine
@@ -1,6 +1,7 @@
1
- import { Express } from 'express';
2
- import { S as SentinelStorage, G as GenericEvent } from '../storage-BKyt7aPJ.js';
3
- import { S as SentinelServerConfig, L as LogEntry } from '../types-BmVoO1iF.js';
1
+ import { Router, Request, Response, NextFunction, Express } from 'express';
2
+ import { S as SentinelStorage, G as GenericEvent } from '../storage-8SPPsAJb.js';
3
+ import { ae as SentinelServerConfig, L as LogEntry, f as AuthConfig, g as AuthPermission, a7 as RateLimitConfig } from '../types-CPU5sxLq.js';
4
+ export { P as PARADIGM_SCHEMA, a as SYMPHONY_SCHEMA, b as loadServerConfig } from '../builtin-symphony-qZiFR8hQ.js';
4
5
 
5
6
  /**
6
7
  * Symbol index loader for the server
@@ -63,6 +64,154 @@ declare function loadGitHistory(projectDir: string, options?: {
63
64
  */
64
65
  declare function getSymbolsAtCommit(projectDir: string, commitHash: string): Promise<string[]>;
65
66
 
67
+ /**
68
+ * Structured Logs API route
69
+ *
70
+ * POST /api/logs — Accept single entry or batch {entries: [...]}
71
+ * GET /api/logs — Query with filters
72
+ */
73
+
74
+ interface LogsRouterOptions {
75
+ storage: SentinelStorage;
76
+ serverConfig: SentinelServerConfig;
77
+ onLogReceived?: (entry: LogEntry, validation?: {
78
+ known: boolean;
79
+ suggestion?: string;
80
+ }) => void;
81
+ symbolIndex?: Array<{
82
+ symbol: string;
83
+ type: string;
84
+ filePath: string;
85
+ }>;
86
+ }
87
+ declare function createLogsRouter(options: LogsRouterOptions): Router;
88
+
89
+ /**
90
+ * Services & State API routes
91
+ *
92
+ * POST /api/services — Register a service
93
+ * GET /api/services — List registered services
94
+ * POST /api/state — Push app state snapshot
95
+ * GET /api/state — Get all live app states
96
+ * GET /api/state/:service — Get state for specific service
97
+ */
98
+
99
+ interface ServicesRouterOptions {
100
+ storage: SentinelStorage;
101
+ }
102
+ declare function createServicesRouter(options: ServicesRouterOptions): Router;
103
+ declare function createStateRouter(options: ServicesRouterOptions): Router;
104
+
105
+ /**
106
+ * Metrics API route
107
+ *
108
+ * POST /api/metrics — Accept single metric or batch {entries: [...]}
109
+ * GET /api/metrics — Query with filters
110
+ * GET /api/metrics/aggregate/:name — Get aggregation for a metric
111
+ */
112
+
113
+ interface MetricsRouterOptions {
114
+ storage: SentinelStorage;
115
+ serverConfig: SentinelServerConfig;
116
+ }
117
+ declare function createMetricsRouter(options: MetricsRouterOptions): Router;
118
+
119
+ /**
120
+ * Distributed Tracing API route
121
+ *
122
+ * POST /api/traces — Submit a trace span
123
+ * GET /api/traces — Query traces
124
+ * GET /api/traces/:traceId — Get full trace view
125
+ */
126
+
127
+ interface TracesRouterOptions {
128
+ storage: SentinelStorage;
129
+ }
130
+ declare function createTracesRouter(options: TracesRouterOptions): Router;
131
+
132
+ /**
133
+ * Schema Registry API routes
134
+ *
135
+ * POST /api/schemas — Register/update schema (upsert by id)
136
+ * GET /api/schemas — List all registered schemas
137
+ * GET /api/schemas/:id — Get specific schema
138
+ */
139
+
140
+ interface SchemasRouterOptions {
141
+ storage: SentinelStorage;
142
+ }
143
+ declare function createSchemasRouter(options: SchemasRouterOptions): Router;
144
+
145
+ /**
146
+ * Generic Events API routes
147
+ *
148
+ * POST /api/events — Ingest event batch { schemaId, service, events: [...] }
149
+ * GET /api/events — Query events with filters
150
+ * GET /api/events/scopes — Scope summaries (frames with counts, etc.)
151
+ * GET /api/events/scope/:value — All events within a single scope value
152
+ */
153
+
154
+ interface EventsRouterOptions {
155
+ storage: SentinelStorage;
156
+ serverConfig: SentinelServerConfig;
157
+ onEventReceived?: (event: GenericEvent) => void;
158
+ }
159
+ declare function createEventsRouter(options: EventsRouterOptions): Router;
160
+
161
+ /**
162
+ * Symbols API route
163
+ */
164
+
165
+ declare function createSymbolsRouter(projectDir: string): Router;
166
+
167
+ /**
168
+ * Project info API route
169
+ */
170
+
171
+ declare function createInfoRouter(projectDir: string): Router;
172
+
173
+ /**
174
+ * Commits API route - Git history
175
+ */
176
+
177
+ declare function createCommitsRouter(projectDir: string): Router;
178
+
179
+ /**
180
+ * Incidents API route
181
+ */
182
+
183
+ declare function createIncidentsRouter(_projectDir: string): Router;
184
+
185
+ /**
186
+ * Patterns API route
187
+ */
188
+
189
+ declare function createPatternsRouter(_projectDir: string): Router;
190
+
191
+ /**
192
+ * Authentication middleware for Sentinel server
193
+ *
194
+ * Bearer token authentication with permission levels.
195
+ * When auth is disabled, all requests pass through.
196
+ */
197
+
198
+ /**
199
+ * Create auth middleware that checks bearer tokens
200
+ */
201
+ declare function createAuthMiddleware(config: AuthConfig): (requiredPermission: AuthPermission) => (req: Request, res: Response, next: NextFunction) => void;
202
+
203
+ /**
204
+ * Rate limiting middleware for Sentinel server
205
+ *
206
+ * Per-service and global rate limiting with configurable sampling.
207
+ * Uses in-memory sliding window counters.
208
+ */
209
+
210
+ /**
211
+ * Create rate limiting middleware
212
+ */
213
+ declare function createRateLimiter(config: RateLimitConfig): (req: Request, res: Response, next: NextFunction) => void;
214
+
66
215
  /**
67
216
  * Sentinel Server - Express server with WebSocket for real-time log streaming
68
217
  */
@@ -96,4 +245,4 @@ declare function createApp(options: ServerOptions & {
96
245
  */
97
246
  declare function startServer(options: ServerOptions): Promise<void>;
98
247
 
99
- export { type CommitInfo, type ParadigmConfig, type ServerOptions, type SymbolEntry, createApp, getSymbolCount, getSymbolsAtCommit, loadGitHistory, loadParadigmConfig, loadSymbolIndex, startServer };
248
+ export { type CommitInfo, type EventsRouterOptions, GenericEvent, LogEntry, type LogsRouterOptions, type MetricsRouterOptions, type ParadigmConfig, type SchemasRouterOptions, SentinelServerConfig, SentinelStorage, type ServerOptions, type ServicesRouterOptions, type SymbolEntry, type TracesRouterOptions, createApp, createAuthMiddleware, createCommitsRouter, createEventsRouter, createIncidentsRouter, createInfoRouter, createLogsRouter, createMetricsRouter, createPatternsRouter, createRateLimiter, createSchemasRouter, createServicesRouter, createStateRouter, createSymbolsRouter, createTracesRouter, getSymbolCount, getSymbolsAtCommit, loadGitHistory, loadParadigmConfig, loadSymbolIndex, startServer };
@@ -1,7 +1,9 @@
1
1
  import {
2
+ PARADIGM_SCHEMA,
3
+ SYMPHONY_SCHEMA,
2
4
  SentinelStorage,
3
5
  loadServerConfig
4
- } from "../chunk-NTX74ZPM.js";
6
+ } from "../chunk-OKYYIAML.js";
5
7
 
6
8
  // src/server/index.ts
7
9
  import express from "express";
@@ -107,7 +109,7 @@ async function loadParadigmConfig(projectDir) {
107
109
  }
108
110
  async function loadWithPremiseCore(projectDir) {
109
111
  try {
110
- const { aggregateFromDirectory } = await import("../dist-AG5JNIZU.js");
112
+ const { aggregateFromDirectory } = await import("../dist-5QE2BB2B.js");
111
113
  log.flow("load-symbols").info("Using premise-core aggregator", { path: projectDir });
112
114
  const result = await aggregateFromDirectory(projectDir);
113
115
  const counts = {};
@@ -1494,8 +1496,16 @@ function createApp(options) {
1494
1496
  app.get("/api/health", (_req, res) => {
1495
1497
  res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
1496
1498
  });
1497
- const uiDistPath = path3.join(__dirname, "..", "..", "ui", "dist");
1498
- if (fs2.existsSync(uiDistPath)) {
1499
+ const uiCandidates = [
1500
+ path3.join(__dirname, "sentinel-ui"),
1501
+ // bundled: paradigm/dist/sentinel-ui/ (copied during build)
1502
+ path3.join(__dirname, "..", "..", "ui", "dist"),
1503
+ // standalone: sentinel/dist/server/ → sentinel/ui/dist
1504
+ path3.join(__dirname, "..", "ui", "dist")
1505
+ // standalone flat: sentinel/dist/ → sentinel/ui/dist
1506
+ ];
1507
+ const uiDistPath = uiCandidates.find((p) => fs2.existsSync(p));
1508
+ if (uiDistPath) {
1499
1509
  app.use(express.static(uiDistPath));
1500
1510
  app.get("{*path}", (req, res) => {
1501
1511
  if (!req.path.startsWith("/api")) {
@@ -1512,6 +1522,9 @@ async function startServer(options) {
1512
1522
  }
1513
1523
  const storage = new SentinelStorage(options.dbPath);
1514
1524
  await storage.ensureReady();
1525
+ storage.registerSchema(PARADIGM_SCHEMA);
1526
+ storage.registerSchema(SYMPHONY_SCHEMA);
1527
+ log3.component("sentinel-server").info("Registered builtin schemas", { schemas: "paradigm-logger, paradigm-symphony" });
1515
1528
  let symbolIndex = [];
1516
1529
  try {
1517
1530
  symbolIndex = await loadSymbolIndex(options.projectDir);
@@ -1640,11 +1653,29 @@ async function startServer(options) {
1640
1653
  });
1641
1654
  }
1642
1655
  export {
1656
+ PARADIGM_SCHEMA,
1657
+ SYMPHONY_SCHEMA,
1658
+ SentinelStorage,
1643
1659
  createApp,
1660
+ createAuthMiddleware,
1661
+ createCommitsRouter,
1662
+ createEventsRouter,
1663
+ createIncidentsRouter,
1664
+ createInfoRouter,
1665
+ createLogsRouter,
1666
+ createMetricsRouter,
1667
+ createPatternsRouter,
1668
+ createRateLimiter,
1669
+ createSchemasRouter,
1670
+ createServicesRouter,
1671
+ createStateRouter,
1672
+ createSymbolsRouter,
1673
+ createTracesRouter,
1644
1674
  getSymbolCount,
1645
1675
  getSymbolsAtCommit,
1646
1676
  loadGitHistory,
1647
1677
  loadParadigmConfig,
1678
+ loadServerConfig,
1648
1679
  loadSymbolIndex,
1649
1680
  startServer
1650
1681
  };