@a-company/sentinel 0.2.0 → 3.6.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,9 @@
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-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';
3
7
 
4
8
  /**
5
9
  * Sentinel Configuration
@@ -7,6 +11,7 @@ export { B as BackupExport, C as ComponentContext, g as CreateGroupInput, h as C
7
11
  * Loads and writes .sentinel.yaml config files.
8
12
  * Provides project-level configuration for the Sentinel SDK and CLI.
9
13
  */
14
+
10
15
  interface SentinelYamlConfig {
11
16
  version: string;
12
17
  project: string;
@@ -22,6 +27,14 @@ interface SentinelYamlConfig {
22
27
  headers?: string[];
23
28
  fields?: string[];
24
29
  };
30
+ server?: {
31
+ port?: number;
32
+ maxLogs?: number;
33
+ maxBatchSize?: number;
34
+ wsMaxSubscribers?: number;
35
+ pruneIntervalInserts?: number;
36
+ logRetentionDays?: number;
37
+ };
25
38
  }
26
39
  /**
27
40
  * Load .sentinel.yaml from a project directory.
@@ -37,6 +50,11 @@ declare function loadConfig(projectDir: string): SentinelYamlConfig | null;
37
50
  * @param config - Config to write
38
51
  */
39
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;
40
58
 
41
59
  /**
42
60
  * Sentinel Auto-Symbol Detector
@@ -73,9 +91,20 @@ declare function generateConfig(projectDir: string): SentinelYamlConfig;
73
91
  * Clusters similar incidents based on symbolic context and error patterns.
74
92
  */
75
93
 
94
+ interface GrouperConfig {
95
+ /** Similarity threshold 0-1 (default: 0.6) */
96
+ similarityThreshold?: number;
97
+ /** Time-decay half-life in days (default: 14) */
98
+ decayHalfLifeDays?: number;
99
+ /** Enable stack trace fingerprinting for better grouping (default: true) */
100
+ useStackFingerprint?: boolean;
101
+ }
76
102
  declare class IncidentGrouper {
77
103
  private storage;
78
- constructor(storage: SentinelStorage);
104
+ private similarityThreshold;
105
+ private decayHalfLifeDays;
106
+ private useStackFingerprint;
107
+ constructor(storage: SentinelStorage, config?: GrouperConfig);
79
108
  /**
80
109
  * Try to find or create a group for an incident
81
110
  * Returns the group ID if grouped, null if no suitable group
@@ -93,8 +122,20 @@ declare class IncidentGrouper {
93
122
  }): IncidentGroup[];
94
123
  /**
95
124
  * Calculate similarity between two incidents (0-1)
125
+ * Applies time-decay so older incidents contribute less, and optionally
126
+ * uses stack trace fingerprinting for more accurate grouping.
96
127
  */
97
128
  private calculateSimilarity;
129
+ /**
130
+ * Extract a fingerprint from a stack trace by normalizing frames.
131
+ * Strips line numbers, column numbers, and absolute paths to capture
132
+ * the structural signature of the call stack.
133
+ */
134
+ private fingerprintStack;
135
+ /**
136
+ * Compare two stack fingerprints (0-1 similarity)
137
+ */
138
+ private compareFingerprints;
98
139
  /**
99
140
  * Calculate string similarity using Levenshtein distance
100
141
  */
@@ -358,7 +399,9 @@ declare class PatternSuggester {
358
399
  */
359
400
  private hasMatchingPattern;
360
401
  /**
361
- * Infer resolution strategy from incidents
402
+ * Infer resolution strategy from incident error patterns and context.
403
+ * Uses keyword heuristics across all incident messages to pick the
404
+ * most likely resolution approach.
362
405
  */
363
406
  private inferStrategy;
364
407
  /**
@@ -431,4 +474,13 @@ declare function loadParadigmPatterns(): PatternExport;
431
474
  */
432
475
  declare function loadAllSeedPatterns(): PatternExport;
433
476
 
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 };
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 };