@vectros-ai/mcp-server 0.13.0 → 0.15.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.
package/dist/index.mjs CHANGED
@@ -62,6 +62,7 @@ __export(api_exports, {
62
62
  TooManyRequestsError: () => TooManyRequestsError,
63
63
  TruncationWarningEvent: () => TruncationWarningEvent,
64
64
  UnauthorizedError: () => UnauthorizedError,
65
+ UserExistsResponse: () => UserExistsResponse,
65
66
  UserRequest: () => UserRequest,
66
67
  UserResponse: () => UserResponse,
67
68
  auth: () => auth_exports,
@@ -738,6 +739,14 @@ var TruncationWarningEvent;
738
739
  ContextWindowBudget: "context_window_budget"
739
740
  };
740
741
  })(TruncationWarningEvent || (TruncationWarningEvent = {}));
742
+ var UserExistsResponse;
743
+ ((UserExistsResponse2) => {
744
+ UserExistsResponse2.Status = {
745
+ Active: "ACTIVE",
746
+ Suspended: "SUSPENDED",
747
+ Pending: "PENDING"
748
+ };
749
+ })(UserExistsResponse || (UserExistsResponse = {}));
741
750
  var UserRequest;
742
751
  ((UserRequest2) => {
743
752
  UserRequest2.Status = {
@@ -2481,7 +2490,7 @@ var AuthClient = class {
2481
2490
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
2482
2491
  }
2483
2492
  /**
2484
- * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope.
2493
+ * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. A root API key (`sk_`) is exempt from both bounds.
2485
2494
  *
2486
2495
  * @param {Vectros.CreateScopedKeyRequest} request
2487
2496
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2813,7 +2822,7 @@ var AuthClient = class {
2813
2822
  );
2814
2823
  }
2815
2824
  /**
2816
- * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2825
+ * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). The `principalId` must name a principal that already exists: a `usr_` principal must be a live user in your tenant, so create the user before granting it a profile. A `usr_` id that names no such user is rejected, and no profile is created. `key_` principals are not checked this way. You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2817
2826
  *
2818
2827
  * @param {Vectros.CreateAccessProfileRequest} request
2819
2828
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3231,11 +3240,12 @@ var AuthClient = class {
3231
3240
  );
3232
3241
  }
3233
3242
  /**
3234
- * Updates an access profile. This is a partial update: any field you omit (or send as null) keeps its existing value. A profile must reference either inline `scopes` or a `roleId`, never both — so setting `scopes` clears any `roleId`, and setting `roleId` clears any inline `scopes`. The `contextId` and `principalId` are immutable. Status changes (for example active to suspended) take effect within about five minutes. If you use a scoped credential, the profile's effective scopes may not exceed your own, and its `identityOverrides` are bounded twice: you may only set a value your own identity holds, and you may only change or clear a value the profile already holds if that value is yours as well. Repointing or clearing another principal's established identity therefore returns 403. A root API key (`sk_`) is exempt. Requires the `profiles:u` scope.
3243
+ * Updates an access profile. This is a partial update: any field you omit (or send as null) keeps its existing value. A profile must reference either inline `scopes` or a `roleId`, never both — so setting `scopes` clears any `roleId`, and setting `roleId` clears any inline `scopes`. The `contextId` and `principalId` are immutable. Status changes (for example active to suspended) take effect within about five minutes. If you use a scoped credential, the profile's effective scopes may not exceed your own, and its `identityOverrides` are bounded twice: you may only set a value your own identity holds, and you may only change or clear a value the profile already holds if that value is yours as well. Repointing or clearing another principal's established identity therefore returns 403. A root API key (`sk_`) is exempt. If you set `roleId`, it must reference a role that already exists in this context. Requires the `profiles:u` scope.
3235
3244
  *
3236
3245
  * @param {Vectros.UpdateAccessProfileRequest} request
3237
3246
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3238
3247
  *
3248
+ * @throws {@link Vectros.BadRequestError}
3239
3249
  * @throws {@link Vectros.ForbiddenError}
3240
3250
  * @throws {@link Vectros.NotFoundError}
3241
3251
  * @throws {@link Vectros.TooManyRequestsError}
@@ -3282,6 +3292,8 @@ var AuthClient = class {
3282
3292
  }
3283
3293
  if (_response.error.reason === "status-code") {
3284
3294
  switch (_response.error.statusCode) {
3295
+ case 400:
3296
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
3285
3297
  case 403:
3286
3298
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
3287
3299
  case 404:
@@ -3911,7 +3923,7 @@ var AuthClient = class {
3911
3923
  );
3912
3924
  }
3913
3925
  /**
3914
- * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) with per-category credit estimates and a split between your live and test environments. Defaults to the current month when `year` and `month` are omitted. Requires the `billing:r` scope on scoped tokens; API keys always have access.
3926
+ * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) with per-category credit estimates and a split between your live and test environments. Defaults to the current month when `year` and `month` are omitted. Requires the `billing:r` scope on scoped tokens; API keys always have access. **A token confined to a single app context sees only that context's usage**: totals, the environment split, and the `contexts` breakdown narrow to it, and the environment your context is not bound to is omitted (`null`), not zeroed. Only a token with cross-context reach sees your full account-wide totals. Two exceptions to the narrowing, since they have no per-context breakdown to narrow to: `reads.calls.used`/`reads.dataOut.bytes` (metered per account, not per context) read as `0` for a confined token rather than a narrowed figure — the corresponding overage-credit charge fields narrow correctly; and `credits.limit` stays your whole plan's ceiling, so `credits.remaining` may overstate the account's true remaining room.
3915
3927
  *
3916
3928
  * @param {Vectros.GetUsageRequest} request
3917
3929
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3973,6 +3985,257 @@ var AuthClient = class {
3973
3985
  }
3974
3986
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3975
3987
  }
3988
+ /**
3989
+ * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key sees every context.
3990
+ *
3991
+ * @param {Vectros.GetIssuerRequest} request
3992
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3993
+ *
3994
+ * @throws {@link Vectros.ForbiddenError}
3995
+ * @throws {@link Vectros.NotFoundError}
3996
+ *
3997
+ * @example
3998
+ * await client.auth.getIssuer({
3999
+ * issuerId: "auth0-prod"
4000
+ * })
4001
+ */
4002
+ getIssuer(request, requestOptions) {
4003
+ return HttpResponsePromise.fromPromise(this.__getIssuer(request, requestOptions));
4004
+ }
4005
+ async __getIssuer(request, requestOptions) {
4006
+ const { issuerId } = request;
4007
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4008
+ const _headers = mergeHeaders(
4009
+ _authRequest.headers,
4010
+ this._options?.headers,
4011
+ requestOptions?.headers
4012
+ );
4013
+ const _response = await fetcher({
4014
+ url: url_exports.join(
4015
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4016
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4017
+ ),
4018
+ method: "GET",
4019
+ headers: _headers,
4020
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4021
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4022
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4023
+ abortSignal: requestOptions?.abortSignal,
4024
+ fetchFn: this._options?.fetch,
4025
+ logging: this._options.logging
4026
+ });
4027
+ if (_response.ok) {
4028
+ return { data: _response.body, rawResponse: _response.rawResponse };
4029
+ }
4030
+ if (_response.error.reason === "status-code") {
4031
+ switch (_response.error.statusCode) {
4032
+ case 403:
4033
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4034
+ case 404:
4035
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4036
+ default:
4037
+ throw new VectrosError({
4038
+ statusCode: _response.error.statusCode,
4039
+ body: _response.error.body,
4040
+ rawResponse: _response.rawResponse
4041
+ });
4042
+ }
4043
+ }
4044
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4045
+ }
4046
+ /**
4047
+ * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned. Deactivate the affected users first if you intend to cut off their access, or register a replacement issuer before removing this one. An issuer that has never been used for an exchange (no bound users yet) can always be deregistered.
4048
+ *
4049
+ * @param {Vectros.DeleteIssuerRequest} request
4050
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4051
+ *
4052
+ * @throws {@link Vectros.ForbiddenError}
4053
+ * @throws {@link Vectros.NotFoundError}
4054
+ * @throws {@link Vectros.ConflictError}
4055
+ * @throws {@link Vectros.TooManyRequestsError}
4056
+ *
4057
+ * @example
4058
+ * await client.auth.deleteIssuer({
4059
+ * issuerId: "auth0-prod"
4060
+ * })
4061
+ */
4062
+ deleteIssuer(request, requestOptions) {
4063
+ return HttpResponsePromise.fromPromise(this.__deleteIssuer(request, requestOptions));
4064
+ }
4065
+ async __deleteIssuer(request, requestOptions) {
4066
+ const { issuerId } = request;
4067
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4068
+ const _headers = mergeHeaders(
4069
+ _authRequest.headers,
4070
+ this._options?.headers,
4071
+ requestOptions?.headers
4072
+ );
4073
+ const _response = await fetcher({
4074
+ url: url_exports.join(
4075
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4076
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4077
+ ),
4078
+ method: "DELETE",
4079
+ headers: _headers,
4080
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4081
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4082
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4083
+ abortSignal: requestOptions?.abortSignal,
4084
+ fetchFn: this._options?.fetch,
4085
+ logging: this._options.logging
4086
+ });
4087
+ if (_response.ok) {
4088
+ return { data: void 0, rawResponse: _response.rawResponse };
4089
+ }
4090
+ if (_response.error.reason === "status-code") {
4091
+ switch (_response.error.statusCode) {
4092
+ case 403:
4093
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4094
+ case 404:
4095
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4096
+ case 409:
4097
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4098
+ case 429:
4099
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4100
+ default:
4101
+ throw new VectrosError({
4102
+ statusCode: _response.error.statusCode,
4103
+ body: _response.error.body,
4104
+ rawResponse: _response.rawResponse
4105
+ });
4106
+ }
4107
+ }
4108
+ return handleNonStatusCodeError(
4109
+ _response.error,
4110
+ _response.rawResponse,
4111
+ "DELETE",
4112
+ "/v1/auth/issuers/{issuerId}"
4113
+ );
4114
+ }
4115
+ /**
4116
+ * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only the issuers registered in that context; a root API key sees every context. Returns a `{data, nextCursor}` envelope.
4117
+ *
4118
+ * @param {Vectros.ListIssuersRequest} request
4119
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4120
+ *
4121
+ * @throws {@link Vectros.ForbiddenError}
4122
+ *
4123
+ * @example
4124
+ * await client.auth.listIssuers()
4125
+ */
4126
+ listIssuers(request = {}, requestOptions) {
4127
+ return HttpResponsePromise.fromPromise(this.__listIssuers(request, requestOptions));
4128
+ }
4129
+ async __listIssuers(request = {}, requestOptions) {
4130
+ const { startFrom, limit } = request;
4131
+ const _queryParams = {
4132
+ startFrom,
4133
+ limit
4134
+ };
4135
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4136
+ const _headers = mergeHeaders(
4137
+ _authRequest.headers,
4138
+ this._options?.headers,
4139
+ requestOptions?.headers
4140
+ );
4141
+ const _response = await fetcher({
4142
+ url: url_exports.join(
4143
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4144
+ "v1/auth/issuers"
4145
+ ),
4146
+ method: "GET",
4147
+ headers: _headers,
4148
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
4149
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4150
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4151
+ abortSignal: requestOptions?.abortSignal,
4152
+ fetchFn: this._options?.fetch,
4153
+ logging: this._options.logging
4154
+ });
4155
+ if (_response.ok) {
4156
+ return { data: _response.body, rawResponse: _response.rawResponse };
4157
+ }
4158
+ if (_response.error.reason === "status-code") {
4159
+ switch (_response.error.statusCode) {
4160
+ case 403:
4161
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4162
+ default:
4163
+ throw new VectrosError({
4164
+ statusCode: _response.error.statusCode,
4165
+ body: _response.error.body,
4166
+ rawResponse: _response.rawResponse
4167
+ });
4168
+ }
4169
+ }
4170
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4171
+ }
4172
+ /**
4173
+ * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`.
4174
+ *
4175
+ * @param {Vectros.IssuerRequest} request
4176
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4177
+ *
4178
+ * @throws {@link Vectros.BadRequestError}
4179
+ * @throws {@link Vectros.ForbiddenError}
4180
+ * @throws {@link Vectros.TooManyRequestsError}
4181
+ *
4182
+ * @example
4183
+ * await client.auth.registerIssuer({
4184
+ * issuerId: "auth0-prod",
4185
+ * issuer: "https://your-tenant.us.auth0.com/",
4186
+ * jwksUri: "https://your-tenant.us.auth0.com/.well-known/jwks.json",
4187
+ * audience: "https://api.your-app.example.com",
4188
+ * contextId: "casework"
4189
+ * })
4190
+ */
4191
+ registerIssuer(request, requestOptions) {
4192
+ return HttpResponsePromise.fromPromise(this.__registerIssuer(request, requestOptions));
4193
+ }
4194
+ async __registerIssuer(request, requestOptions) {
4195
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4196
+ const _headers = mergeHeaders(
4197
+ _authRequest.headers,
4198
+ this._options?.headers,
4199
+ requestOptions?.headers
4200
+ );
4201
+ const _response = await fetcher({
4202
+ url: url_exports.join(
4203
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4204
+ "v1/auth/issuers"
4205
+ ),
4206
+ method: "POST",
4207
+ headers: _headers,
4208
+ contentType: "application/json",
4209
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4210
+ requestType: "json",
4211
+ body: request,
4212
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4213
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4214
+ abortSignal: requestOptions?.abortSignal,
4215
+ fetchFn: this._options?.fetch,
4216
+ logging: this._options.logging
4217
+ });
4218
+ if (_response.ok) {
4219
+ return { data: _response.body, rawResponse: _response.rawResponse };
4220
+ }
4221
+ if (_response.error.reason === "status-code") {
4222
+ switch (_response.error.statusCode) {
4223
+ case 400:
4224
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4225
+ case 403:
4226
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4227
+ case 429:
4228
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4229
+ default:
4230
+ throw new VectrosError({
4231
+ statusCode: _response.error.statusCode,
4232
+ body: _response.error.body,
4233
+ rawResponse: _response.rawResponse
4234
+ });
4235
+ }
4236
+ }
4237
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/issuers");
4238
+ }
3976
4239
  /**
3977
4240
  * Returns the identity bound to your credential — your account, principal type, key id, and scope details — so you can confirm who you are authenticated as and that the credential is valid. MCP clients use this to render "signed in as ..." in a chat UI without a separate identity endpoint.
3978
4241
  *
@@ -4018,7 +4281,7 @@ var AuthClient = class {
4018
4281
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4019
4282
  }
4020
4283
  /**
4021
- * Returns the access profiles for the given principal across all of your contexts. Use this to answer questions like "which apps does this user have access to?" — for example, to build a member-access summary. Results are confined to your account. Requires the `profiles:r` scope.
4284
+ * Returns the access profiles for the given principal. Looking up your OWN principal — or holding the `context-directory-read` capability — returns the profiles across ALL of your contexts, letting you answer questions like "which apps does this user have access to?". A context-bound credential looking up a DIFFERENT principal instead sees only that principal's profile in your credential's own context (at most one result), never across contexts it has no authority over. Results are always confined to your account. Requires the `profiles:r` scope.
4022
4285
  *
4023
4286
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4024
4287
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4296,6 +4559,72 @@ var AuthClient = class {
4296
4559
  }
4297
4560
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4298
4561
  }
4562
+ /**
4563
+ * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. If your issuer is registered against more than one app context (each via its own audience), `context_id` selects which one to target; omit it when your token's `aud` claim matches only one registered context — the common case, unaffected by this field. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4564
+ *
4565
+ * @param {Vectros.TokenExchangeRequest} request
4566
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4567
+ *
4568
+ * @throws {@link Vectros.BadRequestError}
4569
+ * @throws {@link Vectros.UnauthorizedError}
4570
+ * @throws {@link Vectros.ForbiddenError}
4571
+ * @throws {@link Vectros.NotFoundError}
4572
+ * @throws {@link Vectros.TooManyRequestsError}
4573
+ *
4574
+ * @example
4575
+ * await client.auth.exchangeToken({
4576
+ * grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
4577
+ * subject_token: "subject_token",
4578
+ * subject_token_type: "urn:ietf:params:oauth:token-type:jwt"
4579
+ * })
4580
+ */
4581
+ exchangeToken(request, requestOptions) {
4582
+ return HttpResponsePromise.fromPromise(this.__exchangeToken(request, requestOptions));
4583
+ }
4584
+ async __exchangeToken(request, requestOptions) {
4585
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
4586
+ const _response = await fetcher({
4587
+ url: url_exports.join(
4588
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4589
+ "v1/auth/token/exchange"
4590
+ ),
4591
+ method: "POST",
4592
+ headers: _headers,
4593
+ contentType: "application/json",
4594
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4595
+ requestType: "json",
4596
+ body: request,
4597
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4598
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4599
+ abortSignal: requestOptions?.abortSignal,
4600
+ fetchFn: this._options?.fetch,
4601
+ logging: this._options.logging
4602
+ });
4603
+ if (_response.ok) {
4604
+ return { data: _response.body, rawResponse: _response.rawResponse };
4605
+ }
4606
+ if (_response.error.reason === "status-code") {
4607
+ switch (_response.error.statusCode) {
4608
+ case 400:
4609
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4610
+ case 401:
4611
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
4612
+ case 403:
4613
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4614
+ case 404:
4615
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4616
+ case 429:
4617
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4618
+ default:
4619
+ throw new VectrosError({
4620
+ statusCode: _response.error.statusCode,
4621
+ body: _response.error.body,
4622
+ rawResponse: _response.rawResponse
4623
+ });
4624
+ }
4625
+ }
4626
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/exchange");
4627
+ }
4299
4628
  };
4300
4629
  var ComplianceClient = class {
4301
4630
  constructor(options) {
@@ -5773,6 +6102,7 @@ var IdentityClient = class {
5773
6102
  * @example
5774
6103
  * await client.identity.listEntities({
5775
6104
  * namespace: "team",
6105
+ * contextId: "myapp",
5776
6106
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
5777
6107
  * })
5778
6108
  */
@@ -5782,6 +6112,7 @@ var IdentityClient = class {
5782
6112
  async __listEntities(request, requestOptions) {
5783
6113
  const {
5784
6114
  namespace,
6115
+ contextId,
5785
6116
  userId,
5786
6117
  externalId,
5787
6118
  scope,
@@ -5796,6 +6127,7 @@ var IdentityClient = class {
5796
6127
  limit
5797
6128
  } = request;
5798
6129
  const _queryParams = {
6130
+ contextId,
5799
6131
  userId,
5800
6132
  externalId,
5801
6133
  scope,
@@ -5854,6 +6186,7 @@ var IdentityClient = class {
5854
6186
  * @example
5855
6187
  * await client.identity.createEntity({
5856
6188
  * namespace: "team",
6189
+ * contextId: "myapp",
5857
6190
  * body: {
5858
6191
  * externalId: "team_eng_platform"
5859
6192
  * }
@@ -5863,9 +6196,10 @@ var IdentityClient = class {
5863
6196
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5864
6197
  }
5865
6198
  async __createEntity(request, requestOptions) {
5866
- const { namespace, upsert, body: _body } = request;
6199
+ const { namespace, upsert, contextId, body: _body } = request;
5867
6200
  const _queryParams = {
5868
- upsert
6201
+ upsert,
6202
+ contextId
5869
6203
  };
5870
6204
  const _authRequest = await this._options.authProvider.getAuthRequest();
5871
6205
  const _headers = mergeHeaders(
@@ -5922,14 +6256,18 @@ var IdentityClient = class {
5922
6256
  * @example
5923
6257
  * await client.identity.getEntity({
5924
6258
  * namespace: "team",
5925
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6259
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6260
+ * contextId: "myapp"
5926
6261
  * })
5927
6262
  */
5928
6263
  getEntity(request, requestOptions) {
5929
6264
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5930
6265
  }
5931
6266
  async __getEntity(request, requestOptions) {
5932
- const { namespace, id } = request;
6267
+ const { namespace, id, contextId } = request;
6268
+ const _queryParams = {
6269
+ contextId
6270
+ };
5933
6271
  const _authRequest = await this._options.authProvider.getAuthRequest();
5934
6272
  const _headers = mergeHeaders(
5935
6273
  _authRequest.headers,
@@ -5943,7 +6281,7 @@ var IdentityClient = class {
5943
6281
  ),
5944
6282
  method: "GET",
5945
6283
  headers: _headers,
5946
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6284
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
5947
6285
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
5948
6286
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
5949
6287
  abortSignal: requestOptions?.abortSignal,
@@ -5980,6 +6318,7 @@ var IdentityClient = class {
5980
6318
  * await client.identity.updateEntity({
5981
6319
  * namespace: "team",
5982
6320
  * id: "id",
6321
+ * contextId: "myapp",
5983
6322
  * body: {
5984
6323
  * externalId: "team_eng_platform"
5985
6324
  * }
@@ -5989,7 +6328,10 @@ var IdentityClient = class {
5989
6328
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
5990
6329
  }
5991
6330
  async __updateEntity(request, requestOptions) {
5992
- const { namespace, id, body: _body } = request;
6331
+ const { namespace, id, contextId, body: _body } = request;
6332
+ const _queryParams = {
6333
+ contextId
6334
+ };
5993
6335
  const _authRequest = await this._options.authProvider.getAuthRequest();
5994
6336
  const _headers = mergeHeaders(
5995
6337
  _authRequest.headers,
@@ -6004,7 +6346,7 @@ var IdentityClient = class {
6004
6346
  method: "PUT",
6005
6347
  headers: _headers,
6006
6348
  contentType: "application/json",
6007
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6349
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6008
6350
  requestType: "json",
6009
6351
  body: _body,
6010
6352
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6044,14 +6386,18 @@ var IdentityClient = class {
6044
6386
  * @example
6045
6387
  * await client.identity.deleteEntity({
6046
6388
  * namespace: "team",
6047
- * id: "id"
6389
+ * id: "id",
6390
+ * contextId: "myapp"
6048
6391
  * })
6049
6392
  */
6050
6393
  deleteEntity(request, requestOptions) {
6051
6394
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6052
6395
  }
6053
6396
  async __deleteEntity(request, requestOptions) {
6054
- const { namespace, id } = request;
6397
+ const { namespace, id, contextId } = request;
6398
+ const _queryParams = {
6399
+ contextId
6400
+ };
6055
6401
  const _authRequest = await this._options.authProvider.getAuthRequest();
6056
6402
  const _headers = mergeHeaders(
6057
6403
  _authRequest.headers,
@@ -6065,7 +6411,7 @@ var IdentityClient = class {
6065
6411
  ),
6066
6412
  method: "DELETE",
6067
6413
  headers: _headers,
6068
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6069
6415
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6070
6416
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6071
6417
  abortSignal: requestOptions?.abortSignal,
@@ -6108,6 +6454,7 @@ var IdentityClient = class {
6108
6454
  * @example
6109
6455
  * await client.identity.lookupEntities({
6110
6456
  * namespace: "team",
6457
+ * contextId: "myapp",
6111
6458
  * body: {
6112
6459
  * type: "person_v1",
6113
6460
  * field: "ssn"
@@ -6118,7 +6465,10 @@ var IdentityClient = class {
6118
6465
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6119
6466
  }
6120
6467
  async __lookupEntities(request, requestOptions) {
6121
- const { namespace, body: _body } = request;
6468
+ const { namespace, contextId, body: _body } = request;
6469
+ const _queryParams = {
6470
+ contextId
6471
+ };
6122
6472
  const _authRequest = await this._options.authProvider.getAuthRequest();
6123
6473
  const _headers = mergeHeaders(
6124
6474
  _authRequest.headers,
@@ -6133,7 +6483,7 @@ var IdentityClient = class {
6133
6483
  method: "POST",
6134
6484
  headers: _headers,
6135
6485
  contentType: "application/json",
6136
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6486
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6137
6487
  requestType: "json",
6138
6488
  body: _body,
6139
6489
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6177,15 +6527,17 @@ var IdentityClient = class {
6177
6527
  * @example
6178
6528
  * await client.identity.getEntityVersions({
6179
6529
  * namespace: "team",
6180
- * id: "id"
6530
+ * id: "id",
6531
+ * contextId: "myapp"
6181
6532
  * })
6182
6533
  */
6183
6534
  getEntityVersions(request, requestOptions) {
6184
6535
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6185
6536
  }
6186
6537
  async __getEntityVersions(request, requestOptions) {
6187
- const { namespace, id, startFrom } = request;
6538
+ const { namespace, id, contextId, startFrom } = request;
6188
6539
  const _queryParams = {
6540
+ contextId,
6189
6541
  startFrom
6190
6542
  };
6191
6543
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6247,7 +6599,10 @@ var IdentityClient = class {
6247
6599
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6248
6600
  }
6249
6601
  async __getNamespace(request, requestOptions) {
6250
- const { namespace } = request;
6602
+ const { namespace, contextId } = request;
6603
+ const _queryParams = {
6604
+ contextId
6605
+ };
6251
6606
  const _authRequest = await this._options.authProvider.getAuthRequest();
6252
6607
  const _headers = mergeHeaders(
6253
6608
  _authRequest.headers,
@@ -6261,7 +6616,7 @@ var IdentityClient = class {
6261
6616
  ),
6262
6617
  method: "GET",
6263
6618
  headers: _headers,
6264
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6619
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6265
6620
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6266
6621
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6267
6622
  abortSignal: requestOptions?.abortSignal,
@@ -6286,7 +6641,7 @@ var IdentityClient = class {
6286
6641
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6287
6642
  }
6288
6643
  /**
6289
- * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
6644
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name and its `contextId` (which row is selected) are both immutable. Requires a root API key. `org` and `client` are updatable like any other namespace — there is no reserved-built-in exception.
6290
6645
  *
6291
6646
  * @param {Vectros.UpdateNamespaceRequest} request
6292
6647
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6308,7 +6663,10 @@ var IdentityClient = class {
6308
6663
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6309
6664
  }
6310
6665
  async __updateNamespace(request, requestOptions) {
6311
- const { namespace, body: _body } = request;
6666
+ const { namespace, contextId, body: _body } = request;
6667
+ const _queryParams = {
6668
+ contextId
6669
+ };
6312
6670
  const _authRequest = await this._options.authProvider.getAuthRequest();
6313
6671
  const _headers = mergeHeaders(
6314
6672
  _authRequest.headers,
@@ -6323,7 +6681,7 @@ var IdentityClient = class {
6323
6681
  method: "PUT",
6324
6682
  headers: _headers,
6325
6683
  contentType: "application/json",
6326
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6684
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6327
6685
  requestType: "json",
6328
6686
  body: _body,
6329
6687
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6354,7 +6712,7 @@ var IdentityClient = class {
6354
6712
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6355
6713
  }
6356
6714
  /**
6357
- * Deletes a registered scope namespace. Requires a root API key. The reserved built-ins cannot be deleted. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6715
+ * Deletes a registered scope namespace. Requires a root API key. `org` and `client` are deletable like any other namespace — there is no reserved-built-in exception. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6358
6716
  *
6359
6717
  * @param {Vectros.DeleteNamespaceRequest} request
6360
6718
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6372,7 +6730,10 @@ var IdentityClient = class {
6372
6730
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6373
6731
  }
6374
6732
  async __deleteNamespace(request, requestOptions) {
6375
- const { namespace } = request;
6733
+ const { namespace, contextId } = request;
6734
+ const _queryParams = {
6735
+ contextId
6736
+ };
6376
6737
  const _authRequest = await this._options.authProvider.getAuthRequest();
6377
6738
  const _headers = mergeHeaders(
6378
6739
  _authRequest.headers,
@@ -6386,7 +6747,7 @@ var IdentityClient = class {
6386
6747
  ),
6387
6748
  method: "DELETE",
6388
6749
  headers: _headers,
6389
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6750
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6390
6751
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6391
6752
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6392
6753
  abortSignal: requestOptions?.abortSignal,
@@ -6415,7 +6776,7 @@ var IdentityClient = class {
6415
6776
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6416
6777
  }
6417
6778
  /**
6418
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6779
+ * Returns the scope namespaces in your account, including `org` and `client`, which are provisioned for you when the account is created. Returns a `{data, nextCursor}` envelope.
6419
6780
  *
6420
6781
  * @param {Vectros.ListNamespacesRequest} request
6421
6782
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6427,10 +6788,11 @@ var IdentityClient = class {
6427
6788
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6428
6789
  }
6429
6790
  async __listNamespaces(request = {}, requestOptions) {
6430
- const { startFrom, limit } = request;
6791
+ const { startFrom, limit, contextId } = request;
6431
6792
  const _queryParams = {
6432
6793
  startFrom,
6433
- limit
6794
+ limit,
6795
+ contextId
6434
6796
  };
6435
6797
  const _authRequest = await this._options.authProvider.getAuthRequest();
6436
6798
  const _headers = mergeHeaders(
@@ -6465,9 +6827,9 @@ var IdentityClient = class {
6465
6827
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6466
6828
  }
6467
6829
  /**
6468
- * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
6830
+ * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. `org` and `client` are provisioned when your account is created, so registering either returns the already-registered error.
6469
6831
  *
6470
- * @param {Vectros.NamespaceRequest} request
6832
+ * @param {Vectros.RegisterNamespaceRequest} request
6471
6833
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6472
6834
  *
6473
6835
  * @throws {@link Vectros.BadRequestError}
@@ -6476,14 +6838,20 @@ var IdentityClient = class {
6476
6838
  *
6477
6839
  * @example
6478
6840
  * await client.identity.registerNamespace({
6479
- * namespace: "team",
6480
- * specificityRank: 1500
6841
+ * body: {
6842
+ * namespace: "team",
6843
+ * specificityRank: 1500
6844
+ * }
6481
6845
  * })
6482
6846
  */
6483
6847
  registerNamespace(request, requestOptions) {
6484
6848
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6485
6849
  }
6486
6850
  async __registerNamespace(request, requestOptions) {
6851
+ const { contextId, body: _body } = request;
6852
+ const _queryParams = {
6853
+ contextId
6854
+ };
6487
6855
  const _authRequest = await this._options.authProvider.getAuthRequest();
6488
6856
  const _headers = mergeHeaders(
6489
6857
  _authRequest.headers,
@@ -6498,9 +6866,9 @@ var IdentityClient = class {
6498
6866
  method: "POST",
6499
6867
  headers: _headers,
6500
6868
  contentType: "application/json",
6501
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6869
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6502
6870
  requestType: "json",
6503
- body: request,
6871
+ body: _body,
6504
6872
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6505
6873
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6506
6874
  abortSignal: requestOptions?.abortSignal,
@@ -6785,12 +7153,13 @@ var IdentityClient = class {
6785
7153
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
6786
7154
  }
6787
7155
  /**
6788
- * Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope.
7156
+ * Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope. Deleting your account's last OWNER is refused (409) — an account must always retain at least one owner.
6789
7157
  *
6790
7158
  * @param {Vectros.DeleteUserRequest} request
6791
7159
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6792
7160
  *
6793
7161
  * @throws {@link Vectros.NotFoundError}
7162
+ * @throws {@link Vectros.ConflictError}
6794
7163
  * @throws {@link Vectros.TooManyRequestsError}
6795
7164
  *
6796
7165
  * @example
@@ -6830,6 +7199,8 @@ var IdentityClient = class {
6830
7199
  switch (_response.error.statusCode) {
6831
7200
  case 404:
6832
7201
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7202
+ case 409:
7203
+ throw new ConflictError(_response.error.body, _response.rawResponse);
6833
7204
  case 429:
6834
7205
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6835
7206
  default:
@@ -6903,6 +7274,69 @@ var IdentityClient = class {
6903
7274
  }
6904
7275
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/lookup");
6905
7276
  }
7277
+ /**
7278
+ * Answers "does a user with this email hold an ACTIVE access profile in this app context" — a narrow existence check, not a general lookup. `exists` is false for a member whose access to this context has been suspended, not only for a member who was never granted it. The answer is scoped to the `contextId` you supply: it does not reveal whether the email exists elsewhere in your tenant or account, only whether it belongs to an active member of the named context. Returns `{exists, userId, status}` — never the full user record — so a caller asking "does X exist" cannot receive that user's payload/schema binding/etc. as a side effect. Useful for resolving an email you were handed (for example, by an org-admin adding an existing member to another org) to a `userId`, without paging through the full context membership. Requires the `users:r` scope.
7279
+ *
7280
+ * @param {Vectros.UserExistsByEmailRequest} request
7281
+ * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7282
+ *
7283
+ * @throws {@link Vectros.BadRequestError}
7284
+ * @throws {@link Vectros.ForbiddenError}
7285
+ *
7286
+ * @example
7287
+ * await client.identity.userExistsByEmail({
7288
+ * email: "user@example.com",
7289
+ * contextId: "myapp"
7290
+ * })
7291
+ */
7292
+ userExistsByEmail(request = {}, requestOptions) {
7293
+ return HttpResponsePromise.fromPromise(this.__userExistsByEmail(request, requestOptions));
7294
+ }
7295
+ async __userExistsByEmail(request = {}, requestOptions) {
7296
+ const { email, contextId } = request;
7297
+ const _queryParams = {
7298
+ email,
7299
+ contextId
7300
+ };
7301
+ const _authRequest = await this._options.authProvider.getAuthRequest();
7302
+ const _headers = mergeHeaders(
7303
+ _authRequest.headers,
7304
+ this._options?.headers,
7305
+ requestOptions?.headers
7306
+ );
7307
+ const _response = await fetcher({
7308
+ url: url_exports.join(
7309
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
7310
+ "v1/users/exists-by-email"
7311
+ ),
7312
+ method: "GET",
7313
+ headers: _headers,
7314
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
7315
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
7316
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
7317
+ abortSignal: requestOptions?.abortSignal,
7318
+ fetchFn: this._options?.fetch,
7319
+ logging: this._options.logging
7320
+ });
7321
+ if (_response.ok) {
7322
+ return { data: _response.body, rawResponse: _response.rawResponse };
7323
+ }
7324
+ if (_response.error.reason === "status-code") {
7325
+ switch (_response.error.statusCode) {
7326
+ case 400:
7327
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7328
+ case 403:
7329
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
7330
+ default:
7331
+ throw new VectrosError({
7332
+ statusCode: _response.error.statusCode,
7333
+ body: _response.error.body,
7334
+ rawResponse: _response.rawResponse
7335
+ });
7336
+ }
7337
+ }
7338
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/exists-by-email");
7339
+ }
6906
7340
  /**
6907
7341
  * Returns the audit trail of changes to a user, most recent first. Identity history is always recorded and always available. Sensitive field values are redacted in every historical version. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope.
6908
7342
  *
@@ -8664,15 +9098,15 @@ function warnOnSuboptimalKey(key, log) {
8664
9098
  } else if (key.prefix === "st") {
8665
9099
  log.warn(
8666
9100
  { prefix: key.prefix, env: key.env },
8667
- "short-lived token (st_*) will expire mid-session (1h default, 24h max). For long-running MCP installs, prefer a long-lived ssk_* key."
9101
+ "short-lived token (st_*) will expire mid-session (1h max). For long-running MCP installs, prefer a long-lived ssk_* key."
8668
9102
  );
8669
9103
  }
8670
9104
  }
8671
9105
 
8672
9106
  // src/build-info.ts
8673
9107
  var BUILD_INFO = {
8674
- mcpServer: true ? "0.13.0" : "dev",
8675
- sdk: true ? "0.38.0" : "dev"
9108
+ mcpServer: true ? "0.15.0" : "dev",
9109
+ sdk: true ? "0.40.0" : "dev"
8676
9110
  };
8677
9111
 
8678
9112
  // src/log.ts
@@ -8980,7 +9414,7 @@ var inputSchema = {
8980
9414
  // Ownership.
8981
9415
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
8982
9416
  scope: z.string().optional().describe(
8983
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9417
+ 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
8984
9418
  ),
8985
9419
  // Date window.
8986
9420
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9120,7 +9554,7 @@ var inputSchema2 = {
9120
9554
  // List-mode args:
9121
9555
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9122
9556
  scope: z2.string().optional().describe(
9123
- 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9557
+ 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
9124
9558
  ),
9125
9559
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9126
9560
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9371,7 +9805,7 @@ var inputSchema4 = {
9371
9805
  folderId: z4.string().optional().describe("Group this record into a folder."),
9372
9806
  userId: z4.string().optional().describe("Owning user id."),
9373
9807
  scopes: z4.array(z4.string()).optional().describe(
9374
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
9808
+ 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
9375
9809
  )
9376
9810
  };
9377
9811
  var recordCreate = ({ client, log }) => ({
@@ -9495,7 +9929,7 @@ var inputSchema7 = {
9495
9929
  // whole-tenant corpus.
9496
9930
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9497
9931
  scope: z7.string().optional().describe(
9498
- 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9932
+ 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
9499
9933
  ),
9500
9934
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9501
9935
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9669,7 +10103,7 @@ var inputSchema9 = {
9669
10103
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9670
10104
  ),
9671
10105
  scope: z9.string().optional().describe(
9672
- 'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces. Optional; default returns all schemas the credential can see.'
10106
+ 'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other. Optional; default returns all schemas the credential can see.'
9673
10107
  ),
9674
10108
  surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9675
10109
  "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. Identity entities in any namespace (org/client/one you registered) bind under the single `entity` surface; `user` and `entity` are account-wide. Optional."
@@ -9819,7 +10253,7 @@ var inputSchema11 = {
9819
10253
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9820
10254
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9821
10255
  scope: z11.string().optional().describe(
9822
- 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
10256
+ 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
9823
10257
  ),
9824
10258
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9825
10259
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9930,7 +10364,7 @@ var inputSchema12 = {
9930
10364
  ),
9931
10365
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9932
10366
  scopes: z12.array(z12.string()).optional().describe(
9933
- 'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
10367
+ 'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
9934
10368
  ),
9935
10369
  expectedVersion: z12.number().int().optional().describe(
9936
10370
  "Optimistic concurrency: the version you last read. If the document changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
@@ -10014,7 +10448,7 @@ var inputSchema14 = {
10014
10448
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10015
10449
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10016
10450
  scope: z14.string().optional().describe(
10017
- 'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
10451
+ 'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
10018
10452
  ),
10019
10453
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10020
10454
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10063,7 +10497,7 @@ var inputSchema15 = {
10063
10497
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10064
10498
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10065
10499
  scopes: z15.array(z15.string()).optional().describe(
10066
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
10500
+ 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
10067
10501
  )
10068
10502
  };
10069
10503
  var folderCreate = ({ client, log }) => ({
@@ -10101,7 +10535,7 @@ var inputSchema16 = {
10101
10535
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10102
10536
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10103
10537
  scopes: z16.array(z16.string()).optional().describe(
10104
- 'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
10538
+ 'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
10105
10539
  ),
10106
10540
  expectedVersion: z16.number().int().optional().describe(
10107
10541
  "Optimistic concurrency: the version you last read. If the folder changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
@@ -10168,7 +10602,7 @@ var inputSchema18 = {
10168
10602
  var currentIdentity = ({ log, apiKey, environment }) => ({
10169
10603
  name: "current_identity",
10170
10604
  title: "Current identity (tenant + principal scope)",
10171
- description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Also reports mcpServerVersion (this server's own package version) and sdkVersion (the bundled @vectros-ai/sdk version) so a caller can tell what build it's talking to. Use this when the user asks 'what can you do here?', 'what tenant am I in?', or 'what version is this?'. Calls GET /v1/ping under the hood.",
10605
+ description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's verb+ownership reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry as of API 0.40.0 that /v1/ping does not report yet, so allowedActions+dataScope may understate a credential's true reach. Also reports mcpServerVersion (this server's own package version) and sdkVersion (the bundled @vectros-ai/sdk version) so a caller can tell what build it's talking to. Use this when the user asks 'what can you do here?', 'what tenant am I in?', or 'what version is this?'. Calls GET /v1/ping under the hood.",
10172
10606
  inputSchema: inputSchema18,
10173
10607
  handler: async () => {
10174
10608
  try {
@@ -10291,7 +10725,7 @@ var inputSchema19 = {
10291
10725
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10292
10726
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10293
10727
  scopes: z18.array(z18.string()).optional().describe(
10294
- "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10728
+ "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10295
10729
  )
10296
10730
  };
10297
10731
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10455,11 +10889,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10455
10889
  var MCP_MAX_LIMIT5 = 100;
10456
10890
  var inputSchema20 = {
10457
10891
  kind: z19.string().describe(
10458
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10892
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (reserved, registered like any other), or a namespace you registered.'
10459
10893
  ),
10460
10894
  externalId: z19.string().optional().describe(
10461
10895
  "Resolve mode: your own stable identifier for the principal. Returns the single matching principal (with its Vectros UUID), or an empty array if none. The fastest path to the UUID the ownership filters need. Takes precedence if both this and a `field` lookup are supplied."
10462
10896
  ),
10897
+ contextId: z19.string().optional().describe(
10898
+ "Entity kinds only (not `user`, which is always tenant-wide): the app context to look up entities in, for a namespace registered as context-owned rather than tenant-wide. A context-confined credential's own context is used automatically without this; supply it to name a context explicitly (required for an unconfined/root credential to reach a context-owned namespace). Rejected if the namespace turns out to be tenant-wide."
10899
+ ),
10463
10900
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10464
10901
  type: z19.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10465
10902
  field: z19.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10476,13 +10913,14 @@ var inputSchema20 = {
10476
10913
  var lookupPrincipal = ({ client, log }) => ({
10477
10914
  name: "lookup_principal",
10478
10915
  title: "Look up a user identity or a namespaced identity entity",
10479
- description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
10916
+ description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) For an entity kind, `contextId` names a specific app context when the namespace is context-owned rather than tenant-wide; a context-confined credential's own context is used automatically without it. Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
10480
10917
  inputSchema: inputSchema20,
10481
10918
  handler: async (args) => {
10482
10919
  const kind = args.kind;
10483
10920
  const isUser = kind === "user";
10484
10921
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10485
10922
  const externalId = args.externalId;
10923
+ const contextId = args.contextId;
10486
10924
  const type = args.type;
10487
10925
  const field = args.field;
10488
10926
  const value = args.value;
@@ -10491,11 +10929,18 @@ var lookupPrincipal = ({ client, log }) => ({
10491
10929
  const prefix = args.prefix;
10492
10930
  const order = args.order;
10493
10931
  const startFrom = args.startFrom;
10932
+ if (contextId !== void 0 && isUser) {
10933
+ return toolError(
10934
+ "lookup_principal",
10935
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10936
+ );
10937
+ }
10938
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10494
10939
  try {
10495
10940
  let page;
10496
10941
  if (externalId !== void 0) {
10497
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10498
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10942
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10943
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10499
10944
  } else if (field !== void 0) {
10500
10945
  const hasEquality = value !== void 0;
10501
10946
  const hasRange = from !== void 0 || to !== void 0;
@@ -10523,8 +10968,8 @@ var lookupPrincipal = ({ client, log }) => ({
10523
10968
  );
10524
10969
  }
10525
10970
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10526
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10527
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10971
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
10972
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10528
10973
  } else {
10529
10974
  return toolError(
10530
10975
  "lookup_principal",
@@ -10535,7 +10980,7 @@ var lookupPrincipal = ({ client, log }) => ({
10535
10980
  const nextCursor = page.nextCursor ?? null;
10536
10981
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10537
10982
  } catch (err) {
10538
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
10983
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10539
10984
  return toolError("lookup_principal", err);
10540
10985
  }
10541
10986
  }
@@ -10646,7 +11091,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10646
11091
  name: "identity",
10647
11092
  uri: "vectros://identity",
10648
11093
  title: "Current identity (tenant + principal scope)",
10649
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }), plus mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
11094
+ description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry as of API 0.40.0 that /v1/ping does not report yet, so allowedActions+dataScope may understate a credential's true reach. Also reports mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
10650
11095
  mimeType: "application/json",
10651
11096
  read: async () => {
10652
11097
  const identity = await resolveIdentity({ log, apiKey, environment });