@dbx-tools/appkit-mastra 0.6.2 → 0.6.4

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/src/server.ts CHANGED
@@ -20,7 +20,7 @@ import { trace } from "@opentelemetry/api";
20
20
  import type express from "express";
21
21
 
22
22
  import {
23
- executionContextUserId,
23
+ attributedUserId,
24
24
  MASTRA_REQUEST_ID_KEY,
25
25
  MASTRA_SCOPES_KEY,
26
26
  MASTRA_USER_EMAIL_KEY,
@@ -91,11 +91,10 @@ export async function stampRequestContextUser(
91
91
  // attributed to can differ: in `service-principal` mode every request shares
92
92
  // the SP client, but the forwarded user id must still key the memory thread
93
93
  // and the per-user cache namespace so two callers don't share a conversation.
94
- // Prefer the OBO context's own user id, then the forwarded id, then the SP id.
95
- const id =
96
- (isUserContext ? executionContextUserId(executionContext) : attributed.userId) ??
97
- executionContextUserId(executionContext);
98
- const user: User = { id, executionContext };
94
+ const user: User = {
95
+ id: attributedUserId(executionContext, attributed.userId),
96
+ executionContext,
97
+ };
99
98
  requestContext.set(MASTRA_USER_KEY, user);
100
99
  requestContext.set(MASTRA_RESOURCE_ID_KEY, user.id);
101
100
  // AppKit's `UserContext` surfaces display name / email only on