mcp-event-intelligence 0.5.0 → 0.6.1

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 (61) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +31 -38
  3. package/SECURITY.md +4 -4
  4. package/bin/mcp-event-intelligence.mjs +2 -2
  5. package/dist/src/composite/engine.d.ts +11 -7
  6. package/dist/src/composite/engine.js +152 -414
  7. package/dist/src/composite/matching.d.ts +1 -5
  8. package/dist/src/composite/matching.js +0 -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 +36 -3
  14. package/dist/src/intelligenceProtocol/activationSchemas.js +4 -3
  15. package/dist/src/intelligenceProtocol/index.d.ts +8 -12
  16. package/dist/src/intelligenceProtocol/index.js +4 -7
  17. package/dist/src/intelligenceProtocol/lifecycle.js +2 -10
  18. package/dist/src/intelligenceProtocol/operatorRegistry.d.ts +3 -270
  19. package/dist/src/intelligenceProtocol/operatorRegistry.js +5 -144
  20. package/dist/src/intelligenceProtocol/schemas.d.ts +0 -189
  21. package/dist/src/intelligenceProtocol/schemas.js +1 -97
  22. package/dist/src/intelligenceProtocol/triggerPlanSchemas.d.ts +5 -102
  23. package/dist/src/intelligenceProtocol/triggerPlanSchemas.js +2 -26
  24. package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +14 -215
  25. package/dist/src/intelligenceProtocol/triggerSchemas.js +18 -191
  26. package/dist/src/intelligenceProtocol/version.d.ts +2 -2
  27. package/dist/src/intelligenceProtocol/version.js +2 -2
  28. package/dist/src/patternV2/evaluator.d.ts +9 -1
  29. package/dist/src/patternV2/evaluator.js +63 -4
  30. package/dist/src/semantic/types.d.ts +6 -0
  31. package/dist/src/semantic/typesafeJevEvaluator.d.ts +1 -0
  32. package/dist/src/semantic/typesafeJevEvaluator.js +6 -0
  33. package/package.json +5 -2
  34. package/scripts/host-integration.d.mts +48 -5
  35. package/scripts/host-integration.mjs +16 -4
  36. package/scripts/lib/activation-hydrator.mjs +12 -12
  37. package/scripts/lib/composite-event-consumer.mjs +8 -28
  38. package/scripts/lib/composite-wake-coordinator.mjs +19 -19
  39. package/scripts/lib/derived-contract-registry.mjs +4 -4
  40. package/scripts/lib/derived-event-coordinator.mjs +11 -22
  41. package/scripts/lib/local-event-intelligence-runtime.mjs +35 -3
  42. package/scripts/lib/mcp-events-client.mjs +36 -32
  43. package/scripts/lib/persistent-event-store.mjs +228 -61
  44. package/scripts/lib/store-capabilities.mjs +88 -0
  45. package/scripts/lib/store-conformance.mjs +152 -0
  46. package/scripts/lib/temporal-deadline-scheduler.mjs +3 -3
  47. package/scripts/lib/trigger-control-plane.mjs +52 -57
  48. package/scripts/lib/trigger-inspector.mjs +48 -160
  49. package/scripts/lib/trigger-planner.mjs +37 -126
  50. package/scripts/lib/wake-retry-scheduler.mjs +2 -19
  51. package/scripts/mcp-stdio-server.mjs +8 -8
  52. package/scripts/service.mjs +19 -138
  53. package/server.json +3 -3
  54. package/dist/src/intelligenceProtocol/invariants.d.ts +0 -3
  55. package/dist/src/intelligenceProtocol/invariants.js +0 -36
  56. package/dist/src/intelligenceProtocol/mapper.d.ts +0 -14
  57. package/dist/src/intelligenceProtocol/mapper.js +0 -28
  58. package/dist/src/patternV2/legacyCompiler.d.ts +0 -3
  59. package/dist/src/patternV2/legacyCompiler.js +0 -184
  60. package/scripts/lib/event-processor.mjs +0 -624
  61. package/scripts/lib/http-wake-deliverer.mjs +0 -31
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.1] - 2026-09-30
4
+
5
+ Patch release for post-merge v0.6 review findings.
6
+
7
+ ### Fixed
8
+
9
+ - migrate the advertised store conformance fixture to the v0.2 Pattern trigger schema;
10
+ - create a valid Pattern match before exercising wake-claim exclusion in store conformance;
11
+ - bind temporal match `completedAt` to the reached deadline for that candidate's signature instead of the latest deadline reached by the whole Pattern buffer;
12
+ - add regression coverage for multiple temporal candidates becoming due in one scheduler tick;
13
+ - harden release automation against npm registry propagation delay.
14
+
15
+ ## [0.6.0] - 2026-09-30
16
+
17
+ Breaking architecture cleanup: Pattern AST is now the single trigger model.
18
+
19
+ ### Single canonical execution model
20
+
21
+ - remove the pre-Pattern `expression + temporal + correlation` trigger representation;
22
+ - remove `semanticCorrelation` and route semantic reasoning exclusively through explicit Pattern `semantic` nodes;
23
+ - remove the legacy compiler and the parallel legacy execution path;
24
+ - remove the direct single-event `EventProcessor`/semantic-condition wake path;
25
+ - make persisted triggers `clauses + pattern + lifecycle/effect`;
26
+ - make `TriggerPlanInput.pattern` the only advanced authoring surface, with simple plans deterministically compiling to Pattern automatically;
27
+ - expose Pattern directly through activation and inspection surfaces.
28
+
29
+ ### Protocol and runtime
30
+
31
+ - bump internal Event Intelligence protocol/schema to `0.2.0` / `ei.v0.2`;
32
+ - bump composite trigger schema to `trigger.v0.2`;
33
+ - Activation Envelope v2 carries canonical Pattern and partition state;
34
+ - rename match correlation state to partition state where it represents Pattern partition identity;
35
+ - keep Pattern wire grammar `version: "2"` as a schema version, not a second runtime architecture.
36
+
37
+ ### Production hardening
38
+
39
+ - add reproducible Pattern conformance and benchmark evidence;
40
+ - define explicit shared-store capabilities and fail closed when a backend cannot guarantee required distributed semantics;
41
+ - add durable semantic-decision caching tied to evaluator identity, trigger revision and immutable candidate-event identity;
42
+ - make authoritative runtime/store reads Promise-compatible for real database adapters;
43
+ - align embedded host, MCP control-plane and inspector surfaces with async authoritative reads;
44
+ - keep the bundled JSONL store explicitly single-process and reference-grade.
45
+
46
+ ### Documentation and release surface
47
+
48
+ - rewrite README, Quickstart, Architecture and Protocol around the single Pattern runtime;
49
+ - remove current documentation claims of legacy trigger compatibility;
50
+ - align CLI, npm package metadata and MCP Registry metadata on v0.6.0.
51
+
52
+ ### Breaking change
53
+
54
+ 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.
55
+
3
56
  ## [0.5.0] - 2026-09-30
