mcp-event-intelligence 0.3.1 → 0.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +123 -23
  3. package/SECURITY.md +4 -4
  4. package/bin/mcp-event-intelligence.mjs +3 -3
  5. package/dist/src/composite/engine.d.ts +6 -0
  6. package/dist/src/composite/engine.js +599 -10
  7. package/dist/src/composite/matching.d.ts +1 -1
  8. package/dist/src/composite/matching.js +66 -1
  9. package/dist/src/intelligenceProtocol/activationSchemas.d.ts +2 -0
  10. package/dist/src/intelligenceProtocol/activationSchemas.js +1 -0
  11. package/dist/src/intelligenceProtocol/index.d.ts +9 -2
  12. package/dist/src/intelligenceProtocol/index.js +5 -1
  13. package/dist/src/intelligenceProtocol/operatorRegistry.d.ts +567 -0
  14. package/dist/src/intelligenceProtocol/operatorRegistry.js +477 -0
  15. package/dist/src/intelligenceProtocol/patternV2Schemas.d.ts +188 -0
  16. package/dist/src/intelligenceProtocol/patternV2Schemas.js +801 -0
  17. package/dist/src/intelligenceProtocol/schemas.d.ts +6 -0
  18. package/dist/src/intelligenceProtocol/schemas.js +3 -0
  19. package/dist/src/intelligenceProtocol/triggerPlanSchemas.d.ts +179 -4
  20. package/dist/src/intelligenceProtocol/triggerPlanSchemas.js +38 -4
  21. package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +262 -0
  22. package/dist/src/intelligenceProtocol/triggerSchemas.js +164 -2
  23. package/dist/src/mcpEvents/consumer.d.ts +2 -0
  24. package/dist/src/mcpEvents/consumer.js +2 -0
  25. package/dist/src/mcpEvents/erpnextProvider.d.ts +0 -2
  26. package/dist/src/mcpEvents/erpnextProvider.js +0 -3
  27. package/dist/src/mcpEvents/provider.d.ts +24 -10
  28. package/dist/src/mcpEvents/provider.js +124 -55
  29. package/dist/src/mcpEvents/server.d.ts +3 -1
  30. package/dist/src/mcpEvents/server.js +20 -19
  31. package/dist/src/patternV2/evaluator.d.ts +43 -0
  32. package/dist/src/patternV2/evaluator.js +927 -0
  33. package/dist/src/patternV2/legacyCompiler.d.ts +3 -0
  34. package/dist/src/patternV2/legacyCompiler.js +184 -0
  35. package/dist/src/protocol/types.d.ts +1 -0
  36. package/package.json +5 -2
  37. package/scripts/host-integration.d.mts +47 -0
  38. package/scripts/host-integration.mjs +9 -0
  39. package/scripts/lib/activation-hydrator.mjs +1 -0
  40. package/scripts/lib/composite-event-consumer.mjs +4 -0
  41. package/scripts/lib/derived-event-coordinator.mjs +75 -1
  42. package/scripts/lib/json-schema.mjs +134 -0
  43. package/scripts/lib/local-event-intelligence-runtime.mjs +1 -0
  44. package/scripts/lib/mcp-events-client.mjs +798 -253
  45. package/scripts/lib/mcp-events-compatibility.mjs +54 -0
  46. package/scripts/lib/persistent-event-store.mjs +68 -9
  47. package/scripts/lib/trigger-control-plane.mjs +180 -0
  48. package/scripts/lib/trigger-inspector.mjs +15 -0
  49. package/scripts/lib/trigger-planner.mjs +213 -12
  50. package/scripts/mcp-stdio-server.mjs +38 -52
  51. package/server.json +4 -4
