@reventlessdev/reventless-core 3.0.0-alpha.173 → 3.0.0-alpha.174

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 CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.174 (2026-07-21)
7
+
8
+ ### Features
9
+
10
+ * **core:** populate pluginName + route MCP dispatch through shared helper ([06ec4f9](https://github.com/ReventlessDev/reventless-core/commit/06ec4f98b2dc23a8ef547a754d140e48268ee183))
11
+
12
+
6
13
  # 3.0.0-alpha.173 (2026-07-20)
7
14
 
8
15
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-core",
3
- "version": "3.0.0-alpha.173",
3
+ "version": "3.0.0-alpha.174",
4
4
  "description": "Core package for Reventless framework",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -28,17 +28,17 @@
28
28
  "dependencies": {
29
29
  "sury": "11.0.0-alpha.4",
30
30
  "uuid": "^13.0.0",
31
- "@reventlessdev/rescript-effect": "0.1.0-alpha.29",
32
31
  "@reventlessdev/rescript-hash-object": "1.2.0-alpha.13",
33
32
  "@reventlessdev/rescript-fast-csv": "1.2.0-alpha.14",
34
33
  "@reventlessdev/rescript-jest": "1.0.0-alpha.9",
35
34
  "@reventlessdev/rescript-node-streams": "1.1.0-alpha.13",
35
+ "@reventlessdev/rescript-effect": "0.1.0-alpha.29",
36
36
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.17",
37
37
  "@reventlessdev/rescript-ssh2": "1.1.0-alpha.14",
38
38
  "@reventlessdev/rescript-uuid": "1.1.0-alpha.17",
39
39
  "@reventlessdev/reventless-infra": "3.0.0-alpha.102",
40
- "@reventlessdev/reventless-spec": "3.0.0-alpha.79",
41
- "@reventlessdev/reventless-interop": "3.0.0-alpha.28"
40
+ "@reventlessdev/reventless-interop": "3.0.0-alpha.28",
41
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.79"
42
42
  },
43
43
  "devDependencies": {
44
44
  "rescript": "12.3.0",
@@ -22,7 +22,7 @@ function Make(RuntimeEnvironment) {
22
22
  let correlationId = RuntimeEnvironment.extractCorrelationId(event);
23
23
  let causationId = RuntimeEnvironment.extractCausationId(event);
24
24
  let comp = `AggregateRuntime(` + aggregateName + `)`;
25
- let runEffect = effect => Runtime$ReventlessCore.runEffect(correlationId, causationId, comp, undefined, effect);
25
+ let runEffect = effect => Runtime$ReventlessCore.runEffect(correlationId, causationId, comp, undefined, undefined, undefined, effect);
26
26
  let info = CommandGenerator$ReventlessCore.metaInfo(event);
27
27
  if (info !== undefined) {
28
28
  let handler = commandGeneratorHandlers[info];
@@ -42,7 +42,7 @@ function Make(RuntimeEnvironment) {
42
42
  Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, `found ` + count + ` handler(s) for ` + urn));
43
43
  await Promise.all(handlers.map(handler => {
44
44
  let effect = handler(event, context);
45
- return Runtime$ReventlessCore.runEffect(correlationId, causationId, comp, undefined, effect);
45
+ return Runtime$ReventlessCore.runEffect(correlationId, causationId, comp, undefined, undefined, undefined, effect);
46
46
  }));
47
47
  }));
48
48
  });