4
57
 
5
58
  ### Pattern AST v2 / advanced CEP
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.5.0-5b5bd6)](https://registry.modelcontextprotocol.io/?q=io.github.sarooo17%2Fevent-intelligence)
7
+ [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-v0.6.1-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.
@@ -59,17 +59,23 @@ Event Intelligence enumerates the host registry automatically. GitHub, Gmail, pr
59
59
 
60
60
  ### Agent-first trigger flow
61
61
 
62
- Agents do not need to construct the low-level trigger DSL directly. The public authoring flow is self-describing: discover the live event sources, inspect the trigger language only when needed, then ask EI to compile an agent-friendly plan against the sources that are actually available:
62
+ Agents do not need a second DSL or a model-specific planner. The public authoring path is:
63
63
 
64
- ```js
65
- const temporalLanguage = ei.describeTriggerLanguage({
66
- category: 'temporal',
67
- });
68
-
69
- // returns the supported temporal operators, required fields and examples
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
70
74
  ```
71
75
 
72
- The same catalog is available through the optional MCP control plane as `trigger_language_describe`. This keeps operator discovery out of the agent's permanent prompt/context and makes new operators discoverable on demand.
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:
73
79
 
74
80
  ```js
75
81
  const plan = await ei.planTrigger({
@@ -80,7 +86,6 @@ const plan = await ei.planTrigger({
80
86
  { path: 'grand_total', op: 'gt', value: 10000 },
81
87
  ],
82
88
  }],
83
- match: 'all',
84
89
  withinMs: 60 * 60 * 1000,
85
90
  target: {
86
91
  runtime: 'agent',
@@ -92,24 +97,13 @@ const plan = await ei.planTrigger({
92
97
  'Check the submitted invoice for anomalies and report back in this conversation.',
93
98
  },
94
99
  });
95
-
96
- await ei.triggerControl.createTrigger({
97
- definition: plan.definition,
98
- connectionIds: plan.connectionIds,
99
- actor,
100
- owner,
101
- });
102
100
  ```
103
101
 
104
- `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`, accepts the canonical temporal operator set (`calendar`, `absence`, `not`, `unless`, `after`, `until`, `debounce`, `threshold`, `rate`, `distinct`), and returns the canonical trigger definition plus the required connection IDs.
105
-
106
- The canonical trigger definition remains the engine IR/advanced API. Agents should normally author through `planTrigger()` / `trigger_plan`, using `describeTriggerLanguage()` / `trigger_language_describe` for operator discovery.
107
-
108
- ### Pattern AST v2: advanced CEP
109
-
110
- For advanced event programs, `TriggerPlanInput.patternV2` is the preferred authoring surface. Event declarations still describe discovered MCP event sources once; the recursive AST refers to those aliases and composes them without duplicating transport/provider configuration.
102
+ For advanced CEP, author the same canonical `pattern` directly:
111
103
 
112
104
  ```js
105
+ const language = ei.describeTriggerLanguage({ category: 'pattern' });
106
+
113
107
  const plan = await ei.planTrigger({
114
108
  events: [
115
109
  { id: 'order', event: 'erpnext.sales_order.created' },
@@ -117,7 +111,7 @@ const plan = await ei.planTrigger({
117
111
  { id: 'ticket', event: 'support.ticket.created' },
118
112
  ],
119
113
  withinMs: 30 * 60 * 1000,
120
- patternV2: {
114
+ pattern: {
121
115
  version: '2',
122
116
  partitionBy: [{
123
117
  key: 'customer',
@@ -166,22 +160,21 @@ const plan = await ei.planTrigger({
166
160
  });
167
161
  ```
168
162
 
169
- Pattern AST v2 adds nested boolean/sequence patterns, strict and relaxed contiguity, repeat/optional quantifiers, negative look-ahead, streaming windows, cross-event comparisons, aggregates, state-transition operators, partitioning, overlap/after-match policies and deterministic derived measures.
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.
170
164
 
171
- 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 and audit-recorded; ordinary CEP execution requires no model API.
165
+ The wire schema currently identifies this grammar as `version: "2"`; that is a schema version, not a second execution architecture.
172
166
 
173
- Legacy `expression + temporal + correlation` triggers remain supported. `compileLegacyTriggerToPatternV2()` provides an additive compatibility path rather than forcing stored v1 triggers to migrate synchronously.
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.
174
168
 
175
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.
176
170
 
177
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:
178
172
 
179
173
  ```js
180
- const activation = ei.hydrateWake(wakeId);
174
+ const activation = await ei.hydrateWake(wakeId);
181
175
  ```
182
176
 
183
- 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`.
184
-
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`.
185
178
 
186
179
  ### Shared hosts, tenant isolation and storage
187
180
 
@@ -197,7 +190,7 @@ await tenant.triggerControl.createTrigger({
197
190
  owner,
198
191
  });
199
192
 
200
- const acmeConnections = tenant.mcpStatus();
193
+ const acmeConnections = await tenant.mcpStatus();
201
194
  ```
202
195
 
203
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.
@@ -282,7 +275,7 @@ timezone normalization and deterministic occurrence IDs. The local factory in
282
275
  this package should therefore be read as a typed convenience API, not as the
283
276
  production ERP connector itself.
284
277
 
285
- ## What v0.4 implements
278
+ ## What v0.6 implements
286
279
 
287
280
  ### Host-owned event sources
288
281
 
@@ -388,7 +381,7 @@ This project does **not** propose a replacement for MCP Events and does not clai
388
381
 
389
382
  Event Intelligence has one optional AI boundary: **explicit semantic evaluation**.
390
383
 
391
- - Pattern AST v2 exposes a vendor-neutral `semantic` node; legacy `semanticCorrelation` is the compatibility form.
384
+ - Pattern AST exposes a vendor-neutral `semantic` node as the only semantic condition form.
392
385
  - `TYPESAFE_API_KEY` enables the bundled TypeSafe Jev evaluator when a trigger explicitly requests semantic evaluation.
393
386
  - embedded hosts may inject a compatible `semanticEvaluator` instead.
394
387
  - deterministic predicates, patterns, windows, aggregations, state changes, deadlines and derived measures never require an AI evaluator.
@@ -398,7 +391,7 @@ The agent/harness is already responsible for natural-language reasoning. It can
398
391
 
399
392
  ## Full-system acceptance
400
393
 
401
- The v0.4 acceptance suite verifies:
394
+ The v0.6 acceptance suite verifies:
402
395
 
403
396
  - host-owned MCP client → extension discovery → durable subscription → poll/push/webhook occurrence → composite match → in-process wake;
404
397
  - provider-neutral events → composite match → derived event → derived composition → signed runtime wake;
@@ -446,13 +439,13 @@ The standalone service supports manual/provider-native event ingress. It does no
446
439
  ### Docker
447
440
 
448
441
  ```bash
449
- docker build -t mcp-event-intelligence:0.5.0 .
442
+ docker build -t mcp-event-intelligence:0.6.1 .
450
443
 
451
444
  docker run --rm \
452
445
  -p 3000:3000 \
453
446
  -v mcp-event-intelligence-data:/data \
454
447
  -e SERVICE_AUTH_TOKEN="$(openssl rand -hex 32)" \
455
- mcp-event-intelligence:0.5.0
448
+ mcp-event-intelligence:0.6.1
456
449
  ```
457
450
 
458
451
  ## Optional MCP control plane
@@ -545,7 +538,7 @@ io.github.sarooo17/event-intelligence
545
538
 
546
539
  ## Project status
547
540
 
548
- **v0.5.x reference implementation / experimental.**
541
+ **v0.6.x reference implementation / experimental.**
549
542
 
550
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.
551
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.5.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.5.x | Yes |
10
- | < 0.5 | 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.5.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,12 +4,12 @@ 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.5.0');
7
+ console.log('0.6.1');
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.5
12
+ console.log(`MCP Event Intelligence v0.6.1
13
13
 
14
14
  MCP-native complex event processing for durable agents.
15
15
 
@@ -8,12 +8,18 @@ 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>;
@@ -22,11 +28,9 @@ export declare class CompositeTriggerEngine {
22
28
  private patternPartitionKey;
23
29
  private patternBufferId;
24
30
  private patternDecisionRecord;
25
- private applyPatternV2;
26
- private evaluatePatternV2Buffer;
27
- private applyEvent;
28
- private finalizeEligible;
29
- private branchMatch;
30
- private newMatch;
31
+ private applyPattern;
32
+ private applyPatternWithPartition;
33
+ private candidateFitsTriggerWindow;
34
+ private evaluatePatternBuffer;
31
35
  private latestMatch;
32
36
  }