mcp-event-intelligence 0.4.0 → 0.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +107 -26
  3. package/SECURITY.md +4 -4
  4. package/bin/mcp-event-intelligence.mjs +3 -3
  5. package/dist/src/composite/engine.d.ts +14 -4
  6. package/dist/src/composite/engine.js +533 -208
  7. package/dist/src/composite/matching.d.ts +1 -5
  8. package/dist/src/composite/matching.js +45 -54
  9. package/dist/src/composite/runtimeSupport.js +10 -6
  10. package/dist/src/composite/store.d.ts +38 -4
  11. package/dist/src/composite/temporal.d.ts +0 -17
  12. package/dist/src/composite/temporal.js +0 -266
  13. package/dist/src/intelligenceProtocol/activationSchemas.d.ts +38 -3
  14. package/dist/src/intelligenceProtocol/activationSchemas.js +5 -3
  15. package/dist/src/intelligenceProtocol/index.d.ts +12 -9
  16. package/dist/src/intelligenceProtocol/index.js +6 -5
  17. package/dist/src/intelligenceProtocol/lifecycle.js +2 -10
  18. package/dist/src/intelligenceProtocol/operatorRegistry.d.ts +300 -0
  19. package/dist/src/intelligenceProtocol/operatorRegistry.js +338 -0
  20. package/dist/src/intelligenceProtocol/patternV2Schemas.d.ts +188 -0
  21. package/dist/src/intelligenceProtocol/patternV2Schemas.js +801 -0
  22. package/dist/src/intelligenceProtocol/schemas.d.ts +4 -189
  23. package/dist/src/intelligenceProtocol/schemas.js +3 -97
  24. package/dist/src/intelligenceProtocol/triggerPlanSchemas.d.ts +114 -38
  25. package/dist/src/intelligenceProtocol/triggerPlanSchemas.js +27 -18
  26. package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +268 -213
  27. package/dist/src/intelligenceProtocol/triggerSchemas.js +155 -169
  28. package/dist/src/intelligenceProtocol/version.d.ts +2 -2
  29. package/dist/src/intelligenceProtocol/version.js +2 -2
  30. package/dist/src/mcpEvents/consumer.d.ts +1 -0
  31. package/dist/src/mcpEvents/consumer.js +1 -0
  32. package/dist/src/patternV2/evaluator.d.ts +51 -0
  33. package/dist/src/patternV2/evaluator.js +986 -0
  34. package/dist/src/semantic/types.d.ts +6 -0
  35. package/dist/src/semantic/typesafeJevEvaluator.d.ts +1 -0
  36. package/dist/src/semantic/typesafeJevEvaluator.js +6 -0
  37. package/package.json +9 -3
  38. package/scripts/host-integration.d.mts +54 -4
  39. package/scripts/host-integration.mjs +25 -4
  40. package/scripts/lib/activation-hydrator.mjs +13 -12
  41. package/scripts/lib/composite-event-consumer.mjs +10 -28
  42. package/scripts/lib/composite-wake-coordinator.mjs +19 -19
  43. package/scripts/lib/derived-contract-registry.mjs +4 -4
  44. package/scripts/lib/derived-event-coordinator.mjs +69 -6
  45. package/scripts/lib/local-event-intelligence-runtime.mjs +35 -3
  46. package/scripts/lib/mcp-events-client.mjs +97 -55
  47. package/scripts/lib/mcp-events-compatibility.mjs +54 -0
  48. package/scripts/lib/persistent-event-store.mjs +228 -61
  49. package/scripts/lib/store-capabilities.mjs +88 -0
  50. package/scripts/lib/store-conformance.mjs +127 -0
  51. package/scripts/lib/temporal-deadline-scheduler.mjs +3 -3
  52. package/scripts/lib/trigger-control-plane.mjs +202 -53
  53. package/scripts/lib/trigger-inspector.mjs +50 -147
  54. package/scripts/lib/trigger-planner.mjs +141 -52
  55. package/scripts/lib/wake-retry-scheduler.mjs +2 -19
  56. package/scripts/mcp-stdio-server.mjs +46 -61
  57. package/scripts/service.mjs +19 -138
  58. package/server.json +4 -4
  59. package/dist/src/intelligenceProtocol/invariants.d.ts +0 -3
  60. package/dist/src/intelligenceProtocol/invariants.js +0 -36
  61. package/dist/src/intelligenceProtocol/mapper.d.ts +0 -14
  62. package/dist/src/intelligenceProtocol/mapper.js +0 -28
  63. package/scripts/lib/event-processor.mjs +0 -624
  64. package/scripts/lib/http-wake-deliverer.mjs +0 -31
