mcp-event-intelligence 0.4.0 → 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.
- package/CHANGELOG.md +59 -0
- package/README.md +102 -14
- package/SECURITY.md +4 -4
- package/bin/mcp-event-intelligence.mjs +3 -3
- package/dist/src/composite/engine.d.ts +6 -0
- package/dist/src/composite/engine.js +599 -10
- package/dist/src/composite/matching.js +45 -0
- package/dist/src/intelligenceProtocol/activationSchemas.d.ts +2 -0
- package/dist/src/intelligenceProtocol/activationSchemas.js +1 -0
- package/dist/src/intelligenceProtocol/index.d.ts +9 -2
- package/dist/src/intelligenceProtocol/index.js +5 -1
- package/dist/src/intelligenceProtocol/operatorRegistry.d.ts +567 -0
- package/dist/src/intelligenceProtocol/operatorRegistry.js +477 -0
- package/dist/src/intelligenceProtocol/patternV2Schemas.d.ts +188 -0
- package/dist/src/intelligenceProtocol/patternV2Schemas.js +801 -0
- package/dist/src/intelligenceProtocol/schemas.d.ts +4 -0
- package/dist/src/intelligenceProtocol/schemas.js +2 -0
- package/dist/src/intelligenceProtocol/triggerPlanSchemas.d.ts +177 -4
- package/dist/src/intelligenceProtocol/triggerPlanSchemas.js +37 -4
- package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +256 -0
- package/dist/src/intelligenceProtocol/triggerSchemas.js +161 -2
- package/dist/src/mcpEvents/consumer.d.ts +1 -0
- package/dist/src/mcpEvents/consumer.js +1 -0
- package/dist/src/patternV2/evaluator.d.ts +43 -0
- package/dist/src/patternV2/evaluator.js +927 -0
- package/dist/src/patternV2/legacyCompiler.d.ts +3 -0
- package/dist/src/patternV2/legacyCompiler.js +184 -0
- package/package.json +5 -2
- package/scripts/host-integration.d.mts +7 -0
- package/scripts/host-integration.mjs +9 -0
- package/scripts/lib/activation-hydrator.mjs +1 -0
- package/scripts/lib/composite-event-consumer.mjs +2 -0
- package/scripts/lib/derived-event-coordinator.mjs +75 -1
- package/scripts/lib/mcp-events-client.mjs +62 -24
- package/scripts/lib/mcp-events-compatibility.mjs +54 -0
- package/scripts/lib/trigger-control-plane.mjs +154 -0
- package/scripts/lib/trigger-inspector.mjs +15 -0
- package/scripts/lib/trigger-planner.mjs +190 -12
- package/scripts/mcp-stdio-server.mjs +38 -53
- package/server.json +4 -4
|
@@ -13,14 +13,50 @@ export declare const StructuredPredicateSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
13
13
|
path: z.ZodString;
|
|
14
14
|
op: z.ZodLiteral<"contains">;
|
|
15
15
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
op: z.ZodLiteral<"startsWith">;
|
|
19
|
+
value: z.ZodString;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
path: z.ZodString;
|
|
22
|
+
op: z.ZodLiteral<"endsWith">;
|
|
23
|
+
value: z.ZodString;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
path: z.ZodString;
|
|
26
|
+
op: z.ZodLiteral<"regex">;
|
|
27
|
+
value: z.ZodString;
|
|
28
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
16
29
|
}, z.core.$strip>, z.ZodObject<{
|
|
17
30
|
path: z.ZodString;
|
|
18
31
|
op: z.ZodLiteral<"in">;
|
|
19
32
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
op: z.ZodLiteral<"notIn">;
|
|
36
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
path: z.ZodString;
|
|
39
|
+
op: z.ZodLiteral<"between">;
|
|
40
|
+
value: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>], null>;
|
|
20
41
|
}, z.core.$strip>, z.ZodObject<{
|
|
21
42
|
path: z.ZodString;
|
|
22
43
|
op: z.ZodLiteral<"exists">;
|
|
23
44
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
path: z.ZodString;
|
|
47
|
+
op: z.ZodLiteral<"isNull">;
|
|
48
|
+
value: z.ZodDefault<z.ZodBoolean>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
path: z.ZodString;
|
|
51
|
+
op: z.ZodLiteral<"type">;
|
|
52
|
+
value: z.ZodEnum<{
|
|
53
|
+
string: "string";
|
|
54
|
+
number: "number";
|
|
55
|
+
boolean: "boolean";
|
|
56
|
+
object: "object";
|
|
57
|
+
null: "null";
|
|
58
|
+
array: "array";
|
|
59
|
+
}>;
|
|
24
60
|
}, z.core.$strip>, z.ZodObject<{
|
|
25
61
|
path: z.ZodString;
|
|
26
62
|
op: z.ZodLiteral<"gt">;
|
|
@@ -56,14 +92,50 @@ export declare const TriggerClauseSchema: z.ZodObject<{
|
|
|
56
92
|
path: z.ZodString;
|
|
57
93
|
op: z.ZodLiteral<"contains">;
|
|
58
94
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
path: z.ZodString;
|
|
97
|
+
op: z.ZodLiteral<"startsWith">;
|
|
98
|
+
value: z.ZodString;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
op: z.ZodLiteral<"endsWith">;
|
|
102
|
+
value: z.ZodString;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
path: z.ZodString;
|
|
105
|
+
op: z.ZodLiteral<"regex">;
|
|
106
|
+
value: z.ZodString;
|
|
107
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
59
108
|
}, z.core.$strip>, z.ZodObject<{
|
|
60
109
|
path: z.ZodString;
|
|
61
110
|
op: z.ZodLiteral<"in">;
|
|
62
111
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
112
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
113
|
+
path: z.ZodString;
|
|
114
|
+
op: z.ZodLiteral<"notIn">;
|
|
115
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
path: z.ZodString;
|
|
118
|
+
op: z.ZodLiteral<"between">;
|
|
119
|
+
value: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>], null>;
|
|
63
120
|
}, z.core.$strip>, z.ZodObject<{
|
|
64
121
|
path: z.ZodString;
|
|
65
122
|
op: z.ZodLiteral<"exists">;
|
|
66
123
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
+
path: z.ZodString;
|
|
126
|
+
op: z.ZodLiteral<"isNull">;
|
|
127
|
+
value: z.ZodDefault<z.ZodBoolean>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
path: z.ZodString;
|
|
130
|
+
op: z.ZodLiteral<"type">;
|
|
131
|
+
value: z.ZodEnum<{
|
|
132
|
+
string: "string";
|
|
133
|
+
number: "number";
|
|
134
|
+
boolean: "boolean";
|
|
135
|
+
object: "object";
|
|
136
|
+
null: "null";
|
|
137
|
+
array: "array";
|
|
138
|
+
}>;
|
|
67
139
|
}, z.core.$strip>, z.ZodObject<{
|
|
68
140
|
path: z.ZodString;
|
|
69
141
|
op: z.ZodLiteral<"gt">;
|
|
@@ -183,6 +255,29 @@ export declare const DerivedEventDefinitionSchema: z.ZodObject<{
|
|
|
183
255
|
path: z.ZodString;
|
|
184
256
|
}, z.core.$strict>>>;
|
|
185
257
|
constants: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
258
|
+
measures: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
259
|
+
key: z.ZodString;
|
|
260
|
+
expression: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodObject<{
|
|
261
|
+
kind: z.ZodLiteral<"aggregate">;
|
|
262
|
+
function: z.ZodEnum<{
|
|
263
|
+
first: "first";
|
|
264
|
+
last: "last";
|
|
265
|
+
nth: "nth";
|
|
266
|
+
sum: "sum";
|
|
267
|
+
avg: "avg";
|
|
268
|
+
min: "min";
|
|
269
|
+
max: "max";
|
|
270
|
+
count: "count";
|
|
271
|
+
countDistinct: "countDistinct";
|
|
272
|
+
stddev: "stddev";
|
|
273
|
+
percentile: "percentile";
|
|
274
|
+
}>;
|
|
275
|
+
ref: z.ZodString;
|
|
276
|
+
path: z.ZodOptional<z.ZodString>;
|
|
277
|
+
nth: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
percentile: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
}, z.core.$strict>]>;
|
|
280
|
+
}, z.core.$strict>>>;
|
|
186
281
|
}, z.core.$strict>;
|
|
187
282
|
export declare const DerivedEventEvidenceRefSchema: z.ZodObject<{
|
|
188
283
|
serverId: z.ZodNullable<z.ZodString>;
|
|
@@ -190,10 +285,14 @@ export declare const DerivedEventEvidenceRefSchema: z.ZodObject<{
|
|
|
190
285
|
sourceEventId: z.ZodString;
|
|
191
286
|
traceId: z.ZodString;
|
|
192
287
|
occurredAt: z.ZodString;
|
|
288
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
193
289
|
payloadHash: z.ZodNullable<z.ZodString>;
|
|
194
290
|
contractVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
195
291
|
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
196
292
|
}, z.core.$strict>;
|
|
293
|
+
export declare const EventTimePolicySchema: z.ZodObject<{
|
|
294
|
+
allowedLatenessMs: z.ZodNumber;
|
|
295
|
+
}, z.core.$strict>;
|
|
197
296
|
export declare const TriggerLifecyclePolicySchema: z.ZodObject<{
|
|
198
297
|
oneShot: z.ZodDefault<z.ZodBoolean>;
|
|
199
298
|
maxFirings: z.ZodOptional<z.ZodNumber>;
|
|
@@ -245,6 +344,7 @@ export declare const CompositeTriggerDefinitionSchema: z.ZodObject<{
|
|
|
245
344
|
triggerId: z.ZodString;
|
|
246
345
|
version: z.ZodString;
|
|
247
346
|
description: z.ZodOptional<z.ZodString>;
|
|
347
|
+
conditionOnly: z.ZodDefault<z.ZodBoolean>;
|
|
248
348
|
continuation: z.ZodOptional<z.ZodObject<{
|
|
249
349
|
instruction: z.ZodString;
|
|
250
350
|
contextPolicy: z.ZodDefault<z.ZodObject<{
|
|
@@ -274,14 +374,50 @@ export declare const CompositeTriggerDefinitionSchema: z.ZodObject<{
|
|
|
274
374
|
path: z.ZodString;
|
|
275
375
|
op: z.ZodLiteral<"contains">;
|
|
276
376
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
377
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
378
|
+
path: z.ZodString;
|
|
379
|
+
op: z.ZodLiteral<"startsWith">;
|
|
380
|
+
value: z.ZodString;
|
|
381
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
382
|
+
path: z.ZodString;
|
|
383
|
+
op: z.ZodLiteral<"endsWith">;
|
|
384
|
+
value: z.ZodString;
|
|
385
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
386
|
+
path: z.ZodString;
|
|
387
|
+
op: z.ZodLiteral<"regex">;
|
|
388
|
+
value: z.ZodString;
|
|
389
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
277
390
|
}, z.core.$strip>, z.ZodObject<{
|
|
278
391
|
path: z.ZodString;
|
|
279
392
|
op: z.ZodLiteral<"in">;
|
|
280
393
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
394
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
395
|
+
path: z.ZodString;
|
|
396
|
+
op: z.ZodLiteral<"notIn">;
|
|
397
|
+
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
398
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
399
|
+
path: z.ZodString;
|
|
400
|
+
op: z.ZodLiteral<"between">;
|
|
401
|
+
value: z.ZodTuple<[z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>], null>;
|
|
281
402
|
}, z.core.$strip>, z.ZodObject<{
|
|
282
403
|
path: z.ZodString;
|
|
283
404
|
op: z.ZodLiteral<"exists">;
|
|
284
405
|
value: z.ZodDefault<z.ZodBoolean>;
|
|
406
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
407
|
+
path: z.ZodString;
|
|
408
|
+
op: z.ZodLiteral<"isNull">;
|
|
409
|
+
value: z.ZodDefault<z.ZodBoolean>;
|
|
410
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
411
|
+
path: z.ZodString;
|
|
412
|
+
op: z.ZodLiteral<"type">;
|
|
413
|
+
value: z.ZodEnum<{
|
|
414
|
+
string: "string";
|
|
415
|
+
number: "number";
|
|
416
|
+
boolean: "boolean";
|
|
417
|
+
object: "object";
|
|
418
|
+
null: "null";
|
|
419
|
+
array: "array";
|
|
420
|
+
}>;
|
|
285
421
|
}, z.core.$strip>, z.ZodObject<{
|
|
286
422
|
path: z.ZodString;
|
|
287
423
|
op: z.ZodLiteral<"gt">;
|
|
@@ -377,6 +513,43 @@ export declare const CompositeTriggerDefinitionSchema: z.ZodObject<{
|
|
|
377
513
|
path: z.ZodString;
|
|
378
514
|
atLeast: z.ZodNumber;
|
|
379
515
|
}, z.core.$strip>], "kind">>>;
|
|
516
|
+
patternV2: z.ZodOptional<z.ZodObject<{
|
|
517
|
+
version: z.ZodDefault<z.ZodLiteral<"2">>;
|
|
518
|
+
root: z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>;
|
|
519
|
+
partitionBy: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
520
|
+
key: z.ZodString;
|
|
521
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
522
|
+
ref: z.ZodString;
|
|
523
|
+
path: z.ZodString;
|
|
524
|
+
}, z.core.$strict>>;
|
|
525
|
+
}, z.core.$strict>>>;
|
|
526
|
+
selection: z.ZodDefault<z.ZodObject<{
|
|
527
|
+
overlap: z.ZodDefault<z.ZodEnum<{
|
|
528
|
+
allow: "allow";
|
|
529
|
+
disallow: "disallow";
|
|
530
|
+
}>>;
|
|
531
|
+
afterMatch: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
|
|
532
|
+
skipPastLast: "skipPastLast";
|
|
533
|
+
skipToNext: "skipToNext";
|
|
534
|
+
keepAll: "keepAll";
|
|
535
|
+
}>, z.ZodObject<{
|
|
536
|
+
kind: z.ZodEnum<{
|
|
537
|
+
skipToFirst: "skipToFirst";
|
|
538
|
+
skipToLast: "skipToLast";
|
|
539
|
+
}>;
|
|
540
|
+
ref: z.ZodString;
|
|
541
|
+
}, z.core.$strict>]>>;
|
|
542
|
+
maxMatchesPerEvent: z.ZodDefault<z.ZodNumber>;
|
|
543
|
+
}, z.core.$strict>>;
|
|
544
|
+
execution: z.ZodDefault<z.ZodObject<{
|
|
545
|
+
maxCandidates: z.ZodDefault<z.ZodNumber>;
|
|
546
|
+
maxSemanticEvaluations: z.ZodDefault<z.ZodNumber>;
|
|
547
|
+
maxBufferedEvents: z.ZodDefault<z.ZodNumber>;
|
|
548
|
+
}, z.core.$strict>>;
|
|
549
|
+
}, z.core.$strict>>;
|
|
550
|
+
eventTime: z.ZodOptional<z.ZodObject<{
|
|
551
|
+
allowedLatenessMs: z.ZodNumber;
|
|
552
|
+
}, z.core.$strict>>;
|
|
380
553
|
lifecycle: z.ZodDefault<z.ZodObject<{
|
|
381
554
|
oneShot: z.ZodDefault<z.ZodBoolean>;
|
|
382
555
|
maxFirings: z.ZodOptional<z.ZodNumber>;
|
|
@@ -426,6 +599,29 @@ export declare const CompositeTriggerDefinitionSchema: z.ZodObject<{
|
|
|
426
599
|
path: z.ZodString;
|
|
427
600
|
}, z.core.$strict>>>;
|
|
428
601
|
constants: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
602
|
+
measures: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
603
|
+
key: z.ZodString;
|
|
604
|
+
expression: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodObject<{
|
|
605
|
+
kind: z.ZodLiteral<"aggregate">;
|
|
606
|
+
function: z.ZodEnum<{
|
|
607
|
+
first: "first";
|
|
608
|
+
last: "last";
|
|
609
|
+
nth: "nth";
|
|
610
|
+
sum: "sum";
|
|
611
|
+
avg: "avg";
|
|
612
|
+
min: "min";
|
|
613
|
+
max: "max";
|
|
614
|
+
count: "count";
|
|
615
|
+
countDistinct: "countDistinct";
|
|
616
|
+
stddev: "stddev";
|
|
617
|
+
percentile: "percentile";
|
|
618
|
+
}>;
|
|
619
|
+
ref: z.ZodString;
|
|
620
|
+
path: z.ZodOptional<z.ZodString>;
|
|
621
|
+
nth: z.ZodOptional<z.ZodNumber>;
|
|
622
|
+
percentile: z.ZodOptional<z.ZodNumber>;
|
|
623
|
+
}, z.core.$strict>]>;
|
|
624
|
+
}, z.core.$strict>>>;
|
|
429
625
|
}, z.core.$strict>>;
|
|
430
626
|
}, z.core.$strip>;
|
|
431
627
|
export declare const CorrelatableEventSchema: z.ZodObject<{
|
|
@@ -433,6 +629,7 @@ export declare const CorrelatableEventSchema: z.ZodObject<{
|
|
|
433
629
|
sourceEventId: z.ZodString;
|
|
434
630
|
name: z.ZodString;
|
|
435
631
|
occurredAt: z.ZodString;
|
|
632
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
436
633
|
provider: z.ZodOptional<z.ZodString>;
|
|
437
634
|
serverId: z.ZodOptional<z.ZodString>;
|
|
438
635
|
subscriptionArguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -445,6 +642,7 @@ export declare const DerivedEventRecordSchema: z.ZodObject<{
|
|
|
445
642
|
sourceEventId: z.ZodString;
|
|
446
643
|
name: z.ZodString;
|
|
447
644
|
occurredAt: z.ZodString;
|
|
645
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
448
646
|
provider: z.ZodOptional<z.ZodString>;
|
|
449
647
|
serverId: z.ZodOptional<z.ZodString>;
|
|
450
648
|
subscriptionArguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -460,6 +658,7 @@ export declare const DerivedEventRecordSchema: z.ZodObject<{
|
|
|
460
658
|
sourceEventId: z.ZodString;
|
|
461
659
|
traceId: z.ZodString;
|
|
462
660
|
occurredAt: z.ZodString;
|
|
661
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
463
662
|
payloadHash: z.ZodNullable<z.ZodString>;
|
|
464
663
|
contractVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
465
664
|
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -470,6 +669,7 @@ export declare const DerivedEventRecordSchema: z.ZodObject<{
|
|
|
470
669
|
sourceEventId: z.ZodString;
|
|
471
670
|
traceId: z.ZodString;
|
|
472
671
|
occurredAt: z.ZodString;
|
|
672
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
473
673
|
payloadHash: z.ZodNullable<z.ZodString>;
|
|
474
674
|
contractVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
475
675
|
schemaFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -482,6 +682,7 @@ export declare const TriggerSourceEventSchema: z.ZodObject<{
|
|
|
482
682
|
sourceEventId: z.ZodString;
|
|
483
683
|
eventName: z.ZodString;
|
|
484
684
|
occurredAt: z.ZodString;
|
|
685
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
485
686
|
provider: z.ZodOptional<z.ZodString>;
|
|
486
687
|
serverId: z.ZodOptional<z.ZodString>;
|
|
487
688
|
subscriptionArguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -509,6 +710,32 @@ export declare const TriggerMatchStatusSchema: z.ZodEnum<{
|
|
|
509
710
|
fired: "fired";
|
|
510
711
|
expired: "expired";
|
|
511
712
|
}>;
|
|
713
|
+
export declare const PatternMatchStateSchema: z.ZodObject<{
|
|
714
|
+
version: z.ZodLiteral<"2">;
|
|
715
|
+
role: z.ZodEnum<{
|
|
716
|
+
match: "match";
|
|
717
|
+
buffer: "buffer";
|
|
718
|
+
}>;
|
|
719
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
720
|
+
maxObservedOccurredAt: z.ZodOptional<z.ZodString>;
|
|
721
|
+
semanticDecisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
722
|
+
nodeId: z.ZodString;
|
|
723
|
+
decision: z.ZodObject<{
|
|
724
|
+
evaluator: z.ZodString;
|
|
725
|
+
outcome: z.ZodEnum<{
|
|
726
|
+
match: "match";
|
|
727
|
+
reject: "reject";
|
|
728
|
+
uncertain: "uncertain";
|
|
729
|
+
}>;
|
|
730
|
+
probability: z.ZodNumber;
|
|
731
|
+
matched: z.ZodBoolean;
|
|
732
|
+
shouldEscalate: z.ZodBoolean;
|
|
733
|
+
inputFields: z.ZodArray<z.ZodString>;
|
|
734
|
+
providerEvidence: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
735
|
+
evaluatedAt: z.ZodString;
|
|
736
|
+
}, z.core.$strip>;
|
|
737
|
+
}, z.core.$strict>>>;
|
|
738
|
+
}, z.core.$strict>;
|
|
512
739
|
export declare const TriggerMatchRecordSchema: z.ZodObject<{
|
|
513
740
|
protocolVersion: z.ZodLiteral<"0.1.0">;
|
|
514
741
|
schemaVersion: z.ZodLiteral<"trigger.v0.1">;
|
|
@@ -532,6 +759,7 @@ export declare const TriggerMatchRecordSchema: z.ZodObject<{
|
|
|
532
759
|
sourceEventId: z.ZodString;
|
|
533
760
|
eventName: z.ZodString;
|
|
534
761
|
occurredAt: z.ZodString;
|
|
762
|
+
receivedAt: z.ZodOptional<z.ZodString>;
|
|
535
763
|
provider: z.ZodOptional<z.ZodString>;
|
|
536
764
|
serverId: z.ZodOptional<z.ZodString>;
|
|
537
765
|
subscriptionArguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -552,12 +780,39 @@ export declare const TriggerMatchRecordSchema: z.ZodObject<{
|
|
|
552
780
|
providerEvidence: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
553
781
|
evaluatedAt: z.ZodString;
|
|
554
782
|
}, z.core.$strip>>;
|
|
783
|
+
patternState: z.ZodOptional<z.ZodObject<{
|
|
784
|
+
version: z.ZodLiteral<"2">;
|
|
785
|
+
role: z.ZodEnum<{
|
|
786
|
+
match: "match";
|
|
787
|
+
buffer: "buffer";
|
|
788
|
+
}>;
|
|
789
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
790
|
+
maxObservedOccurredAt: z.ZodOptional<z.ZodString>;
|
|
791
|
+
semanticDecisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
792
|
+
nodeId: z.ZodString;
|
|
793
|
+
decision: z.ZodObject<{
|
|
794
|
+
evaluator: z.ZodString;
|
|
795
|
+
outcome: z.ZodEnum<{
|
|
796
|
+
match: "match";
|
|
797
|
+
reject: "reject";
|
|
798
|
+
uncertain: "uncertain";
|
|
799
|
+
}>;
|
|
800
|
+
probability: z.ZodNumber;
|
|
801
|
+
matched: z.ZodBoolean;
|
|
802
|
+
shouldEscalate: z.ZodBoolean;
|
|
803
|
+
inputFields: z.ZodArray<z.ZodString>;
|
|
804
|
+
providerEvidence: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
805
|
+
evaluatedAt: z.ZodString;
|
|
806
|
+
}, z.core.$strip>;
|
|
807
|
+
}, z.core.$strict>>>;
|
|
808
|
+
}, z.core.$strict>>;
|
|
555
809
|
firedWakeId: z.ZodNullable<z.ZodString>;
|
|
556
810
|
derivedEventIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
557
811
|
}, z.core.$strip>;
|
|
558
812
|
export type StructuredPredicate = z.infer<typeof StructuredPredicateSchema>;
|
|
559
813
|
export type TriggerClause = z.infer<typeof TriggerClauseSchema>;
|
|
560
814
|
export type TemporalCondition = z.infer<typeof TemporalConditionSchema>;
|
|
815
|
+
export type EventTimePolicy = z.infer<typeof EventTimePolicySchema>;
|
|
561
816
|
export type TriggerLifecyclePolicy = z.infer<typeof TriggerLifecyclePolicySchema>;
|
|
562
817
|
export type ContinuationContextPolicy = z.infer<typeof ContinuationContextPolicySchema>;
|
|
563
818
|
export type ContinuationContract = z.infer<typeof ContinuationContractSchema>;
|
|
@@ -566,6 +821,7 @@ export type DerivedEventRecord = z.infer<typeof DerivedEventRecordSchema>;
|
|
|
566
821
|
export type CompositeTriggerDefinition = z.infer<typeof CompositeTriggerDefinitionSchema>;
|
|
567
822
|
export type CorrelatableEvent = z.infer<typeof CorrelatableEventSchema>;
|
|
568
823
|
export type TriggerSourceEvent = z.infer<typeof TriggerSourceEventSchema>;
|
|
824
|
+
export type PatternMatchState = z.infer<typeof PatternMatchStateSchema>;
|
|
569
825
|
export type TriggerMatchRecord = z.infer<typeof TriggerMatchRecordSchema>;
|
|
570
826
|
export type CompositeCorrelationDecision = z.infer<typeof CompositeCorrelationDecisionSchema>;
|
|
571
827
|
export declare function parseCompositeTriggerDefinition(value: unknown): CompositeTriggerDefinition;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { RuntimeTargetSchema } from './schemas.js';
|
|
3
|
+
import { PatternAstV2DefinitionSchema, PatternMeasureSchema, collectPatternDurationsMs, collectGuaranteedPatternBindings, collectPatternMeasureRefs, collectPatternRefs, } from './patternV2Schemas.js';
|
|
3
4
|
export const COMPOSITE_TRIGGER_PROTOCOL_VERSION = '0.1.0';
|
|
4
5
|
export const COMPOSITE_TRIGGER_SCHEMA_VERSION = 'trigger.v0.1';
|
|
5
6
|
const Id = z.string().min(1).max(200);
|
|
@@ -11,8 +12,28 @@ export const StructuredPredicateSchema = z.discriminatedUnion('op', [
|
|
|
11
12
|
z.object({ path: z.string().min(1), op: z.literal('eq'), value: Scalar }),
|
|
12
13
|
z.object({ path: z.string().min(1), op: z.literal('neq'), value: Scalar }),
|
|
13
14
|
z.object({ path: z.string().min(1), op: z.literal('contains'), value: Scalar }),
|
|
15
|
+
z.object({ path: z.string().min(1), op: z.literal('startsWith'), value: z.string() }),
|
|
16
|
+
z.object({ path: z.string().min(1), op: z.literal('endsWith'), value: z.string() }),
|
|
17
|
+
z.object({
|
|
18
|
+
path: z.string().min(1),
|
|
19
|
+
op: z.literal('regex'),
|
|
20
|
+
value: z.string(),
|
|
21
|
+
flags: z.string().max(10).optional(),
|
|
22
|
+
}),
|
|
14
23
|
z.object({ path: z.string().min(1), op: z.literal('in'), value: z.array(Scalar).min(1) }),
|
|
24
|
+
z.object({ path: z.string().min(1), op: z.literal('notIn'), value: z.array(Scalar).min(1) }),
|
|
25
|
+
z.object({
|
|
26
|
+
path: z.string().min(1),
|
|
27
|
+
op: z.literal('between'),
|
|
28
|
+
value: z.tuple([Scalar, Scalar]),
|
|
29
|
+
}),
|
|
15
30
|
z.object({ path: z.string().min(1), op: z.literal('exists'), value: z.boolean().default(true) }),
|
|
31
|
+
z.object({ path: z.string().min(1), op: z.literal('isNull'), value: z.boolean().default(true) }),
|
|
32
|
+
z.object({
|
|
33
|
+
path: z.string().min(1),
|
|
34
|
+
op: z.literal('type'),
|
|
35
|
+
value: z.enum(['string', 'number', 'boolean', 'null', 'object', 'array']),
|
|
36
|
+
}),
|
|
16
37
|
z.object({ path: z.string().min(1), op: z.literal('gt'), value: z.number() }),
|
|
17
38
|
z.object({ path: z.string().min(1), op: z.literal('gte'), value: z.number() }),
|
|
18
39
|
z.object({ path: z.string().min(1), op: z.literal('lt'), value: z.number() }),
|
|
@@ -113,6 +134,7 @@ export const DerivedEventDefinitionSchema = z.object({
|
|
|
113
134
|
contractVersion: z.string().min(1).max(50),
|
|
114
135
|
projections: z.array(DerivedEventProjectionSchema).max(32).default([]),
|
|
115
136
|
constants: z.record(z.string(), Scalar).default({}),
|
|
137
|
+
measures: z.array(PatternMeasureSchema).max(32).default([]),
|
|
116
138
|
}).strict();
|
|
117
139
|
export const DerivedEventEvidenceRefSchema = z.object({
|
|
118
140
|
serverId: Id.nullable(),
|
|
@@ -120,10 +142,15 @@ export const DerivedEventEvidenceRefSchema = z.object({
|
|
|
120
142
|
sourceEventId: Id,
|
|
121
143
|
traceId: Id,
|
|
122
144
|
occurredAt: Timestamp,
|
|
145
|
+
receivedAt: Timestamp.optional(),
|
|
123
146
|
payloadHash: z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
124
147
|
contractVersion: z.string().min(1).nullable().optional(),
|
|
125
148
|
schemaFingerprint: z.string().regex(/^[a-f0-9]{64}$/).nullable().optional(),
|
|
126
149
|
}).strict();
|
|
150
|
+
export const EventTimePolicySchema = z.object({
|
|
151
|
+
allowedLatenessMs: z.number().int().nonnegative()
|
|
152
|
+
.max(1000 * 60 * 60 * 24 * 30),
|
|
153
|
+
}).strict();
|
|
127
154
|
export const TriggerLifecyclePolicySchema = z.object({
|
|
128
155
|
oneShot: z.boolean().default(false),
|
|
129
156
|
maxFirings: z.number().int().min(1).optional(),
|
|
@@ -182,10 +209,13 @@ export const CompositeTriggerDefinitionSchema = z.object({
|
|
|
182
209
|
triggerId: Id,
|
|
183
210
|
version: z.string().min(1),
|
|
184
211
|
description: z.string().max(500).optional(),
|
|
212
|
+
conditionOnly: z.boolean().default(false),
|
|
185
213
|
continuation: ContinuationContractSchema.optional(),
|
|
186
214
|
clauses: z.array(TriggerClauseSchema).min(1),
|
|
187
215
|
expression: TriggerExpressionSchema,
|
|
188
216
|
temporal: z.array(TemporalConditionSchema).default([]),
|
|
217
|
+
patternV2: PatternAstV2DefinitionSchema.optional(),
|
|
218
|
+
eventTime: EventTimePolicySchema.optional(),
|
|
189
219
|
lifecycle: TriggerLifecyclePolicySchema.default({
|
|
190
220
|
oneShot: false,
|
|
191
221
|
cooldownMs: 0,
|
|
@@ -199,10 +229,27 @@ export const CompositeTriggerDefinitionSchema = z.object({
|
|
|
199
229
|
target: RuntimeTargetSchema.optional(),
|
|
200
230
|
derivedEvent: DerivedEventDefinitionSchema.optional(),
|
|
201
231
|
}).superRefine((value, ctx) => {
|
|
202
|
-
if (!value.target && !value.derivedEvent) {
|
|
232
|
+
if (!value.target && !value.derivedEvent && !value.conditionOnly) {
|
|
203
233
|
ctx.addIssue({
|
|
204
234
|
code: 'custom',
|
|
205
|
-
message: 'Trigger requires target, derivedEvent, or
|
|
235
|
+
message: 'Trigger requires target, derivedEvent, or conditionOnly=true',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (value.conditionOnly &&
|
|
239
|
+
(value.target || value.derivedEvent || value.continuation)) {
|
|
240
|
+
ctx.addIssue({
|
|
241
|
+
code: 'custom',
|
|
242
|
+
message: 'conditionOnly triggers cannot declare target, derivedEvent, or continuation',
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (value.conditionOnly &&
|
|
246
|
+
(value.lifecycle.oneShot ||
|
|
247
|
+
value.lifecycle.maxFirings !== undefined ||
|
|
248
|
+
value.lifecycle.cooldownMs > 0 ||
|
|
249
|
+
value.lifecycle.completeOnGoal)) {
|
|
250
|
+
ctx.addIssue({
|
|
251
|
+
code: 'custom',
|
|
252
|
+
message: 'conditionOnly triggers cannot use effect-based lifecycle fields',
|
|
206
253
|
});
|
|
207
254
|
}
|
|
208
255
|
if (value.continuation && !value.target) {
|
|
@@ -236,6 +283,36 @@ export const CompositeTriggerDefinitionSchema = z.object({
|
|
|
236
283
|
}
|
|
237
284
|
if (value.derivedEvent) {
|
|
238
285
|
const projectionKeys = new Set();
|
|
286
|
+
const measureKeys = new Set();
|
|
287
|
+
for (const measure of value.derivedEvent.measures ?? []) {
|
|
288
|
+
if (measure.key === '_derived') {
|
|
289
|
+
ctx.addIssue({
|
|
290
|
+
code: 'custom',
|
|
291
|
+
message: 'Derived event measure key _derived is reserved',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if (measureKeys.has(measure.key)) {
|
|
295
|
+
ctx.addIssue({
|
|
296
|
+
code: 'custom',
|
|
297
|
+
message: `Derived event measure key must be unique: ${measure.key}`,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (Object.prototype.hasOwnProperty.call(value.derivedEvent.constants, measure.key)) {
|
|
301
|
+
ctx.addIssue({
|
|
302
|
+
code: 'custom',
|
|
303
|
+
message: `Derived event key cannot be both constant and measure: ${measure.key}`,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
for (const ref of collectPatternMeasureRefs(measure)) {
|
|
307
|
+
if (!ids.has(ref)) {
|
|
308
|
+
ctx.addIssue({
|
|
309
|
+
code: 'custom',
|
|
310
|
+
message: `Derived event measure ${measure.key} references unknown clause: ${ref}`,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
measureKeys.add(measure.key);
|
|
315
|
+
}
|
|
239
316
|
for (const projection of value.derivedEvent.projections) {
|
|
240
317
|
if (!ids.has(projection.ref)) {
|
|
241
318
|
ctx.addIssue({
|
|
@@ -243,6 +320,12 @@ export const CompositeTriggerDefinitionSchema = z.object({
|
|
|
243
320
|
message: `Derived event projection references unknown clause: ${projection.ref}`,
|
|
244
321
|
});
|
|
245
322
|
}
|
|
323
|
+
if (measureKeys.has(projection.key)) {
|
|
324
|
+
ctx.addIssue({
|
|
325
|
+
code: 'custom',
|
|
326
|
+
message: `Derived event key cannot be both measure and projection: ${projection.key}`,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
246
329
|
if (projectionKeys.has(projection.key)) {
|
|
247
330
|
ctx.addIssue({
|
|
248
331
|
code: 'custom',
|
|
@@ -270,6 +353,69 @@ export const CompositeTriggerDefinitionSchema = z.object({
|
|
|
270
353
|
});
|
|
271
354
|
}
|
|
272
355
|
}
|
|
356
|
+
if (value.patternV2) {
|
|
357
|
+
const patternRefs = collectPatternRefs(value.patternV2.root);
|
|
358
|
+
for (const ref of patternRefs) {
|
|
359
|
+
if (!ids.has(ref)) {
|
|
360
|
+
ctx.addIssue({
|
|
361
|
+
code: 'custom',
|
|
362
|
+
message: `Pattern AST v2 references unknown clause: ${ref}`,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
for (const dimension of value.patternV2.partitionBy) {
|
|
367
|
+
const dimensionRefs = new Set();
|
|
368
|
+
for (const field of dimension.fields) {
|
|
369
|
+
if (!ids.has(field.ref)) {
|
|
370
|
+
ctx.addIssue({
|
|
371
|
+
code: 'custom',
|
|
372
|
+
message: `Pattern partition ${dimension.key} references unknown clause: ${field.ref}`,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
if (dimensionRefs.has(field.ref)) {
|
|
376
|
+
ctx.addIssue({
|
|
377
|
+
code: 'custom',
|
|
378
|
+
message: `Pattern partition ${dimension.key} has duplicate field mapping for ${field.ref}`,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
dimensionRefs.add(field.ref);
|
|
382
|
+
}
|
|
383
|
+
for (const ref of patternRefs) {
|
|
384
|
+
if (!dimensionRefs.has(ref)) {
|
|
385
|
+
ctx.addIssue({
|
|
386
|
+
code: 'custom',
|
|
387
|
+
message: `Pattern partition ${dimension.key} does not map pattern ref: ${ref}`,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const guaranteedPatternRefs = collectGuaranteedPatternBindings(value.patternV2.root);
|
|
393
|
+
if (typeof value.patternV2.selection.afterMatch === 'object' &&
|
|
394
|
+
!guaranteedPatternRefs.includes(value.patternV2.selection.afterMatch.ref)) {
|
|
395
|
+
ctx.addIssue({
|
|
396
|
+
code: 'custom',
|
|
397
|
+
message: `Pattern afterMatch ref is not guaranteed by every match: ${value.patternV2.selection.afterMatch.ref}`,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
for (const measure of value.derivedEvent?.measures ?? []) {
|
|
401
|
+
for (const ref of collectPatternMeasureRefs(measure)) {
|
|
402
|
+
if (!guaranteedPatternRefs.includes(ref)) {
|
|
403
|
+
ctx.addIssue({
|
|
404
|
+
code: 'custom',
|
|
405
|
+
message: `Derived measure ${measure.key} references non-guaranteed pattern ref: ${ref}`,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const oversized = collectPatternDurationsMs(value.patternV2.root)
|
|
411
|
+
.filter((duration) => duration > value.withinMs);
|
|
412
|
+
if (oversized.length) {
|
|
413
|
+
ctx.addIssue({
|
|
414
|
+
code: 'custom',
|
|
415
|
+
message: `Pattern AST v2 duration exceeds trigger withinMs: ${Math.max(...oversized)} > ${value.withinMs}`,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
273
419
|
const conditionIds = new Set();
|
|
274
420
|
for (const condition of value.temporal) {
|
|
275
421
|
if (conditionIds.has(condition.id)) {
|
|
@@ -332,6 +478,7 @@ export const CorrelatableEventSchema = z.object({
|
|
|
332
478
|
sourceEventId: Id,
|
|
333
479
|
name: z.string().min(1),
|
|
334
480
|
occurredAt: Timestamp,
|
|
481
|
+
receivedAt: Timestamp.optional(),
|
|
335
482
|
provider: z.string().min(1).optional(),
|
|
336
483
|
serverId: Id.optional(),
|
|
337
484
|
subscriptionArguments: z.record(z.string(), z.unknown()).default({}),
|
|
@@ -353,6 +500,7 @@ export const TriggerSourceEventSchema = z.object({
|
|
|
353
500
|
sourceEventId: Id,
|
|
354
501
|
eventName: z.string().min(1),
|
|
355
502
|
occurredAt: Timestamp,
|
|
503
|
+
receivedAt: Timestamp.optional(),
|
|
356
504
|
provider: z.string().min(1).optional(),
|
|
357
505
|
serverId: Id.optional(),
|
|
358
506
|
subscriptionArguments: z.record(z.string(), z.unknown()).default({}),
|
|
@@ -376,6 +524,16 @@ export const TriggerMatchStatusSchema = z.enum([
|
|
|
376
524
|
'fired',
|
|
377
525
|
'expired',
|
|
378
526
|
]);
|
|
527
|
+
export const PatternMatchStateSchema = z.object({
|
|
528
|
+
version: z.literal('2'),
|
|
529
|
+
role: z.enum(['buffer', 'match']),
|
|
530
|
+
signature: z.string().min(1).optional(),
|
|
531
|
+
maxObservedOccurredAt: Timestamp.optional(),
|
|
532
|
+
semanticDecisions: z.array(z.object({
|
|
533
|
+
nodeId: Id,
|
|
534
|
+
decision: CompositeCorrelationDecisionSchema,
|
|
535
|
+
}).strict()).default([]),
|
|
536
|
+
}).strict();
|
|
379
537
|
export const TriggerMatchRecordSchema = z.object({
|
|
380
538
|
protocolVersion: z.literal(COMPOSITE_TRIGGER_PROTOCOL_VERSION),
|
|
381
539
|
schemaVersion: z.literal(COMPOSITE_TRIGGER_SCHEMA_VERSION),
|
|
@@ -389,6 +547,7 @@ export const TriggerMatchRecordSchema = z.object({
|
|
|
389
547
|
updatedAt: Timestamp,
|
|
390
548
|
sourceEvents: z.array(TriggerSourceEventSchema),
|
|
391
549
|
correlationDecision: CompositeCorrelationDecisionSchema.nullable(),
|
|
550
|
+
patternState: PatternMatchStateSchema.optional(),
|
|
392
551
|
firedWakeId: Id.nullable(),
|
|
393
552
|
derivedEventIds: z.array(Id).default([]),
|
|
394
553
|
});
|
|
@@ -6,6 +6,7 @@ export async function mcpOccurrenceToCorrelatableEvent(event, input) {
|
|
|
6
6
|
sourceEventId: event.eventId,
|
|
7
7
|
name: event.name,
|
|
8
8
|
occurredAt: event.timestamp,
|
|
9
|
+
...(input.receivedAt ? { receivedAt: input.receivedAt } : {}),
|
|
9
10
|
...(input.provider ? { provider: input.provider } : {}),
|
|
10
11
|
...(input.serverId ? { serverId: input.serverId } : {}),
|
|
11
12
|
subscriptionArguments: input.subscriptionArguments ?? {},
|