@a-company/sentinel 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express.d.ts +44 -0
- package/dist/adapters/express.js +30 -0
- package/dist/adapters/fastify.d.ts +23 -0
- package/dist/adapters/fastify.js +18 -0
- package/dist/adapters/hono.d.ts +23 -0
- package/dist/adapters/hono.js +26 -0
- package/dist/chunk-KPMG4XED.js +1249 -0
- package/dist/cli.js +32 -0
- package/dist/commands-KIMGFR2I.js +3278 -0
- package/dist/dist-2F7NO4H4.js +6851 -0
- package/dist/dist-BPWLYV4U.js +6853 -0
- package/dist/index.d.ts +434 -0
- package/dist/index.js +2270 -0
- package/dist/mcp.js +2767 -0
- package/dist/sdk-B27_vK1g.d.ts +644 -0
- package/dist/server/index.d.ts +82 -0
- package/dist/server/index.js +854 -0
- package/package.json +98 -0
- package/src/seeds/loader.ts +45 -0
- package/src/seeds/paradigm-patterns.json +195 -0
- package/src/seeds/universal-patterns.json +292 -0
- package/ui/dist/assets/index-BNgsn_C8.js +62 -0
- package/ui/dist/assets/index-BNgsn_C8.js.map +1 -0
- package/ui/dist/assets/index-DPxatSdT.css +1 -0
- package/ui/dist/index.html +17 -0
- package/ui/dist/sentinel.svg +19 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { S as SentinelStorage, 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 './sdk-B27_vK1g.js';
|
|
2
|
+
export { B as BackupExport, C as ComponentContext, g as CreateGroupInput, h as CreateIncidentInput, i as CreatePatternInput, D as DayCount, j as Environment, k as ErrorDetails, l as FlowEvent, m as FlowEventType, n as FlowPosition, o as FlowTracker, p as IncidentNote, q as IncidentQueryOptions, r as IncidentStatus, M as MatchedCriteria, s as MatcherConfig, t as PatternConfidence, u as PatternCriteria, v as PatternEffectiveness, w as PatternMatch, x as PatternMatcher, y as PatternPriority, z as PatternQueryOptions, A as PatternRecurrence, G as PatternResolution, H as PatternSource, J as PatternSymbolCriteria, K as PatternTestResult, L as PracticeCategory, N as PracticeEvent, O as PracticeEventInput, Q as PracticeEventQuery, R as PracticeResult, T as Resolution, U as ResolutionQueryOptions, V as ResolutionRecord, W as ResolutionStrategy, X as Sentinel, Y as SentinelConfig, Z as SymbolHotspot, _ as SymbolIncidentCount, $ as SymbolResolutionTime, a0 as SymbolicContext } from './sdk-B27_vK1g.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sentinel Configuration
|
|
6
|
+
*
|
|
7
|
+
* Loads and writes .sentinel.yaml config files.
|
|
8
|
+
* Provides project-level configuration for the Sentinel SDK and CLI.
|
|
9
|
+
*/
|
|
10
|
+
interface SentinelYamlConfig {
|
|
11
|
+
version: string;
|
|
12
|
+
project: string;
|
|
13
|
+
environment?: string;
|
|
14
|
+
symbols?: {
|
|
15
|
+
components?: string[];
|
|
16
|
+
gates?: string[];
|
|
17
|
+
flows?: string[];
|
|
18
|
+
signals?: string[];
|
|
19
|
+
};
|
|
20
|
+
routes?: Record<string, string>;
|
|
21
|
+
scrub?: {
|
|
22
|
+
headers?: string[];
|
|
23
|
+
fields?: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load .sentinel.yaml from a project directory.
|
|
28
|
+
*
|
|
29
|
+
* @param projectDir - Project root directory
|
|
30
|
+
* @returns Parsed config or null if not found
|
|
31
|
+
*/
|
|
32
|
+
declare function loadConfig(projectDir: string): SentinelYamlConfig | null;
|
|
33
|
+
/**
|
|
34
|
+
* Write .sentinel.yaml to a project directory.
|
|
35
|
+
*
|
|
36
|
+
* @param projectDir - Project root directory
|
|
37
|
+
* @param config - Config to write
|
|
38
|
+
*/
|
|
39
|
+
declare function writeConfig(projectDir: string, config: SentinelYamlConfig): void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Sentinel Auto-Symbol Detector
|
|
43
|
+
*
|
|
44
|
+
* Scans codebase structure to infer Paradigm symbols.
|
|
45
|
+
* Works for any project — doesn't require Paradigm.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
interface DetectionResult {
|
|
49
|
+
components: string[];
|
|
50
|
+
gates: string[];
|
|
51
|
+
flows: string[];
|
|
52
|
+
signals: string[];
|
|
53
|
+
routes: Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Detect symbols from codebase structure.
|
|
57
|
+
*
|
|
58
|
+
* @param projectDir - Project root directory
|
|
59
|
+
* @returns Detected symbols and route mappings
|
|
60
|
+
*/
|
|
61
|
+
declare function detectSymbols(projectDir: string): DetectionResult;
|
|
62
|
+
/**
|
|
63
|
+
* Generate a .sentinel.yaml config from detected symbols.
|
|
64
|
+
*
|
|
65
|
+
* @param projectDir - Project root directory
|
|
66
|
+
* @returns SentinelYamlConfig ready to write
|
|
67
|
+
*/
|
|
68
|
+
declare function generateConfig(projectDir: string): SentinelYamlConfig;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Paradigm Sentinel - Incident Grouper
|
|
72
|
+
*
|
|
73
|
+
* Clusters similar incidents based on symbolic context and error patterns.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
declare class IncidentGrouper {
|
|
77
|
+
private storage;
|
|
78
|
+
constructor(storage: SentinelStorage);
|
|
79
|
+
/**
|
|
80
|
+
* Try to find or create a group for an incident
|
|
81
|
+
* Returns the group ID if grouped, null if no suitable group
|
|
82
|
+
*/
|
|
83
|
+
group(incident: SymbolicIncidentRecord): string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Find incidents similar to the given one
|
|
86
|
+
*/
|
|
87
|
+
findSimilar(incident: SymbolicIncidentRecord, limit?: number): SymbolicIncidentRecord[];
|
|
88
|
+
/**
|
|
89
|
+
* Analyze ungrouped incidents and create groups automatically
|
|
90
|
+
*/
|
|
91
|
+
analyzeAndGroup(options?: {
|
|
92
|
+
minSize?: number;
|
|
93
|
+
}): IncidentGroup[];
|
|
94
|
+
/**
|
|
95
|
+
* Calculate similarity between two incidents (0-1)
|
|
96
|
+
*/
|
|
97
|
+
private calculateSimilarity;
|
|
98
|
+
/**
|
|
99
|
+
* Calculate string similarity using Levenshtein distance
|
|
100
|
+
*/
|
|
101
|
+
private stringSimilarity;
|
|
102
|
+
/**
|
|
103
|
+
* Levenshtein distance for string comparison
|
|
104
|
+
*/
|
|
105
|
+
private levenshteinDistance;
|
|
106
|
+
/**
|
|
107
|
+
* Check if incident should join existing group
|
|
108
|
+
*/
|
|
109
|
+
private shouldJoinGroup;
|
|
110
|
+
/**
|
|
111
|
+
* Extract symbols common to all incidents
|
|
112
|
+
*/
|
|
113
|
+
private extractCommonSymbols;
|
|
114
|
+
/**
|
|
115
|
+
* Extract common error patterns from incidents
|
|
116
|
+
*/
|
|
117
|
+
private extractCommonErrorPatterns;
|
|
118
|
+
private getEarliestTimestamp;
|
|
119
|
+
private getLatestTimestamp;
|
|
120
|
+
private getUniqueEnvironments;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Paradigm Sentinel - Timeline Builder
|
|
125
|
+
*
|
|
126
|
+
* Builds and renders flow timelines for incidents with flow context.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
declare class TimelineBuilder {
|
|
130
|
+
/**
|
|
131
|
+
* Build a timeline from an incident with flow position
|
|
132
|
+
*/
|
|
133
|
+
build(incident: SymbolicIncidentRecord): FlowTimeline | null;
|
|
134
|
+
/**
|
|
135
|
+
* Render timeline as ASCII art
|
|
136
|
+
*/
|
|
137
|
+
renderAscii(timeline: FlowTimeline): string;
|
|
138
|
+
/**
|
|
139
|
+
* Render timeline as structured data (for MCP/JSON output)
|
|
140
|
+
*/
|
|
141
|
+
renderStructured(timeline: FlowTimeline): object;
|
|
142
|
+
/**
|
|
143
|
+
* Infer event type from symbol prefix
|
|
144
|
+
*/
|
|
145
|
+
private inferEventType;
|
|
146
|
+
/**
|
|
147
|
+
* Get icon for event type
|
|
148
|
+
*/
|
|
149
|
+
private getEventIcon;
|
|
150
|
+
/**
|
|
151
|
+
* Get status text for event type
|
|
152
|
+
*/
|
|
153
|
+
private getEventStatus;
|
|
154
|
+
/**
|
|
155
|
+
* Format timestamp for display
|
|
156
|
+
*/
|
|
157
|
+
private formatTime;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Paradigm Sentinel - Statistics Calculator
|
|
162
|
+
*
|
|
163
|
+
* Calculates various statistics and metrics for incidents and patterns.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
declare class StatsCalculator {
|
|
167
|
+
private storage;
|
|
168
|
+
constructor(storage: SentinelStorage);
|
|
169
|
+
/**
|
|
170
|
+
* Get comprehensive statistics for a time period
|
|
171
|
+
*/
|
|
172
|
+
getStats(periodDays?: number): SentinelStats;
|
|
173
|
+
/**
|
|
174
|
+
* Get health metrics for a specific symbol
|
|
175
|
+
*/
|
|
176
|
+
getSymbolHealth(symbol: string): SymbolHealth;
|
|
177
|
+
/**
|
|
178
|
+
* Get trending issues (symbols with increasing incident rates)
|
|
179
|
+
*/
|
|
180
|
+
getTrendingIssues(days?: number): {
|
|
181
|
+
symbol: string;
|
|
182
|
+
trend: number;
|
|
183
|
+
}[];
|
|
184
|
+
/**
|
|
185
|
+
* Get resolution metrics
|
|
186
|
+
*/
|
|
187
|
+
getResolutionMetrics(): {
|
|
188
|
+
avgTimeToResolve: number;
|
|
189
|
+
resolvedWithPattern: number;
|
|
190
|
+
resolvedManually: number;
|
|
191
|
+
totalResolved: number;
|
|
192
|
+
resolutionRate: number;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Get pattern effectiveness metrics
|
|
196
|
+
*/
|
|
197
|
+
getPatternEffectiveness(): {
|
|
198
|
+
patternId: string;
|
|
199
|
+
name: string;
|
|
200
|
+
matches: number;
|
|
201
|
+
resolutions: number;
|
|
202
|
+
recurrences: number;
|
|
203
|
+
effectiveness: number;
|
|
204
|
+
}[];
|
|
205
|
+
/**
|
|
206
|
+
* Get incident rate by hour of day
|
|
207
|
+
*/
|
|
208
|
+
getIncidentsByHour(days?: number): {
|
|
209
|
+
hour: number;
|
|
210
|
+
count: number;
|
|
211
|
+
}[];
|
|
212
|
+
/**
|
|
213
|
+
* Get incident rate by environment
|
|
214
|
+
*/
|
|
215
|
+
getIncidentsByEnvironment(): {
|
|
216
|
+
environment: string;
|
|
217
|
+
count: number;
|
|
218
|
+
percentage: number;
|
|
219
|
+
}[];
|
|
220
|
+
/**
|
|
221
|
+
* Get symbol correlation matrix (which symbols fail together)
|
|
222
|
+
*/
|
|
223
|
+
getSymbolCorrelation(): {
|
|
224
|
+
symbol1: string;
|
|
225
|
+
symbol2: string;
|
|
226
|
+
correlation: number;
|
|
227
|
+
}[];
|
|
228
|
+
/**
|
|
229
|
+
* Generate a summary dashboard string
|
|
230
|
+
*/
|
|
231
|
+
generateDashboard(periodDays?: number): string;
|
|
232
|
+
/**
|
|
233
|
+
* Helper: Count symbols across incidents
|
|
234
|
+
*/
|
|
235
|
+
private countSymbols;
|
|
236
|
+
/**
|
|
237
|
+
* Helper: Get all symbols from incident
|
|
238
|
+
*/
|
|
239
|
+
private getSymbolsFromIncident;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Paradigm Sentinel - Context Enricher
|
|
244
|
+
*
|
|
245
|
+
* Enriches incidents with symbol metadata from .purpose files and symbol index.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
declare class ContextEnricher {
|
|
249
|
+
private projectRoot;
|
|
250
|
+
private symbolCache;
|
|
251
|
+
private purposeCache;
|
|
252
|
+
constructor(projectRoot?: string);
|
|
253
|
+
/**
|
|
254
|
+
* Enrich an incident with symbol context
|
|
255
|
+
*/
|
|
256
|
+
enrich(incident: SymbolicIncidentRecord): EnrichedIncident;
|
|
257
|
+
/**
|
|
258
|
+
* Get symbol metadata from index or .purpose files
|
|
259
|
+
*/
|
|
260
|
+
getSymbolContext(symbol: string): SymbolEnrichment;
|
|
261
|
+
/**
|
|
262
|
+
* Find symbol in premise index
|
|
263
|
+
*/
|
|
264
|
+
private findInSymbolIndex;
|
|
265
|
+
/**
|
|
266
|
+
* Find symbol in .purpose files
|
|
267
|
+
*/
|
|
268
|
+
private findInPurposeFiles;
|
|
269
|
+
/**
|
|
270
|
+
* Get potential file paths for a symbol
|
|
271
|
+
*/
|
|
272
|
+
private getSearchPathsForSymbol;
|
|
273
|
+
/**
|
|
274
|
+
* Parse a .purpose file
|
|
275
|
+
*/
|
|
276
|
+
private parsePurposeFile;
|
|
277
|
+
/**
|
|
278
|
+
* Clear caches
|
|
279
|
+
*/
|
|
280
|
+
clearCache(): void;
|
|
281
|
+
/**
|
|
282
|
+
* Batch enrich multiple incidents
|
|
283
|
+
*/
|
|
284
|
+
enrichBatch(incidents: SymbolicIncidentRecord[]): EnrichedIncident[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Paradigm Sentinel - Pattern Suggester
|
|
289
|
+
*
|
|
290
|
+
* Generates pattern suggestions from resolved incidents and incident groups.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
declare class PatternSuggester {
|
|
294
|
+
private storage;
|
|
295
|
+
constructor(storage: SentinelStorage);
|
|
296
|
+
/**
|
|
297
|
+
* Suggest a pattern from a resolved incident
|
|
298
|
+
*/
|
|
299
|
+
suggestFromIncident(incident: SymbolicIncidentRecord): Partial<FailurePattern>;
|
|
300
|
+
/**
|
|
301
|
+
* Suggest a pattern from an incident group
|
|
302
|
+
*/
|
|
303
|
+
suggestFromGroup(group: IncidentGroup): Partial<FailurePattern>;
|
|
304
|
+
/**
|
|
305
|
+
* Find incidents that could become patterns
|
|
306
|
+
*/
|
|
307
|
+
findPatternCandidates(minOccurrences?: number): PatternCandidate[];
|
|
308
|
+
/**
|
|
309
|
+
* Generate pattern from multiple similar incidents
|
|
310
|
+
*/
|
|
311
|
+
private suggestFromIncidents;
|
|
312
|
+
/**
|
|
313
|
+
* Build symbol criteria for pattern, adding wildcards where appropriate
|
|
314
|
+
*/
|
|
315
|
+
private buildSymbolCriteria;
|
|
316
|
+
/**
|
|
317
|
+
* Extract keywords from error message
|
|
318
|
+
*/
|
|
319
|
+
private extractErrorKeywords;
|
|
320
|
+
/**
|
|
321
|
+
* Extract common error keywords from multiple incidents
|
|
322
|
+
*/
|
|
323
|
+
private extractCommonErrorKeywords;
|
|
324
|
+
/**
|
|
325
|
+
* Extract symbols common to all incidents
|
|
326
|
+
*/
|
|
327
|
+
private extractCommonSymbols;
|
|
328
|
+
/**
|
|
329
|
+
* Extract missing signals common to multiple incidents
|
|
330
|
+
*/
|
|
331
|
+
private extractCommonMissingSignals;
|
|
332
|
+
/**
|
|
333
|
+
* Generate a pattern ID from incident
|
|
334
|
+
*/
|
|
335
|
+
private generatePatternId;
|
|
336
|
+
/**
|
|
337
|
+
* Generate a human-readable pattern name
|
|
338
|
+
*/
|
|
339
|
+
private generatePatternName;
|
|
340
|
+
/**
|
|
341
|
+
* Generate tags from incident
|
|
342
|
+
*/
|
|
343
|
+
private generateTags;
|
|
344
|
+
/**
|
|
345
|
+
* Generate tags from incident group
|
|
346
|
+
*/
|
|
347
|
+
private generateTagsFromGroup;
|
|
348
|
+
/**
|
|
349
|
+
* Generate tags from multiple incidents
|
|
350
|
+
*/
|
|
351
|
+
private generateTagsFromIncidents;
|
|
352
|
+
/**
|
|
353
|
+
* Get symbol signature for grouping
|
|
354
|
+
*/
|
|
355
|
+
private getSymbolSignature;
|
|
356
|
+
/**
|
|
357
|
+
* Check if there's already a pattern matching this incident
|
|
358
|
+
*/
|
|
359
|
+
private hasMatchingPattern;
|
|
360
|
+
/**
|
|
361
|
+
* Infer resolution strategy from incidents
|
|
362
|
+
*/
|
|
363
|
+
private inferStrategy;
|
|
364
|
+
/**
|
|
365
|
+
* Get priority based on occurrence count
|
|
366
|
+
*/
|
|
367
|
+
private getPriorityFromCount;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Paradigm Sentinel - Pattern Importer
|
|
372
|
+
*
|
|
373
|
+
* Validates and imports patterns from JSON files or URLs.
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
interface ValidationResult {
|
|
377
|
+
valid: boolean;
|
|
378
|
+
errors: string[];
|
|
379
|
+
warnings: string[];
|
|
380
|
+
}
|
|
381
|
+
declare class PatternImporter {
|
|
382
|
+
/**
|
|
383
|
+
* Validate a pattern export file
|
|
384
|
+
*/
|
|
385
|
+
validate(data: unknown): ValidationResult;
|
|
386
|
+
/**
|
|
387
|
+
* Validate a single pattern
|
|
388
|
+
*/
|
|
389
|
+
validatePattern(pattern: Record<string, unknown>, index: number): {
|
|
390
|
+
errors: string[];
|
|
391
|
+
warnings: string[];
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Load patterns from a JSON file
|
|
395
|
+
*/
|
|
396
|
+
loadFromFile(filePath: string): PatternExport;
|
|
397
|
+
/**
|
|
398
|
+
* Load patterns from a URL
|
|
399
|
+
*/
|
|
400
|
+
loadFromUrl(url: string): Promise<PatternExport>;
|
|
401
|
+
/**
|
|
402
|
+
* Normalize raw data to PatternExport
|
|
403
|
+
*/
|
|
404
|
+
private normalizeExport;
|
|
405
|
+
/**
|
|
406
|
+
* Normalize a raw pattern object
|
|
407
|
+
*/
|
|
408
|
+
private normalizePattern;
|
|
409
|
+
/**
|
|
410
|
+
* Merge patterns from multiple sources
|
|
411
|
+
*/
|
|
412
|
+
mergePatterns(...exports: PatternExport[]): PatternExport;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Paradigm Sentinel - Seed Pattern Loader
|
|
417
|
+
*
|
|
418
|
+
* Loads built-in patterns from JSON files.
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Load universal patterns that apply to most projects
|
|
423
|
+
*/
|
|
424
|
+
declare function loadUniversalPatterns(): PatternExport;
|
|
425
|
+
/**
|
|
426
|
+
* Load Paradigm-specific patterns
|
|
427
|
+
*/
|
|
428
|
+
declare function loadParadigmPatterns(): PatternExport;
|
|
429
|
+
/**
|
|
430
|
+
* Load all seed patterns combined
|
|
431
|
+
*/
|
|
432
|
+
declare function loadAllSeedPatterns(): PatternExport;
|
|
433
|
+
|
|
434
|
+
export { ContextEnricher, EnrichedIncident, FailurePattern, FlowTimeline, IncidentGroup, IncidentGrouper, PatternCandidate, PatternExport, PatternImporter, PatternSuggester, SentinelStats, SentinelStorage, type SentinelYamlConfig, StatsCalculator, SymbolEnrichment, SymbolHealth, SymbolicIncidentRecord, TimelineBuilder, detectSymbols, generateConfig, loadAllSeedPatterns, loadConfig, loadParadigmPatterns, loadUniversalPatterns, writeConfig };
|