package/CHANGELOG.md CHANGED
@@ -1,5 +1,105 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.0] - 2026-09-30
4
+
5
+ Breaking architecture cleanup: Pattern AST is now the single trigger model.
6
+
7
+ ### Single canonical execution model
8
+
9
+ - remove the pre-Pattern `expression + temporal + correlation` trigger representation;
10
+ - remove `semanticCorrelation` and route semantic reasoning exclusively through explicit Pattern `semantic` nodes;
11
+ - remove the legacy compiler and the parallel legacy execution path;
12
+ - remove the direct single-event `EventProcessor`/semantic-condition wake path;
13
+ - make persisted triggers `clauses + pattern + lifecycle/effect`;
14
+ - make `TriggerPlanInput.pattern` the only advanced authoring surface, with simple plans deterministically compiling to Pattern automatically;
15
+ - expose Pattern directly through activation and inspection surfaces.
16
+
17
+ ### Protocol and runtime
18
+
19
+ - bump internal Event Intelligence protocol/schema to `0.2.0` / `ei.v0.2`;
20
+ - bump composite trigger schema to `trigger.v0.2`;
21
+ - Activation Envelope v2 carries canonical Pattern and partition state;
22
+ - rename match correlation state to partition state where it represents Pattern partition identity;
23
+ - keep Pattern wire grammar `version: "2"` as a schema version, not a second runtime architecture.
24
+
25
+ ### Production hardening
26
+
27
+ - add reproducible Pattern conformance and benchmark evidence;
28
+ - define explicit shared-store capabilities and fail closed when a backend cannot guarantee required distributed semantics;
29
+ - add durable semantic-decision caching tied to evaluator identity, trigger revision and immutable candidate-event identity;
30
+ - make authoritative runtime/store reads Promise-compatible for real database adapters;
31
+ - align embedded host, MCP control-plane and inspector surfaces with async authoritative reads;
32
+ - keep the bundled JSONL store explicitly single-process and reference-grade.
33
+
34
+ ### Documentation and release surface
35
+
36
+ - rewrite README, Quickstart, Architecture and Protocol around the single Pattern runtime;
37
+ - remove current documentation claims of legacy trigger compatibility;
38
+ - align CLI, npm package metadata and MCP Registry metadata on v0.6.0.
39
+
40
+ ### Breaking change
41
+
42
+ Persisted pre-v0.6 trigger definitions are intentionally not accepted by the v0.6 runtime. Historical release notes remain unchanged as history; runtime compatibility code does not.
43
+
44
+ ## [0.5.0] - 2026-09-30
45
+
46
+ ### Pattern AST v2 / advanced CEP
47
+
48
+ - add additive recursive Pattern AST v2 while keeping legacy composite triggers executable;
49
+ - add nested `allOf` / `anyOf` / `sequence`, explicit `next` / `followedBy` / `followedByAny` contiguity, repeat/optional quantifiers and greedy/lazy matching;
50
+ - add bounded negative patterns (`notNext`, `notFollowedBy`) and first-class calendar/absence/debounce/rate/distinct temporal nodes;
51
+ - add within/sliding/tumbling/hopping/session/count windows;
52
+ - add cross-event arithmetic comparisons plus startsWith/endsWith/regex/notIn/between/isNull/type predicates;
53
+ - add sum/avg/min/max/count/countDistinct/first/last/nth/stddev/percentile aggregates and derived-event measures;
54
+ - add changed/changedFrom/increasedBy/decreasedBy/delta/percentChange/stableFor/crossesAbove/crossesBelow state operators;
55
+ - add partitioned durable CEP buffers, overlap/after-match selection policies, bounded candidate budgets and bounded event-time retention;
56
+ - add vendor-neutral first-class `semantic` nodes behind `SemanticEvaluator`; TypeSafe Jev remains optional and explicit;
57
+ - enforce per-node semantic timeout, trigger-level semantic-evaluation budgets and audit every semantic decision, including rejects;
58
+ - validate Pattern v2 refs, partition dimensions, durations, payload paths and derived measures against live source contracts;
59
+ - add `compileLegacyTriggerToPatternV2()` for compatibility/migration and differential verification;
60
+ - expose the complete v2 language through `describeTriggerLanguage()` / `trigger_language_describe`;
61
+ - add end-to-end coverage for advanced predicates, quantifiers, contiguity, windows, arithmetic, state, semantic evaluation, partition isolation, negative deadlines and derived measures.
62
+
63
+ ### Event-time correctness
64
+
65
+ - preserve host `receivedAt` separately from provider `occurredAt` through correlation evidence, derived lineage and activation hydration;
66
+ - sequence and window evaluation no longer depend on delivery order;
67
+ - partial matches are selected by compatible event-time span and can be re-anchored when an earlier event arrives late;
68
+ - add explicit `eventTime.allowedLatenessMs` watermarks for bounded late-event tolerance;
69
+ - events older than the watermark may finish retained compatible partials but cannot seed stale windows;
70
+ - late events outside `withinMs` are isolated instead of creating false composite matches.
71
+
72
+ ### Agent authoring language
73
+
74
+ - add a versioned, self-describing trigger operator registry;
75
+ - add embedded `host.describeTriggerLanguage()` / scoped discovery;
76
+ - add non-mutating MCP `trigger_language_describe` with category/operator filtering;
77
+ - make the MCP `trigger_plan` tool reuse the package's canonical `TriggerPlanInputSchema` instead of maintaining a duplicate input schema;
78
+ - expose all canonical temporal operators through `TriggerPlanInput.temporal`;
79
+ - validate temporal event references and `distinct.path` against live source schemas before compilation;
80
+ - add registry/schema parity tests so supported operators cannot silently drift out of the agent-visible catalog.
81
+
82
+ ### Trigger composition
83
+
84
+ - add explicit `conditionOnly: true` programs with no runtime target, continuation or derived output;
85
+ - agent-friendly planning can compile condition-only programs;
86
+ - identical active `(connection, event, arguments)` clauses share one upstream MCP EventSubscription with observable local fan-out count.
87
+
88
+ ### MCP Events compatibility
89
+
90
+ - external draft assumptions are centralized behind a versioned compatibility profile instead of being spread through the runtime;
91
+ - the current default profile remains the 2026-09-25 experimental extension snapshot;
92
+ - host-owned/embedded integration remains the primary architecture; standalone/provider-native paths are compatibility surfaces, not a new deployment requirement.
93
+
94
+
95
+ ### Compatibility
96
+
97
+ - Pattern AST v2 is additive; legacy composite/temporal triggers remain executable unchanged;
98
+ - the internal persisted Event Intelligence protocol/schema identifiers remain on the v0.1 compatibility line;
99
+ - `compileLegacyTriggerToPatternV2()` is available for migration/differential verification without forcing existing persisted triggers to rewrite;
100
+ - MCP Events remains experimental and isolated behind the versioned compatibility profile.
101
+
102
+
3
103
  ## [0.4.0] - 2026-09-25
