@mastra/platform-workspace 1.2.0 → 1.2.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.
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ function resolvePlatformOptions(options) {
17
17
  return {
18
18
  accessToken: requireOption(options.accessToken ?? process.env.MASTRA_PLATFORM_ACCESS_TOKEN, "accessToken"),
19
19
  projectId: requireOption(options.projectId ?? process.env.MASTRA_PROJECT_ID, "projectId"),
20
+ actingUserId: options.actingUserId?.trim() || void 0,
20
21
  proxyUrl: (process.env.MASTRA_WORKSPACE_PROXY_URL ?? DEFAULT_PROXY_URL).replace(/\/$/, ""),
21
22
  sessionId: options.sessionId,
22
23
  threadId: options.threadId,
@@ -62,6 +63,7 @@ var PlatformApiError = class extends Error {
62
63
  var PlatformClient = class {
63
64
  accessToken;
64
65
  projectId;
66
+ actingUserId;
65
67
  proxyUrl;
66
68
  /** Advisory session correlation id — see {@link PlatformClientOptions.sessionId}. */
67
69
  sessionId;
@@ -72,6 +74,7 @@ var PlatformClient = class {
72
74
  const resolved = resolvePlatformOptions(options);
73
75
  this.accessToken = resolved.accessToken;
74
76
  this.projectId = resolved.projectId;
77
+ this.actingUserId = resolved.actingUserId;
75
78
  this.proxyUrl = resolved.proxyUrl;
76
79
  this.sessionId = resolved.sessionId;
77
80
  this.threadId = resolved.threadId;
@@ -82,6 +85,7 @@ var PlatformClient = class {
82
85
  for (const [key, value] of Object.entries(options.query ?? {})) if (value !== void 0) url.searchParams.set(key, String(value));
83
86
  const headers = new Headers(options.headers);
84
87
  headers.set("authorization", `Bearer ${this.accessToken}`);
88
+ if (this.actingUserId) headers.set("x-acting-user-id", this.actingUserId);
85
89
  if (this.sessionId) headers.set("x-mastra-session-id", this.sessionId);
86
90
  if (this.threadId) headers.set("x-mastra-thread-id", this.threadId);
87
91
  const { query: _query, ...fetchOptions } = options;
@@ -949,6 +953,7 @@ var PlatformSandbox = class PlatformSandbox extends MastraSandbox {
949
953
  ...id !== void 0 && { id },
950
954
  accessToken: this._client.accessToken,
951
955
  projectId: this._client.projectId,
956
+ actingUserId: options.actingUserId ?? this._client.actingUserId,
952
957
  ...this._client.sessionId !== void 0 && { sessionId: this._client.sessionId },
953
958
  ...this._client.threadId !== void 0 && { threadId: this._client.threadId },
954
959
  fetch: this._client.fetch,
@@ -1592,6 +1597,10 @@ const platformSandboxProvider = {
1592
1597
  type: "string",
1593
1598
  description: "Platform project ID (falls back to MASTRA_PROJECT_ID)"
1594
1599
  },
1600
+ actingUserId: {
1601
+ type: "string",
1602
+ description: "Opaque user subject attributed to sandbox requests"
1603
+ },
1595
1604
  environmentId: {
1596
1605
  type: "string",
1597
1606
  description: "Platform environment ID (falls back to MASTRA_ENVIRONMENT_ID)"