@a-company/sentinel 0.2.0 → 3.5.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.
@@ -5711,9 +5711,10 @@ function parsePurposeFileDetailed(filePath) {
5711
5711
  detailedErrors.push({ message: error, type: "file" });
5712
5712
  return { data: null, errors, detailedErrors, rawContent: void 0, isYamlValid: false };
5713
5713
  }
5714
+ const processedContent = rawContent.replace(/^([#~!$^][\w-]+):/gm, '"$1":').replace(/^(\s*-\s+)([!#][\w-]+)$/gm, '$1"$2"');
5714
5715
  let data = null;
5715
5716
  try {
5716
- data = load(rawContent);
5717
+ data = load(processedContent);
5717
5718
  } catch (e) {
5718
5719
  const yamlError = e;
5719
5720
  const line = yamlError.mark?.line ? yamlError.mark.line + 1 : void 0;
@@ -5735,6 +5736,28 @@ function parsePurposeFileDetailed(filePath) {
5735
5736
  isYamlValid: true
5736
5737
  };
5737
5738
  }
5739
+ if (typeof data === "object" && data !== null) {
5740
+ const obj = data;
5741
+ const prefixMap = {
5742
+ "#": "components",
5743
+ "$": "flows",
5744
+ "^": "gates",
5745
+ "!": "signals",
5746
+ "~": "aspects"
5747
+ };
5748
+ for (const key of Object.keys(obj)) {
5749
+ const prefix = key[0];
5750
+ const target = prefixMap[prefix];
5751
+ if (!target || key.length < 2) continue;
5752
+ const id = key.slice(1);
5753
+ const value = obj[key];
5754
+ if (typeof value !== "object" || value === null) continue;
5755
+ const dict = obj[target] || {};
5756
+ if (!(target in obj)) obj[target] = dict;
5757
+ if (!(id in dict)) dict[id] = value;
5758
+ delete obj[key];
5759
+ }
5760
+ }
5738
5761
  const parseResult = PurposeFileSchema.safeParse(data);
5739
5762
  if (!parseResult.success) {
5740
5763
  for (const issue of parseResult.error.issues) {
@@ -6472,7 +6495,9 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6472
6495
  data: item,
6473
6496
  description: item.description,
6474
6497
  anchors: item.anchors?.map((a) => parseAnchorString(a)),
6475
- appliesTo: item["applies-to"]
6498
+ appliesTo: item["applies-to"],
6499
+ tags: item.tags,
6500
+ enforcement: item.enforcement
6476
6501
  }));
6477
6502
  }
6478
6503
  const symbolRefs = extractSymbolReferences(parsed);
@@ -5713,9 +5713,10 @@ function parsePurposeFileDetailed(filePath) {
5713
5713
  detailedErrors.push({ message: error, type: "file" });
5714
5714
  return { data: null, errors, detailedErrors, rawContent: void 0, isYamlValid: false };
5715
5715
  }
5716
+ const processedContent = rawContent.replace(/^([#~!$^][\w-]+):/gm, '"$1":').replace(/^(\s*-\s+)([!#][\w-]+)$/gm, '$1"$2"');
5716
5717
  let data = null;
5717
5718
  try {
5718
- data = load(rawContent);
5719
+ data = load(processedContent);
5719
5720
  } catch (e) {
5720
5721
  const yamlError = e;
5721
5722
  const line = yamlError.mark?.line ? yamlError.mark.line + 1 : void 0;
@@ -5737,6 +5738,28 @@ function parsePurposeFileDetailed(filePath) {
5737
5738
  isYamlValid: true
5738
5739
  };
5739
5740
  }
5741
+ if (typeof data === "object" && data !== null) {
5742
+ const obj = data;
5743
+ const prefixMap = {
5744
+ "#": "components",
5745
+ "$": "flows",
5746
+ "^": "gates",
5747
+ "!": "signals",
5748
+ "~": "aspects"
5749
+ };
5750
+ for (const key of Object.keys(obj)) {
5751
+ const prefix = key[0];
5752
+ const target = prefixMap[prefix];
5753
+ if (!target || key.length < 2) continue;
5754
+ const id = key.slice(1);
5755
+ const value = obj[key];
5756
+ if (typeof value !== "object" || value === null) continue;
5757
+ const dict = obj[target] || {};
5758
+ if (!(target in obj)) obj[target] = dict;
5759
+ if (!(id in dict)) dict[id] = value;
5760
+ delete obj[key];
5761
+ }
5762
+ }
5740
5763
  const parseResult = PurposeFileSchema.safeParse(data);
5741
5764
  if (!parseResult.success) {
5742
5765
  for (const issue of parseResult.error.issues) {
@@ -6474,7 +6497,9 @@ async function aggregateFromPremise(premiseFile, rootDir) {
6474
6497
  data: item,
6475
6498
  description: item.description,
6476
6499
  anchors: item.anchors?.map((a) => parseAnchorString(a)),
6477
- appliesTo: item["applies-to"]
6500
+ appliesTo: item["applies-to"],
6501
+ tags: item.tags,
6502
+ enforcement: item.enforcement
6478
6503
  }));
6479
6504
  }
6480
6505
  const symbolRefs = extractSymbolReferences(parsed);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
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';
1
+ export { F as FlowTracker, P as PatternMatcher, S as Sentinel } from './sdk-BTblv--p.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 } from './storage-BqCJqZat.js';
3
6
 
4
7
  /**
5
8
  * Sentinel Configuration
@@ -7,6 +10,7 @@ export { B as BackupExport, C as ComponentContext, g as CreateGroupInput, h as C
7
10
  * Loads and writes .sentinel.yaml config files.
8
11
  * Provides project-level configuration for the Sentinel SDK and CLI.
9
12
  */
13
+
10
14
  interface SentinelYamlConfig {
11
15
  version: string;
12
16
  project: string;
@@ -22,6 +26,14 @@ interface SentinelYamlConfig {
22
26
  headers?: string[];
23
27
  fields?: string[];
24
28
  };
29
+ server?: {
30
+ port?: number;
31
+ maxLogs?: number;
32
+ maxBatchSize?: number;
33
+ wsMaxSubscribers?: number;
34
+ pruneIntervalInserts?: number;
35
+ logRetentionDays?: number;
36
+ };
25
37
  }
26
38
  /**
27
39
  * Load .sentinel.yaml from a project directory.
@@ -37,6 +49,11 @@ declare function loadConfig(projectDir: string): SentinelYamlConfig | null;
37
49
  * @param config - Config to write
38
50
  */
39
51
  declare function writeConfig(projectDir: string, config: SentinelYamlConfig): void;
52
+ /**
53
+ * Load server configuration with resolution order:
54
+ * env vars → local .sentinel.yaml → global ~/.paradigm/sentinel.yaml → defaults
55
+ */
56
+ declare function loadServerConfig(projectDir?: string): SentinelServerConfig;
40
57
 
41
58
  /**
42
59
  * Sentinel Auto-Symbol Detector
@@ -73,9 +90,20 @@ declare function generateConfig(projectDir: string): SentinelYamlConfig;
73
90
  * Clusters similar incidents based on symbolic context and error patterns.
74
91
  */
75
92
 
93
+ interface GrouperConfig {
94
+ /** Similarity threshold 0-1 (default: 0.6) */
95
+ similarityThreshold?: number;
96
+ /** Time-decay half-life in days (default: 14) */
97
+ decayHalfLifeDays?: number;
98
+ /** Enable stack trace fingerprinting for better grouping (default: true) */
99
+ useStackFingerprint?: boolean;
100
+ }
76
101
  declare class IncidentGrouper {
77
102
  private storage;
78
- constructor(storage: SentinelStorage);
103
+ private similarityThreshold;
104
+ private decayHalfLifeDays;
105
+ private useStackFingerprint;
106
+ constructor(storage: SentinelStorage, config?: GrouperConfig);
79
107
  /**
80
108
  * Try to find or create a group for an incident
81
109
  * Returns the group ID if grouped, null if no suitable group
@@ -93,8 +121,20 @@ declare class IncidentGrouper {
93
121
  }): IncidentGroup[];
94
122
  /**
95
123
  * Calculate similarity between two incidents (0-1)
124
+ * Applies time-decay so older incidents contribute less, and optionally
125
+ * uses stack trace fingerprinting for more accurate grouping.
96
126
  */
97
127
  private calculateSimilarity;
128
+ /**
129
+ * Extract a fingerprint from a stack trace by normalizing frames.
130
+ * Strips line numbers, column numbers, and absolute paths to capture
131
+ * the structural signature of the call stack.
132
+ */
133
+ private fingerprintStack;
134
+ /**
135
+ * Compare two stack fingerprints (0-1 similarity)
136
+ */
137
+ private compareFingerprints;
98
138
  /**
99
139
  * Calculate string similarity using Levenshtein distance
100
140
  */
@@ -358,7 +398,9 @@ declare class PatternSuggester {
358
398
  */
359
399
  private hasMatchingPattern;
360
400
  /**
361
- * Infer resolution strategy from incidents
401
+ * Infer resolution strategy from incident error patterns and context.
402
+ * Uses keyword heuristics across all incident messages to pick the
403
+ * most likely resolution approach.
362
404
  */
363
405
  private inferStrategy;
364
406
  /**
@@ -431,4 +473,4 @@ declare function loadParadigmPatterns(): PatternExport;
431
473
  */
432
474
  declare function loadAllSeedPatterns(): PatternExport;
433
475
 
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 };
476
+ export { ContextEnricher, EnrichedIncident, FailurePattern, FlowTimeline, IncidentGroup, IncidentGrouper, PatternCandidate, PatternExport, PatternImporter, PatternSuggester, SentinelServerConfig, SentinelStats, SentinelStorage, type SentinelYamlConfig, StatsCalculator, SymbolEnrichment, SymbolHealth, SymbolicIncidentRecord, TimelineBuilder, detectSymbols, generateConfig, loadAllSeedPatterns, loadConfig, loadParadigmPatterns, loadServerConfig, loadUniversalPatterns, writeConfig };