@@ -18,8 +18,17 @@ let annotateInvocation = (
18
18
  ~causationId=?,
19
19
  ~comp=?,
20
20
  ~pluginName=?,
21
+ ~identity=?,
22
+ ~claims=?,
21
23
  ) => {
22
24
  let cid = correlationId->Option.getOr("unknown")
25
+ // Resolve the owning plugin from the comp→plugin registry when not supplied,
26
+ // so RequestContext.pluginName matches the `plugin` log field (which
27
+ // EffectLogger.install resolves the same way via LogPrefix.resolvePlugin).
28
+ let resolvedPlugin = switch pluginName {
29
+ | Some(_) => pluginName
30
+ | None => Reventless.LogPrefix.resolvePlugin(~comp?, ())
31
+ }
23
32
  let annotateOpt = (eff, key, value) =>
24
33
  switch value {
25
34
  | Some(v) => eff->Effect.annotateLogs(key, v)
@@ -31,15 +40,31 @@ let annotateInvocation = (
31
40
  ->annotateOpt("causationId", causationId)
32
41
  ->Effect.provideService(
33
42
  RequestContext.tag,
34
- RequestContext.make(~correlationId=cid, ~causationId?, ~component=?comp, ~pluginName?),
43
+ RequestContext.make(
44
+ ~correlationId=cid,
45
+ ~causationId?,
46
+ ~component=?comp,
47
+ ~pluginName=?resolvedPlugin,
48
+ ~identity?,
49
+ ~claims?,
50
+ ),
35
51
  )
36
52
  }
37
53
 
38
54
  // Annotate + run. Used by the multi-component dispatchers (AllAggregates,
39
- // AllEventCollectors) that loop over per-source handlers.
40
- let runEffect = (~correlationId=?, ~causationId=?, ~comp=?, ~pluginName=?, effect) =>
55
+ // AllEventCollectors) that loop over per-source handlers, and by any dispatch
56
+ // site that already holds the invocation's identity (e.g. the MCP tool caller).
57
+ let runEffect = (
58
+ ~correlationId=?,
59
+ ~causationId=?,
60
+ ~comp=?,
61
+ ~pluginName=?,
62
+ ~identity=?,
63
+ ~claims=?,
64
+ effect,
65
+ ) =>
41
66
  effect
42
- ->annotateInvocation(~correlationId?, ~causationId?, ~comp?, ~pluginName?)
67
+ ->annotateInvocation(~correlationId?, ~causationId?, ~comp?, ~pluginName?, ~identity?, ~claims?)
43
68
  ->Effect.runPromise
44
69
 
45
70
  // Convert an effectHandler to an eventHandler at build time, annotating the
@@ -2,10 +2,12 @@
2
2
 
3
3
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
4
4
  import * as Effect from "effect/Effect";
5
+ import * as LogPrefix$Reventless from "@reventlessdev/reventless-spec/src/LogPrefix.res.mjs";
5
6
  import * as RequestContext$ReventlessCore from "../../RequestContext.res.mjs";
6
7
 
7
- function annotateInvocation(effect, correlationId, causationId, comp, pluginName) {
8
+ function annotateInvocation(effect, correlationId, causationId, comp, pluginName, identity, claims) {
8
9
  let cid = Stdlib_Option.getOr(correlationId, "unknown");
10
+ let resolvedPlugin = pluginName !== undefined ? pluginName : LogPrefix$Reventless.resolvePlugin(comp, undefined);
9
11
  let annotateOpt = (eff, key, value) => {
10
12
  if (value !== undefined) {
11
13
  return Effect.annotateLogs(eff, key, value);
@@ -13,18 +15,18 @@ function annotateInvocation(effect, correlationId, causationId, comp, pluginName
13
15
  return eff;
14
16
  }
15
17
  };
16
- return Effect.provideService(annotateOpt(annotateOpt(Effect.annotateLogs(effect, "correlationId", cid), "comp", comp), "causationId", causationId), RequestContext$ReventlessCore.tag, RequestContext$ReventlessCore.make(cid, causationId, comp, pluginName, undefined, undefined));
18
+ return Effect.provideService(annotateOpt(annotateOpt(Effect.annotateLogs(effect, "correlationId", cid), "comp", comp), "causationId", causationId), RequestContext$ReventlessCore.tag, RequestContext$ReventlessCore.make(cid, causationId, comp, resolvedPlugin, identity, claims));
17
19
  }
18
20
 
19
- function runEffect(correlationId, causationId, comp, pluginName, effect) {
20
- return Effect.runPromise(annotateInvocation(effect, correlationId, causationId, comp, pluginName));
21
+ function runEffect(correlationId, causationId, comp, pluginName, identity, claims, effect) {
22
+ return Effect.runPromise(annotateInvocation(effect, correlationId, causationId, comp, pluginName, identity, claims));
21
23
  }
22
24
 
23
25
  function runEffectHandler(extractCorrelationId, extractCausationId, comp, pluginName, handler) {
24
26
  return (event, ctx) => {
25
27
  let correlationId = extractCorrelationId !== undefined ? extractCorrelationId(event) : undefined;
26
28
  let causationId = extractCausationId !== undefined ? extractCausationId(event) : undefined;
27
- return Effect.runPromise(annotateInvocation(handler(event, ctx), correlationId, causationId, comp, pluginName));
29
+ return Effect.runPromise(annotateInvocation(handler(event, ctx), correlationId, causationId, comp, pluginName, undefined, undefined));
28
30
  };
29
31
  }
30
32