@vectros-ai/mcp-server 0.9.0 → 0.11.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
@@ -18,7 +18,6 @@ __export(api_exports, {
18
18
  BatchWriteRequest: () => BatchWriteRequest,
19
19
  BatchWriteResult: () => BatchWriteResult,
20
20
  ChatMessage: () => ChatMessage,
21
- ClientRequest: () => ClientRequest,
22
21
  ConflictError: () => ConflictError,
23
22
  ContentDeltaEvent: () => ContentDeltaEvent,
24
23
  ContentTooLargeError: () => ContentTooLargeError,
@@ -27,6 +26,7 @@ __export(api_exports, {
27
26
  DocumentRequest: () => DocumentRequest,
28
27
  DocumentResponse: () => DocumentResponse,
29
28
  DoneEvent: () => DoneEvent,
29
+ EntityRequest: () => EntityRequest,
30
30
  ErasureCertificate: () => ErasureCertificate,
31
31
  ErasureRequest: () => ErasureRequest,
32
32
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -38,16 +38,15 @@ __export(api_exports, {
38
38
  FileUploadRequest: () => FileUploadRequest,
39
39
  ForbiddenError: () => ForbiddenError,
40
40
  IdentityLookupRequest: () => IdentityLookupRequest,
41
+ IndexFailure: () => IndexFailure,
41
42
  InternalServerError: () => InternalServerError,
42
- ListClientsRequestOrder: () => ListClientsRequestOrder,
43
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
43
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
44
44
  ListUsersRequestOrder: () => ListUsersRequestOrder,
45
45
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
46
46
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
47
47
  ModelDataVersionResponse: () => ModelDataVersionResponse,
48
48
  NotFoundError: () => NotFoundError,
49
49
  NotImplementedError: () => NotImplementedError,
50
- OrgRequest: () => OrgRequest,
51
50
  PaymentRequiredError: () => PaymentRequiredError,
52
51
  PingResponse: () => PingResponse,
53
52
  RagSearch: () => RagSearch,
@@ -288,11 +287,6 @@ var UnauthorizedError = class extends VectrosError {
288
287
  var auth_exports = {};
289
288
  var ErasureRequest;
290
289
  ((ErasureRequest2) => {
291
- ErasureRequest2.SubjectType = {
292
- User: "user",
293
- Client: "client",
294
- Org: "org"
295
- };
296
290
  ErasureRequest2.AuditDisposition = {
297
291
  RetainRedacted: "retain-redacted",
298
292
  Purge: "purge"
@@ -304,11 +298,6 @@ var ExportRequest;
304
298
  Tenant: "tenant",
305
299
  Subject: "subject"
306
300
  };
307
- ExportRequest2.SubjectType = {
308
- User: "user",
309
- Client: "client",
310
- Org: "org"
311
- };
312
301
  ExportRequest2.Format = {
313
302
  Ndjson: "ndjson"
314
303
  };
@@ -347,15 +336,10 @@ var LookupDocumentsRequestOrder = {
347
336
  var folders_exports = {};
348
337
  var identity_exports = {};
349
338
  __export(identity_exports, {
350
- ListClientsRequestOrder: () => ListClientsRequestOrder,
351
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
339
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
352
340
  ListUsersRequestOrder: () => ListUsersRequestOrder
353
341
  });
354
- var ListClientsRequestOrder = {
355
- Asc: "asc",
356
- Desc: "desc"
357
- };
358
- var ListOrgsRequestOrder = {
342
+ var ListEntitiesRequestOrder = {
359
343
  Asc: "asc",
360
344
  Desc: "desc"
361
345
  };
@@ -454,13 +438,6 @@ var ChatMessage;
454
438
  Assistant: "assistant"
455
439
  };
456
440
  })(ChatMessage || (ChatMessage = {}));
457
- var ClientRequest;
458
- ((ClientRequest2) => {
459
- ClientRequest2.Status = {
460
- Active: "ACTIVE",
461
- Suspended: "SUSPENDED"
462
- };
463
- })(ClientRequest || (ClientRequest = {}));
464
441
  var ContentDeltaEvent;
465
442
  ((ContentDeltaEvent2) => {
466
443
  ContentDeltaEvent2.Event = {
@@ -515,6 +492,13 @@ var DoneEvent;
515
492
  Done: "done"
516
493
  };
517
494
  })(DoneEvent || (DoneEvent = {}));
495
+ var EntityRequest;
496
+ ((EntityRequest2) => {
497
+ EntityRequest2.Status = {
498
+ Active: "ACTIVE",
499
+ Suspended: "SUSPENDED"
500
+ };
501
+ })(EntityRequest || (EntityRequest = {}));
518
502
  var ErasureCertificate;
519
503
  ((ErasureCertificate2) => {
520
504
  ErasureCertificate2.AuditDisposition = {
@@ -530,11 +514,6 @@ var ErasureRequestResponse;
530
514
  Completed: "completed",
531
515
  Failed: "failed"
532
516
  };
533
- ErasureRequestResponse2.SubjectType = {
534
- User: "user",
535
- Client: "client",
536
- Org: "org"
537
- };
538
517
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
539
518
  var ErrorEvent;
540
519
  ((ErrorEvent2) => {
@@ -560,11 +539,6 @@ var ExportRequestResponse;
560
539
  Tenant: "tenant",
561
540
  Subject: "subject"
562
541
  };
563
- ExportRequestResponse2.SubjectType = {
564
- User: "user",
565
- Client: "client",
566
- Org: "org"
567
- };
568
542
  })(ExportRequestResponse || (ExportRequestResponse = {}));
569
543
  var FieldDef;
570
544
  ((FieldDef2) => {
@@ -578,13 +552,6 @@ var FieldDef;
578
552
  Object: "object",
579
553
  Reference: "reference"
580
554
  };
581
- FieldDef2.TargetSurface = {
582
- Record: "record",
583
- Document: "document",
584
- User: "user",
585
- Org: "org",
586
- Client: "client"
587
- };
588
555
  })(FieldDef || (FieldDef = {}));
589
556
  var IdentityLookupRequest;
590
557
  ((IdentityLookupRequest2) => {
@@ -593,6 +560,17 @@ var IdentityLookupRequest;
593
560
  Desc: "desc"
594
561
  };
595
562
  })(IdentityLookupRequest || (IdentityLookupRequest = {}));
563
+ var IndexFailure;
564
+ ((IndexFailure2) => {
565
+ IndexFailure2.Code = {
566
+ SourceUnavailable: "SOURCE_UNAVAILABLE",
567
+ TextIndexFailed: "TEXT_INDEX_FAILED",
568
+ EmbeddingFailed: "EMBEDDING_FAILED",
569
+ IndexingFailed: "INDEXING_FAILED",
570
+ VectorLimitExceeded: "VECTOR_LIMIT_EXCEEDED",
571
+ Internal: "INTERNAL"
572
+ };
573
+ })(IndexFailure || (IndexFailure = {}));
596
574
  var ModelDataVersionResponse;
597
575
  ((ModelDataVersionResponse2) => {
598
576
  ModelDataVersionResponse2.ChangeType = {
@@ -601,13 +579,6 @@ var ModelDataVersionResponse;
601
579
  Delete: "DELETE"
602
580
  };
603
581
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
604
- var OrgRequest;
605
- ((OrgRequest2) => {
606
- OrgRequest2.Status = {
607
- Active: "ACTIVE",
608
- Suspended: "SUSPENDED"
609
- };
610
- })(OrgRequest || (OrgRequest = {}));
611
582
  var PingResponse;
612
583
  ((PingResponse2) => {
613
584
  PingResponse2.Environment = {
@@ -637,11 +608,6 @@ var RagSearch;
637
608
  })(RagSearch || (RagSearch = {}));
638
609
  var ReadAccessLogResponse;
639
610
  ((ReadAccessLogResponse2) => {
640
- ReadAccessLogResponse2.SubjectType = {
641
- User: "user",
642
- Client: "client",
643
- Org: "org"
644
- };
645
611
  ReadAccessLogResponse2.Action = {
646
612
  Read: "read",
647
613
  List: "list",
@@ -711,8 +677,7 @@ var SchemaRequest;
711
677
  Record: "record",
712
678
  Document: "document",
713
679
  User: "user",
714
- Org: "org",
715
- Client: "client"
680
+ Entity: "entity"
716
681
  };
717
682
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
718
683
  })(SchemaRequest || (SchemaRequest = {}));
@@ -735,8 +700,7 @@ var SchemaResponse;
735
700
  Record: "record",
736
701
  Document: "document",
737
702
  User: "user",
738
- Org: "org",
739
- Client: "client"
703
+ Entity: "entity"
740
704
  };
741
705
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
742
706
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2291,7 +2255,7 @@ function withNoOpAuthProvider(options) {
2291
2255
  authProvider: new NoOpAuthProvider()
2292
2256
  };
2293
2257
  }
2294
- function handleNonStatusCodeError(error, rawResponse, method, path) {
2258
+ function handleNonStatusCodeError(error, rawResponse, method, path2) {
2295
2259
  switch (error.reason) {
2296
2260
  case "non-json":
2297
2261
  throw new VectrosError({
@@ -2305,7 +2269,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
2305
2269
  rawResponse
2306
2270
  });
2307
2271
  case "timeout":
2308
- throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
2272
+ throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path2}.`, {
2309
2273
  cause: error.cause
2310
2274
  });
2311
2275
  case "unknown":
@@ -2377,7 +2341,7 @@ var AuthClient = class {
2377
2341
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2378
2342
  }
2379
2343
  /**
2380
- * Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId`, plus optional `clientId`) within a `contextId` for the primary accounting query; `resourceId` within a `contextId` for 'who read this record'; `callerKeyId` for 'what did this credential read' (account-wide forensic); or `contextId` alone to enumerate a whole context. `from`/`to` bound the time window. Results are scoped to your account, derived from your token — never from input. Requires the `access-log:r` scope.
2344
+ * Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId`) within a `contextId` for the primary accounting query; `resourceId` within a `contextId` for 'who read this record'; `callerKeyId` for 'what did this credential read' (account-wide forensic); or `contextId` alone to enumerate a whole context. `from`/`to` bound the time window. Results are scoped to your account, derived from your token — never from input. Requires the `access-log:r` scope.
2381
2345
  *
2382
2346
  * @param {Vectros.GetAccessLogRequest} request
2383
2347
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2390,7 +2354,6 @@ var AuthClient = class {
2390
2354
  * subjectType: "user",
2391
2355
  * subjectId: "user_abc123",
2392
2356
  * contextId: "ctx_intake",
2393
- * clientId: "client_xyz789",
2394
2357
  * action: "read",
2395
2358
  * callerKeyId: "key_abc123",
2396
2359
  * resourceType: "intake_form",
@@ -2405,7 +2368,6 @@ var AuthClient = class {
2405
2368
  subjectType,
2406
2369
  subjectId,
2407
2370
  contextId,
2408
- clientId,
2409
2371
  from: from_,
2410
2372
  to,
2411
2373
  action,
@@ -2420,7 +2382,6 @@ var AuthClient = class {
2420
2382
  subjectType,
2421
2383
  subjectId,
2422
2384
  contextId,
2423
- clientId,
2424
2385
  from: from_,
2425
2386
  to,
2426
2387
  action,
@@ -2854,7 +2815,7 @@ var AuthClient = class {
2854
2815
  );
2855
2816
  }
2856
2817
  /**
2857
- * 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). 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` may set only `orgId` and `clientId`; 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.
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). 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.
2858
2819
  *
2859
2820
  * @param {Vectros.CreateAccessProfileRequest} request
2860
2821
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4126,7 +4087,7 @@ var AuthClient = class {
4126
4087
  );
4127
4088
  }
4128
4089
  /**
4129
- * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user, organization, or client. Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4090
+ * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user or identity entity (in any namespace). Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4130
4091
  *
4131
4092
  * @param {Vectros.TokenRequest} request
4132
4093
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4144,7 +4105,7 @@ var AuthClient = class {
4144
4105
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4145
4106
  * },
4146
4107
  * dataScope: {
4147
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4108
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4148
4109
  * }
4149
4110
  * },
4150
4111
  * expiresInSeconds: 3600
@@ -4343,7 +4304,7 @@ var ComplianceClient = class {
4343
4304
  this._options = normalizeClientOptionsWithAuth(options);
4344
4305
  }
4345
4306
  /**
4346
- * Submits a right-to-erasure request for a single end-subject (a user, client, or organization). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4307
+ * Submits a right-to-erasure request for a single end-subject (a user, or an identity entity in any namespace). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4347
4308
  *
4348
4309
  * @param {Vectros.ErasureRequest} request
4349
4310
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4594,7 +4555,7 @@ var DocumentsClient = class {
4594
4555
  this._options = normalizeClientOptionsWithAuth(options);
4595
4556
  }
4596
4557
  /**
4597
- * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId`, `orgId`, `clientId`, or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4558
+ * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId` or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4598
4559
  *
4599
4560
  * @param {Vectros.ListDocumentsRequest} request
4600
4561
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4602,8 +4563,6 @@ var DocumentsClient = class {
4602
4563
  * @example
4603
4564
  * await client.documents.listDocuments({
4604
4565
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4605
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4606
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4607
4566
  * scope: "group:eng-team",
4608
4567
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4609
4568
  * startFrom: "doc_prev123"
@@ -4613,11 +4572,9 @@ var DocumentsClient = class {
4613
4572
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4614
4573
  }
4615
4574
  async __listDocuments(request = {}, requestOptions) {
4616
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4575
+ const { userId, scope, folderId, startFrom, limit } = request;
4617
4576
  const _queryParams = {
4618
4577
  userId,
4619
- orgId,
4620
- clientId,
4621
4578
  scope,
4622
4579
  folderId,
4623
4580
  startFrom,
@@ -5350,7 +5307,7 @@ var FoldersClient = class {
5350
5307
  this._options = normalizeClientOptionsWithAuth(options);
5351
5308
  }
5352
5309
  /**
5353
- * Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId`, `orgId`, or `clientId`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
5310
+ * Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId` or `scope`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
5354
5311
  *
5355
5312
  * @param {Vectros.ListFoldersRequest} request
5356
5313
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5358,9 +5315,8 @@ var FoldersClient = class {
5358
5315
  * @example
5359
5316
  * await client.folders.listFolders({
5360
5317
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5361
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5362
5318
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5363
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5319
+ * scope: "group:eng-team",
5364
5320
  * startFrom: "fld_prev123"
5365
5321
  * })
5366
5322
  */
@@ -5368,12 +5324,11 @@ var FoldersClient = class {
5368
5324
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5369
5325
  }
5370
5326
  async __listFolders(request = {}, requestOptions) {
5371
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5327
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5372
5328
  const _queryParams = {
5373
5329
  parentFolderId,
5374
- orgId,
5375
5330
  userId,
5376
- clientId,
5331
+ scope,
5377
5332
  startFrom,
5378
5333
  limit
5379
5334
  };
@@ -5659,7 +5614,7 @@ var FoldersClient = class {
5659
5614
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5660
5615
  }
5661
5616
  /**
5662
- * Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `orgId`, `clientId`) are applied when present and left unchanged when omitted; sending any of these as null is rejected, because clearing a field is not supported in this release (omit it instead). `slug` and `parentFolderId` are immutable — a folder cannot be re-slugged or moved via the API — and the request is rejected if either is present. Pass `expectedVersion` for optimistic concurrency (you get a 409 if the folder changed since you last read it). Requires the `folders:u` scope.
5617
+ * Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `scopes`) are applied when present and left unchanged when omitted; sending any of these as null is rejected, because clearing a field is not supported in this release (omit it instead). `slug` and `parentFolderId` are immutable — a folder cannot be re-slugged or moved via the API — and the request is rejected if either is present. Pass `expectedVersion` for optimistic concurrency (you get a 409 if the folder changed since you last read it). Requires the `folders:u` scope.
5663
5618
  *
5664
5619
  * @param {Vectros.PatchFolderRequest} request
5665
5620
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5792,54 +5747,48 @@ var IdentityClient = class {
5792
5747
  this._options = normalizeClientOptionsWithAuth(options);
5793
5748
  }
5794
5749
  /**
5795
- * Returns a paginated list of clients in your account. Narrow the results with `orgId` or `userId`, or use `externalId` for an exact lookup by your own identifier. For schema-bound clients, you can also query by a schema-declared lookup field using `type`, `field`, and one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `clients:r` scope.
5750
+ * Returns a paginated list of entities in a namespace. Filter by `userId` (entities owned by a user), by `externalId` (exact lookup by your own identifier), or by `scope` (`scope=<namespace>:<value>` — entities that have that value as a parent, e.g. `scope=org:6ba7...`). Naming this namespace's own name in `scope` resolves the entity itself (`scope=team:6ba7...` on `/v1/entities/team` returns that team), since an entity is always in its own scope. `userId` and `scope` can be combined to narrow on both dimensions at once; `externalId` identifies a single entity and cannot be combined with either. Requires the `entities:r:<namespace>` scope.
5796
5751
  *
5797
- * @param {Vectros.ListClientsRequest} request
5752
+ * @param {Vectros.ListEntitiesRequest} request
5798
5753
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5799
5754
  *
5800
5755
  * @example
5801
- * await client.identity.listClients({
5802
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5803
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5804
- * externalId: "patient_789",
5805
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5806
- * type: "client_v1",
5807
- * field: "industry",
5808
- * value: "healthcare",
5809
- * prefix: "health"
5756
+ * await client.identity.listEntities({
5757
+ * namespace: "team"
5810
5758
  * })
5811
5759
  */
5812
- listClients(request = {}, requestOptions) {
5813
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5760
+ listEntities(request, requestOptions) {
5761
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5814
5762
  }
5815
- async __listClients(request = {}, requestOptions) {
5763
+ async __listEntities(request, requestOptions) {
5816
5764
  const {
5817
- orgId,
5765
+ namespace,
5818
5766
  userId,
5819
5767
  externalId,
5820
- startFrom,
5821
- limit,
5768
+ scope,
5822
5769
  type: type_,
5823
5770
  field,
5824
5771
  value,
5825
5772
  from: from_,
5826
5773
  to,
5827
5774
  prefix,
5828
- order
5775
+ order,
5776
+ startFrom,
5777
+ limit
5829
5778
  } = request;
5830
5779
  const _queryParams = {
5831
- orgId,
5832
5780
  userId,
5833
5781
  externalId,
5834
- startFrom,
5835
- limit,
5782
+ scope,
5836
5783
  type: type_,
5837
5784
  field,
5838
5785
  value,
5839
5786
  from: from_,
5840
5787
  to,
5841
5788
  prefix,
5842
- order: order != null ? order : void 0
5789
+ order: order != null ? order : void 0,
5790
+ startFrom,
5791
+ limit
5843
5792
  };
5844
5793
  const _authRequest = await this._options.authProvider.getAuthRequest();
5845
5794
  const _headers = mergeHeaders(
@@ -5850,7 +5799,7 @@ var IdentityClient = class {
5850
5799
  const _response = await fetcher({
5851
5800
  url: url_exports.join(
5852
5801
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5853
- "v1/clients"
5802
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5854
5803
  ),
5855
5804
  method: "GET",
5856
5805
  headers: _headers,
@@ -5871,12 +5820,12 @@ var IdentityClient = class {
5871
5820
  rawResponse: _response.rawResponse
5872
5821
  });
5873
5822
  }
5874
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5823
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5875
5824
  }
5876
5825
  /**
5877
- * Creates a new client identity in your account. This call is idempotent on `externalId`: if a client with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing client was returned) tells the two apart. To overwrite an existing client's content instead of returning it unchanged, set `?upsert=true` (this also requires the `clients:u` scope). Requires the `clients:c` scope.
5826
+ * Creates a new entity in the given namespace. This call is idempotent on `externalId` within the namespace: if an entity with the same `externalId` already exists, the existing record is returned instead of creating a duplicate (`created: false`, HTTP 200). To overwrite an existing entity's content instead of returning it unchanged, set `?upsert=true` (also requires the `entities:u:<namespace>` scope). The namespace must be entity-backed (`org`/`client`, or registered via `POST /v1/namespaces`). Requires the `entities:c:<namespace>` scope.
5878
5827
  *
5879
- * @param {Vectros.CreateClientRequest} request
5828
+ * @param {Vectros.CreateEntityRequest} request
5880
5829
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5881
5830
  *
5882
5831
  * @throws {@link Vectros.BadRequestError}
@@ -5884,17 +5833,18 @@ var IdentityClient = class {
5884
5833
  * @throws {@link Vectros.TooManyRequestsError}
5885
5834
  *
5886
5835
  * @example
5887
- * await client.identity.createClient({
5836
+ * await client.identity.createEntity({
5837
+ * namespace: "team",
5888
5838
  * body: {
5889
- * externalId: "patient_789"
5839
+ * externalId: "team_eng_platform"
5890
5840
  * }
5891
5841
  * })
5892
5842
  */
5893
- createClient(request, requestOptions) {
5894
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5843
+ createEntity(request, requestOptions) {
5844
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5895
5845
  }
5896
- async __createClient(request, requestOptions) {
5897
- const { upsert, body: _body } = request;
5846
+ async __createEntity(request, requestOptions) {
5847
+ const { namespace, upsert, body: _body } = request;
5898
5848
  const _queryParams = {
5899
5849
  upsert
5900
5850
  };
@@ -5907,7 +5857,7 @@ var IdentityClient = class {
5907
5857
  const _response = await fetcher({
5908
5858
  url: url_exports.join(
5909
5859
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5910
- "v1/clients"
5860
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5911
5861
  ),
5912
5862
  method: "POST",
5913
5863
  headers: _headers,
@@ -5940,26 +5890,27 @@ var IdentityClient = class {
5940
5890
  });
5941
5891
  }
5942
5892
  }
5943
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5893
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5944
5894
  }
5945
5895
  /**
5946
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5896
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5947
5897
  *
5948
- * @param {Vectros.GetClientRequest} request
5898
+ * @param {Vectros.GetEntityRequest} request
5949
5899
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5950
5900
  *
5951
5901
  * @throws {@link Vectros.NotFoundError}
5952
5902
  *
5953
5903
  * @example
5954
- * await client.identity.getClient({
5955
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5904
+ * await client.identity.getEntity({
5905
+ * namespace: "team",
5906
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5956
5907
  * })
5957
5908
  */
5958
- getClient(request, requestOptions) {
5959
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5909
+ getEntity(request, requestOptions) {
5910
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5960
5911
  }
5961
- async __getClient(request, requestOptions) {
5962
- const { id } = request;
5912
+ async __getEntity(request, requestOptions) {
5913
+ const { namespace, id } = request;
5963
5914
  const _authRequest = await this._options.authProvider.getAuthRequest();
5964
5915
  const _headers = mergeHeaders(
5965
5916
  _authRequest.headers,
@@ -5969,7 +5920,7 @@ var IdentityClient = class {
5969
5920
  const _response = await fetcher({
5970
5921
  url: url_exports.join(
5971
5922
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5972
- `v1/clients/${url_exports.encodePathParam(id)}`
5923
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5973
5924
  ),
5974
5925
  method: "GET",
5975
5926
  headers: _headers,
@@ -5995,30 +5946,31 @@ var IdentityClient = class {
5995
5946
  });
5996
5947
  }
5997
5948
  }
5998
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5949
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
5999
5950
  }
6000
5951
  /**
6001
- * Updates mutable fields on an existing client. Omitted fields are preserved (a null does not clear a field); when `payload` is supplied it replaces the stored payload in full rather than being deep-merged. Requires the `clients:u` scope.
5952
+ * Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Requires the `entities:u:<namespace>` scope.
6002
5953
  *
6003
- * @param {Vectros.UpdateClientRequest} request
5954
+ * @param {Vectros.UpdateEntityRequest} request
6004
5955
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6005
5956
  *
6006
5957
  * @throws {@link Vectros.NotFoundError}
6007
5958
  * @throws {@link Vectros.TooManyRequestsError}
6008
5959
  *
6009
5960
  * @example
6010
- * await client.identity.updateClient({
5961
+ * await client.identity.updateEntity({
5962
+ * namespace: "team",
6011
5963
  * id: "id",
6012
5964
  * body: {
6013
- * externalId: "patient_789"
5965
+ * externalId: "team_eng_platform"
6014
5966
  * }
6015
5967
  * })
6016
5968
  */
6017
- updateClient(request, requestOptions) {
6018
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5969
+ updateEntity(request, requestOptions) {
5970
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6019
5971
  }
6020
- async __updateClient(request, requestOptions) {
6021
- const { id, body: _body } = request;
5972
+ async __updateEntity(request, requestOptions) {
5973
+ const { namespace, id, body: _body } = request;
6022
5974
  const _authRequest = await this._options.authProvider.getAuthRequest();
6023
5975
  const _headers = mergeHeaders(
6024
5976
  _authRequest.headers,
@@ -6028,7 +5980,7 @@ var IdentityClient = class {
6028
5980
  const _response = await fetcher({
6029
5981
  url: url_exports.join(
6030
5982
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6031
- `v1/clients/${url_exports.encodePathParam(id)}`
5983
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6032
5984
  ),
6033
5985
  method: "PUT",
6034
5986
  headers: _headers,
@@ -6059,27 +6011,28 @@ var IdentityClient = class {
6059
6011
  });
6060
6012
  }
6061
6013
  }
6062
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6014
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6063
6015
  }
6064
6016
  /**
6065
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6017
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6066
6018
  *
6067
- * @param {Vectros.DeleteClientRequest} request
6019
+ * @param {Vectros.DeleteEntityRequest} request
6068
6020
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6069
6021
  *
6070
6022
  * @throws {@link Vectros.NotFoundError}
6071
6023
  * @throws {@link Vectros.TooManyRequestsError}
6072
6024
  *
6073
6025
  * @example
6074
- * await client.identity.deleteClient({
6026
+ * await client.identity.deleteEntity({
6027
+ * namespace: "team",
6075
6028
  * id: "id"
6076
6029
  * })
6077
6030
  */
6078
- deleteClient(request, requestOptions) {
6079
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6031
+ deleteEntity(request, requestOptions) {
6032
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6080
6033
  }
6081
- async __deleteClient(request, requestOptions) {
6082
- const { id } = request;
6034
+ async __deleteEntity(request, requestOptions) {
6035
+ const { namespace, id } = request;
6083
6036
  const _authRequest = await this._options.authProvider.getAuthRequest();
6084
6037
  const _headers = mergeHeaders(
6085
6038
  _authRequest.headers,
@@ -6089,7 +6042,7 @@ var IdentityClient = class {
6089
6042
  const _response = await fetcher({
6090
6043
  url: url_exports.join(
6091
6044
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6092
- `v1/clients/${url_exports.encodePathParam(id)}`
6045
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6093
6046
  ),
6094
6047
  method: "DELETE",
6095
6048
  headers: _headers,
@@ -6117,27 +6070,36 @@ var IdentityClient = class {
6117
6070
  });
6118
6071
  }
6119
6072
  }
6120
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6073
+ return handleNonStatusCodeError(
6074
+ _response.error,
6075
+ _response.rawResponse,
6076
+ "DELETE",
6077
+ "/v1/entities/{namespace}/{id}"
6078
+ );
6121
6079
  }
6122
6080
  /**
6123
- * Body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/clients`. Use this when looking up by a sensitive (blind-indexed) field: the value travels in the request body rather than the URL. The `GET` list rejects a sensitive field's value and directs you here. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6081
+ * Looks up entities in a namespace by a schema-declared field value, with the criteria in the request body instead of the URL. Use this for a sensitive field: the value travels in the body and never appears in the URL. Body equivalent of the `type`/`field`/`value` lookup on `GET /v1/entities/{namespace}`, which rejects sensitive-field values and directs you here. Requires the `entities:r:<namespace>` scope.
6124
6082
  *
6125
- * @param {Vectros.IdentityLookupRequest} request
6083
+ * @param {Vectros.LookupEntitiesRequest} request
6126
6084
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6127
6085
  *
6128
6086
  * @throws {@link Vectros.BadRequestError}
6129
6087
  * @throws {@link Vectros.TooManyRequestsError}
6130
6088
  *
6131
6089
  * @example
6132
- * await client.identity.lookupClients({
6133
- * type: "person_v1",
6134
- * field: "ssn"
6090
+ * await client.identity.lookupEntities({
6091
+ * namespace: "team",
6092
+ * body: {
6093
+ * type: "person_v1",
6094
+ * field: "ssn"
6095
+ * }
6135
6096
  * })
6136
6097
  */
6137
- lookupClients(request, requestOptions) {
6138
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6098
+ lookupEntities(request, requestOptions) {
6099
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6139
6100
  }
6140
- async __lookupClients(request, requestOptions) {
6101
+ async __lookupEntities(request, requestOptions) {
6102
+ const { namespace, body: _body } = request;
6141
6103
  const _authRequest = await this._options.authProvider.getAuthRequest();
6142
6104
  const _headers = mergeHeaders(
6143
6105
  _authRequest.headers,
@@ -6147,14 +6109,14 @@ var IdentityClient = class {
6147
6109
  const _response = await fetcher({
6148
6110
  url: url_exports.join(
6149
6111
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6150
- "v1/clients/lookup"
6112
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6151
6113
  ),
6152
6114
  method: "POST",
6153
6115
  headers: _headers,
6154
6116
  contentType: "application/json",
6155
6117
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6156
6118
  requestType: "json",
6157
- body: request,
6119
+ body: _body,
6158
6120
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6159
6121
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6160
6122
  abortSignal: requestOptions?.abortSignal,
@@ -6178,26 +6140,32 @@ var IdentityClient = class {
6178
6140
  });
6179
6141
  }
6180
6142
  }
6181
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6143
+ return handleNonStatusCodeError(
6144
+ _response.error,
6145
+ _response.rawResponse,
6146
+ "POST",
6147
+ "/v1/entities/{namespace}/lookup"
6148
+ );
6182
6149
  }
6183
6150
  /**
6184
- * Returns the audit trail of changes to a client, newest first. Identity auditing is always on, so this history is always available; sensitive field values are redacted in each version. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6151
+ * Returns the audit trail of changes made to an entity, newest first. Sensitive field values are redacted in the history. Requires the `entities:r:<namespace>` scope.
6185
6152
  *
6186
- * @param {Vectros.GetClientVersionsRequest} request
6153
+ * @param {Vectros.GetEntityVersionsRequest} request
6187
6154
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6188
6155
  *
6189
6156
  * @throws {@link Vectros.NotFoundError}
6190
6157
  *
6191
6158
  * @example
6192
- * await client.identity.getClientVersions({
6159
+ * await client.identity.getEntityVersions({
6160
+ * namespace: "team",
6193
6161
  * id: "id"
6194
6162
  * })
6195
6163
  */
6196
- getClientVersions(request, requestOptions) {
6197
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6164
+ getEntityVersions(request, requestOptions) {
6165
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6198
6166
  }
6199
- async __getClientVersions(request, requestOptions) {
6200
- const { id, startFrom } = request;
6167
+ async __getEntityVersions(request, requestOptions) {
6168
+ const { namespace, id, startFrom } = request;
6201
6169
  const _queryParams = {
6202
6170
  startFrom
6203
6171
  };
@@ -6210,7 +6178,7 @@ var IdentityClient = class {
6210
6178
  const _response = await fetcher({
6211
6179
  url: url_exports.join(
6212
6180
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6213
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6181
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6214
6182
  ),
6215
6183
  method: "GET",
6216
6184
  headers: _headers,
@@ -6236,174 +6204,31 @@ var IdentityClient = class {
6236
6204
  });
6237
6205
  }
6238
6206
  }
6239
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6240
- }
6241
- /**
6242
- * Returns a paginated list of organizations in your account. Filter by `userId` to return only the organizations owned by a specific user, or by `externalId` for an exact lookup using your own identifier. You can also query schema-declared lookup fields by supplying `type` and `field` together with one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). Requires the `orgs:r` scope.
6243
- *
6244
- * @param {Vectros.ListOrgsRequest} request
6245
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6246
- *
6247
- * @example
6248
- * await client.identity.listOrgs({
6249
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6250
- * externalId: "clinic_001",
6251
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6252
- * type: "org_v1",
6253
- * field: "region",
6254
- * value: "us-east",
6255
- * prefix: "us-"
6256
- * })
6257
- */
6258
- listOrgs(request = {}, requestOptions) {
6259
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6260
- }
6261
- async __listOrgs(request = {}, requestOptions) {
6262
- const {
6263
- userId,
6264
- externalId,
6265
- startFrom,
6266
- limit,
6267
- type: type_,
6268
- field,
6269
- value,
6270
- from: from_,
6271
- to,
6272
- prefix,
6273
- order
6274
- } = request;
6275
- const _queryParams = {
6276
- userId,
6277
- externalId,
6278
- startFrom,
6279
- limit,
6280
- type: type_,
6281
- field,
6282
- value,
6283
- from: from_,
6284
- to,
6285
- prefix,
6286
- order: order != null ? order : void 0
6287
- };
6288
- const _authRequest = await this._options.authProvider.getAuthRequest();
6289
- const _headers = mergeHeaders(
6290
- _authRequest.headers,
6291
- this._options?.headers,
6292
- requestOptions?.headers
6207
+ return handleNonStatusCodeError(
6208
+ _response.error,
6209
+ _response.rawResponse,
6210
+ "GET",
6211
+ "/v1/entities/{namespace}/{id}/versions"
6293
6212
  );
6294
- const _response = await fetcher({
6295
- url: url_exports.join(
6296
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6297
- "v1/orgs"
6298
- ),
6299
- method: "GET",
6300
- headers: _headers,
6301
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6302
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6303
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6304
- abortSignal: requestOptions?.abortSignal,
6305
- fetchFn: this._options?.fetch,
6306
- logging: this._options.logging
6307
- });
6308
- if (_response.ok) {
6309
- return { data: _response.body, rawResponse: _response.rawResponse };
6310
- }
6311
- if (_response.error.reason === "status-code") {
6312
- throw new VectrosError({
6313
- statusCode: _response.error.statusCode,
6314
- body: _response.error.body,
6315
- rawResponse: _response.rawResponse
6316
- });
6317
- }
6318
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6319
6213
  }
6320
6214
  /**
6321
- * Creates a new organization in your account. This call is idempotent on `externalId`: if an organization with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing organization was returned) tells the two apart. To overwrite an existing organization's content instead of returning it unchanged, set `?upsert=true` (this also requires the `orgs:u` scope). Requires the `orgs:c` scope.
6215
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6322
6216
  *
6323
- * @param {Vectros.CreateOrgRequest} request
6324
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6325
- *
6326
- * @throws {@link Vectros.BadRequestError}
6327
- * @throws {@link Vectros.ForbiddenError}
6328
- * @throws {@link Vectros.TooManyRequestsError}
6329
- *
6330
- * @example
6331
- * await client.identity.createOrg({
6332
- * body: {
6333
- * externalId: "clinic_001"
6334
- * }
6335
- * })
6336
- */
6337
- createOrg(request, requestOptions) {
6338
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6339
- }
6340
- async __createOrg(request, requestOptions) {
6341
- const { upsert, body: _body } = request;
6342
- const _queryParams = {
6343
- upsert
6344
- };
6345
- const _authRequest = await this._options.authProvider.getAuthRequest();
6346
- const _headers = mergeHeaders(
6347
- _authRequest.headers,
6348
- this._options?.headers,
6349
- requestOptions?.headers
6350
- );
6351
- const _response = await fetcher({
6352
- url: url_exports.join(
6353
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6354
- "v1/orgs"
6355
- ),
6356
- method: "POST",
6357
- headers: _headers,
6358
- contentType: "application/json",
6359
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6360
- requestType: "json",
6361
- body: _body,
6362
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6363
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6364
- abortSignal: requestOptions?.abortSignal,
6365
- fetchFn: this._options?.fetch,
6366
- logging: this._options.logging
6367
- });
6368
- if (_response.ok) {
6369
- return { data: _response.body, rawResponse: _response.rawResponse };
6370
- }
6371
- if (_response.error.reason === "status-code") {
6372
- switch (_response.error.statusCode) {
6373
- case 400:
6374
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6375
- case 403:
6376
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6377
- case 429:
6378
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6379
- default:
6380
- throw new VectrosError({
6381
- statusCode: _response.error.statusCode,
6382
- body: _response.error.body,
6383
- rawResponse: _response.rawResponse
6384
- });
6385
- }
6386
- }
6387
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6388
- }
6389
- /**
6390
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6391
- *
6392
- * @param {Vectros.GetOrgRequest} request
6217
+ * @param {Vectros.GetNamespaceRequest} request
6393
6218
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6394
6219
  *
6395
6220
  * @throws {@link Vectros.NotFoundError}
6396
6221
  *
6397
6222
  * @example
6398
- * await client.identity.getOrg({
6399
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6223
+ * await client.identity.getNamespace({
6224
+ * namespace: "team"
6400
6225
  * })
6401
6226
  */
6402
- getOrg(request, requestOptions) {
6403
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6227
+ getNamespace(request, requestOptions) {
6228
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6404
6229
  }
6405
- async __getOrg(request, requestOptions) {
6406
- const { id } = request;
6230
+ async __getNamespace(request, requestOptions) {
6231
+ const { namespace } = request;
6407
6232
  const _authRequest = await this._options.authProvider.getAuthRequest();
6408
6233
  const _headers = mergeHeaders(
6409
6234
  _authRequest.headers,
@@ -6413,7 +6238,7 @@ var IdentityClient = class {
6413
6238
  const _response = await fetcher({
6414
6239
  url: url_exports.join(
6415
6240
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6416
- `v1/orgs/${url_exports.encodePathParam(id)}`
6241
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6417
6242
  ),
6418
6243
  method: "GET",
6419
6244
  headers: _headers,
@@ -6439,30 +6264,31 @@ var IdentityClient = class {
6439
6264
  });
6440
6265
  }
6441
6266
  }
6442
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6267
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6443
6268
  }
6444
6269
  /**
6445
- * Updates the mutable fields of an organization. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied rather than deep-merged. Requires the `orgs:u` scope.
6270
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
6446
6271
  *
6447
- * @param {Vectros.UpdateOrgRequest} request
6272
+ * @param {Vectros.UpdateNamespaceRequest} request
6448
6273
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6449
6274
  *
6275
+ * @throws {@link Vectros.ForbiddenError}
6450
6276
  * @throws {@link Vectros.NotFoundError}
6451
6277
  * @throws {@link Vectros.TooManyRequestsError}
6452
6278
  *
6453
6279
  * @example
6454
- * await client.identity.updateOrg({
6455
- * id: "id",
6280
+ * await client.identity.updateNamespace({
6281
+ * namespace: "team",
6456
6282
  * body: {
6457
- * externalId: "clinic_001"
6283
+ * namespace: "team"
6458
6284
  * }
6459
6285
  * })
6460
6286
  */
6461
- updateOrg(request, requestOptions) {
6462
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6287
+ updateNamespace(request, requestOptions) {
6288
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6463
6289
  }
6464
- async __updateOrg(request, requestOptions) {
6465
- const { id, body: _body } = request;
6290
+ async __updateNamespace(request, requestOptions) {
6291
+ const { namespace, body: _body } = request;
6466
6292
  const _authRequest = await this._options.authProvider.getAuthRequest();
6467
6293
  const _headers = mergeHeaders(
6468
6294
  _authRequest.headers,
@@ -6472,7 +6298,7 @@ var IdentityClient = class {
6472
6298
  const _response = await fetcher({
6473
6299
  url: url_exports.join(
6474
6300
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6475
- `v1/orgs/${url_exports.encodePathParam(id)}`
6301
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6476
6302
  ),
6477
6303
  method: "PUT",
6478
6304
  headers: _headers,
@@ -6491,6 +6317,8 @@ var IdentityClient = class {
6491
6317
  }
6492
6318
  if (_response.error.reason === "status-code") {
6493
6319
  switch (_response.error.statusCode) {
6320
+ case 403:
6321
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6494
6322
  case 404:
6495
6323
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6496
6324
  case 429:
@@ -6503,27 +6331,28 @@ var IdentityClient = class {
6503
6331
  });
6504
6332
  }
6505
6333
  }
6506
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6334
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6507
6335
  }
6508
6336
  /**
6509
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6337
+ * 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.
6510
6338
  *
6511
- * @param {Vectros.DeleteOrgRequest} request
6339
+ * @param {Vectros.DeleteNamespaceRequest} request
6512
6340
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6513
6341
  *
6342
+ * @throws {@link Vectros.ForbiddenError}
6514
6343
  * @throws {@link Vectros.NotFoundError}
6515
6344
  * @throws {@link Vectros.TooManyRequestsError}
6516
6345
  *
6517
6346
  * @example
6518
- * await client.identity.deleteOrg({
6519
- * id: "id"
6347
+ * await client.identity.deleteNamespace({
6348
+ * namespace: "team"
6520
6349
  * })
6521
6350
  */
6522
- deleteOrg(request, requestOptions) {
6523
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6351
+ deleteNamespace(request, requestOptions) {
6352
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6524
6353
  }
6525
- async __deleteOrg(request, requestOptions) {
6526
- const { id } = request;
6354
+ async __deleteNamespace(request, requestOptions) {
6355
+ const { namespace } = request;
6527
6356
  const _authRequest = await this._options.authProvider.getAuthRequest();
6528
6357
  const _headers = mergeHeaders(
6529
6358
  _authRequest.headers,
@@ -6533,7 +6362,7 @@ var IdentityClient = class {
6533
6362
  const _response = await fetcher({
6534
6363
  url: url_exports.join(
6535
6364
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6536
- `v1/orgs/${url_exports.encodePathParam(id)}`
6365
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6537
6366
  ),
6538
6367
  method: "DELETE",
6539
6368
  headers: _headers,
@@ -6549,6 +6378,8 @@ var IdentityClient = class {
6549
6378
  }
6550
6379
  if (_response.error.reason === "status-code") {
6551
6380
  switch (_response.error.statusCode) {
6381
+ case 403:
6382
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6552
6383
  case 404:
6553
6384
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6554
6385
  case 429:
@@ -6561,27 +6392,26 @@ var IdentityClient = class {
6561
6392
  });
6562
6393
  }
6563
6394
  }
6564
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6395
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6565
6396
  }
6566
6397
  /**
6567
- * Looks up organizations by a schema-declared field value, with the search criteria sent in the request body instead of the URL. Use this when looking up by a sensitive field: the value travels in the body and is never exposed in the URL. This is the body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/orgs`, which rejects sensitive-field values and directs you here. Returns a `{data, nextCursor}` envelope. Requires the `orgs:r` scope.
6398
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6568
6399
  *
6569
- * @param {Vectros.IdentityLookupRequest} request
6400
+ * @param {Vectros.ListNamespacesRequest} request
6570
6401
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6571
6402
  *
6572
- * @throws {@link Vectros.BadRequestError}
6573
- * @throws {@link Vectros.TooManyRequestsError}
6574
- *
6575
6403
  * @example
6576
- * await client.identity.lookupOrgs({
6577
- * type: "person_v1",
6578
- * field: "ssn"
6579
- * })
6404
+ * await client.identity.listNamespaces()
6580
6405
  */
6581
- lookupOrgs(request, requestOptions) {
6582
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6406
+ listNamespaces(request = {}, requestOptions) {
6407
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6583
6408
  }
6584
- async __lookupOrgs(request, requestOptions) {
6409
+ async __listNamespaces(request = {}, requestOptions) {
6410
+ const { startFrom, limit } = request;
6411
+ const _queryParams = {
6412
+ startFrom,
6413
+ limit
6414
+ };
6585
6415
  const _authRequest = await this._options.authProvider.getAuthRequest();
6586
6416
  const _headers = mergeHeaders(
6587
6417
  _authRequest.headers,
@@ -6591,14 +6421,11 @@ var IdentityClient = class {
6591
6421
  const _response = await fetcher({
6592
6422
  url: url_exports.join(
6593
6423
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6594
- "v1/orgs/lookup"
6424
+ "v1/namespaces"
6595
6425
  ),
6596
- method: "POST",
6426
+ method: "GET",
6597
6427
  headers: _headers,
6598
- contentType: "application/json",
6599
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6600
- requestType: "json",
6601
- body: request,
6428
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6602
6429
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6603
6430
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6604
6431
  abortSignal: requestOptions?.abortSignal,
@@ -6609,42 +6436,33 @@ var IdentityClient = class {
6609
6436
  return { data: _response.body, rawResponse: _response.rawResponse };
6610
6437
  }
6611
6438
  if (_response.error.reason === "status-code") {
6612
- switch (_response.error.statusCode) {
6613
- case 400:
6614
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6615
- case 429:
6616
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6617
- default:
6618
- throw new VectrosError({
6619
- statusCode: _response.error.statusCode,
6620
- body: _response.error.body,
6621
- rawResponse: _response.rawResponse
6622
- });
6623
- }
6439
+ throw new VectrosError({
6440
+ statusCode: _response.error.statusCode,
6441
+ body: _response.error.body,
6442
+ rawResponse: _response.rawResponse
6443
+ });
6624
6444
  }
6625
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6445
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6626
6446
  }
6627
6447
  /**
6628
- * Returns the audit trail of changes made to an organization, newest first. Version history is always recorded for identity entities, and sensitive field values are redacted in the history. Requires the `orgs:r` scope.
6448
+ * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
6629
6449
  *
6630
- * @param {Vectros.GetOrgVersionsRequest} request
6450
+ * @param {Vectros.NamespaceRequest} request
6631
6451
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6632
6452
  *
6633
- * @throws {@link Vectros.NotFoundError}
6453
+ * @throws {@link Vectros.BadRequestError}
6454
+ * @throws {@link Vectros.ForbiddenError}
6455
+ * @throws {@link Vectros.TooManyRequestsError}
6634
6456
  *
6635
6457
  * @example
6636
- * await client.identity.getOrgVersions({
6637
- * id: "id"
6458
+ * await client.identity.registerNamespace({
6459
+ * namespace: "team"
6638
6460
  * })
6639
6461
  */
6640
- getOrgVersions(request, requestOptions) {
6641
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6462
+ registerNamespace(request, requestOptions) {
6463
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6642
6464
  }
6643
- async __getOrgVersions(request, requestOptions) {
6644
- const { id, startFrom } = request;
6645
- const _queryParams = {
6646
- startFrom
6647
- };
6465
+ async __registerNamespace(request, requestOptions) {
6648
6466
  const _authRequest = await this._options.authProvider.getAuthRequest();
6649
6467
  const _headers = mergeHeaders(
6650
6468
  _authRequest.headers,
@@ -6654,11 +6472,14 @@ var IdentityClient = class {
6654
6472
  const _response = await fetcher({
6655
6473
  url: url_exports.join(
6656
6474
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6657
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6475
+ "v1/namespaces"
6658
6476
  ),
6659
- method: "GET",
6477
+ method: "POST",
6660
6478
  headers: _headers,
6661
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6479
+ contentType: "application/json",
6480
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6481
+ requestType: "json",
6482
+ body: request,
6662
6483
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6663
6484
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6664
6485
  abortSignal: requestOptions?.abortSignal,
@@ -6670,8 +6491,12 @@ var IdentityClient = class {
6670
6491
  }
6671
6492
  if (_response.error.reason === "status-code") {
6672
6493
  switch (_response.error.statusCode) {
6673
- case 404:
6674
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6494
+ case 400:
6495
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6496
+ case 403:
6497
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6498
+ case 429:
6499
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6675
6500
  default:
6676
6501
  throw new VectrosError({
6677
6502
  statusCode: _response.error.statusCode,
@@ -6680,7 +6505,7 @@ var IdentityClient = class {
6680
6505
  });
6681
6506
  }
6682
6507
  }
6683
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6508
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6684
6509
  }
6685
6510
  /**
6686
6511
  * Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope.
@@ -7557,7 +7382,7 @@ var RecordsClient = class {
7557
7382
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7558
7383
  }
7559
7384
  /**
7560
- * Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `orgId`, `clientId`, `scope`) further narrow the type and folder modes; the `recent` feed is standalone and ignores all filters. Each token only sees the record types it is scoped to read. Requires the `records:r` scope. By default the response returns the indexed projection of each record; set `includePayload=true` to include full payloads.
7385
+ * Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `scope`) further narrow the type and folder modes; the `recent` feed is standalone and ignores all filters. Each token only sees the record types it is scoped to read. Requires the `records:r` scope. By default the response returns the indexed projection of each record; set `includePayload=true` to include full payloads.
7561
7386
  *
7562
7387
  * @param {Vectros.ListRecordsRequest} request
7563
7388
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7567,8 +7392,6 @@ var RecordsClient = class {
7567
7392
  * type: "intake_form",
7568
7393
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7569
7394
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7570
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7571
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7572
7395
  * scope: "group:eng-team",
7573
7396
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7574
7397
  * })
@@ -7577,24 +7400,11 @@ var RecordsClient = class {
7577
7400
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7578
7401
  }
7579
7402
  async __listRecords(request = {}, requestOptions) {
7580
- const {
7581
- type: type_,
7582
- folderId,
7583
- userId,
7584
- orgId,
7585
- clientId,
7586
- scope,
7587
- startFrom,
7588
- limit,
7589
- includePayload,
7590
- recent
7591
- } = request;
7403
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7592
7404
  const _queryParams = {
7593
7405
  type: type_,
7594
7406
  folderId,
7595
7407
  userId,
7596
- orgId,
7597
- clientId,
7598
7408
  scope,
7599
7409
  startFrom,
7600
7410
  limit,
@@ -7894,7 +7704,7 @@ var RecordsClient = class {
7894
7704
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7895
7705
  }
7896
7706
  /**
7897
- * Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `orgId`, `clientId`) are set when present and left unchanged when omitted; sending a top-level field as null is rejected (clearing a top-level field is not supported in this release — omit it instead). `typeName`, `schemaId`, `externalId`, and `indexMode` are immutable and rejected if present. The merged result is validated against the schema. Pass `expectedVersion` to make the patch conditional (optimistic concurrency, 409 on conflict). Requires the `records:u:<type>` scope.
7707
+ * Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `scopes`) are set when present and left unchanged when omitted; sending a top-level field as null is rejected (clearing a top-level field is not supported in this release — omit it instead). `typeName`, `schemaId`, `externalId`, and `indexMode` are immutable and rejected if present. The merged result is validated against the schema. Pass `expectedVersion` to make the patch conditional (optimistic concurrency, 409 on conflict). Requires the `records:u:<type>` scope.
7898
7708
  *
7899
7709
  * @param {Vectros.PatchRecordRequest} request
7900
7710
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8220,7 +8030,7 @@ var SchemasClient = class {
8220
8030
  this._options = normalizeClientOptionsWithAuth(options);
8221
8031
  }
8222
8032
  /**
8223
- * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `orgId` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (user, org, or client) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
8033
+ * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (`user` or `entity`) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
8224
8034
  *
8225
8035
  * @param {Vectros.ListSchemasRequest} request
8226
8036
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8228,7 +8038,7 @@ var SchemasClient = class {
8228
8038
  * @example
8229
8039
  * await client.schemas.listSchemas({
8230
8040
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8231
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8041
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8232
8042
  * surface: "document",
8233
8043
  * recordType: "intake_form",
8234
8044
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8238,10 +8048,10 @@ var SchemasClient = class {
8238
8048
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8239
8049
  }
8240
8050
  async __listSchemas(request = {}, requestOptions) {
8241
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8051
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8242
8052
  const _queryParams = {
8243
8053
  userId,
8244
- orgId,
8054
+ scope,
8245
8055
  surface,
8246
8056
  recordType,
8247
8057
  startFrom,
@@ -8687,12 +8497,12 @@ var VectrosClient = class {
8687
8497
  get auth() {
8688
8498
  return this._auth ?? (this._auth = new AuthClient(this._options));
8689
8499
  }
8690
- get identity() {
8691
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8692
- }
8693
8500
  get documents() {
8694
8501
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8695
8502
  }
8503
+ get identity() {
8504
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8505
+ }
8696
8506
  get compliance() {
8697
8507
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8698
8508
  }
@@ -8795,8 +8605,8 @@ function warnOnSuboptimalKey(key, log) {
8795
8605
 
8796
8606
  // src/build-info.ts
8797
8607
  var BUILD_INFO = {
8798
- mcpServer: true ? "0.9.0" : "dev",
8799
- sdk: true ? "0.34.0" : "dev"
8608
+ mcpServer: true ? "0.11.0" : "dev",
8609
+ sdk: true ? "0.36.0" : "dev"
8800
8610
  };
8801
8611
 
8802
8612
  // src/log.ts
@@ -9000,31 +8810,45 @@ async function consumeStream(stream, onProgress) {
9000
8810
  }
9001
8811
 
9002
8812
  // src/tools/errors.ts
8813
+ function asErrorBody(body) {
8814
+ if (body && typeof body === "object") return body;
8815
+ return void 0;
8816
+ }
9003
8817
  function toolError(toolName, err, docPointer) {
9004
8818
  let summary = `${toolName} failed`;
9005
8819
  let detail = String(err);
8820
+ let errorCode;
8821
+ let requestId;
9006
8822
  if (err instanceof StreamError) {
9007
8823
  summary = `${toolName} stream error`;
9008
8824
  detail = err.message;
9009
8825
  } else if (err instanceof Error) {
9010
8826
  const e = err;
9011
8827
  detail = e.message;
8828
+ const body = asErrorBody(e.body);
8829
+ if (body) {
8830
+ if (typeof body.message === "string" && body.message.trim().length > 0) detail = body.message;
8831
+ if (typeof body.errorCode === "string" && body.errorCode.length > 0) errorCode = body.errorCode;
8832
+ if (typeof body.requestId === "string" && body.requestId.length > 0) requestId = body.requestId;
8833
+ }
9012
8834
  if (e.statusCode) {
9013
- summary = `${toolName} failed: HTTP ${e.statusCode}`;
8835
+ summary = `${toolName} failed: HTTP ${e.statusCode}${errorCode ? ` (${errorCode})` : ""}`;
9014
8836
  } else if (e.name && e.name !== "Error") {
9015
8837
  summary = `${toolName} failed: ${e.name}`;
9016
8838
  }
9017
8839
  }
9018
- const pointer = docPointer ? `
8840
+ const trailer = (errorCode ? `
8841
+ errorCode: ${errorCode}` : "") + (requestId ? `
8842
+ requestId: ${requestId}` : "") + (docPointer ? `
9019
8843
 
9020
- See: ${docPointer}` : "";
8844
+ See: ${docPointer}` : "");
9021
8845
  return {
9022
8846
  isError: true,
9023
8847
  content: [
9024
8848
  {
9025
8849
  type: "text",
9026
8850
  text: `${summary}
9027
- ${detail}${pointer}`
8851
+ ${detail}${trailer}`
9028
8852
  }
9029
8853
  ]
9030
8854
  };
@@ -9081,10 +8905,8 @@ var inputSchema = {
9081
8905
  ),
9082
8906
  // Ownership.
9083
8907
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9084
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9085
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9086
8908
  scope: z.string().optional().describe(
9087
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
8909
+ '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.'
9088
8910
  ),
9089
8911
  // Date window.
9090
8912
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9103,7 +8925,7 @@ var inputSchema = {
9103
8925
  var hybridSearch = ({ client, log }) => ({
9104
8926
  name: "hybrid_search",
9105
8927
  title: "Hybrid search",
9106
- description: "Search your tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/orgId/clientId), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
8928
+ description: 'Search your tenant\'s indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/scope), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller\'s scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword (BM25) leg matched nothing (all textScores 0) \u2014 typically the default PHRASE mode finding no contiguous match for a long natural-language query. Loosen the keyword leg: shorten the query to its key terms, or set textMode "AND" (all terms, higher precision) or "OR" (any term, broad recall).',
9107
8929
  inputSchema,
9108
8930
  handler: async (args) => {
9109
8931
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9121,8 +8943,6 @@ var hybridSearch = ({ client, log }) => ({
9121
8943
  typeName: args.typeName,
9122
8944
  filters: args.filters,
9123
8945
  userId: args.userId,
9124
- orgId: args.orgId,
9125
- clientId: args.clientId,
9126
8946
  scope: args.scope,
9127
8947
  createdAfter: args.createdAfter,
9128
8948
  createdBefore: args.createdBefore,
@@ -9207,10 +9027,8 @@ var inputSchema2 = {
9207
9027
  ),
9208
9028
  // List-mode args:
9209
9029
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9210
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9211
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9212
9030
  scope: z2.string().optional().describe(
9213
- 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9031
+ '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.'
9214
9032
  ),
9215
9033
  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."),
9216
9034
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9220,7 +9038,7 @@ var inputSchema2 = {
9220
9038
  var recordQuery = ({ client, log }) => ({
9221
9039
  name: "record_query",
9222
9040
  title: "Record query (list or lookup)",
9223
- description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId`/`orgId`/`clientId`.\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9041
+ description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9224
9042
  inputSchema: inputSchema2,
9225
9043
  handler: async (args) => {
9226
9044
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9274,8 +9092,6 @@ var recordQuery = ({ client, log }) => ({
9274
9092
  page = await client.records.listRecords({
9275
9093
  type,
9276
9094
  userId: args.userId,
9277
- orgId: args.orgId,
9278
- clientId: args.clientId,
9279
9095
  scope: args.scope,
9280
9096
  startFrom,
9281
9097
  limit
@@ -9361,7 +9177,7 @@ var inputSchema3 = {
9361
9177
  var recordGet = ({ client, log }) => ({
9362
9178
  name: "record_get",
9363
9179
  title: "Get a record by id or externalId",
9364
- description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window.",
9180
+ description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window. The response carries the record's processing `indexStatus`; when it is FAILED an `indexFailure.code` explains whether the content is still searchable (e.g. VECTOR_LIMIT_EXCEEDED keeps keyword search vs INDEXING_FAILED = not findable at all) \u2014 branch on the `code`, not the message.",
9365
9181
  inputSchema: inputSchema3,
9366
9182
  handler: async (args) => {
9367
9183
  const id = args.id;
@@ -9399,7 +9215,7 @@ import { z as z4 } from "zod";
9399
9215
  var inputSchema4 = {
9400
9216
  type: z4.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9401
9217
  fields: z4.record(z4.string(), z4.unknown()).describe(
9402
- "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values."
9218
+ "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values. Every number must fall within the signed 64-bit range (a value outside it, or with >38 significant digits, is refused with a 400 naming the field) \u2014 send a larger whole number (e.g. a big external id) as a STRING, which stores it exactly and supports exact-match lookup."
9403
9219
  ),
9404
9220
  externalId: z4.string().optional().describe(
9405
9221
  "Stable caller-supplied id. Immutable; unique per type. Re-creating with the same externalId returns the existing record (idempotent) \u2014 use it to make creates safely retryable."
@@ -9410,16 +9226,14 @@ var inputSchema4 = {
9410
9226
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9411
9227
  folderId: z4.string().optional().describe("Group this record into a folder."),
9412
9228
  userId: z4.string().optional().describe("Owning user id."),
9413
- orgId: z4.string().optional().describe("Owning organization id."),
9414
- clientId: z4.string().optional().describe("Associated client id."),
9415
9229
  scopes: z4.array(z4.string()).optional().describe(
9416
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9230
+ '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.'
9417
9231
  )
9418
9232
  };
9419
9233
  var recordCreate = ({ client, log }) => ({
9420
9234
  name: "record_create",
9421
9235
  title: "Create a record",
9422
- description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c.",
9236
+ description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c (and records:r to receive the existing record on a collision).",
9423
9237
  inputSchema: inputSchema4,
9424
9238
  handler: async (args) => {
9425
9239
  const type = args.type;
@@ -9433,8 +9247,6 @@ var recordCreate = ({ client, log }) => ({
9433
9247
  status: args.status,
9434
9248
  folderId: args.folderId,
9435
9249
  userId: args.userId,
9436
- orgId: args.orgId,
9437
- clientId: args.clientId,
9438
9250
  scopes: args.scopes
9439
9251
  }
9440
9252
  });
@@ -9538,10 +9350,8 @@ var inputSchema7 = {
9538
9350
  // answer on a specific owner / folder / type / metadata subset, not just the
9539
9351
  // whole-tenant corpus.
9540
9352
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9541
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9542
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9543
9353
  scope: z7.string().optional().describe(
9544
- 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9354
+ '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.'
9545
9355
  ),
9546
9356
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9547
9357
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9569,8 +9379,6 @@ var ragAsk = ({ client, log }) => ({
9569
9379
  mode: searchArg.mode ?? "HYBRID",
9570
9380
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9571
9381
  userId: searchArg.userId,
9572
- orgId: searchArg.orgId,
9573
- clientId: searchArg.clientId,
9574
9382
  scope: searchArg.scope,
9575
9383
  folderId: searchArg.folderId,
9576
9384
  rootFolderId: searchArg.rootFolderId,
@@ -9716,32 +9524,32 @@ var inputSchema9 = {
9716
9524
  userId: z9.string().optional().describe(
9717
9525
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9718
9526
  ),
9719
- orgId: z9.string().optional().describe(
9720
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9527
+ scope: z9.string().optional().describe(
9528
+ '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.'
9721
9529
  ),
9722
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9723
- "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. The identity surfaces (user/org/client) are account-wide. Optional."
9530
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9531
+ "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."
9724
9532
  ),
9725
9533
  recordType: z9.string().optional().describe(
9726
- 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|org|client` for an identity schema. Takes precedence over userId/orgId. Optional.'
9534
+ 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
9727
9535
  )
9728
9536
  };
9729
9537
  var listSchemas = ({ client, log }) => ({
9730
9538
  name: "list_schemas",
9731
9539
  title: "List record schemas",
9732
- description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/org/client \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`orgId`; default returns everything the credential can see.',
9540
+ description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
9733
9541
  inputSchema: inputSchema9,
9734
9542
  handler: async (args) => {
9735
9543
  const userId = args.userId;
9736
- const orgId = args.orgId;
9544
+ const scope = args.scope;
9737
9545
  const surface = args.surface;
9738
9546
  const recordType = args.recordType;
9739
9547
  try {
9740
9548
  const schemas = await drainPages(
9741
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9549
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9742
9550
  );
9743
9551
  log.debug(
9744
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9552
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9745
9553
  "list_schemas ok"
9746
9554
  );
9747
9555
  return {
@@ -9783,7 +9591,7 @@ function isNotAvailable(err) {
9783
9591
  var documentGet = ({ client, log }) => ({
9784
9592
  name: "document_get",
9785
9593
  title: "Get document metadata (and optionally text)",
9786
- description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`.",
9594
+ description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`. When `indexStatus` is FAILED the response also carries `indexFailure` with a machine-readable `code` telling you whether the content is still findable \u2014 e.g. TEXT_INDEX_FAILED / VECTOR_LIMIT_EXCEEDED (one leg still serves it) vs INDEXING_FAILED (not findable by search at all). Branch on `code`, not on the message.",
9787
9595
  inputSchema: inputSchema10,
9788
9596
  handler: async (args) => {
9789
9597
  const documentId = args.documentId;
@@ -9866,10 +9674,8 @@ var inputSchema11 = {
9866
9674
  // List-mode args:
9867
9675
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9868
9676
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9869
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9870
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9871
9677
  scope: z11.string().optional().describe(
9872
- 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9678
+ '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.'
9873
9679
  ),
9874
9680
  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."),
9875
9681
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9879,7 +9685,7 @@ var inputSchema11 = {
9879
9685
  var documentQuery = ({ client, log }) => ({
9880
9686
  name: "document_query",
9881
9687
  title: "Document query (list or lookup)",
9882
- description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`orgId`/`clientId`/`scope`.\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9688
+ description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9883
9689
  inputSchema: inputSchema11,
9884
9690
  handler: async (args) => {
9885
9691
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9939,8 +9745,6 @@ var documentQuery = ({ client, log }) => ({
9939
9745
  page = await client.documents.listDocuments({
9940
9746
  folderId: args.folderId,
9941
9747
  userId: args.userId,
9942
- orgId: args.orgId,
9943
- clientId: args.clientId,
9944
9748
  scope: args.scope,
9945
9749
  startFrom,
9946
9750
  limit
@@ -9981,8 +9785,9 @@ var inputSchema12 = {
9981
9785
  "Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
9982
9786
  ),
9983
9787
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9984
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9985
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9788
+ scopes: z12.array(z12.string()).optional().describe(
9789
+ '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).'
9790
+ ),
9986
9791
  expectedVersion: z12.number().int().optional().describe(
9987
9792
  "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."
9988
9793
  )
@@ -10002,8 +9807,7 @@ var documentUpdate = ({ client, log }) => ({
10002
9807
  const folderId = args.folderId;
10003
9808
  const status = args.status;
10004
9809
  const userId = args.userId;
10005
- const orgId = args.orgId;
10006
- const clientId = args.clientId;
9810
+ const scopes = args.scopes;
10007
9811
  const expectedVersion = args.expectedVersion;
10008
9812
  try {
10009
9813
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10015,8 +9819,7 @@ var documentUpdate = ({ client, log }) => ({
10015
9819
  if (folderId !== void 0) body.folderId = folderId;
10016
9820
  if (status !== void 0) body.status = status;
10017
9821
  if (userId !== void 0) body.userId = userId;
10018
- if (orgId !== void 0) body.orgId = orgId;
10019
- if (clientId !== void 0) body.clientId = clientId;
9822
+ if (scopes !== void 0) body.scopes = scopes;
10020
9823
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10021
9824
  const updated = await client.documents.patchDocument({
10022
9825
  id: resolved.id,
@@ -10066,8 +9869,9 @@ var inputSchema14 = {
10066
9869
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10067
9870
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10068
9871
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10069
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10070
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9872
+ scope: z14.string().optional().describe(
9873
+ '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.'
9874
+ ),
10071
9875
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10072
9876
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10073
9877
  `List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
@@ -10076,7 +9880,7 @@ var inputSchema14 = {
10076
9880
  var folderQuery = ({ client, log }) => ({
10077
9881
  name: "folder_query",
10078
9882
  title: "Folder query (list or get)",
10079
- description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId`/`orgId`/`clientId`.\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
9883
+ description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
10080
9884
  inputSchema: inputSchema14,
10081
9885
  handler: async (args) => {
10082
9886
  const id = args.id;
@@ -10090,8 +9894,7 @@ var folderQuery = ({ client, log }) => ({
10090
9894
  const page = await client.folders.listFolders({
10091
9895
  parentFolderId: args.parentId,
10092
9896
  userId: args.userId,
10093
- orgId: args.orgId,
10094
- clientId: args.clientId,
9897
+ scope: args.scope,
10095
9898
  startFrom: args.startFrom,
10096
9899
  limit
10097
9900
  });
@@ -10115,16 +9918,14 @@ var inputSchema15 = {
10115
9918
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10116
9919
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10117
9920
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10118
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10119
- clientId: z15.string().optional().describe("Associated client (Vectros UUID)."),
10120
9921
  scopes: z15.array(z15.string()).optional().describe(
10121
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9922
+ '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.'
10122
9923
  )
10123
9924
  };
10124
9925
  var folderCreate = ({ client, log }) => ({
10125
9926
  name: "folder_create",
10126
9927
  title: "Create a folder",
10127
- description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c.",
9928
+ description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c (and folders:r to receive the existing folder on a collision).",
10128
9929
  inputSchema: inputSchema15,
10129
9930
  handler: async (args) => {
10130
9931
  try {
@@ -10135,8 +9936,6 @@ var folderCreate = ({ client, log }) => ({
10135
9936
  parentFolderId: args.parentId,
10136
9937
  slug: args.slug,
10137
9938
  userId: args.userId,
10138
- orgId: args.orgId,
10139
- clientId: args.clientId,
10140
9939
  scopes: args.scopes
10141
9940
  }
10142
9941
  });
@@ -10157,8 +9956,9 @@ var inputSchema16 = {
10157
9956
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10158
9957
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10159
9958
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10160
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10161
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9959
+ scopes: z16.array(z16.string()).optional().describe(
9960
+ '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).'
9961
+ ),
10162
9962
  expectedVersion: z16.number().int().optional().describe(
10163
9963
  "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."
10164
9964
  )
@@ -10173,16 +9973,14 @@ var folderUpdate = ({ client, log }) => ({
10173
9973
  const name = args.name;
10174
9974
  const description = args.description;
10175
9975
  const userId = args.userId;
10176
- const orgId = args.orgId;
10177
- const clientId = args.clientId;
9976
+ const scopes = args.scopes;
10178
9977
  const expectedVersion = args.expectedVersion;
10179
9978
  try {
10180
9979
  const body = {};
10181
9980
  if (name !== void 0) body.name = name;
10182
9981
  if (description !== void 0) body.description = description;
10183
9982
  if (userId !== void 0) body.userId = userId;
10184
- if (orgId !== void 0) body.orgId = orgId;
10185
- if (clientId !== void 0) body.clientId = clientId;
9983
+ if (scopes !== void 0) body.scopes = scopes;
10186
9984
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10187
9985
  const updated = await client.folders.patchFolder({ id, body });
10188
9986
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10226,7 +10024,7 @@ var inputSchema18 = {
10226
10024
  var currentIdentity = ({ log, apiKey, environment }) => ({
10227
10025
  name: "current_identity",
10228
10026
  title: "Current identity (tenant + principal scope)",
10229
- description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, and (for scoped keys) allowedActions + dataScope. Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood. Backend may still be rolling out the extended /v1/ping response shape \u2014 until then this tool returns a minimal shape; richer fields appear automatically as backend ships.",
10027
+ 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>\"). Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood.",
10230
10028
  inputSchema: inputSchema18,
10231
10029
  handler: async () => {
10232
10030
  try {
@@ -10324,7 +10122,7 @@ var inputSchema19 = {
10324
10122
  "Index strategy. HYBRID (BM25 + dense, default; best for general retrieval), SEMANTIC (dense only; concept-driven queries), TEXT (BM25 only; exact-match / keyword), NONE (store-only / archival \u2014 retrievable by id and structured-field lookup but never in search results). Omit to inherit the bound schema's default."
10325
10123
  ),
10326
10124
  externalId: z18.string().optional().describe(
10327
- "Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create."
10125
+ 'Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create. Receiving the existing document back is a read of it and needs documents:r in addition to documents:c; a create-only key gets an "already exists" error instead of the document.'
10328
10126
  ),
10329
10127
  upsert: z18.boolean().optional().describe(
10330
10128
  "When true, re-ingesting an existing externalId OVERWRITES that document and re-indexes the new body (text mode) / re-uploads and re-indexes the new file (file mode), instead of returning the existing one unchanged. This is the curation/re-sync primitive: edit a source, re-ingest with upsert:true, and the search index reflects the new content. Requires the documents:u scope. IMPORTANT: pass the SAME schemaId (and type) you used originally \u2014 externalId is unique WITHIN a type, so omitting schemaId resolves in the untyped namespace and mints a duplicate instead of updating. The response `created` flag confirms which happened (created:true = a new document was minted)."
@@ -10333,12 +10131,12 @@ var inputSchema19 = {
10333
10131
  "Bind this document to a record schema. When set, `payload` is validated against the schema and its lookup fields become directly queryable via document_query (records parity). Resolve a schema id from its type via list_schemas. Omit for an untyped document."
10334
10132
  ),
10335
10133
  payload: z18.record(z18.string(), z18.unknown()).optional().describe(
10336
- "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata."
10134
+ "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata. Every number must fall within the signed 64-bit range \u2014 send a larger whole number as a STRING (stored exactly, exact-match lookup), else the ingest is refused with a 400 naming the field."
10337
10135
  ),
10338
10136
  // Inline text mode (mutually exclusive with filePath):
10339
10137
  text: z18.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10340
10138
  storeText: z18.boolean().optional().describe(
10341
- "Whether the document's text is retained after indexing (default true). Applies to BOTH modes and is fixed at ingest time. Text mode: the ingested body is always retained (this flag is effectively always true \u2014 the body is the document). File mode: true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards the extracted text once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable."
10139
+ "FILE MODE ONLY. Whether the uploaded file's EXTRACTED text is retained after indexing (default true), fixed at ingest. true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards it once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable. NOT accepted with `text`: a text-ingested body is the document itself and is ALWAYS retained, so the backend has no storeText knob on the text path \u2014 passing it with `text` is rejected rather than silently ignored."
10342
10140
  ),
10343
10141
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10344
10142
  filePath: z18.string().min(1).optional().describe(
@@ -10348,16 +10146,14 @@ var inputSchema19 = {
10348
10146
  // Common (both modes):
10349
10147
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10350
10148
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10351
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10352
- clientId: z18.string().optional().describe("Owning client ID. Optional."),
10353
10149
  scopes: z18.array(z18.string()).optional().describe(
10354
- "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10150
+ "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."
10355
10151
  )
10356
10152
  };
10357
10153
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10358
10154
  name: "document_ingest",
10359
10155
  title: "Ingest a new document (text body or file upload)",
10360
- description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText defaults to true and is fixed at ingest: in file mode, false discards the extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained.",
10156
+ description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate \u2014 requires documents:r in addition to documents:c, since being handed the existing document is a read of it). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText is a FILE-MODE knob (default true): false discards the uploaded file's extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained, so storeText is not accepted with `text`.",
10361
10157
  inputSchema: inputSchema19,
10362
10158
  handler: async (args) => {
10363
10159
  const title = args.title;
@@ -10394,14 +10190,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10394
10190
  )
10395
10191
  );
10396
10192
  }
10193
+ if (text && args.storeText !== void 0) {
10194
+ return toolError(
10195
+ "document_ingest",
10196
+ new Error(
10197
+ "`storeText` is not supported with `text` \u2014 a text-ingested body is the document itself and is always retained; the text path has no storeText control. Omit it (text mode), or use `filePath` mode where storeText:false discards the uploaded file's extracted text after indexing."
10198
+ )
10199
+ );
10200
+ }
10397
10201
  const common = {
10398
10202
  folderId: args.folderId,
10399
10203
  payload: args.payload,
10400
10204
  schemaId,
10401
10205
  externalId: args.externalId,
10402
- userId: args.userId,
10403
- orgId: args.orgId,
10404
- clientId: args.clientId
10206
+ userId: args.userId
10405
10207
  };
10406
10208
  try {
10407
10209
  if (text) {
@@ -10508,7 +10310,9 @@ import { z as z19 } from "zod";
10508
10310
  var MCP_DEFAULT_LIMIT5 = 10;
10509
10311
  var MCP_MAX_LIMIT5 = 100;
10510
10312
  var inputSchema20 = {
10511
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10313
+ kind: z19.string().describe(
10314
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10315
+ ),
10512
10316
  externalId: z19.string().optional().describe(
10513
10317
  "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."
10514
10318
  ),
@@ -10527,11 +10331,12 @@ var inputSchema20 = {
10527
10331
  };
10528
10332
  var lookupPrincipal = ({ client, log }) => ({
10529
10333
  name: "lookup_principal",
10530
- title: "Look up a user / org / client identity",
10531
- description: "Resolve a user, org, or client identity. 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.",
10334
+ title: "Look up a user identity or a namespaced identity entity",
10335
+ 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.",
10532
10336
  inputSchema: inputSchema20,
10533
10337
  handler: async (args) => {
10534
10338
  const kind = args.kind;
10339
+ const isUser = kind === "user";
10535
10340
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10536
10341
  const externalId = args.externalId;
10537
10342
  const type = args.type;
@@ -10545,13 +10350,7 @@ var lookupPrincipal = ({ client, log }) => ({
10545
10350
  try {
10546
10351
  let page;
10547
10352
  if (externalId !== void 0) {
10548
- if (kind === "user") {
10549
- page = await client.identity.listUsers({ externalId, limit });
10550
- } else if (kind === "org") {
10551
- page = await client.identity.listOrgs({ externalId, limit });
10552
- } else {
10553
- page = await client.identity.listClients({ externalId, limit });
10554
- }
10353
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10555
10354
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10556
10355
  } else if (field !== void 0) {
10557
10356
  const hasEquality = value !== void 0;
@@ -10580,13 +10379,7 @@ var lookupPrincipal = ({ client, log }) => ({
10580
10379
  );
10581
10380
  }
10582
10381
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10583
- if (kind === "user") {
10584
- page = await client.identity.lookupUsers(req);
10585
- } else if (kind === "org") {
10586
- page = await client.identity.lookupOrgs(req);
10587
- } else {
10588
- page = await client.identity.lookupClients(req);
10589
- }
10382
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10590
10383
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10591
10384
  } else {
10592
10385
  return toolError(
@@ -10709,7 +10502,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10709
10502
  name: "identity",
10710
10503
  uri: "vectros://identity",
10711
10504
  title: "Current identity (tenant + principal scope)",
10712
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, environment, principalType, principalKeyId, and (for scoped keys) allowedActions + dataScope. Until backend ships the extended /v1/ping response, returns a minimal derived shape; richer fields appear automatically as backend rolls out.",
10505
+ 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, and (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). The /v1/ping backing call ships this extended shape today.",
10713
10506
  mimeType: "application/json",
10714
10507
  read: async () => {
10715
10508
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -11178,10 +10971,144 @@ function parseToolsEnv(value) {
11178
10971
  return requested;
11179
10972
  }
11180
10973
 
10974
+ // src/resolve-key.ts
10975
+ import { execFile } from "child_process";
10976
+ import { statSync } from "fs";
10977
+ import path from "path";
10978
+ var HELPER_COMMAND = "vectros";
10979
+ var HELPER_TIMEOUT_MS = 1e4;
10980
+ var HELPER_MAX_BUFFER = 64 * 1024;
10981
+ var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
10982
+ var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
10983
+ var DETAIL_MAX_CHARS = 200;
10984
+ async function resolveApiKey(deps = {}) {
10985
+ const env = deps.env ?? process.env;
10986
+ const envKey = env.VECTROS_API_KEY;
10987
+ if (envKey && envKey.trim().length > 0) {
10988
+ return { key: envKey.trim(), source: "env" };
10989
+ }
10990
+ const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
10991
+ if (alias !== void 0 && !ALIAS_RE.test(alias)) {
10992
+ return {
10993
+ source: "none",
10994
+ reason: "bad-alias",
10995
+ detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
10996
+ };
10997
+ }
10998
+ const runHelper = deps.runHelper ?? defaultRunHelper;
10999
+ const outcome = await runHelper({ alias, env });
11000
+ switch (outcome.status) {
11001
+ case "ok":
11002
+ return { key: outcome.secret, source: "keyring", alias };
11003
+ case "cli-absent":
11004
+ return { source: "none", reason: "cli-absent", alias };
11005
+ // Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
11006
+ // seam, so redacting only inside the default implementation would leave any
11007
+ // other implementation's text to reach the fatal log raw. Belongs at the sink.
11008
+ case "no-usable-key":
11009
+ return {
11010
+ source: "none",
11011
+ reason: "no-usable-key",
11012
+ alias,
11013
+ detail: outcome.detail ? redactDetail(outcome.detail) : void 0
11014
+ };
11015
+ case "error":
11016
+ return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
11017
+ }
11018
+ }
11019
+ function noKeyMessage(resolved) {
11020
+ const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
11021
+ switch (resolved.reason) {
11022
+ case "cli-absent":
11023
+ return `no API key: VECTROS_API_KEY is unset and the \`vectros\` CLI is not on PATH. Either ${setEnv}, or install @vectros-ai/cli and run \`vectros switch <alias>\`.`;
11024
+ case "no-usable-key":
11025
+ return `no API key: VECTROS_API_KEY is unset and \`vectros keyring show\` returned no key${resolved.detail ? ` \u2014 ${resolved.detail}` : ""}. Run \`vectros switch <alias>\` to pick an identity, \`vectros keyring doctor\` to inspect the keyring (CLI 0.10.0+), upgrade @vectros-ai/cli if it predates the keyring (0.9.0), or ${setEnv}.`;
11026
+ case "bad-alias":
11027
+ return `invalid VECTROS_KEYRING_ALIAS: ${resolved.detail ?? "not a valid keyring alias"} Run \`vectros keyring list\` to see the entry names, unset it to use the active identity, or ${setEnv}.`;
11028
+ case "helper-failed":
11029
+ return `no API key: VECTROS_API_KEY is unset and the \`vectros keyring show\` helper failed (${resolved.detail ?? "unknown error"}). Upgrade @vectros-ai/cli if it is an old build, or ${setEnv} to bypass the keyring.`;
11030
+ default:
11031
+ return `no API key: ${setEnv}.`;
11032
+ }
11033
+ }
11034
+ function keyringNotice(resolved) {
11035
+ if (resolved.source !== "keyring") return void 0;
11036
+ if (resolved.alias !== void 0) {
11037
+ return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
11038
+ }
11039
+ return {
11040
+ level: "warn",
11041
+ alias: "(active)",
11042
+ message: "resolved API key from the vectros CLI keyring: no entry was named, so this server is running as whatever identity `vectros switch` last made active. Set VECTROS_API_KEY, or VECTROS_KEYRING_ALIAS, to choose deliberately \u2014 `vectros keyring doctor` shows which entry is active and whether it holds a live key."
11043
+ };
11044
+ }
11045
+ function redactDetail(message) {
11046
+ const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
11047
+ return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
11048
+ }
11049
+ function resolveCommandPath(command, env, platform = process.platform) {
11050
+ const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
11051
+ if (!pathVar) return void 0;
11052
+ const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
11053
+ for (const rawDir of pathVar.split(path.delimiter)) {
11054
+ const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
11055
+ if (!dir || !path.isAbsolute(dir)) continue;
11056
+ for (const ext of exts) {
11057
+ const candidate = path.join(dir, command + ext);
11058
+ try {
11059
+ if (statSync(candidate).isFile()) return candidate;
11060
+ } catch {
11061
+ }
11062
+ }
11063
+ }
11064
+ return void 0;
11065
+ }
11066
+ function mapExecResult(err, stdout, stderr = "") {
11067
+ if (!err) {
11068
+ const secret = stdout.trim();
11069
+ return secret ? { status: "ok", secret } : { status: "no-usable-key" };
11070
+ }
11071
+ const code = err.code;
11072
+ if (code === "ENOENT") return { status: "cli-absent" };
11073
+ const detail = redactDetail(stderr.trim() || err.message);
11074
+ if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
11075
+ return { status: "error", detail };
11076
+ }
11077
+ function defaultRunHelper({ alias, env }, deps = {}) {
11078
+ const platform = deps.platform ?? process.platform;
11079
+ const exec = deps.execFileImpl ?? execFile;
11080
+ const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
11081
+ if (!resolved) return Promise.resolve({ status: "cli-absent" });
11082
+ const isWindows = platform === "win32";
11083
+ const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
11084
+ const file = isWindows ? `"${resolved}"` : resolved;
11085
+ return new Promise((resolve2) => {
11086
+ exec(
11087
+ file,
11088
+ args,
11089
+ {
11090
+ env,
11091
+ timeout: HELPER_TIMEOUT_MS,
11092
+ maxBuffer: HELPER_MAX_BUFFER,
11093
+ windowsHide: true,
11094
+ shell: isWindows
11095
+ },
11096
+ (err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
11097
+ );
11098
+ });
11099
+ }
11100
+
11181
11101
  // src/cli-http.ts
11182
11102
  async function main() {
11183
11103
  const log = createLogger2();
11184
- const apiKey = process.env.VECTROS_API_KEY;
11104
+ const resolved = await resolveApiKey();
11105
+ const apiKey = resolved.key;
11106
+ const notice = keyringNotice(resolved);
11107
+ if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
11108
+ if (!apiKey) {
11109
+ log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
11110
+ process.exit(1);
11111
+ }
11185
11112
  const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
11186
11113
  if (apiBaseUrl !== void 0) {
11187
11114
  try {