4
104
 
5
105
  Current MCP Events draft alignment.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![CI](https://github.com/sarooo17/event-intelligence/actions/workflows/ci.yml/badge.svg)](https://github.com/sarooo17/event-intelligence/actions/workflows/ci.yml)
6
6
  [![npm](https://img.shields.io/npm/v/mcp-event-intelligence.svg)](https://www.npmjs.com/package/mcp-event-intelligence)
7
- [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-v0.4.0-5b5bd6)](https://registry.modelcontextprotocol.io/?q=io.github.sarooo17%2Fevent-intelligence)
7
+ [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-v0.6.0-5b5bd6)](https://registry.modelcontextprotocol.io/?q=io.github.sarooo17%2Fevent-intelligence)
8
8
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
9
9
 
10
10
  MCP Event Intelligence is an experimental event runtime for agents that need to react to **future conditions over multiple event sources** without keeping an LLM or agent loop alive.
@@ -19,7 +19,7 @@ An agent can express an intent such as:
19
19
 
20
20
  > When this PR is merged, the production deploy succeeds, and no error is observed for 10 minutes, wake this task and review the release.
21
21
 
22
- Event Intelligence persists that continuation independently of the model, waits for the world to satisfy it, and wakes the host only when necessary.
22
+ Event Intelligence persists the future condition independently of the model, waits for the world to satisfy it, and wakes the host only when the condition has an activation target. Conditions may also exist without an agent continuation; higher-level facts are composed separately through derived-event triggers.
23
23
 
24
24
  ## Embed it in an existing agent host
25
25
 
@@ -59,7 +59,23 @@ Event Intelligence enumerates the host registry automatically. GitHub, Gmail, pr
59
59
 
60
60
  ### Agent-first trigger flow
61
61
 
62
- Agents no longer need to construct the low-level trigger DSL directly for common cases. Ask EI to compile an agent-friendly plan against the event sources that are actually available:
62
+ Agents do not need a second DSL or a model-specific planner. The public authoring path is:
63
+
64
+ ```text
65
+ event_sources_list
66
+ ↓
67
+ trigger_language_describe (only when grammar discovery is useful)
68
+ ↓
69
+ trigger_plan
70
+ ↓
71
+ Pattern AST definition
72
+ ↓
73
+ trigger_create
74
+ ```
75
+
76
+ `planTrigger()` is deterministic: it resolves live event sources, fills `serverId`, validates subscription arguments and predicate/pattern field paths against advertised schemas, and returns the canonical trigger definition plus the required connection IDs.
77
+
78
+ For a simple condition, omitting `pattern` produces an `allOf` Pattern over the declared events:
63
79
 
64
80
  ```js
65
81
  const plan = await ei.planTrigger({
@@ -70,7 +86,6 @@ const plan = await ei.planTrigger({
70
86
  { path: 'grand_total', op: 'gt', value: 10000 },
71
87
  ],
72
88
  }],
73
- match: 'all',
74
89
  withinMs: 60 * 60 * 1000,
75
90
  target: {
76
91
  runtime: 'agent',
@@ -82,27 +97,84 @@ const plan = await ei.planTrigger({
82
97
  'Check the submitted invoice for anomalies and report back in this conversation.',
83
98
  },
84
99
  });
100
+ ```
85
101
 
86
- await ei.triggerControl.createTrigger({
87
- definition: plan.definition,
88
- connectionIds: plan.connectionIds,
89
- actor,
90
- owner,
102
+ For advanced CEP, author the same canonical `pattern` directly:
103
+
104
+ ```js
105
+ const language = ei.describeTriggerLanguage({ category: 'pattern' });
106
+
107
+ const plan = await ei.planTrigger({
108
+ events: [
109
+ { id: 'order', event: 'erpnext.sales_order.created' },
110
+ { id: 'failure', event: 'payments.failed' },
111
+ { id: 'ticket', event: 'support.ticket.created' },
112
+ ],
113
+ withinMs: 30 * 60 * 1000,
114
+ pattern: {
115
+ version: '2',
116
+ partitionBy: [{
117
+ key: 'customer',
118
+ fields: [
119
+ { ref: 'order', path: 'customer' },
120
+ { ref: 'failure', path: 'customer' },
121
+ { ref: 'ticket', path: 'customer' },
122
+ ],
123
+ }],
124
+ root: {
125
+ kind: 'aggregate',
126
+ function: 'sum',
127
+ ref: 'order',
128
+ path: 'grand_total',
129
+ op: 'gte',
130
+ value: 10000,
131
+ child: {
132
+ kind: 'sequence',
133
+ contiguity: 'followedBy',
134
+ children: [
135
+ { kind: 'event', ref: 'order' },
136
+ {
137
+ kind: 'repeat',
138
+ child: { kind: 'event', ref: 'failure' },
139
+ min: 2,
140
+ max: 5,
141
+ mode: 'greedy',
142
+ },
143
+ {
144
+ kind: 'optional',
145
+ child: { kind: 'event', ref: 'ticket' },
146
+ mode: 'greedy',
147
+ },
148
+ ],
149
+ },
150
+ },
151
+ },
152
+ target: {
153
+ runtime: 'agent',
154
+ kind: 'conversation',
155
+ id: 'chat-42',
156
+ },
157
+ continuation: {
158
+ instruction: 'Review this customer payment-risk pattern.',
159
+ },
91
160
  });
92
161
  ```
93
162
 
94
- `planTrigger()` is deterministic. It does not call a model. It resolves event names to live source/server IDs, validates predicate paths against advertised payload schemas, compiles `all` / `any` / `sequence` / `count`, and returns the canonical trigger definition plus the required connection IDs.
163
+ Pattern AST is the **single canonical trigger execution model**. It covers nested boolean and sequence patterns, contiguity, repeat/optional quantifiers, bounded negative patterns, calendar/absence/debounce/rate/distinct semantics, event-time windows, cross-event comparisons and arithmetic, aggregates, state transitions, partitioning, match-selection policy and deterministic derived measures.
164
+
165
+ The wire schema currently identifies this grammar as `version: "2"`; that is a schema version, not a second execution architecture.
166
+
167
+ The runtime is **deterministic first**. A first-class `semantic` node is available only when structural data cannot express the condition reliably. It is vendor-neutral and calls the configured `SemanticEvaluator`; the bundled TypeSafe Jev adapter is optional when `TYPESAFE_API_KEY` is present. Semantic calls are explicit, bounded, timed out, cacheable and audit-recorded; ordinary CEP execution requires no model API.
95
168
 
96
- The persisted `continuation` answers a separate question from the trigger condition: **what should the agent do after the future condition becomes true?**
169
+ The persisted `continuation` answers a separate question from the trigger condition: **what should the agent do after the future condition becomes true?** A trigger can instead set `conditionOnly: true` and persist only the condition state, with no runtime target or continuation.
97
170
 
98
171
  The wire wake remains deliberately small and reference-only. Embedded hosts also receive an Activation Envelope as the second wake argument. The same envelope can be reconstructed later:
99
172
 
100
173
  ```js
101
- const activation = ei.hydrateWake(wakeId);
174
+ const activation = await ei.hydrateWake(wakeId);
102
175
  ```
103
176
 
104
- The envelope contains the configured continuation, trigger/match state, and matched evidence. Event payloads are labeled as untrusted external signals and are included only according to the trigger's `continuation.contextPolicy`.
105
-
177
+ The envelope contains the configured continuation, canonical Pattern, match state, and matched evidence. Event payloads are labeled as untrusted external signals and are included only according to the trigger's `continuation.contextPolicy`.
106
178
 
107
179
  ### Shared hosts, tenant isolation and storage
108
180
 
@@ -118,7 +190,7 @@ await tenant.triggerControl.createTrigger({
118
190
  owner,
119
191
  });
120
192
 
121
- const acmeConnections = tenant.mcpStatus();
193
+ const acmeConnections = await tenant.mcpStatus();
122
194
  ```
123
195
 
124
196
  The default reference store physically namespaces non-default scopes under separate persistent store partitions. Trigger IDs, match IDs, cursors, event sources, deadlines, derived events and wake delivery state are therefore resolved inside a scope rather than filtered out of a global result after the fact. The root host object is the trusted operator/control-plane capability; tenant code should receive a scoped view.
@@ -203,7 +275,7 @@ timezone normalization and deterministic occurrence IDs. The local factory in
203
275
  this package should therefore be read as a typed convenience API, not as the
204
276
  production ERP connector itself.
205
277
 
206
- ## What v0.4 implements
278
+ ## What v0.6 implements
207
279
 
208
280
  ### Host-owned event sources
209
281
 
@@ -215,6 +287,7 @@ production ERP connector itself.
215
287
  - `events/poll` with server-directed `nextPollMs`, nullable cursors and bounded page draining;
216
288
  - host-owned push and webhook delivery adapters feeding the same EventOccurrence pipeline;
217
289
  - persistent opaque cursors and per-subscription delivery state;
290
+ - shared upstream subscriptions fan out to every active trigger using the same `(connection, event, arguments)` tuple;
218
291
  - per-scope source/cursor isolation for shared hosts;
219
292
  - single-flight polling per connection plus bounded `hasMore` batch draining;
220
293
  - automatic event-source registration;
@@ -244,7 +317,7 @@ Poll, push and webhook are treated only as delivery mechanisms. All three normal
244
317
  - event-source discovery;
245
318
  - agent-friendly deterministic trigger planning/compilation;
246
319
  - MCP subscription `arguments` validated against each source `inputSchema`, kept distinct from EI payload predicates;
247
- - `eq`, `neq`, `contains`, `in`, `exists`, `gt`, `gte`, `lt`, `lte` predicates;
320
+ - structured predicates including `eq`, `neq`, `contains`, `startsWith`, `endsWith`, `regex`, `in`, `notIn`, `between`, `exists`, `isNull`, `type`, `gt`, `gte`, `lt`, `lte`;
248
321
  - persisted continuation contracts separated from trigger conditions;
249
322
  - Activation Envelope hydration with matched event evidence;
250
323
  - embedded wake callbacks receive `(packet, activation)`;
@@ -306,17 +379,19 @@ This project does **not** propose a replacement for MCP Events and does not clai
306
379
 
307
380
  ## AI and API keys
308
381
 
309
- Event Intelligence has one optional AI boundary: **semantic correlation**.
382
+ Event Intelligence has one optional AI boundary: **explicit semantic evaluation**.
310
383
 
311
- - `TYPESAFE_API_KEY` enables the bundled TypeSafe Jev evaluator when a trigger explicitly requests semantic correlation.
384
+ - Pattern AST exposes a vendor-neutral `semantic` node as the only semantic condition form.
385
+ - `TYPESAFE_API_KEY` enables the bundled TypeSafe Jev evaluator when a trigger explicitly requests semantic evaluation.
312
386
  - embedded hosts may inject a compatible `semanticEvaluator` instead.
387
+ - deterministic predicates, patterns, windows, aggregations, state changes, deadlines and derived measures never require an AI evaluator.
313
388
  - there is no bundled OpenAI planner and no OpenAI API dependency.
314
389
 
315
390
  The agent/harness is already responsible for natural-language reasoning. It can use `trigger_plan` / `planTrigger()` to compile common requests deterministically against discovered source schemas, or submit a canonical trigger definition directly for advanced cases. Deterministic correlation, temporal logic, persistence, derived events and wake delivery require no model API.
316
391
 
317
392
  ## Full-system acceptance
318
393
 
319
- The v0.4 acceptance suite verifies:
394
+ The v0.6 acceptance suite verifies:
320
395
 
321
396
  - host-owned MCP client → extension discovery → durable subscription → poll/push/webhook occurrence → composite match → in-process wake;
322
397
  - provider-neutral events → composite match → derived event → derived composition → signed runtime wake;
@@ -334,7 +409,9 @@ The v0.4 acceptance suite verifies:
334
409
 
335
410
  A separate live regression also verified real GitHub webhook ingress into the MCP EventOccurrence / composite fan-in path.
336
411
 
337
- ## Standalone reference service
412
+ ## Reference/debug service
413
+
414
+ The HTTP service remains useful for local development, conformance work and provider-native regression tests. It is **not** the primary integration model and does not replace the embedded host-owned package path above.
338
415
 
339
416
  ### Requirements
340
417
 
@@ -362,13 +439,13 @@ The standalone service supports manual/provider-native event ingress. It does no
362
439
  ### Docker
363
440
 
364
441
  ```bash
365
- docker build -t mcp-event-intelligence:0.4.0 .
442
+ docker build -t mcp-event-intelligence:0.6.0 .
366
443
 
367
444
  docker run --rm \
368
445
  -p 3000:3000 \
369
446
  -v mcp-event-intelligence-data:/data \
370
447
  -e SERVICE_AUTH_TOKEN="$(openssl rand -hex 32)" \
371
- mcp-event-intelligence:0.4.0
448
+ mcp-event-intelligence:0.6.0
372
449
  ```
373
450
 
374
451
  ## Optional MCP control plane
@@ -414,7 +491,11 @@ The detailed execution model, clocks, lifecycle, persistence and trust boundarie
414
491
 
415
492
  ### Event-time vs processing-time
416
493
 
417
- Normal event windows use event `occurredAt`.
494
+ Normal event windows use event `occurredAt`; MCP ingress also preserves host `receivedAt` when available. Delivery order does not define event order.
495
+
496
+ Out-of-order events are matched against compatible event-time windows. A late event may re-anchor a partial match to an earlier `occurredAt` only when the complete event-time span still fits `withinMs`; otherwise it starts a separate partial window and cannot create a false sequence.
497
+
498
+ Triggers may set `eventTime.allowedLatenessMs` (default `0`). EI maintains an event-time watermark per trigger/correlation stream: old partial windows are retained until their expiry falls behind `maxObservedEventTime - allowedLatenessMs`. An event older than the watermark can still complete a retained compatible partial, but cannot seed a new stale window.
418
499
 
419
500
  Absence/deadline progression uses Event Intelligence processing time. This separation is explicit and tested.
420
501
 
@@ -432,7 +513,7 @@ It uses stable wake IDs, persisted delivery state, atomic claim leases, bounded
432
513
 
433
514
  A derived event says **what became true at a point in history**.
434
515
 
435
- v0.3 intentionally does not implement a mutable current-state/facts database.
516
+ Event Intelligence intentionally does not implement a mutable current-state/facts database.
436
517
 
437
518
  ## Security
438
519
 
@@ -457,7 +538,7 @@ io.github.sarooo17/event-intelligence
457
538
 
458
539
  ## Project status
459
540
 
460
- **v0.4.x reference implementation / experimental.**
541
+ **v0.6.x reference implementation / experimental.**
461
542
 
462
543
  The architecture is implemented and exercised end-to-end. Storage is now injectable and scoped, while the bundled JSONL backend remains a single-process reference implementation. Remaining work is primarily production database adapters/HA validation, scale benchmarks and upstream feedback.
463
544
 
package/SECURITY.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Supported versions
4
4
 
5
- The public package is pre-1.0. Security fixes are supported on the current 0.3.x line.
5
+ The public package is pre-1.0. Security fixes are supported on the current 0.6.x line.
6
6
 
7
7
  | Version | Supported |
8
8
  | --- | --- |
9
- | 0.3.x | Yes |
10
- | < 0.3 | No |
9
+ | 0.6.x | Yes |
10
+ | < 0.6 | No |
11
11
 
12
12
  ## Reporting a vulnerability
13
13
 
@@ -26,7 +26,7 @@ Useful reports include:
26
26
 
27
27
  ## Security boundaries
28
28
 
29
- Event Intelligence 0.3.x is an experimental reference implementation with scoped multi-tenant host support. It is not a turnkey hardened hosted service.
29
+ Event Intelligence 0.6.x is an experimental reference implementation with scoped multi-tenant host support. It is not a turnkey hardened hosted service.
30
30
 
31
31
  Important defaults and constraints:
32
32
 
@@ -4,14 +4,14 @@ const args = process.argv.slice(2);
4
4
  const flags = new Set(args);
5
5
 
6
6
  if (flags.has('--version') || flags.has('-v')) {
7
- console.log('0.4.0');
7
+ console.log('0.6.0');
8
8
  process.exit(0);
9
9
  }
10
10
 
11
11
  if (flags.has('--help') || flags.has('-h')) {
12
- console.log(`MCP Event Intelligence v0.4
12
+ console.log(`MCP Event Intelligence v0.6
13
13
 
14
- Durable temporal event intelligence for sleeping agents.
14
+ MCP-native complex event processing for durable agents.
15
15
 
16
16
  Usage:
17
17
  mcp-event-intelligence Start the HTTP reference service
@@ -8,19 +8,29 @@ export interface CompositeIngestResult {
8
8
  matched: boolean;
9
9
  fired: boolean;
10
10
  }
11
+ export interface CompositeTriggerEngineOptions {
12
+ workerId?: string;
13
+ partitionLeaseMs?: number;
14
+ }
11
15
  export declare class CompositeTriggerEngine {
12
16
  private readonly store;
13
17
  private readonly evaluator;
14
18
  private readonly now;
15
19
  private readonly support;
16
- constructor(store: CompositeTriggerStore & CompositeTriggerAudit, evaluator?: SemanticEvaluator | null, now?: () => Date);
20
+ private readonly workerId;
21
+ private readonly partitionLeaseMs;
22
+ constructor(store: CompositeTriggerStore & CompositeTriggerAudit, evaluator?: SemanticEvaluator | null, now?: () => Date, options?: CompositeTriggerEngineOptions);
17
23
  register(definitionInput: unknown): Promise<CompositeTriggerDefinition>;
18
24
  ingest(eventInput: unknown): Promise<CompositeIngestResult[]>;
19
25
  markFired(matchId: string, wakeId: string): Promise<TriggerMatchRecord>;
20
26
  markDerivedEmitted(matchId: string, derivedEventId: string): Promise<TriggerMatchRecord>;
21
27
  private ingestTimerEvent;
22
- private applyEvent;
23
- private finalizeEligible;
24
- private newMatch;
28
+ private patternPartitionKey;
29
+ private patternBufferId;
30
+ private patternDecisionRecord;
31
+ private applyPattern;
32
+ private applyPatternWithPartition;
33
+ private candidateFitsTriggerWindow;
34
+ private evaluatePatternBuffer;
25
35
  private latestMatch;
26
36
  }