@@ -0,0 +1,567 @@
1
+ export declare const TRIGGER_LANGUAGE_VERSION: "2";
2
+ export declare const PREDICATE_OPERATOR: {
3
+ readonly EQ: "eq";
4
+ readonly NEQ: "neq";
5
+ readonly CONTAINS: "contains";
6
+ readonly STARTS_WITH: "startsWith";
7
+ readonly ENDS_WITH: "endsWith";
8
+ readonly REGEX: "regex";
9
+ readonly IN: "in";
10
+ readonly NOT_IN: "notIn";
11
+ readonly BETWEEN: "between";
12
+ readonly EXISTS: "exists";
13
+ readonly IS_NULL: "isNull";
14
+ readonly TYPE: "type";
15
+ readonly GT: "gt";
16
+ readonly GTE: "gte";
17
+ readonly LT: "lt";
18
+ readonly LTE: "lte";
19
+ };
20
+ export declare const COMPOSITION_OPERATOR: {
21
+ readonly ALL: "all";
22
+ readonly ANY: "any";
23
+ readonly SEQUENCE: "sequence";
24
+ readonly COUNT: "count";
25
+ };
26
+ export declare const TEMPORAL_OPERATOR: {
27
+ readonly CALENDAR: "calendar";
28
+ readonly ABSENCE: "absence";
29
+ readonly NOT: "not";
30
+ readonly UNLESS: "unless";
31
+ readonly AFTER: "after";
32
+ readonly UNTIL: "until";
33
+ readonly DEBOUNCE: "debounce";
34
+ readonly THRESHOLD: "threshold";
35
+ readonly RATE: "rate";
36
+ readonly DISTINCT: "distinct";
37
+ };
38
+ export declare const TRIGGER_LANGUAGE_CATALOG: Readonly<{
39
+ version: "2";
40
+ predicates: readonly ({
41
+ id: "eq";
42
+ description: string;
43
+ fields: string[];
44
+ example: {
45
+ path: string;
46
+ op: string;
47
+ value: string;
48
+ };
49
+ optionalFields?: undefined;
50
+ values?: undefined;
51
+ } | {
52
+ id: "neq";
53
+ description: string;
54
+ fields: string[];
55
+ example: {
56
+ path: string;
57
+ op: string;
58
+ value: string;
59
+ };
60
+ optionalFields?: undefined;
61
+ values?: undefined;
62
+ } | {
63
+ id: "contains";
64
+ description: string;
65
+ fields: string[];
66
+ example: {
67
+ path: string;
68
+ op: string;
69
+ value: string;
70
+ };
71
+ optionalFields?: undefined;
72
+ values?: undefined;
73
+ } | {
74
+ id: "startsWith";
75
+ description: string;
76
+ fields: string[];
77
+ example: {
78
+ path: string;
79
+ op: string;
80
+ value: string;
81
+ };
82
+ optionalFields?: undefined;
83
+ values?: undefined;
84
+ } | {
85
+ id: "endsWith";
86
+ description: string;
87
+ fields: string[];
88
+ example: {
89
+ path: string;
90
+ op: string;
91
+ value: string;
92
+ };
93
+ optionalFields?: undefined;
94
+ values?: undefined;
95
+ } | {
96
+ id: "regex";
97
+ description: string;
98
+ fields: string[];
99
+ optionalFields: string[];
100
+ example: {
101
+ path: string;
102
+ op: string;
103
+ value: string;
104
+ };
105
+ values?: undefined;
106
+ } | {
107
+ id: "in";
108
+ description: string;
109
+ fields: string[];
110
+ example: {
111
+ path: string;
112
+ op: string;
113
+ value: string[];
114
+ };
115
+ optionalFields?: undefined;
116
+ values?: undefined;
117
+ } | {
118
+ id: "notIn";
119
+ description: string;
120
+ fields: string[];
121
+ example: {
122
+ path: string;
123
+ op: string;
124
+ value: string[];
125
+ };
126
+ optionalFields?: undefined;
127
+ values?: undefined;
128
+ } | {
129
+ id: "between";
130
+ description: string;
131
+ fields: string[];
132
+ example: {
133
+ path: string;
134
+ op: string;
135
+ value: number[];
136
+ };
137
+ optionalFields?: undefined;
138
+ values?: undefined;
139
+ } | {
140
+ id: "exists";
141
+ description: string;
142
+ fields: string[];
143
+ example: {
144
+ path: string;
145
+ op: string;
146
+ value: boolean;
147
+ };
148
+ optionalFields?: undefined;
149
+ values?: undefined;
150
+ } | {
151
+ id: "isNull";
152
+ description: string;
153
+ fields: string[];
154
+ example: {
155
+ path: string;
156
+ op: string;
157
+ value: boolean;
158
+ };
159
+ optionalFields?: undefined;
160
+ values?: undefined;
161
+ } | {
162
+ id: "type";
163
+ description: string;
164
+ fields: string[];
165
+ values: string[];
166
+ example: {
167
+ path: string;
168
+ op: string;
169
+ value: string;
170
+ };
171
+ optionalFields?: undefined;
172
+ } | {
173
+ id: "gt";
174
+ description: string;
175
+ fields: string[];
176
+ example: {
177
+ path: string;
178
+ op: string;
179
+ value: number;
180
+ };
181
+ optionalFields?: undefined;
182
+ values?: undefined;
183
+ } | {
184
+ id: "gte";
185
+ description: string;
186
+ fields: string[];
187
+ example: {
188
+ path: string;
189
+ op: string;
190
+ value: number;
191
+ };
192
+ optionalFields?: undefined;
193
+ values?: undefined;
194
+ } | {
195
+ id: "lt";
196
+ description: string;
197
+ fields: string[];
198
+ example: {
199
+ path: string;
200
+ op: string;
201
+ value: number;
202
+ };
203
+ optionalFields?: undefined;
204
+ values?: undefined;
205
+ } | {
206
+ id: "lte";
207
+ description: string;
208
+ fields: string[];
209
+ example: {
210
+ path: string;
211
+ op: string;
212
+ value: number;
213
+ };
214
+ optionalFields?: undefined;
215
+ values?: undefined;
216
+ })[];
217
+ composition: readonly ({
218
+ id: "all";
219
+ canonicalKind: string;
220
+ description: string;
221
+ example: {
222
+ match: string;
223
+ };
224
+ } | {
225
+ id: "any";
226
+ canonicalKind: string;
227
+ description: string;
228
+ example: {
229
+ match: string;
230
+ };
231
+ } | {
232
+ id: "sequence";
233
+ canonicalKind: string;
234
+ description: string;
235
+ example: {
236
+ match: string;
237
+ };
238
+ } | {
239
+ id: "count";
240
+ canonicalKind: string;
241
+ description: string;
242
+ example: {
243
+ match: {
244
+ kind: string;
245
+ eventId: string;
246
+ atLeast: number;
247
+ };
248
+ };
249
+ })[];
250
+ temporal: readonly ({
251
+ id: "calendar";
252
+ description: string;
253
+ fields: string[];
254
+ optionalFields: string[];
255
+ example: {
256
+ id: string;
257
+ kind: string;
258
+ ref: string;
259
+ timezone: string;
260
+ after: string;
261
+ before: string;
262
+ weekdays: number[];
263
+ afterRef?: undefined;
264
+ forMs?: undefined;
265
+ beforeRef?: undefined;
266
+ atLeast?: undefined;
267
+ perMs?: undefined;
268
+ path?: undefined;
269
+ };
270
+ oneOf?: undefined;
271
+ } | {
272
+ id: "absence";
273
+ description: string;
274
+ fields: string[];
275
+ oneOf: string[][];
276
+ example: {
277
+ id: string;
278
+ kind: string;
279
+ ref: string;
280
+ afterRef: string;
281
+ forMs: number;
282
+ timezone?: undefined;
283
+ after?: undefined;
284
+ before?: undefined;
285
+ weekdays?: undefined;
286
+ beforeRef?: undefined;
287
+ atLeast?: undefined;
288
+ perMs?: undefined;
289
+ path?: undefined;
290
+ };
291
+ optionalFields?: undefined;
292
+ } | {
293
+ id: "not";
294
+ description: string;
295
+ fields: string[];
296
+ example: {
297
+ id: string;
298
+ kind: string;
299
+ ref: string;
300
+ timezone?: undefined;
301
+ after?: undefined;
302
+ before?: undefined;
303
+ weekdays?: undefined;
304
+ afterRef?: undefined;
305
+ forMs?: undefined;
306
+ beforeRef?: undefined;
307
+ atLeast?: undefined;
308
+ perMs?: undefined;
309
+ path?: undefined;
310
+ };
311
+ optionalFields?: undefined;
312
+ oneOf?: undefined;
313
+ } | {
314
+ id: "unless";
315
+ description: string;
316
+ fields: string[];
317
+ example: {
318
+ id: string;
319
+ kind: string;
320
+ ref: string;
321
+ timezone?: undefined;
322
+ after?: undefined;
323
+ before?: undefined;
324
+ weekdays?: undefined;
325
+ afterRef?: undefined;
326
+ forMs?: undefined;
327
+ beforeRef?: undefined;
328
+ atLeast?: undefined;
329
+ perMs?: undefined;
330
+ path?: undefined;
331
+ };
332
+ optionalFields?: undefined;
333
+ oneOf?: undefined;
334
+ } | {
335
+ id: "after";
336
+ description: string;
337
+ fields: string[];
338
+ example: {
339
+ id: string;
340
+ kind: string;
341
+ ref: string;
342
+ afterRef: string;
343
+ timezone?: undefined;
344
+ after?: undefined;
345
+ before?: undefined;
346
+ weekdays?: undefined;
347
+ forMs?: undefined;
348
+ beforeRef?: undefined;
349
+ atLeast?: undefined;
350
+ perMs?: undefined;
351
+ path?: undefined;
352
+ };
353
+ optionalFields?: undefined;
354
+ oneOf?: undefined;
355
+ } | {
356
+ id: "until";
357
+ description: string;
358
+ fields: string[];
359
+ example: {
360
+ id: string;
361
+ kind: string;
362
+ ref: string;
363
+ beforeRef: string;
364
+ timezone?: undefined;
365
+ after?: undefined;
366
+ before?: undefined;
367
+ weekdays?: undefined;
368
+ afterRef?: undefined;
369
+ forMs?: undefined;
370
+ atLeast?: undefined;
371
+ perMs?: undefined;
372
+ path?: undefined;
373
+ };
374
+ optionalFields?: undefined;
375
+ oneOf?: undefined;
376
+ } | {
377
+ id: "debounce";
378
+ description: string;
379
+ fields: string[];
380
+ example: {
381
+ id: string;
382
+ kind: string;
383
+ ref: string;
384
+ forMs: number;
385
+ timezone?: undefined;
386
+ after?: undefined;
387
+ before?: undefined;
388
+ weekdays?: undefined;
389
+ afterRef?: undefined;
390
+ beforeRef?: undefined;
391
+ atLeast?: undefined;
392
+ perMs?: undefined;
393
+ path?: undefined;
394
+ };
395
+ optionalFields?: undefined;
396
+ oneOf?: undefined;
397
+ } | {
398
+ id: "threshold";
399
+ description: string;
400
+ fields: string[];
401
+ example: {
402
+ id: string;
403
+ kind: string;
404
+ ref: string;
405
+ atLeast: number;
406
+ timezone?: undefined;
407
+ after?: undefined;
408
+ before?: undefined;
409
+ weekdays?: undefined;
410
+ afterRef?: undefined;
411
+ forMs?: undefined;
412
+ beforeRef?: undefined;
413
+ perMs?: undefined;
414
+ path?: undefined;
415
+ };
416
+ optionalFields?: undefined;
417
+ oneOf?: undefined;
418
+ } | {
419
+ id: "rate";
420
+ description: string;
421
+ fields: string[];
422
+ example: {
423
+ id: string;
424
+ kind: string;
425
+ ref: string;
426
+ atLeast: number;
427
+ perMs: number;
428
+ timezone?: undefined;
429
+ after?: undefined;
430
+ before?: undefined;
431
+ weekdays?: undefined;
432
+ afterRef?: undefined;
433
+ forMs?: undefined;
434
+ beforeRef?: undefined;
435
+ path?: undefined;
436
+ };
437
+ optionalFields?: undefined;
438
+ oneOf?: undefined;
439
+ } | {
440
+ id: "distinct";
441
+ description: string;
442
+ fields: string[];
443
+ example: {
444
+ id: string;
445
+ kind: string;
446
+ ref: string;
447
+ path: string;
448
+ atLeast: number;
449
+ timezone?: undefined;
450
+ after?: undefined;
451
+ before?: undefined;
452
+ weekdays?: undefined;
453
+ afterRef?: undefined;
454
+ forMs?: undefined;
455
+ beforeRef?: undefined;
456
+ perMs?: undefined;
457
+ };
458
+ optionalFields?: undefined;
459
+ oneOf?: undefined;
460
+ })[];
461
+ pattern: readonly ({
462
+ id: string;
463
+ description: string;
464
+ example: {
465
+ kind: string;
466
+ ref: string;
467
+ };
468
+ contiguity?: undefined;
469
+ fields?: undefined;
470
+ optionalFields?: undefined;
471
+ } | {
472
+ id: string;
473
+ description: string;
474
+ example?: undefined;
475
+ contiguity?: undefined;
476
+ fields?: undefined;
477
+ optionalFields?: undefined;
478
+ } | {
479
+ id: string;
480
+ description: string;
481
+ contiguity: string[];
482
+ example?: undefined;
483
+ fields?: undefined;
484
+ optionalFields?: undefined;
485
+ } | {
486
+ id: string;
487
+ description: string;
488
+ fields: string[];
489
+ optionalFields: string[];
490
+ contiguity: string[];
491
+ example?: undefined;
492
+ } | {
493
+ id: string;
494
+ description: string;
495
+ fields: string[];
496
+ optionalFields: string[];
497
+ example?: undefined;
498
+ contiguity?: undefined;
499
+ } | {
500
+ id: string;
501
+ description: string;
502
+ fields: string[];
503
+ example?: undefined;
504
+ contiguity?: undefined;
505
+ optionalFields?: undefined;
506
+ })[];
507
+ windows: readonly ({
508
+ id: string;
509
+ description: string;
510
+ fields: string[];
511
+ optionalFields?: undefined;
512
+ } | {
513
+ id: string;
514
+ description: string;
515
+ fields: string[];
516
+ optionalFields: string[];
517
+ })[];
518
+ aggregates: readonly {
519
+ id: string;
520
+ description: string;
521
+ }[];
522
+ state: readonly {
523
+ id: string;
524
+ description: string;
525
+ }[];
526
+ selection: readonly {
527
+ id: string;
528
+ values: (string | {
529
+ kind: string;
530
+ ref: string;
531
+ })[];
532
+ description: string;
533
+ }[];
534
+ semantic: readonly {
535
+ id: string;
536
+ description: string;
537
+ fields: string[];
538
+ optionalFields: string[];
539
+ }[];
540
+ correlation: readonly {
541
+ id: string;
542
+ description: string;
543
+ authoringField: string;
544
+ }[];
545
+ execution: readonly {
546
+ id: string;
547
+ description: string;
548
+ }[];
549
+ timing: readonly ({
550
+ id: string;
551
+ description: string;
552
+ authoringPath?: undefined;
553
+ } | {
554
+ id: string;
555
+ description: string;
556
+ authoringPath: string;
557
+ })[];
558
+ lifecycle: readonly {
559
+ id: string;
560
+ description: string;
561
+ }[];
562
+ }>;
563
+ export type TriggerLanguageCategory = 'predicates' | 'composition' | 'temporal' | 'pattern' | 'windows' | 'aggregates' | 'state' | 'selection' | 'semantic' | 'execution' | 'correlation' | 'timing' | 'lifecycle';
564
+ export declare function describeTriggerLanguage(input?: {
565
+ category?: TriggerLanguageCategory;
566
+ operator?: string;
567
+ }): Record<string, unknown>;