@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.
- package/dist/adapters/express.d.ts +3 -1
- package/dist/adapters/fastify.d.ts +3 -1
- package/dist/adapters/hono.d.ts +3 -1
- package/dist/{chunk-KPMG4XED.js → chunk-FOF7CPJ6.js} +994 -2
- package/dist/chunk-VQ3SIN7S.js +422 -0
- package/dist/cli.js +6 -6
- package/dist/{commands-KIMGFR2I.js → commands-7PHRWGOB.js} +1791 -289
- package/dist/{dist-2F7NO4H4.js → dist-AG5JNIZU.js} +27 -2
- package/dist/{dist-BPWLYV4U.js → dist-TYG2XME3.js} +27 -2
- package/dist/index.d.ts +47 -5
- package/dist/index.js +141 -186
- package/dist/mcp.js +1040 -9
- package/dist/sdk-BTblv--p.d.ts +180 -0
- package/dist/server/index.d.ts +19 -3
- package/dist/server/index.js +581 -9
- package/dist/storage-BqCJqZat.d.ts +129 -0
- package/dist/transport-DqamniUy.d.ts +185 -0
- package/dist/transport.d.ts +2 -0
- package/dist/transport.js +10 -0
- package/dist/{sdk-B27_vK1g.d.ts → types-BmVoO1iF.d.ts} +196 -259
- package/package.json +15 -1
- package/ui/dist/assets/{index-DPxatSdT.css → index-9iUtfyBP.css} +1 -1
- package/ui/dist/assets/index-BfINPxlF.js +62 -0
- package/ui/dist/assets/index-BfINPxlF.js.map +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-BNgsn_C8.js +0 -62
- package/ui/dist/assets/index-BNgsn_C8.js.map +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { S as SentinelStorage } from './storage-BqCJqZat.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';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Paradigm Sentinel - Pattern Matching Engine
|
|
6
|
+
*
|
|
7
|
+
* Matches incidents against failure patterns using symbolic context,
|
|
8
|
+
* error text, and missing signals.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare class PatternMatcher {
|
|
12
|
+
private storage;
|
|
13
|
+
constructor(storage: SentinelStorage);
|
|
14
|
+
/**
|
|
15
|
+
* Match an incident against all patterns and return ranked results
|
|
16
|
+
*/
|
|
17
|
+
match(incident: SymbolicIncidentRecord, config?: Partial<MatcherConfig>): PatternMatch[];
|
|
18
|
+
/**
|
|
19
|
+
* Test a pattern against historical incidents
|
|
20
|
+
*/
|
|
21
|
+
testPattern(pattern: FailurePattern, limit?: number): PatternTestResult;
|
|
22
|
+
/**
|
|
23
|
+
* Score how well a pattern matches an incident
|
|
24
|
+
*/
|
|
25
|
+
private scoreMatch;
|
|
26
|
+
/**
|
|
27
|
+
* Match symbols between pattern and incident
|
|
28
|
+
*/
|
|
29
|
+
private matchSymbols;
|
|
30
|
+
/**
|
|
31
|
+
* Match a single symbol value (supports wildcards)
|
|
32
|
+
*/
|
|
33
|
+
private matchSingleSymbol;
|
|
34
|
+
/**
|
|
35
|
+
* Match error text keywords and regex
|
|
36
|
+
*/
|
|
37
|
+
private matchErrorText;
|
|
38
|
+
/**
|
|
39
|
+
* Match missing signals from flow position
|
|
40
|
+
*/
|
|
41
|
+
private matchMissingSignals;
|
|
42
|
+
/**
|
|
43
|
+
* Check if pattern's environment filter matches incident
|
|
44
|
+
*/
|
|
45
|
+
private matchEnvironment;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Sentinel SDK
|
|
50
|
+
*
|
|
51
|
+
* The developer-facing API for capturing errors with symbolic context.
|
|
52
|
+
* Wraps the core storage and pattern matching engine.
|
|
53
|
+
*
|
|
54
|
+
* Usage:
|
|
55
|
+
* import { Sentinel } from '@a-company/sentinel';
|
|
56
|
+
* const sentinel = new Sentinel({ project: 'my-app' });
|
|
57
|
+
* sentinel.capture(new Error('Payment failed'), { component: '#checkout' });
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Flow tracker for monitoring multi-step flows.
|
|
62
|
+
*
|
|
63
|
+
* Usage:
|
|
64
|
+
* const flow = sentinel.flow('$checkout-flow');
|
|
65
|
+
* flow.expect('!payment-authorized', '!order-created');
|
|
66
|
+
* flow.gate('^authenticated', true);
|
|
67
|
+
* flow.signal('!payment-authorized');
|
|
68
|
+
* flow.complete();
|
|
69
|
+
*/
|
|
70
|
+
declare class FlowTracker {
|
|
71
|
+
private flowId;
|
|
72
|
+
private sentinel;
|
|
73
|
+
private actual;
|
|
74
|
+
private expected;
|
|
75
|
+
private completed;
|
|
76
|
+
constructor(flowId: string, sentinel: Sentinel);
|
|
77
|
+
/** Declare which signals/gates are expected in this flow */
|
|
78
|
+
expect(...symbols: string[]): this;
|
|
79
|
+
/** Record a generic step in the flow */
|
|
80
|
+
step(symbol: string): this;
|
|
81
|
+
/** Record a gate check result */
|
|
82
|
+
gate(id: string, passed: boolean): this;
|
|
83
|
+
/** Record a signal emission */
|
|
84
|
+
signal(id: string, _data?: object): this;
|
|
85
|
+
/** Mark the flow as successfully completed */
|
|
86
|
+
complete(): void;
|
|
87
|
+
/** Capture an error with full flow position context */
|
|
88
|
+
fail(error: Error): void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The main Sentinel SDK class.
|
|
92
|
+
*
|
|
93
|
+
* Usage:
|
|
94
|
+
* const sentinel = new Sentinel({ project: 'my-app', environment: 'production' });
|
|
95
|
+
*
|
|
96
|
+
* // Capture errors with symbolic context
|
|
97
|
+
* sentinel.capture(error, { component: '#checkout', gate: '^payment-validated' });
|
|
98
|
+
*
|
|
99
|
+
* // Component context for scoped captures
|
|
100
|
+
* const ctx = sentinel.component('#checkout');
|
|
101
|
+
* ctx.capture(error);
|
|
102
|
+
*
|
|
103
|
+
* // Flow tracking
|
|
104
|
+
* const flow = sentinel.flow('$checkout-flow');
|
|
105
|
+
* flow.gate('^authenticated', true);
|
|
106
|
+
* flow.signal('!payment-authorized');
|
|
107
|
+
* flow.complete();
|
|
108
|
+
*/
|
|
109
|
+
declare class Sentinel {
|
|
110
|
+
private storage;
|
|
111
|
+
private matcher;
|
|
112
|
+
private config;
|
|
113
|
+
private ready;
|
|
114
|
+
private readyPromise;
|
|
115
|
+
private seeded;
|
|
116
|
+
constructor(config: SentinelConfig);
|
|
117
|
+
/** Explicitly initialize storage. Optional — auto-called on first capture. */
|
|
118
|
+
init(): Promise<void>;
|
|
119
|
+
private doInit;
|
|
120
|
+
private ensureReady;
|
|
121
|
+
/**
|
|
122
|
+
* Create a component context for scoped error capture.
|
|
123
|
+
*
|
|
124
|
+
* @param id - Component symbol (e.g. '#checkout' or 'checkout')
|
|
125
|
+
* @returns ComponentContext with capture() and wrap() methods
|
|
126
|
+
*/
|
|
127
|
+
component(id: string): ComponentContext;
|
|
128
|
+
/**
|
|
129
|
+
* Record a gate check result.
|
|
130
|
+
* If the gate fails, auto-captures an incident.
|
|
131
|
+
*
|
|
132
|
+
* @param id - Gate symbol (e.g. '^authenticated' or 'authenticated')
|
|
133
|
+
* @param passed - Whether the gate passed
|
|
134
|
+
*/
|
|
135
|
+
gate(id: string, passed: boolean): void;
|
|
136
|
+
/**
|
|
137
|
+
* Record a signal emission. Primarily for flow tracking context.
|
|
138
|
+
*
|
|
139
|
+
* @param id - Signal symbol (e.g. '!payment-authorized' or 'payment-authorized')
|
|
140
|
+
*/
|
|
141
|
+
signal(id: string, _data?: object): void;
|
|
142
|
+
/**
|
|
143
|
+
* Create a flow tracker for monitoring multi-step operations.
|
|
144
|
+
*
|
|
145
|
+
* @param id - Flow symbol (e.g. '$checkout-flow' or 'checkout-flow')
|
|
146
|
+
* @returns FlowTracker instance
|
|
147
|
+
*/
|
|
148
|
+
flow(id: string): FlowTracker;
|
|
149
|
+
/**
|
|
150
|
+
* Capture an error with symbolic context.
|
|
151
|
+
*
|
|
152
|
+
* @param error - The error to capture
|
|
153
|
+
* @param context - Symbolic context (component, gate, flow, signal)
|
|
154
|
+
* @param flowPosition - Optional flow position data
|
|
155
|
+
* @returns Incident ID (e.g. 'INC-001')
|
|
156
|
+
*/
|
|
157
|
+
capture(error: Error, context?: Partial<SymbolicContext>, flowPosition?: FlowPosition): string;
|
|
158
|
+
/**
|
|
159
|
+
* Get pattern matches for a captured incident.
|
|
160
|
+
*
|
|
161
|
+
* @param incidentId - The incident ID to match
|
|
162
|
+
* @returns Array of pattern matches sorted by confidence
|
|
163
|
+
*/
|
|
164
|
+
match(incidentId: string): PatternMatch[];
|
|
165
|
+
/**
|
|
166
|
+
* Create Express error-handling middleware.
|
|
167
|
+
*
|
|
168
|
+
* Usage:
|
|
169
|
+
* app.use(sentinel.express());
|
|
170
|
+
*/
|
|
171
|
+
express(): any;
|
|
172
|
+
/** Close the database connection. Call when shutting down. */
|
|
173
|
+
close(): void;
|
|
174
|
+
/** Get the underlying storage instance (for advanced usage). */
|
|
175
|
+
getStorage(): SentinelStorage;
|
|
176
|
+
/** Get the underlying pattern matcher (for advanced usage). */
|
|
177
|
+
getMatcher(): PatternMatcher;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { FlowTracker as F, PatternMatcher as P, Sentinel as S };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Express } from 'express';
|
|
2
|
+
import { S as SentinelStorage } from '../storage-BqCJqZat.js';
|
|
3
|
+
import { S as SentinelServerConfig, L as LogEntry } from '../types-BmVoO1iF.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Symbol index loader for the server
|
|
@@ -62,20 +64,34 @@ declare function loadGitHistory(projectDir: string, options?: {
|
|
|
62
64
|
declare function getSymbolsAtCommit(projectDir: string, commitHash: string): Promise<string[]>;
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
|
-
* Sentinel Server - Express server for
|
|
67
|
+
* Sentinel Server - Express server with WebSocket for real-time log streaming
|
|
66
68
|
*/
|
|
67
69
|
|
|
68
70
|
interface ServerOptions {
|
|
69
71
|
port: number;
|
|
70
72
|
projectDir: string;
|
|
71
73
|
open?: boolean;
|
|
74
|
+
dbPath?: string;
|
|
75
|
+
logPruneLimit?: number;
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
78
|
* Create the Express application with all routes configured
|
|
75
79
|
*/
|
|
76
|
-
declare function createApp(options: ServerOptions
|
|
80
|
+
declare function createApp(options: ServerOptions & {
|
|
81
|
+
storage?: SentinelStorage;
|
|
82
|
+
serverConfig?: SentinelServerConfig;
|
|
83
|
+
symbolIndex?: Array<{
|
|
84
|
+
symbol: string;
|
|
85
|
+
type: string;
|
|
86
|
+
filePath: string;
|
|
87
|
+
}>;
|
|
88
|
+
onLogReceived?: (entry: LogEntry, validation?: {
|
|
89
|
+
known: boolean;
|
|
90
|
+
suggestion?: string;
|
|
91
|
+
}) => void;
|
|
92
|
+
}): Express;
|
|
77
93
|
/**
|
|
78
|
-
* Start the Sentinel server
|
|
94
|
+
* Start the Sentinel server with WebSocket support
|
|
79
95
|
*/
|
|
80
96
|
declare function startServer(options: ServerOptions): Promise<void>;
|
|
81
97
|
|