@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/cli-http.mjs CHANGED
@@ -64,6 +64,7 @@ __export(api_exports, {
64
64
  TooManyRequestsError: () => TooManyRequestsError,
65
65
  TruncationWarningEvent: () => TruncationWarningEvent,
66
66
  UnauthorizedError: () => UnauthorizedError,
67
+ UserExistsResponse: () => UserExistsResponse,
67
68
  UserRequest: () => UserRequest,
68
69
  UserResponse: () => UserResponse,
69
70
  auth: () => auth_exports,
@@ -740,6 +741,14 @@ var TruncationWarningEvent;
740
741
  ContextWindowBudget: "context_window_budget"
741
742
  };
742
743
  })(TruncationWarningEvent || (TruncationWarningEvent = {}));
744
+ var UserExistsResponse;
745
+ ((UserExistsResponse2) => {
746
+ UserExistsResponse2.Status = {
747
+ Active: "ACTIVE",
748
+ Suspended: "SUSPENDED",
749
+ Pending: "PENDING"
750
+ };
751
+ })(UserExistsResponse || (UserExistsResponse = {}));
743
752
  var UserRequest;
744
753
  ((UserRequest2) => {
745
754
  UserRequest2.Status = {
@@ -2483,7 +2492,7 @@ var AuthClient = class {
2483
2492
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
2484
2493
  }
2485
2494
  /**
2486
- * 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.
2495
+ * 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.
2487
2496
  *
2488
2497
  * @param {Vectros.CreateScopedKeyRequest} request
2489
2498
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2815,7 +2824,7 @@ var AuthClient = class {
2815
2824
  );
2816
2825
  }
2817
2826
  /**
2818
- * 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.
2827
+ * 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.
2819
2828
  *
2820
2829
  * @param {Vectros.CreateAccessProfileRequest} request
2821
2830
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3233,11 +3242,12 @@ var AuthClient = class {
3233
3242
  );
3234
3243
  }
3235
3244
  /**
3236
- * 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.
3245
+ * 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.
3237
3246
  *
3238
3247
  * @param {Vectros.UpdateAccessProfileRequest} request
3239
3248
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3240
3249
  *
3250
+ * @throws {@link Vectros.BadRequestError}
3241
3251
  * @throws {@link Vectros.ForbiddenError}
3242
3252
  * @throws {@link Vectros.NotFoundError}
3243
3253
  * @throws {@link Vectros.TooManyRequestsError}
@@ -3284,6 +3294,8 @@ var AuthClient = class {
3284
3294
  }
3285
3295
  if (_response.error.reason === "status-code") {
3286
3296
  switch (_response.error.statusCode) {
3297
+ case 400:
3298
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
3287
3299
  case 403:
3288
3300
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
3289
3301
  case 404:
@@ -3913,7 +3925,7 @@ var AuthClient = class {
3913
3925
  );
3914
3926
  }
3915
3927
  /**
3916
- * 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.
3928
+ * 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.
3917
3929
  *
3918
3930
  * @param {Vectros.GetUsageRequest} request
3919
3931
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3975,6 +3987,257 @@ var AuthClient = class {
3975
3987
  }
3976
3988
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3977
3989
  }
3990
+ /**
3991
+ * 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.
3992
+ *
3993
+ * @param {Vectros.GetIssuerRequest} request
3994
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3995
+ *
3996
+ * @throws {@link Vectros.ForbiddenError}
3997
+ * @throws {@link Vectros.NotFoundError}
3998
+ *
3999
+ * @example
4000
+ * await client.auth.getIssuer({
4001
+ * issuerId: "auth0-prod"
4002
+ * })
4003
+ */
4004
+ getIssuer(request, requestOptions) {
4005
+ return HttpResponsePromise.fromPromise(this.__getIssuer(request, requestOptions));
4006
+ }
4007
+ async __getIssuer(request, requestOptions) {
4008
+ const { issuerId } = request;
4009
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4010
+ const _headers = mergeHeaders(
4011
+ _authRequest.headers,
4012
+ this._options?.headers,
4013
+ requestOptions?.headers
4014
+ );
4015
+ const _response = await fetcher({
4016
+ url: url_exports.join(
4017
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4018
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4019
+ ),
4020
+ method: "GET",
4021
+ headers: _headers,
4022
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4023
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4024
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4025
+ abortSignal: requestOptions?.abortSignal,
4026
+ fetchFn: this._options?.fetch,
4027
+ logging: this._options.logging
4028
+ });
4029
+ if (_response.ok) {
4030
+ return { data: _response.body, rawResponse: _response.rawResponse };
4031
+ }
4032
+ if (_response.error.reason === "status-code") {
4033
+ switch (_response.error.statusCode) {
4034
+ case 403:
4035
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4036
+ case 404:
4037
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4038
+ default:
4039
+ throw new VectrosError({
4040
+ statusCode: _response.error.statusCode,
4041
+ body: _response.error.body,
4042
+ rawResponse: _response.rawResponse
4043
+ });
4044
+ }
4045
+ }
4046
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4047
+ }
4048
+ /**
4049
+ * 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.
4050
+ *
4051
+ * @param {Vectros.DeleteIssuerRequest} request
4052
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4053
+ *
4054
+ * @throws {@link Vectros.ForbiddenError}
4055
+ * @throws {@link Vectros.NotFoundError}
4056
+ * @throws {@link Vectros.ConflictError}
4057
+ * @throws {@link Vectros.TooManyRequestsError}
4058
+ *
4059
+ * @example
4060
+ * await client.auth.deleteIssuer({
4061
+ * issuerId: "auth0-prod"
4062
+ * })
4063
+ */
4064
+ deleteIssuer(request, requestOptions) {
4065
+ return HttpResponsePromise.fromPromise(this.__deleteIssuer(request, requestOptions));
4066
+ }
4067
+ async __deleteIssuer(request, requestOptions) {
4068
+ const { issuerId } = request;
4069
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4070
+ const _headers = mergeHeaders(
4071
+ _authRequest.headers,
4072
+ this._options?.headers,
4073
+ requestOptions?.headers
4074
+ );
4075
+ const _response = await fetcher({
4076
+ url: url_exports.join(
4077
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4078
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4079
+ ),
4080
+ method: "DELETE",
4081
+ headers: _headers,
4082
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4083
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4084
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4085
+ abortSignal: requestOptions?.abortSignal,
4086
+ fetchFn: this._options?.fetch,
4087
+ logging: this._options.logging
4088
+ });
4089
+ if (_response.ok) {
4090
+ return { data: void 0, rawResponse: _response.rawResponse };
4091
+ }
4092
+ if (_response.error.reason === "status-code") {
4093
+ switch (_response.error.statusCode) {
4094
+ case 403:
4095
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4096
+ case 404:
4097
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4098
+ case 409:
4099
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4100
+ case 429:
4101
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4102
+ default:
4103
+ throw new VectrosError({
4104
+ statusCode: _response.error.statusCode,
4105
+ body: _response.error.body,
4106
+ rawResponse: _response.rawResponse
4107
+ });
4108
+ }
4109
+ }
4110
+ return handleNonStatusCodeError(
4111
+ _response.error,
4112
+ _response.rawResponse,
4113
+ "DELETE",
4114
+ "/v1/auth/issuers/{issuerId}"
4115
+ );
4116
+ }
4117
+ /**
4118
+ * 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.
4119
+ *
4120
+ * @param {Vectros.ListIssuersRequest} request
4121
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4122
+ *
4123
+ * @throws {@link Vectros.ForbiddenError}
4124
+ *
4125
+ * @example
4126
+ * await client.auth.listIssuers()
4127
+ */
4128
+ listIssuers(request = {}, requestOptions) {
4129
+ return HttpResponsePromise.fromPromise(this.__listIssuers(request, requestOptions));
4130
+ }
4131
+ async __listIssuers(request = {}, requestOptions) {
4132
+ const { startFrom, limit } = request;
4133
+ const _queryParams = {
4134
+ startFrom,
4135
+ limit
4136
+ };
4137
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4138
+ const _headers = mergeHeaders(
4139
+ _authRequest.headers,
4140
+ this._options?.headers,
4141
+ requestOptions?.headers
4142
+ );
4143
+ const _response = await fetcher({
4144
+ url: url_exports.join(
4145
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4146
+ "v1/auth/issuers"
4147
+ ),
4148
+ method: "GET",
4149
+ headers: _headers,
4150
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
4151
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4152
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4153
+ abortSignal: requestOptions?.abortSignal,
4154
+ fetchFn: this._options?.fetch,
4155
+ logging: this._options.logging
4156
+ });
4157
+ if (_response.ok) {
4158
+ return { data: _response.body, rawResponse: _response.rawResponse };
4159
+ }
4160
+ if (_response.error.reason === "status-code") {
4161
+ switch (_response.error.statusCode) {
4162
+ case 403:
4163
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4164
+ default:
4165
+ throw new VectrosError({
4166
+ statusCode: _response.error.statusCode,
4167
+ body: _response.error.body,
4168
+ rawResponse: _response.rawResponse
4169
+ });
4170
+ }
4171
+ }
4172
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4173
+ }
4174
+ /**
4175
+ * 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`.
4176
+ *
4177
+ * @param {Vectros.IssuerRequest} request
4178
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4179
+ *
4180
+ * @throws {@link Vectros.BadRequestError}
4181
+ * @throws {@link Vectros.ForbiddenError}
4182
+ * @throws {@link Vectros.TooManyRequestsError}
4183
+ *
4184
+ * @example
4185
+ * await client.auth.registerIssuer({
4186
+ * issuerId: "auth0-prod",
4187
+ * issuer: "https://your-tenant.us.auth0.com/",
4188
+ * jwksUri: "https://your-tenant.us.auth0.com/.well-known/jwks.json",
4189
+ * audience: "https://api.your-app.example.com",
4190
+ * contextId: "casework"
4191
+ * })
4192
+ */
4193
+ registerIssuer(request, requestOptions) {
4194
+ return HttpResponsePromise.fromPromise(this.__registerIssuer(request, requestOptions));
4195
+ }
4196
+ async __registerIssuer(request, requestOptions) {
4197
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4198
+ const _headers = mergeHeaders(
4199
+ _authRequest.headers,
4200
+ this._options?.headers,
4201
+ requestOptions?.headers
4202
+ );
4203
+ const _response = await fetcher({
4204
+ url: url_exports.join(
4205
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4206
+ "v1/auth/issuers"
4207
+ ),
4208
+ method: "POST",
4209
+ headers: _headers,
4210
+ contentType: "application/json",
4211
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4212
+ requestType: "json",
4213
+ body: request,
4214
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4215
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4216
+ abortSignal: requestOptions?.abortSignal,
4217
+ fetchFn: this._options?.fetch,
4218
+ logging: this._options.logging
4219
+ });
4220
+ if (_response.ok) {
4221
+ return { data: _response.body, rawResponse: _response.rawResponse };
4222
+ }
4223
+ if (_response.error.reason === "status-code") {
4224
+ switch (_response.error.statusCode) {
4225
+ case 400:
4226
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4227
+ case 403:
4228
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4229
+ case 429:
4230
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4231
+ default:
4232
+ throw new VectrosError({
4233
+ statusCode: _response.error.statusCode,
4234
+ body: _response.error.body,
4235
+ rawResponse: _response.rawResponse
4236
+ });
4237
+ }
4238
+ }
4239
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/issuers");
4240
+ }
3978
4241
  /**
3979
4242
  * 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.
3980
4243
  *
@@ -4020,7 +4283,7 @@ var AuthClient = class {
4020
4283
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4021
4284
  }
4022
4285
  /**
4023
- * 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.
4286
+ * 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.
4024
4287
  *
4025
4288
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4026
4289
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4298,6 +4561,72 @@ var AuthClient = class {
4298
4561
  }
4299
4562
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4300
4563
  }
4564
+ /**
4565
+ * 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.
4566
+ *
4567
+ * @param {Vectros.TokenExchangeRequest} request
4568
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4569
+ *
4570
+ * @throws {@link Vectros.BadRequestError}
4571
+ * @throws {@link Vectros.UnauthorizedError}
4572
+ * @throws {@link Vectros.ForbiddenError}
4573
+ * @throws {@link Vectros.NotFoundError}
4574
+ * @throws {@link Vectros.TooManyRequestsError}
4575
+ *
4576
+ * @example
4577
+ * await client.auth.exchangeToken({
4578
+ * grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
4579
+ * subject_token: "subject_token",
4580
+ * subject_token_type: "urn:ietf:params:oauth:token-type:jwt"
4581
+ * })
4582
+ */
4583
+ exchangeToken(request, requestOptions) {
4584
+ return HttpResponsePromise.fromPromise(this.__exchangeToken(request, requestOptions));
4585
+ }
4586
+ async __exchangeToken(request, requestOptions) {
4587
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
4588
+ const _response = await fetcher({
4589
+ url: url_exports.join(
4590
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4591
+ "v1/auth/token/exchange"
4592
+ ),
4593
+ method: "POST",
4594
+ headers: _headers,
4595
+ contentType: "application/json",
4596
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4597
+ requestType: "json",
4598
+ body: request,
4599
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4600
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4601
+ abortSignal: requestOptions?.abortSignal,
4602
+ fetchFn: this._options?.fetch,
4603
+ logging: this._options.logging
4604
+ });
4605
+ if (_response.ok) {
4606
+ return { data: _response.body, rawResponse: _response.rawResponse };
4607
+ }
4608
+ if (_response.error.reason === "status-code") {
4609
+ switch (_response.error.statusCode) {
4610
+ case 400:
4611
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4612
+ case 401:
4613
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
4614
+ case 403:
4615
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4616
+ case 404:
4617
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4618
+ case 429:
4619
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4620
+ default:
4621
+ throw new VectrosError({
4622
+ statusCode: _response.error.statusCode,
4623
+ body: _response.error.body,
4624
+ rawResponse: _response.rawResponse
4625
+ });
4626
+ }
4627
+ }
4628
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/exchange");
4629
+ }
4301
4630
  };
4302
4631
  var ComplianceClient = class {
4303
4632
  constructor(options) {
@@ -5775,6 +6104,7 @@ var IdentityClient = class {
5775
6104
  * @example
5776
6105
  * await client.identity.listEntities({
5777
6106
  * namespace: "team",
6107
+ * contextId: "myapp",
5778
6108
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
5779
6109
  * })
5780
6110
  */
@@ -5784,6 +6114,7 @@ var IdentityClient = class {
5784
6114
  async __listEntities(request, requestOptions) {
5785
6115
  const {
5786
6116
  namespace,
6117
+ contextId,
5787
6118
  userId,
5788
6119
  externalId,
5789
6120
  scope,
@@ -5798,6 +6129,7 @@ var IdentityClient = class {
5798
6129
  limit
5799
6130
  } = request;
5800
6131
  const _queryParams = {
6132
+ contextId,
5801
6133
  userId,
5802
6134
  externalId,
5803
6135
  scope,
@@ -5856,6 +6188,7 @@ var IdentityClient = class {
5856
6188
  * @example
5857
6189
  * await client.identity.createEntity({
5858
6190
  * namespace: "team",
6191
+ * contextId: "myapp",
5859
6192
  * body: {
5860
6193
  * externalId: "team_eng_platform"
5861
6194
  * }
@@ -5865,9 +6198,10 @@ var IdentityClient = class {
5865
6198
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5866
6199
  }
5867
6200
  async __createEntity(request, requestOptions) {
5868
- const { namespace, upsert, body: _body } = request;
6201
+ const { namespace, upsert, contextId, body: _body } = request;
5869
6202
  const _queryParams = {
5870
- upsert
6203
+ upsert,
6204
+ contextId
5871
6205
  };
5872
6206
  const _authRequest = await this._options.authProvider.getAuthRequest();
5873
6207
  const _headers = mergeHeaders(
@@ -5924,14 +6258,18 @@ var IdentityClient = class {
5924
6258
  * @example
5925
6259
  * await client.identity.getEntity({
5926
6260
  * namespace: "team",
5927
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6261
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6262
+ * contextId: "myapp"
5928
6263
  * })
5929
6264
  */
5930
6265
  getEntity(request, requestOptions) {
5931
6266
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5932
6267
  }
5933
6268
  async __getEntity(request, requestOptions) {
5934
- const { namespace, id } = request;
6269
+ const { namespace, id, contextId } = request;
6270
+ const _queryParams = {
6271
+ contextId
6272
+ };
5935
6273
  const _authRequest = await this._options.authProvider.getAuthRequest();
5936
6274
  const _headers = mergeHeaders(
5937
6275
  _authRequest.headers,
@@ -5945,7 +6283,7 @@ var IdentityClient = class {
5945
6283
  ),
5946
6284
  method: "GET",
5947
6285
  headers: _headers,
5948
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6286
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
5949
6287
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
5950
6288
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
5951
6289
  abortSignal: requestOptions?.abortSignal,
@@ -5982,6 +6320,7 @@ var IdentityClient = class {
5982
6320
  * await client.identity.updateEntity({
5983
6321
  * namespace: "team",
5984
6322
  * id: "id",
6323
+ * contextId: "myapp",
5985
6324
  * body: {
5986
6325
  * externalId: "team_eng_platform"
5987
6326
  * }
@@ -5991,7 +6330,10 @@ var IdentityClient = class {
5991
6330
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
5992
6331
  }
5993
6332
  async __updateEntity(request, requestOptions) {
5994
- const { namespace, id, body: _body } = request;
6333
+ const { namespace, id, contextId, body: _body } = request;
6334
+ const _queryParams = {
6335
+ contextId
6336
+ };
5995
6337
  const _authRequest = await this._options.authProvider.getAuthRequest();
5996
6338
  const _headers = mergeHeaders(
5997
6339
  _authRequest.headers,
@@ -6006,7 +6348,7 @@ var IdentityClient = class {
6006
6348
  method: "PUT",
6007
6349
  headers: _headers,
6008
6350
  contentType: "application/json",
6009
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6351
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6010
6352
  requestType: "json",
6011
6353
  body: _body,
6012
6354
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6046,14 +6388,18 @@ var IdentityClient = class {
6046
6388
  * @example
6047
6389
  * await client.identity.deleteEntity({
6048
6390
  * namespace: "team",
6049
- * id: "id"
6391
+ * id: "id",
6392
+ * contextId: "myapp"
6050
6393
  * })
6051
6394
  */
6052
6395
  deleteEntity(request, requestOptions) {
6053
6396
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6054
6397
  }
6055
6398
  async __deleteEntity(request, requestOptions) {
6056
- const { namespace, id } = request;
6399
+ const { namespace, id, contextId } = request;
6400
+ const _queryParams = {
6401
+ contextId
6402
+ };
6057
6403
  const _authRequest = await this._options.authProvider.getAuthRequest();
6058
6404
  const _headers = mergeHeaders(
6059
6405
  _authRequest.headers,
@@ -6067,7 +6413,7 @@ var IdentityClient = class {
6067
6413
  ),
6068
6414
  method: "DELETE",
6069
6415
  headers: _headers,
6070
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6416
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6071
6417
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6072
6418
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6073
6419
  abortSignal: requestOptions?.abortSignal,
@@ -6110,6 +6456,7 @@ var IdentityClient = class {
6110
6456
  * @example
6111
6457
  * await client.identity.lookupEntities({
6112
6458
  * namespace: "team",
6459
+ * contextId: "myapp",
6113
6460
  * body: {
6114
6461
  * type: "person_v1",
6115
6462
  * field: "ssn"
@@ -6120,7 +6467,10 @@ var IdentityClient = class {
6120
6467
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6121
6468
  }
6122
6469
  async __lookupEntities(request, requestOptions) {
6123
- const { namespace, body: _body } = request;
6470
+ const { namespace, contextId, body: _body } = request;
6471
+ const _queryParams = {
6472
+ contextId
6473
+ };
6124
6474
  const _authRequest = await this._options.authProvider.getAuthRequest();
6125
6475
  const _headers = mergeHeaders(
6126
6476
  _authRequest.headers,
@@ -6135,7 +6485,7 @@ var IdentityClient = class {
6135
6485
  method: "POST",
6136
6486
  headers: _headers,
6137
6487
  contentType: "application/json",
6138
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6488
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6139
6489
  requestType: "json",
6140
6490
  body: _body,
6141
6491
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6179,15 +6529,17 @@ var IdentityClient = class {
6179
6529
  * @example
6180
6530
  * await client.identity.getEntityVersions({
6181
6531
  * namespace: "team",
6182
- * id: "id"
6532
+ * id: "id",
6533
+ * contextId: "myapp"
6183
6534
  * })
6184
6535
  */
6185
6536
  getEntityVersions(request, requestOptions) {
6186
6537
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6187
6538
  }
6188
6539
  async __getEntityVersions(request, requestOptions) {
6189
- const { namespace, id, startFrom } = request;
6540
+ const { namespace, id, contextId, startFrom } = request;
6190
6541
  const _queryParams = {
6542
+ contextId,
6191
6543
  startFrom
6192
6544
  };
6193
6545
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6249,7 +6601,10 @@ var IdentityClient = class {
6249
6601
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6250
6602
  }
6251
6603
  async __getNamespace(request, requestOptions) {
6252
- const { namespace } = request;
6604
+ const { namespace, contextId } = request;
6605
+ const _queryParams = {
6606
+ contextId
6607
+ };
6253
6608
  const _authRequest = await this._options.authProvider.getAuthRequest();
6254
6609
  const _headers = mergeHeaders(
6255
6610
  _authRequest.headers,
@@ -6263,7 +6618,7 @@ var IdentityClient = class {
6263
6618
  ),
6264
6619
  method: "GET",
6265
6620
  headers: _headers,
6266
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6621
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6267
6622
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6268
6623
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6269
6624
  abortSignal: requestOptions?.abortSignal,
@@ -6288,7 +6643,7 @@ var IdentityClient = class {
6288
6643
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6289
6644
  }
6290
6645
  /**
6291
- * 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.
6646
+ * 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.
6292
6647
  *
6293
6648
  * @param {Vectros.UpdateNamespaceRequest} request
6294
6649
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6310,7 +6665,10 @@ var IdentityClient = class {
6310
6665
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6311
6666
  }
6312
6667
  async __updateNamespace(request, requestOptions) {
6313
- const { namespace, body: _body } = request;
6668
+ const { namespace, contextId, body: _body } = request;
6669
+ const _queryParams = {
6670
+ contextId
6671
+ };
6314
6672
  const _authRequest = await this._options.authProvider.getAuthRequest();
6315
6673
  const _headers = mergeHeaders(
6316
6674
  _authRequest.headers,
@@ -6325,7 +6683,7 @@ var IdentityClient = class {
6325
6683
  method: "PUT",
6326
6684
  headers: _headers,
6327
6685
  contentType: "application/json",
6328
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6686
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6329
6687
  requestType: "json",
6330
6688
  body: _body,
6331
6689
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6356,7 +6714,7 @@ var IdentityClient = class {
6356
6714
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6357
6715
  }
6358
6716
  /**
6359
- * 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.
6717
+ * 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.
6360
6718
  *
6361
6719
  * @param {Vectros.DeleteNamespaceRequest} request
6362
6720
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6374,7 +6732,10 @@ var IdentityClient = class {
6374
6732
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6375
6733
  }
6376
6734
  async __deleteNamespace(request, requestOptions) {
6377
- const { namespace } = request;
6735
+ const { namespace, contextId } = request;
6736
+ const _queryParams = {
6737
+ contextId
6738
+ };
6378
6739
  const _authRequest = await this._options.authProvider.getAuthRequest();
6379
6740
  const _headers = mergeHeaders(
6380
6741
  _authRequest.headers,
@@ -6388,7 +6749,7 @@ var IdentityClient = class {
6388
6749
  ),
6389
6750
  method: "DELETE",
6390
6751
  headers: _headers,
6391
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6752
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6392
6753
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6393
6754
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6394
6755
  abortSignal: requestOptions?.abortSignal,
@@ -6417,7 +6778,7 @@ var IdentityClient = class {
6417
6778
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6418
6779
  }
6419
6780
  /**
6420
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6781
+ * 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.
6421
6782
  *
6422
6783
  * @param {Vectros.ListNamespacesRequest} request
6423
6784
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6429,10 +6790,11 @@ var IdentityClient = class {
6429
6790
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6430
6791
  }
6431
6792
  async __listNamespaces(request = {}, requestOptions) {
6432
- const { startFrom, limit } = request;
6793
+ const { startFrom, limit, contextId } = request;
6433
6794
  const _queryParams = {
6434
6795
  startFrom,
6435
- limit
6796
+ limit,
6797
+ contextId
6436
6798
  };
6437
6799
  const _authRequest = await this._options.authProvider.getAuthRequest();
6438
6800
  const _headers = mergeHeaders(
@@ -6467,9 +6829,9 @@ var IdentityClient = class {
6467
6829
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6468
6830
  }
6469
6831
  /**
6470
- * 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.
6832
+ * 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.
6471
6833
  *
6472
- * @param {Vectros.NamespaceRequest} request
6834
+ * @param {Vectros.RegisterNamespaceRequest} request
6473
6835
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6474
6836
  *
6475
6837
  * @throws {@link Vectros.BadRequestError}
@@ -6478,14 +6840,20 @@ var IdentityClient = class {
6478
6840
  *
6479
6841
  * @example
6480
6842
  * await client.identity.registerNamespace({
6481
- * namespace: "team",
6482
- * specificityRank: 1500
6843
+ * body: {
6844
+ * namespace: "team",
6845
+ * specificityRank: 1500
6846
+ * }
6483
6847
  * })
6484
6848
  */
6485
6849
  registerNamespace(request, requestOptions) {
6486
6850
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6487
6851
  }
6488
6852
  async __registerNamespace(request, requestOptions) {
6853
+ const { contextId, body: _body } = request;
6854
+ const _queryParams = {
6855
+ contextId
6856
+ };
6489
6857
  const _authRequest = await this._options.authProvider.getAuthRequest();
6490
6858
  const _headers = mergeHeaders(
6491
6859
  _authRequest.headers,
@@ -6500,9 +6868,9 @@ var IdentityClient = class {
6500
6868
  method: "POST",
6501
6869
  headers: _headers,
6502
6870
  contentType: "application/json",
6503
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6871
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6504
6872
  requestType: "json",
6505
- body: request,
6873
+ body: _body,
6506
6874
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6507
6875
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6508
6876
  abortSignal: requestOptions?.abortSignal,
@@ -6787,12 +7155,13 @@ var IdentityClient = class {
6787
7155
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
6788
7156
  }
6789
7157
  /**
6790
- * 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.
7158
+ * 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.
6791
7159
  *
6792
7160
  * @param {Vectros.DeleteUserRequest} request
6793
7161
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6794
7162
  *
6795
7163
  * @throws {@link Vectros.NotFoundError}
7164
+ * @throws {@link Vectros.ConflictError}
6796
7165
  * @throws {@link Vectros.TooManyRequestsError}
6797
7166
  *
6798
7167
  * @example
@@ -6832,6 +7201,8 @@ var IdentityClient = class {
6832
7201
  switch (_response.error.statusCode) {
6833
7202
  case 404:
6834
7203
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7204
+ case 409:
7205
+ throw new ConflictError(_response.error.body, _response.rawResponse);
6835
7206
  case 429:
6836
7207
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6837
7208
  default:
@@ -6905,6 +7276,69 @@ var IdentityClient = class {
6905
7276
  }
6906
7277
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/lookup");
6907
7278
  }
7279
+ /**
7280
+ * 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.
7281
+ *
7282
+ * @param {Vectros.UserExistsByEmailRequest} request
7283
+ * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7284
+ *
7285
+ * @throws {@link Vectros.BadRequestError}
7286
+ * @throws {@link Vectros.ForbiddenError}
7287
+ *
7288
+ * @example
7289
+ * await client.identity.userExistsByEmail({
7290
+ * email: "user@example.com",
7291
+ * contextId: "myapp"
7292
+ * })
7293
+ */
7294
+ userExistsByEmail(request = {}, requestOptions) {
7295
+ return HttpResponsePromise.fromPromise(this.__userExistsByEmail(request, requestOptions));
7296
+ }
7297
+ async __userExistsByEmail(request = {}, requestOptions) {
7298
+ const { email, contextId } = request;
7299
+ const _queryParams = {
7300
+ email,
7301
+ contextId
7302
+ };
7303
+ const _authRequest = await this._options.authProvider.getAuthRequest();
7304
+ const _headers = mergeHeaders(
7305
+ _authRequest.headers,
7306
+ this._options?.headers,
7307
+ requestOptions?.headers
7308
+ );
7309
+ const _response = await fetcher({
7310
+ url: url_exports.join(
7311
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
7312
+ "v1/users/exists-by-email"
7313
+ ),
7314
+ method: "GET",
7315
+ headers: _headers,
7316
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
7317
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
7318
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
7319
+ abortSignal: requestOptions?.abortSignal,
7320
+ fetchFn: this._options?.fetch,
7321
+ logging: this._options.logging
7322
+ });
7323
+ if (_response.ok) {
7324
+ return { data: _response.body, rawResponse: _response.rawResponse };
7325
+ }
7326
+ if (_response.error.reason === "status-code") {
7327
+ switch (_response.error.statusCode) {
7328
+ case 400:
7329
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7330
+ case 403:
7331
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
7332
+ default:
7333
+ throw new VectrosError({
7334
+ statusCode: _response.error.statusCode,
7335
+ body: _response.error.body,
7336
+ rawResponse: _response.rawResponse
7337
+ });
7338
+ }
7339
+ }
7340
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/exists-by-email");
7341
+ }
6908
7342
  /**
6909
7343
  * 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.
6910
7344
  *
@@ -8666,15 +9100,15 @@ function warnOnSuboptimalKey(key, log) {
8666
9100
  } else if (key.prefix === "st") {
8667
9101
  log.warn(
8668
9102
  { prefix: key.prefix, env: key.env },
8669
- "short-lived token (st_*) will expire mid-session (1h default, 24h max). For long-running MCP installs, prefer a long-lived ssk_* key."
9103
+ "short-lived token (st_*) will expire mid-session (1h max). For long-running MCP installs, prefer a long-lived ssk_* key."
8670
9104
  );
8671
9105
  }
8672
9106
  }
8673
9107
 
8674
9108
  // src/build-info.ts
8675
9109
  var BUILD_INFO = {
8676
- mcpServer: true ? "0.13.0" : "dev",
8677
- sdk: true ? "0.38.0" : "dev"
9110
+ mcpServer: true ? "0.15.0" : "dev",
9111
+ sdk: true ? "0.40.0" : "dev"
8678
9112
  };
8679
9113
 
8680
9114
  // src/log.ts
@@ -8982,7 +9416,7 @@ var inputSchema = {
8982
9416
  // Ownership.
8983
9417
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
8984
9418
  scope: z.string().optional().describe(
8985
- '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.'
9419
+ '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.'
8986
9420
  ),
8987
9421
  // Date window.
8988
9422
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9122,7 +9556,7 @@ var inputSchema2 = {
9122
9556
  // List-mode args:
9123
9557
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9124
9558
  scope: z2.string().optional().describe(
9125
- '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.'
9559
+ '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.'
9126
9560
  ),
9127
9561
  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."),
9128
9562
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9373,7 +9807,7 @@ var inputSchema4 = {
9373
9807
  folderId: z4.string().optional().describe("Group this record into a folder."),
9374
9808
  userId: z4.string().optional().describe("Owning user id."),
9375
9809
  scopes: z4.array(z4.string()).optional().describe(
9376
- '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.'
9810
+ '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.'
9377
9811
  )
9378
9812
  };
9379
9813
  var recordCreate = ({ client, log }) => ({
@@ -9497,7 +9931,7 @@ var inputSchema7 = {
9497
9931
  // whole-tenant corpus.
9498
9932
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9499
9933
  scope: z7.string().optional().describe(
9500
- '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.'
9934
+ '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.'
9501
9935
  ),
9502
9936
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9503
9937
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9671,7 +10105,7 @@ var inputSchema9 = {
9671
10105
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9672
10106
  ),
9673
10107
  scope: z9.string().optional().describe(
9674
- '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.'
10108
+ '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.'
9675
10109
  ),
9676
10110
  surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9677
10111
  "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."
@@ -9821,7 +10255,7 @@ var inputSchema11 = {
9821
10255
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9822
10256
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9823
10257
  scope: z11.string().optional().describe(
9824
- '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.'
10258
+ '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.'
9825
10259
  ),
9826
10260
  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."),
9827
10261
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9932,7 +10366,7 @@ var inputSchema12 = {
9932
10366
  ),
9933
10367
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9934
10368
  scopes: z12.array(z12.string()).optional().describe(
9935
- '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).'
10369
+ '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).'
9936
10370
  ),
9937
10371
  expectedVersion: z12.number().int().optional().describe(
9938
10372
  "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."
@@ -10016,7 +10450,7 @@ var inputSchema14 = {
10016
10450
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10017
10451
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10018
10452
  scope: z14.string().optional().describe(
10019
- '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.'
10453
+ '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.'
10020
10454
  ),
10021
10455
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10022
10456
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10065,7 +10499,7 @@ var inputSchema15 = {
10065
10499
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10066
10500
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10067
10501
  scopes: z15.array(z15.string()).optional().describe(
10068
- '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.'
10502
+ '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.'
10069
10503
  )
10070
10504
  };
10071
10505
  var folderCreate = ({ client, log }) => ({
@@ -10103,7 +10537,7 @@ var inputSchema16 = {
10103
10537
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10104
10538
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10105
10539
  scopes: z16.array(z16.string()).optional().describe(
10106
- '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).'
10540
+ '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).'
10107
10541
  ),
10108
10542
  expectedVersion: z16.number().int().optional().describe(
10109
10543
  "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."
@@ -10170,7 +10604,7 @@ var inputSchema18 = {
10170
10604
  var currentIdentity = ({ log, apiKey, environment }) => ({
10171
10605
  name: "current_identity",
10172
10606
  title: "Current identity (tenant + principal scope)",
10173
- 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.",
10607
+ 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.",
10174
10608
  inputSchema: inputSchema18,
10175
10609
  handler: async () => {
10176
10610
  try {
@@ -10293,7 +10727,7 @@ var inputSchema19 = {
10293
10727
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10294
10728
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10295
10729
  scopes: z18.array(z18.string()).optional().describe(
10296
- "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."
10730
+ "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."
10297
10731
  )
10298
10732
  };
10299
10733
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10457,11 +10891,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10457
10891
  var MCP_MAX_LIMIT5 = 100;
10458
10892
  var inputSchema20 = {
10459
10893
  kind: z19.string().describe(
10460
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10894
+ '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.'
10461
10895
  ),
10462
10896
  externalId: z19.string().optional().describe(
10463
10897
  "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."
10464
10898
  ),
10899
+ contextId: z19.string().optional().describe(
10900
+ "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."
10901
+ ),
10465
10902
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10466
10903
  type: z19.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10467
10904
  field: z19.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10478,13 +10915,14 @@ var inputSchema20 = {
10478
10915
  var lookupPrincipal = ({ client, log }) => ({
10479
10916
  name: "lookup_principal",
10480
10917
  title: "Look up a user identity or a namespaced identity entity",
10481
- 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.",
10918
+ 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.",
10482
10919
  inputSchema: inputSchema20,
10483
10920
  handler: async (args) => {
10484
10921
  const kind = args.kind;
10485
10922
  const isUser = kind === "user";
10486
10923
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10487
10924
  const externalId = args.externalId;
10925
+ const contextId = args.contextId;
10488
10926
  const type = args.type;
10489
10927
  const field = args.field;
10490
10928
  const value = args.value;
@@ -10493,11 +10931,18 @@ var lookupPrincipal = ({ client, log }) => ({
10493
10931
  const prefix = args.prefix;
10494
10932
  const order = args.order;
10495
10933
  const startFrom = args.startFrom;
10934
+ if (contextId !== void 0 && isUser) {
10935
+ return toolError(
10936
+ "lookup_principal",
10937
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10938
+ );
10939
+ }
10940
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10496
10941
  try {
10497
10942
  let page;
10498
10943
  if (externalId !== void 0) {
10499
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10500
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10944
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10945
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10501
10946
  } else if (field !== void 0) {
10502
10947
  const hasEquality = value !== void 0;
10503
10948
  const hasRange = from !== void 0 || to !== void 0;
@@ -10525,8 +10970,8 @@ var lookupPrincipal = ({ client, log }) => ({
10525
10970
  );
10526
10971
  }
10527
10972
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10528
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10529
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10973
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
10974
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10530
10975
  } else {
10531
10976
  return toolError(
10532
10977
  "lookup_principal",
@@ -10537,7 +10982,7 @@ var lookupPrincipal = ({ client, log }) => ({
10537
10982
  const nextCursor = page.nextCursor ?? null;
10538
10983
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10539
10984
  } catch (err) {
10540
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
10985
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10541
10986
  return toolError("lookup_principal", err);
10542
10987
  }
10543
10988
  }
@@ -10648,7 +11093,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10648
11093
  name: "identity",
10649
11094
  uri: "vectros://identity",
10650
11095
  title: "Current identity (tenant + principal scope)",
10651
- 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.",
11096
+ 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.",
10652
11097
  mimeType: "application/json",
10653
11098
  read: async () => {
10654
11099
  const identity = await resolveIdentity({ log, apiKey, environment });