@vectros-ai/mcp-server 0.9.0 → 0.10.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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/server.ts
4
4
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
5
 
6
- // ../../node_modules/@vectros-ai/sdk/dist/index.mjs
6
+ // node_modules/@vectros-ai/sdk/dist/index.mjs
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
9
9
  for (var name in all)
@@ -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,
@@ -39,15 +39,13 @@ __export(api_exports, {
39
39
  ForbiddenError: () => ForbiddenError,
40
40
  IdentityLookupRequest: () => IdentityLookupRequest,
41
41
  InternalServerError: () => InternalServerError,
42
- ListClientsRequestOrder: () => ListClientsRequestOrder,
43
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
42
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
44
43
  ListUsersRequestOrder: () => ListUsersRequestOrder,
45
44
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
46
45
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
47
46
  ModelDataVersionResponse: () => ModelDataVersionResponse,
48
47
  NotFoundError: () => NotFoundError,
49
48
  NotImplementedError: () => NotImplementedError,
50
- OrgRequest: () => OrgRequest,
51
49
  PaymentRequiredError: () => PaymentRequiredError,
52
50
  PingResponse: () => PingResponse,
53
51
  RagSearch: () => RagSearch,
@@ -288,11 +286,6 @@ var UnauthorizedError = class extends VectrosError {
288
286
  var auth_exports = {};
289
287
  var ErasureRequest;
290
288
  ((ErasureRequest2) => {
291
- ErasureRequest2.SubjectType = {
292
- User: "user",
293
- Client: "client",
294
- Org: "org"
295
- };
296
289
  ErasureRequest2.AuditDisposition = {
297
290
  RetainRedacted: "retain-redacted",
298
291
  Purge: "purge"
@@ -304,11 +297,6 @@ var ExportRequest;
304
297
  Tenant: "tenant",
305
298
  Subject: "subject"
306
299
  };
307
- ExportRequest2.SubjectType = {
308
- User: "user",
309
- Client: "client",
310
- Org: "org"
311
- };
312
300
  ExportRequest2.Format = {
313
301
  Ndjson: "ndjson"
314
302
  };
@@ -347,15 +335,10 @@ var LookupDocumentsRequestOrder = {
347
335
  var folders_exports = {};
348
336
  var identity_exports = {};
349
337
  __export(identity_exports, {
350
- ListClientsRequestOrder: () => ListClientsRequestOrder,
351
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
338
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
352
339
  ListUsersRequestOrder: () => ListUsersRequestOrder
353
340
  });
354
- var ListClientsRequestOrder = {
355
- Asc: "asc",
356
- Desc: "desc"
357
- };
358
- var ListOrgsRequestOrder = {
341
+ var ListEntitiesRequestOrder = {
359
342
  Asc: "asc",
360
343
  Desc: "desc"
361
344
  };
@@ -454,13 +437,6 @@ var ChatMessage;
454
437
  Assistant: "assistant"
455
438
  };
456
439
  })(ChatMessage || (ChatMessage = {}));
457
- var ClientRequest;
458
- ((ClientRequest2) => {
459
- ClientRequest2.Status = {
460
- Active: "ACTIVE",
461
- Suspended: "SUSPENDED"
462
- };
463
- })(ClientRequest || (ClientRequest = {}));
464
440
  var ContentDeltaEvent;
465
441
  ((ContentDeltaEvent2) => {
466
442
  ContentDeltaEvent2.Event = {
@@ -515,6 +491,13 @@ var DoneEvent;
515
491
  Done: "done"
516
492
  };
517
493
  })(DoneEvent || (DoneEvent = {}));
494
+ var EntityRequest;
495
+ ((EntityRequest2) => {
496
+ EntityRequest2.Status = {
497
+ Active: "ACTIVE",
498
+ Suspended: "SUSPENDED"
499
+ };
500
+ })(EntityRequest || (EntityRequest = {}));
518
501
  var ErasureCertificate;
519
502
  ((ErasureCertificate2) => {
520
503
  ErasureCertificate2.AuditDisposition = {
@@ -530,11 +513,6 @@ var ErasureRequestResponse;
530
513
  Completed: "completed",
531
514
  Failed: "failed"
532
515
  };
533
- ErasureRequestResponse2.SubjectType = {
534
- User: "user",
535
- Client: "client",
536
- Org: "org"
537
- };
538
516
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
539
517
  var ErrorEvent;
540
518
  ((ErrorEvent2) => {
@@ -560,11 +538,6 @@ var ExportRequestResponse;
560
538
  Tenant: "tenant",
561
539
  Subject: "subject"
562
540
  };
563
- ExportRequestResponse2.SubjectType = {
564
- User: "user",
565
- Client: "client",
566
- Org: "org"
567
- };
568
541
  })(ExportRequestResponse || (ExportRequestResponse = {}));
569
542
  var FieldDef;
570
543
  ((FieldDef2) => {
@@ -578,13 +551,6 @@ var FieldDef;
578
551
  Object: "object",
579
552
  Reference: "reference"
580
553
  };
581
- FieldDef2.TargetSurface = {
582
- Record: "record",
583
- Document: "document",
584
- User: "user",
585
- Org: "org",
586
- Client: "client"
587
- };
588
554
  })(FieldDef || (FieldDef = {}));
589
555
  var IdentityLookupRequest;
590
556
  ((IdentityLookupRequest2) => {
@@ -601,13 +567,6 @@ var ModelDataVersionResponse;
601
567
  Delete: "DELETE"
602
568
  };
603
569
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
604
- var OrgRequest;
605
- ((OrgRequest2) => {
606
- OrgRequest2.Status = {
607
- Active: "ACTIVE",
608
- Suspended: "SUSPENDED"
609
- };
610
- })(OrgRequest || (OrgRequest = {}));
611
570
  var PingResponse;
612
571
  ((PingResponse2) => {
613
572
  PingResponse2.Environment = {
@@ -637,11 +596,6 @@ var RagSearch;
637
596
  })(RagSearch || (RagSearch = {}));
638
597
  var ReadAccessLogResponse;
639
598
  ((ReadAccessLogResponse2) => {
640
- ReadAccessLogResponse2.SubjectType = {
641
- User: "user",
642
- Client: "client",
643
- Org: "org"
644
- };
645
599
  ReadAccessLogResponse2.Action = {
646
600
  Read: "read",
647
601
  List: "list",
@@ -711,8 +665,7 @@ var SchemaRequest;
711
665
  Record: "record",
712
666
  Document: "document",
713
667
  User: "user",
714
- Org: "org",
715
- Client: "client"
668
+ Entity: "entity"
716
669
  };
717
670
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
718
671
  })(SchemaRequest || (SchemaRequest = {}));
@@ -735,8 +688,7 @@ var SchemaResponse;
735
688
  Record: "record",
736
689
  Document: "document",
737
690
  User: "user",
738
- Org: "org",
739
- Client: "client"
691
+ Entity: "entity"
740
692
  };
741
693
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
742
694
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2291,7 +2243,7 @@ function withNoOpAuthProvider(options) {
2291
2243
  authProvider: new NoOpAuthProvider()
2292
2244
  };
2293
2245
  }
2294
- function handleNonStatusCodeError(error, rawResponse, method, path) {
2246
+ function handleNonStatusCodeError(error, rawResponse, method, path2) {
2295
2247
  switch (error.reason) {
2296
2248
  case "non-json":
2297
2249
  throw new VectrosError({
@@ -2305,7 +2257,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
2305
2257
  rawResponse
2306
2258
  });
2307
2259
  case "timeout":
2308
- throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
2260
+ throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path2}.`, {
2309
2261
  cause: error.cause
2310
2262
  });
2311
2263
  case "unknown":
@@ -2377,7 +2329,7 @@ var AuthClient = class {
2377
2329
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2378
2330
  }
2379
2331
  /**
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.
2332
+ * 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
2333
  *
2382
2334
  * @param {Vectros.GetAccessLogRequest} request
2383
2335
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2390,7 +2342,6 @@ var AuthClient = class {
2390
2342
  * subjectType: "user",
2391
2343
  * subjectId: "user_abc123",
2392
2344
  * contextId: "ctx_intake",
2393
- * clientId: "client_xyz789",
2394
2345
  * action: "read",
2395
2346
  * callerKeyId: "key_abc123",
2396
2347
  * resourceType: "intake_form",
@@ -2405,7 +2356,6 @@ var AuthClient = class {
2405
2356
  subjectType,
2406
2357
  subjectId,
2407
2358
  contextId,
2408
- clientId,
2409
2359
  from: from_,
2410
2360
  to,
2411
2361
  action,
@@ -2420,7 +2370,6 @@ var AuthClient = class {
2420
2370
  subjectType,
2421
2371
  subjectId,
2422
2372
  contextId,
2423
- clientId,
2424
2373
  from: from_,
2425
2374
  to,
2426
2375
  action,
@@ -2854,7 +2803,7 @@ var AuthClient = class {
2854
2803
  );
2855
2804
  }
2856
2805
  /**
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.
2806
+ * 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
2807
  *
2859
2808
  * @param {Vectros.CreateAccessProfileRequest} request
2860
2809
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4144,7 +4093,7 @@ var AuthClient = class {
4144
4093
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4145
4094
  * },
4146
4095
  * dataScope: {
4147
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4096
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4148
4097
  * }
4149
4098
  * },
4150
4099
  * expiresInSeconds: 3600
@@ -4594,7 +4543,7 @@ var DocumentsClient = class {
4594
4543
  this._options = normalizeClientOptionsWithAuth(options);
4595
4544
  }
4596
4545
  /**
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.
4546
+ * 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
4547
  *
4599
4548
  * @param {Vectros.ListDocumentsRequest} request
4600
4549
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4602,8 +4551,6 @@ var DocumentsClient = class {
4602
4551
  * @example
4603
4552
  * await client.documents.listDocuments({
4604
4553
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4605
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4606
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4607
4554
  * scope: "group:eng-team",
4608
4555
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4609
4556
  * startFrom: "doc_prev123"
@@ -4613,11 +4560,9 @@ var DocumentsClient = class {
4613
4560
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4614
4561
  }
4615
4562
  async __listDocuments(request = {}, requestOptions) {
4616
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4563
+ const { userId, scope, folderId, startFrom, limit } = request;
4617
4564
  const _queryParams = {
4618
4565
  userId,
4619
- orgId,
4620
- clientId,
4621
4566
  scope,
4622
4567
  folderId,
4623
4568
  startFrom,
@@ -5350,7 +5295,7 @@ var FoldersClient = class {
5350
5295
  this._options = normalizeClientOptionsWithAuth(options);
5351
5296
  }
5352
5297
  /**
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.
5298
+ * 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
5299
  *
5355
5300
  * @param {Vectros.ListFoldersRequest} request
5356
5301
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5358,9 +5303,8 @@ var FoldersClient = class {
5358
5303
  * @example
5359
5304
  * await client.folders.listFolders({
5360
5305
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5361
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5362
5306
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5363
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5307
+ * scope: "group:eng-team",
5364
5308
  * startFrom: "fld_prev123"
5365
5309
  * })
5366
5310
  */
@@ -5368,12 +5312,11 @@ var FoldersClient = class {
5368
5312
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5369
5313
  }
5370
5314
  async __listFolders(request = {}, requestOptions) {
5371
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5315
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5372
5316
  const _queryParams = {
5373
5317
  parentFolderId,
5374
- orgId,
5375
5318
  userId,
5376
- clientId,
5319
+ scope,
5377
5320
  startFrom,
5378
5321
  limit
5379
5322
  };
@@ -5659,7 +5602,7 @@ var FoldersClient = class {
5659
5602
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5660
5603
  }
5661
5604
  /**
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.
5605
+ * 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
5606
  *
5664
5607
  * @param {Vectros.PatchFolderRequest} request
5665
5608
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5792,54 +5735,48 @@ var IdentityClient = class {
5792
5735
  this._options = normalizeClientOptionsWithAuth(options);
5793
5736
  }
5794
5737
  /**
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.
5738
+ * 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
5739
  *
5797
- * @param {Vectros.ListClientsRequest} request
5740
+ * @param {Vectros.ListEntitiesRequest} request
5798
5741
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5799
5742
  *
5800
5743
  * @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"
5744
+ * await client.identity.listEntities({
5745
+ * namespace: "team"
5810
5746
  * })
5811
5747
  */
5812
- listClients(request = {}, requestOptions) {
5813
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5748
+ listEntities(request, requestOptions) {
5749
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5814
5750
  }
5815
- async __listClients(request = {}, requestOptions) {
5751
+ async __listEntities(request, requestOptions) {
5816
5752
  const {
5817
- orgId,
5753
+ namespace,
5818
5754
  userId,
5819
5755
  externalId,
5820
- startFrom,
5821
- limit,
5756
+ scope,
5822
5757
  type: type_,
5823
5758
  field,
5824
5759
  value,
5825
5760
  from: from_,
5826
5761
  to,
5827
5762
  prefix,
5828
- order
5763
+ order,
5764
+ startFrom,
5765
+ limit
5829
5766
  } = request;
5830
5767
  const _queryParams = {
5831
- orgId,
5832
5768
  userId,
5833
5769
  externalId,
5834
- startFrom,
5835
- limit,
5770
+ scope,
5836
5771
  type: type_,
5837
5772
  field,
5838
5773
  value,
5839
5774
  from: from_,
5840
5775
  to,
5841
5776
  prefix,
5842
- order: order != null ? order : void 0
5777
+ order: order != null ? order : void 0,
5778
+ startFrom,
5779
+ limit
5843
5780
  };
5844
5781
  const _authRequest = await this._options.authProvider.getAuthRequest();
5845
5782
  const _headers = mergeHeaders(
@@ -5850,7 +5787,7 @@ var IdentityClient = class {
5850
5787
  const _response = await fetcher({
5851
5788
  url: url_exports.join(
5852
5789
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5853
- "v1/clients"
5790
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5854
5791
  ),
5855
5792
  method: "GET",
5856
5793
  headers: _headers,
@@ -5871,12 +5808,12 @@ var IdentityClient = class {
5871
5808
  rawResponse: _response.rawResponse
5872
5809
  });
5873
5810
  }
5874
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5811
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5875
5812
  }
5876
5813
  /**
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.
5814
+ * 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
5815
  *
5879
- * @param {Vectros.CreateClientRequest} request
5816
+ * @param {Vectros.CreateEntityRequest} request
5880
5817
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5881
5818
  *
5882
5819
  * @throws {@link Vectros.BadRequestError}
@@ -5884,17 +5821,18 @@ var IdentityClient = class {
5884
5821
  * @throws {@link Vectros.TooManyRequestsError}
5885
5822
  *
5886
5823
  * @example
5887
- * await client.identity.createClient({
5824
+ * await client.identity.createEntity({
5825
+ * namespace: "team",
5888
5826
  * body: {
5889
- * externalId: "patient_789"
5827
+ * externalId: "team_eng_platform"
5890
5828
  * }
5891
5829
  * })
5892
5830
  */
5893
- createClient(request, requestOptions) {
5894
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5831
+ createEntity(request, requestOptions) {
5832
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5895
5833
  }
5896
- async __createClient(request, requestOptions) {
5897
- const { upsert, body: _body } = request;
5834
+ async __createEntity(request, requestOptions) {
5835
+ const { namespace, upsert, body: _body } = request;
5898
5836
  const _queryParams = {
5899
5837
  upsert
5900
5838
  };
@@ -5907,7 +5845,7 @@ var IdentityClient = class {
5907
5845
  const _response = await fetcher({
5908
5846
  url: url_exports.join(
5909
5847
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5910
- "v1/clients"
5848
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5911
5849
  ),
5912
5850
  method: "POST",
5913
5851
  headers: _headers,
@@ -5940,26 +5878,27 @@ var IdentityClient = class {
5940
5878
  });
5941
5879
  }
5942
5880
  }
5943
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5881
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5944
5882
  }
5945
5883
  /**
5946
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5884
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5947
5885
  *
5948
- * @param {Vectros.GetClientRequest} request
5886
+ * @param {Vectros.GetEntityRequest} request
5949
5887
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5950
5888
  *
5951
5889
  * @throws {@link Vectros.NotFoundError}
5952
5890
  *
5953
5891
  * @example
5954
- * await client.identity.getClient({
5955
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5892
+ * await client.identity.getEntity({
5893
+ * namespace: "team",
5894
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5956
5895
  * })
5957
5896
  */
5958
- getClient(request, requestOptions) {
5959
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5897
+ getEntity(request, requestOptions) {
5898
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5960
5899
  }
5961
- async __getClient(request, requestOptions) {
5962
- const { id } = request;
5900
+ async __getEntity(request, requestOptions) {
5901
+ const { namespace, id } = request;
5963
5902
  const _authRequest = await this._options.authProvider.getAuthRequest();
5964
5903
  const _headers = mergeHeaders(
5965
5904
  _authRequest.headers,
@@ -5969,7 +5908,7 @@ var IdentityClient = class {
5969
5908
  const _response = await fetcher({
5970
5909
  url: url_exports.join(
5971
5910
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5972
- `v1/clients/${url_exports.encodePathParam(id)}`
5911
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5973
5912
  ),
5974
5913
  method: "GET",
5975
5914
  headers: _headers,
@@ -5995,30 +5934,31 @@ var IdentityClient = class {
5995
5934
  });
5996
5935
  }
5997
5936
  }
5998
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5937
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
5999
5938
  }
6000
5939
  /**
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.
5940
+ * 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
5941
  *
6003
- * @param {Vectros.UpdateClientRequest} request
5942
+ * @param {Vectros.UpdateEntityRequest} request
6004
5943
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6005
5944
  *
6006
5945
  * @throws {@link Vectros.NotFoundError}
6007
5946
  * @throws {@link Vectros.TooManyRequestsError}
6008
5947
  *
6009
5948
  * @example
6010
- * await client.identity.updateClient({
5949
+ * await client.identity.updateEntity({
5950
+ * namespace: "team",
6011
5951
  * id: "id",
6012
5952
  * body: {
6013
- * externalId: "patient_789"
5953
+ * externalId: "team_eng_platform"
6014
5954
  * }
6015
5955
  * })
6016
5956
  */
6017
- updateClient(request, requestOptions) {
6018
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5957
+ updateEntity(request, requestOptions) {
5958
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6019
5959
  }
6020
- async __updateClient(request, requestOptions) {
6021
- const { id, body: _body } = request;
5960
+ async __updateEntity(request, requestOptions) {
5961
+ const { namespace, id, body: _body } = request;
6022
5962
  const _authRequest = await this._options.authProvider.getAuthRequest();
6023
5963
  const _headers = mergeHeaders(
6024
5964
  _authRequest.headers,
@@ -6028,7 +5968,7 @@ var IdentityClient = class {
6028
5968
  const _response = await fetcher({
6029
5969
  url: url_exports.join(
6030
5970
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6031
- `v1/clients/${url_exports.encodePathParam(id)}`
5971
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6032
5972
  ),
6033
5973
  method: "PUT",
6034
5974
  headers: _headers,
@@ -6059,27 +5999,28 @@ var IdentityClient = class {
6059
5999
  });
6060
6000
  }
6061
6001
  }
6062
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6002
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6063
6003
  }
6064
6004
  /**
6065
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6005
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6066
6006
  *
6067
- * @param {Vectros.DeleteClientRequest} request
6007
+ * @param {Vectros.DeleteEntityRequest} request
6068
6008
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6069
6009
  *
6070
6010
  * @throws {@link Vectros.NotFoundError}
6071
6011
  * @throws {@link Vectros.TooManyRequestsError}
6072
6012
  *
6073
6013
  * @example
6074
- * await client.identity.deleteClient({
6014
+ * await client.identity.deleteEntity({
6015
+ * namespace: "team",
6075
6016
  * id: "id"
6076
6017
  * })
6077
6018
  */
6078
- deleteClient(request, requestOptions) {
6079
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6019
+ deleteEntity(request, requestOptions) {
6020
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6080
6021
  }
6081
- async __deleteClient(request, requestOptions) {
6082
- const { id } = request;
6022
+ async __deleteEntity(request, requestOptions) {
6023
+ const { namespace, id } = request;
6083
6024
  const _authRequest = await this._options.authProvider.getAuthRequest();
6084
6025
  const _headers = mergeHeaders(
6085
6026
  _authRequest.headers,
@@ -6089,7 +6030,7 @@ var IdentityClient = class {
6089
6030
  const _response = await fetcher({
6090
6031
  url: url_exports.join(
6091
6032
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6092
- `v1/clients/${url_exports.encodePathParam(id)}`
6033
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6093
6034
  ),
6094
6035
  method: "DELETE",
6095
6036
  headers: _headers,
@@ -6117,27 +6058,36 @@ var IdentityClient = class {
6117
6058
  });
6118
6059
  }
6119
6060
  }
6120
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6061
+ return handleNonStatusCodeError(
6062
+ _response.error,
6063
+ _response.rawResponse,
6064
+ "DELETE",
6065
+ "/v1/entities/{namespace}/{id}"
6066
+ );
6121
6067
  }
6122
6068
  /**
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.
6069
+ * 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
6070
  *
6125
- * @param {Vectros.IdentityLookupRequest} request
6071
+ * @param {Vectros.LookupEntitiesRequest} request
6126
6072
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6127
6073
  *
6128
6074
  * @throws {@link Vectros.BadRequestError}
6129
6075
  * @throws {@link Vectros.TooManyRequestsError}
6130
6076
  *
6131
6077
  * @example
6132
- * await client.identity.lookupClients({
6133
- * type: "person_v1",
6134
- * field: "ssn"
6078
+ * await client.identity.lookupEntities({
6079
+ * namespace: "team",
6080
+ * body: {
6081
+ * type: "person_v1",
6082
+ * field: "ssn"
6083
+ * }
6135
6084
  * })
6136
6085
  */
6137
- lookupClients(request, requestOptions) {
6138
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6086
+ lookupEntities(request, requestOptions) {
6087
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6139
6088
  }
6140
- async __lookupClients(request, requestOptions) {
6089
+ async __lookupEntities(request, requestOptions) {
6090
+ const { namespace, body: _body } = request;
6141
6091
  const _authRequest = await this._options.authProvider.getAuthRequest();
6142
6092
  const _headers = mergeHeaders(
6143
6093
  _authRequest.headers,
@@ -6147,14 +6097,14 @@ var IdentityClient = class {
6147
6097
  const _response = await fetcher({
6148
6098
  url: url_exports.join(
6149
6099
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6150
- "v1/clients/lookup"
6100
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6151
6101
  ),
6152
6102
  method: "POST",
6153
6103
  headers: _headers,
6154
6104
  contentType: "application/json",
6155
6105
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6156
6106
  requestType: "json",
6157
- body: request,
6107
+ body: _body,
6158
6108
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6159
6109
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6160
6110
  abortSignal: requestOptions?.abortSignal,
@@ -6178,26 +6128,32 @@ var IdentityClient = class {
6178
6128
  });
6179
6129
  }
6180
6130
  }
6181
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6131
+ return handleNonStatusCodeError(
6132
+ _response.error,
6133
+ _response.rawResponse,
6134
+ "POST",
6135
+ "/v1/entities/{namespace}/lookup"
6136
+ );
6182
6137
  }
6183
6138
  /**
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.
6139
+ * 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
6140
  *
6186
- * @param {Vectros.GetClientVersionsRequest} request
6141
+ * @param {Vectros.GetEntityVersionsRequest} request
6187
6142
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6188
6143
  *
6189
6144
  * @throws {@link Vectros.NotFoundError}
6190
6145
  *
6191
6146
  * @example
6192
- * await client.identity.getClientVersions({
6147
+ * await client.identity.getEntityVersions({
6148
+ * namespace: "team",
6193
6149
  * id: "id"
6194
6150
  * })
6195
6151
  */
6196
- getClientVersions(request, requestOptions) {
6197
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6152
+ getEntityVersions(request, requestOptions) {
6153
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6198
6154
  }
6199
- async __getClientVersions(request, requestOptions) {
6200
- const { id, startFrom } = request;
6155
+ async __getEntityVersions(request, requestOptions) {
6156
+ const { namespace, id, startFrom } = request;
6201
6157
  const _queryParams = {
6202
6158
  startFrom
6203
6159
  };
@@ -6210,7 +6166,7 @@ var IdentityClient = class {
6210
6166
  const _response = await fetcher({
6211
6167
  url: url_exports.join(
6212
6168
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6213
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6169
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6214
6170
  ),
6215
6171
  method: "GET",
6216
6172
  headers: _headers,
@@ -6236,174 +6192,31 @@ var IdentityClient = class {
6236
6192
  });
6237
6193
  }
6238
6194
  }
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
6195
+ return handleNonStatusCodeError(
6196
+ _response.error,
6197
+ _response.rawResponse,
6198
+ "GET",
6199
+ "/v1/entities/{namespace}/{id}/versions"
6293
6200
  );
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
6201
  }
6320
6202
  /**
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.
6203
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6322
6204
  *
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
6205
+ * @param {Vectros.GetNamespaceRequest} request
6393
6206
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6394
6207
  *
6395
6208
  * @throws {@link Vectros.NotFoundError}
6396
6209
  *
6397
6210
  * @example
6398
- * await client.identity.getOrg({
6399
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6211
+ * await client.identity.getNamespace({
6212
+ * namespace: "team"
6400
6213
  * })
6401
6214
  */
6402
- getOrg(request, requestOptions) {
6403
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6215
+ getNamespace(request, requestOptions) {
6216
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6404
6217
  }
6405
- async __getOrg(request, requestOptions) {
6406
- const { id } = request;
6218
+ async __getNamespace(request, requestOptions) {
6219
+ const { namespace } = request;
6407
6220
  const _authRequest = await this._options.authProvider.getAuthRequest();
6408
6221
  const _headers = mergeHeaders(
6409
6222
  _authRequest.headers,
@@ -6413,7 +6226,7 @@ var IdentityClient = class {
6413
6226
  const _response = await fetcher({
6414
6227
  url: url_exports.join(
6415
6228
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6416
- `v1/orgs/${url_exports.encodePathParam(id)}`
6229
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6417
6230
  ),
6418
6231
  method: "GET",
6419
6232
  headers: _headers,
@@ -6439,30 +6252,31 @@ var IdentityClient = class {
6439
6252
  });
6440
6253
  }
6441
6254
  }
6442
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6255
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6443
6256
  }
6444
6257
  /**
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.
6258
+ * 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
6259
  *
6447
- * @param {Vectros.UpdateOrgRequest} request
6260
+ * @param {Vectros.UpdateNamespaceRequest} request
6448
6261
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6449
6262
  *
6263
+ * @throws {@link Vectros.ForbiddenError}
6450
6264
  * @throws {@link Vectros.NotFoundError}
6451
6265
  * @throws {@link Vectros.TooManyRequestsError}
6452
6266
  *
6453
6267
  * @example
6454
- * await client.identity.updateOrg({
6455
- * id: "id",
6268
+ * await client.identity.updateNamespace({
6269
+ * namespace: "team",
6456
6270
  * body: {
6457
- * externalId: "clinic_001"
6271
+ * namespace: "team"
6458
6272
  * }
6459
6273
  * })
6460
6274
  */
6461
- updateOrg(request, requestOptions) {
6462
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6275
+ updateNamespace(request, requestOptions) {
6276
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6463
6277
  }
6464
- async __updateOrg(request, requestOptions) {
6465
- const { id, body: _body } = request;
6278
+ async __updateNamespace(request, requestOptions) {
6279
+ const { namespace, body: _body } = request;
6466
6280
  const _authRequest = await this._options.authProvider.getAuthRequest();
6467
6281
  const _headers = mergeHeaders(
6468
6282
  _authRequest.headers,
@@ -6472,7 +6286,7 @@ var IdentityClient = class {
6472
6286
  const _response = await fetcher({
6473
6287
  url: url_exports.join(
6474
6288
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6475
- `v1/orgs/${url_exports.encodePathParam(id)}`
6289
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6476
6290
  ),
6477
6291
  method: "PUT",
6478
6292
  headers: _headers,
@@ -6491,6 +6305,8 @@ var IdentityClient = class {
6491
6305
  }
6492
6306
  if (_response.error.reason === "status-code") {
6493
6307
  switch (_response.error.statusCode) {
6308
+ case 403:
6309
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6494
6310
  case 404:
6495
6311
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6496
6312
  case 429:
@@ -6503,27 +6319,28 @@ var IdentityClient = class {
6503
6319
  });
6504
6320
  }
6505
6321
  }
6506
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6322
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6507
6323
  }
6508
6324
  /**
6509
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6325
+ * 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
6326
  *
6511
- * @param {Vectros.DeleteOrgRequest} request
6327
+ * @param {Vectros.DeleteNamespaceRequest} request
6512
6328
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6513
6329
  *
6330
+ * @throws {@link Vectros.ForbiddenError}
6514
6331
  * @throws {@link Vectros.NotFoundError}
6515
6332
  * @throws {@link Vectros.TooManyRequestsError}
6516
6333
  *
6517
6334
  * @example
6518
- * await client.identity.deleteOrg({
6519
- * id: "id"
6335
+ * await client.identity.deleteNamespace({
6336
+ * namespace: "team"
6520
6337
  * })
6521
6338
  */
6522
- deleteOrg(request, requestOptions) {
6523
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6339
+ deleteNamespace(request, requestOptions) {
6340
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6524
6341
  }
6525
- async __deleteOrg(request, requestOptions) {
6526
- const { id } = request;
6342
+ async __deleteNamespace(request, requestOptions) {
6343
+ const { namespace } = request;
6527
6344
  const _authRequest = await this._options.authProvider.getAuthRequest();
6528
6345
  const _headers = mergeHeaders(
6529
6346
  _authRequest.headers,
@@ -6533,7 +6350,7 @@ var IdentityClient = class {
6533
6350
  const _response = await fetcher({
6534
6351
  url: url_exports.join(
6535
6352
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6536
- `v1/orgs/${url_exports.encodePathParam(id)}`
6353
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6537
6354
  ),
6538
6355
  method: "DELETE",
6539
6356
  headers: _headers,
@@ -6549,6 +6366,8 @@ var IdentityClient = class {
6549
6366
  }
6550
6367
  if (_response.error.reason === "status-code") {
6551
6368
  switch (_response.error.statusCode) {
6369
+ case 403:
6370
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6552
6371
  case 404:
6553
6372
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6554
6373
  case 429:
@@ -6561,27 +6380,26 @@ var IdentityClient = class {
6561
6380
  });
6562
6381
  }
6563
6382
  }
6564
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6383
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6565
6384
  }
6566
6385
  /**
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.
6386
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6568
6387
  *
6569
- * @param {Vectros.IdentityLookupRequest} request
6388
+ * @param {Vectros.ListNamespacesRequest} request
6570
6389
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6571
6390
  *
6572
- * @throws {@link Vectros.BadRequestError}
6573
- * @throws {@link Vectros.TooManyRequestsError}
6574
- *
6575
6391
  * @example
6576
- * await client.identity.lookupOrgs({
6577
- * type: "person_v1",
6578
- * field: "ssn"
6579
- * })
6392
+ * await client.identity.listNamespaces()
6580
6393
  */
6581
- lookupOrgs(request, requestOptions) {
6582
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6394
+ listNamespaces(request = {}, requestOptions) {
6395
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6583
6396
  }
6584
- async __lookupOrgs(request, requestOptions) {
6397
+ async __listNamespaces(request = {}, requestOptions) {
6398
+ const { startFrom, limit } = request;
6399
+ const _queryParams = {
6400
+ startFrom,
6401
+ limit
6402
+ };
6585
6403
  const _authRequest = await this._options.authProvider.getAuthRequest();
6586
6404
  const _headers = mergeHeaders(
6587
6405
  _authRequest.headers,
@@ -6591,14 +6409,11 @@ var IdentityClient = class {
6591
6409
  const _response = await fetcher({
6592
6410
  url: url_exports.join(
6593
6411
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6594
- "v1/orgs/lookup"
6412
+ "v1/namespaces"
6595
6413
  ),
6596
- method: "POST",
6414
+ method: "GET",
6597
6415
  headers: _headers,
6598
- contentType: "application/json",
6599
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6600
- requestType: "json",
6601
- body: request,
6416
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6602
6417
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6603
6418
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6604
6419
  abortSignal: requestOptions?.abortSignal,
@@ -6609,42 +6424,33 @@ var IdentityClient = class {
6609
6424
  return { data: _response.body, rawResponse: _response.rawResponse };
6610
6425
  }
6611
6426
  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
- }
6427
+ throw new VectrosError({
6428
+ statusCode: _response.error.statusCode,
6429
+ body: _response.error.body,
6430
+ rawResponse: _response.rawResponse
6431
+ });
6624
6432
  }
6625
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6433
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6626
6434
  }
6627
6435
  /**
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.
6436
+ * 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
6437
  *
6630
- * @param {Vectros.GetOrgVersionsRequest} request
6438
+ * @param {Vectros.NamespaceRequest} request
6631
6439
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6632
6440
  *
6633
- * @throws {@link Vectros.NotFoundError}
6441
+ * @throws {@link Vectros.BadRequestError}
6442
+ * @throws {@link Vectros.ForbiddenError}
6443
+ * @throws {@link Vectros.TooManyRequestsError}
6634
6444
  *
6635
6445
  * @example
6636
- * await client.identity.getOrgVersions({
6637
- * id: "id"
6446
+ * await client.identity.registerNamespace({
6447
+ * namespace: "team"
6638
6448
  * })
6639
6449
  */
6640
- getOrgVersions(request, requestOptions) {
6641
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6450
+ registerNamespace(request, requestOptions) {
6451
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6642
6452
  }
6643
- async __getOrgVersions(request, requestOptions) {
6644
- const { id, startFrom } = request;
6645
- const _queryParams = {
6646
- startFrom
6647
- };
6453
+ async __registerNamespace(request, requestOptions) {
6648
6454
  const _authRequest = await this._options.authProvider.getAuthRequest();
6649
6455
  const _headers = mergeHeaders(
6650
6456
  _authRequest.headers,
@@ -6654,11 +6460,14 @@ var IdentityClient = class {
6654
6460
  const _response = await fetcher({
6655
6461
  url: url_exports.join(
6656
6462
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6657
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6463
+ "v1/namespaces"
6658
6464
  ),
6659
- method: "GET",
6465
+ method: "POST",
6660
6466
  headers: _headers,
6661
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6467
+ contentType: "application/json",
6468
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6469
+ requestType: "json",
6470
+ body: request,
6662
6471
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6663
6472
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6664
6473
  abortSignal: requestOptions?.abortSignal,
@@ -6670,8 +6479,12 @@ var IdentityClient = class {
6670
6479
  }
6671
6480
  if (_response.error.reason === "status-code") {
6672
6481
  switch (_response.error.statusCode) {
6673
- case 404:
6674
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6482
+ case 400:
6483
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6484
+ case 403:
6485
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6486
+ case 429:
6487
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6675
6488
  default:
6676
6489
  throw new VectrosError({
6677
6490
  statusCode: _response.error.statusCode,
@@ -6680,7 +6493,7 @@ var IdentityClient = class {
6680
6493
  });
6681
6494
  }
6682
6495
  }
6683
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6496
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6684
6497
  }
6685
6498
  /**
6686
6499
  * 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 +7370,7 @@ var RecordsClient = class {
7557
7370
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7558
7371
  }
7559
7372
  /**
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.
7373
+ * 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
7374
  *
7562
7375
  * @param {Vectros.ListRecordsRequest} request
7563
7376
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7567,8 +7380,6 @@ var RecordsClient = class {
7567
7380
  * type: "intake_form",
7568
7381
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7569
7382
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7570
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7571
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7572
7383
  * scope: "group:eng-team",
7573
7384
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7574
7385
  * })
@@ -7577,24 +7388,11 @@ var RecordsClient = class {
7577
7388
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7578
7389
  }
7579
7390
  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;
7391
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7592
7392
  const _queryParams = {
7593
7393
  type: type_,
7594
7394
  folderId,
7595
7395
  userId,
7596
- orgId,
7597
- clientId,
7598
7396
  scope,
7599
7397
  startFrom,
7600
7398
  limit,
@@ -7894,7 +7692,7 @@ var RecordsClient = class {
7894
7692
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7895
7693
  }
7896
7694
  /**
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.
7695
+ * 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
7696
  *
7899
7697
  * @param {Vectros.PatchRecordRequest} request
7900
7698
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8220,7 +8018,7 @@ var SchemasClient = class {
8220
8018
  this._options = normalizeClientOptionsWithAuth(options);
8221
8019
  }
8222
8020
  /**
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.
8021
+ * 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
8022
  *
8225
8023
  * @param {Vectros.ListSchemasRequest} request
8226
8024
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8228,7 +8026,7 @@ var SchemasClient = class {
8228
8026
  * @example
8229
8027
  * await client.schemas.listSchemas({
8230
8028
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8231
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8029
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8232
8030
  * surface: "document",
8233
8031
  * recordType: "intake_form",
8234
8032
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8238,10 +8036,10 @@ var SchemasClient = class {
8238
8036
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8239
8037
  }
8240
8038
  async __listSchemas(request = {}, requestOptions) {
8241
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8039
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8242
8040
  const _queryParams = {
8243
8041
  userId,
8244
- orgId,
8042
+ scope,
8245
8043
  surface,
8246
8044
  recordType,
8247
8045
  startFrom,
@@ -8687,12 +8485,12 @@ var VectrosClient = class {
8687
8485
  get auth() {
8688
8486
  return this._auth ?? (this._auth = new AuthClient(this._options));
8689
8487
  }
8690
- get identity() {
8691
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8692
- }
8693
8488
  get documents() {
8694
8489
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8695
8490
  }
8491
+ get identity() {
8492
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8493
+ }
8696
8494
  get compliance() {
8697
8495
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8698
8496
  }
@@ -8795,8 +8593,8 @@ function warnOnSuboptimalKey(key, log) {
8795
8593
 
8796
8594
  // src/build-info.ts
8797
8595
  var BUILD_INFO = {
8798
- mcpServer: true ? "0.9.0" : "dev",
8799
- sdk: true ? "0.34.0" : "dev"
8596
+ mcpServer: true ? "0.10.0" : "dev",
8597
+ sdk: true ? "0.35.0" : "dev"
8800
8598
  };
8801
8599
  function formatBuildInfo() {
8802
8600
  return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
@@ -9084,10 +8882,8 @@ var inputSchema = {
9084
8882
  ),
9085
8883
  // Ownership.
9086
8884
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9087
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9088
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9089
8885
  scope: z.string().optional().describe(
9090
- '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.'
8886
+ '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.'
9091
8887
  ),
9092
8888
  // Date window.
9093
8889
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9106,7 +8902,7 @@ var inputSchema = {
9106
8902
  var hybridSearch = ({ client, log }) => ({
9107
8903
  name: "hybrid_search",
9108
8904
  title: "Hybrid search",
9109
- 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\".",
8905
+ 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 leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
9110
8906
  inputSchema,
9111
8907
  handler: async (args) => {
9112
8908
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9124,8 +8920,6 @@ var hybridSearch = ({ client, log }) => ({
9124
8920
  typeName: args.typeName,
9125
8921
  filters: args.filters,
9126
8922
  userId: args.userId,
9127
- orgId: args.orgId,
9128
- clientId: args.clientId,
9129
8923
  scope: args.scope,
9130
8924
  createdAfter: args.createdAfter,
9131
8925
  createdBefore: args.createdBefore,
@@ -9210,10 +9004,8 @@ var inputSchema2 = {
9210
9004
  ),
9211
9005
  // List-mode args:
9212
9006
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9213
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9214
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9215
9007
  scope: z2.string().optional().describe(
9216
- '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.'
9008
+ '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.'
9217
9009
  ),
9218
9010
  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."),
9219
9011
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9223,7 +9015,7 @@ var inputSchema2 = {
9223
9015
  var recordQuery = ({ client, log }) => ({
9224
9016
  name: "record_query",
9225
9017
  title: "Record query (list or lookup)",
9226
- 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.",
9018
+ 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.",
9227
9019
  inputSchema: inputSchema2,
9228
9020
  handler: async (args) => {
9229
9021
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9277,8 +9069,6 @@ var recordQuery = ({ client, log }) => ({
9277
9069
  page = await client.records.listRecords({
9278
9070
  type,
9279
9071
  userId: args.userId,
9280
- orgId: args.orgId,
9281
- clientId: args.clientId,
9282
9072
  scope: args.scope,
9283
9073
  startFrom,
9284
9074
  limit
@@ -9413,10 +9203,8 @@ var inputSchema4 = {
9413
9203
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9414
9204
  folderId: z4.string().optional().describe("Group this record into a folder."),
9415
9205
  userId: z4.string().optional().describe("Owning user id."),
9416
- orgId: z4.string().optional().describe("Owning organization id."),
9417
- clientId: z4.string().optional().describe("Associated client id."),
9418
9206
  scopes: z4.array(z4.string()).optional().describe(
9419
- '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.'
9207
+ '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.'
9420
9208
  )
9421
9209
  };
9422
9210
  var recordCreate = ({ client, log }) => ({
@@ -9436,8 +9224,6 @@ var recordCreate = ({ client, log }) => ({
9436
9224
  status: args.status,
9437
9225
  folderId: args.folderId,
9438
9226
  userId: args.userId,
9439
- orgId: args.orgId,
9440
- clientId: args.clientId,
9441
9227
  scopes: args.scopes
9442
9228
  }
9443
9229
  });
@@ -9541,10 +9327,8 @@ var inputSchema7 = {
9541
9327
  // answer on a specific owner / folder / type / metadata subset, not just the
9542
9328
  // whole-tenant corpus.
9543
9329
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9544
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9545
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9546
9330
  scope: z7.string().optional().describe(
9547
- '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.'
9331
+ '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.'
9548
9332
  ),
9549
9333
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9550
9334
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9572,8 +9356,6 @@ var ragAsk = ({ client, log }) => ({
9572
9356
  mode: searchArg.mode ?? "HYBRID",
9573
9357
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9574
9358
  userId: searchArg.userId,
9575
- orgId: searchArg.orgId,
9576
- clientId: searchArg.clientId,
9577
9359
  scope: searchArg.scope,
9578
9360
  folderId: searchArg.folderId,
9579
9361
  rootFolderId: searchArg.rootFolderId,
@@ -9719,32 +9501,32 @@ var inputSchema9 = {
9719
9501
  userId: z9.string().optional().describe(
9720
9502
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9721
9503
  ),
9722
- orgId: z9.string().optional().describe(
9723
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9504
+ scope: z9.string().optional().describe(
9505
+ '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.'
9724
9506
  ),
9725
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9726
- "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."
9507
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9508
+ "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."
9727
9509
  ),
9728
9510
  recordType: z9.string().optional().describe(
9729
- '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.'
9511
+ '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.'
9730
9512
  )
9731
9513
  };
9732
9514
  var listSchemas = ({ client, log }) => ({
9733
9515
  name: "list_schemas",
9734
9516
  title: "List record schemas",
9735
- 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.',
9517
+ 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.',
9736
9518
  inputSchema: inputSchema9,
9737
9519
  handler: async (args) => {
9738
9520
  const userId = args.userId;
9739
- const orgId = args.orgId;
9521
+ const scope = args.scope;
9740
9522
  const surface = args.surface;
9741
9523
  const recordType = args.recordType;
9742
9524
  try {
9743
9525
  const schemas = await drainPages(
9744
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9526
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9745
9527
  );
9746
9528
  log.debug(
9747
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9529
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9748
9530
  "list_schemas ok"
9749
9531
  );
9750
9532
  return {
@@ -9869,10 +9651,8 @@ var inputSchema11 = {
9869
9651
  // List-mode args:
9870
9652
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9871
9653
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9872
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9873
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9874
9654
  scope: z11.string().optional().describe(
9875
- '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.'
9655
+ '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.'
9876
9656
  ),
9877
9657
  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."),
9878
9658
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9882,7 +9662,7 @@ var inputSchema11 = {
9882
9662
  var documentQuery = ({ client, log }) => ({
9883
9663
  name: "document_query",
9884
9664
  title: "Document query (list or lookup)",
9885
- 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.",
9665
+ 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.",
9886
9666
  inputSchema: inputSchema11,
9887
9667
  handler: async (args) => {
9888
9668
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9942,8 +9722,6 @@ var documentQuery = ({ client, log }) => ({
9942
9722
  page = await client.documents.listDocuments({
9943
9723
  folderId: args.folderId,
9944
9724
  userId: args.userId,
9945
- orgId: args.orgId,
9946
- clientId: args.clientId,
9947
9725
  scope: args.scope,
9948
9726
  startFrom,
9949
9727
  limit
@@ -9984,8 +9762,9 @@ var inputSchema12 = {
9984
9762
  "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."
9985
9763
  ),
9986
9764
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9987
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9988
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9765
+ scopes: z12.array(z12.string()).optional().describe(
9766
+ '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).'
9767
+ ),
9989
9768
  expectedVersion: z12.number().int().optional().describe(
9990
9769
  "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."
9991
9770
  )
@@ -10005,8 +9784,7 @@ var documentUpdate = ({ client, log }) => ({
10005
9784
  const folderId = args.folderId;
10006
9785
  const status = args.status;
10007
9786
  const userId = args.userId;
10008
- const orgId = args.orgId;
10009
- const clientId = args.clientId;
9787
+ const scopes = args.scopes;
10010
9788
  const expectedVersion = args.expectedVersion;
10011
9789
  try {
10012
9790
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10018,8 +9796,7 @@ var documentUpdate = ({ client, log }) => ({
10018
9796
  if (folderId !== void 0) body.folderId = folderId;
10019
9797
  if (status !== void 0) body.status = status;
10020
9798
  if (userId !== void 0) body.userId = userId;
10021
- if (orgId !== void 0) body.orgId = orgId;
10022
- if (clientId !== void 0) body.clientId = clientId;
9799
+ if (scopes !== void 0) body.scopes = scopes;
10023
9800
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10024
9801
  const updated = await client.documents.patchDocument({
10025
9802
  id: resolved.id,
@@ -10069,8 +9846,9 @@ var inputSchema14 = {
10069
9846
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10070
9847
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10071
9848
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10072
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10073
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9849
+ scope: z14.string().optional().describe(
9850
+ '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.'
9851
+ ),
10074
9852
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10075
9853
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10076
9854
  `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\`.`
@@ -10079,7 +9857,7 @@ var inputSchema14 = {
10079
9857
  var folderQuery = ({ client, log }) => ({
10080
9858
  name: "folder_query",
10081
9859
  title: "Folder query (list or get)",
10082
- 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.",
9860
+ 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.",
10083
9861
  inputSchema: inputSchema14,
10084
9862
  handler: async (args) => {
10085
9863
  const id = args.id;
@@ -10093,8 +9871,7 @@ var folderQuery = ({ client, log }) => ({
10093
9871
  const page = await client.folders.listFolders({
10094
9872
  parentFolderId: args.parentId,
10095
9873
  userId: args.userId,
10096
- orgId: args.orgId,
10097
- clientId: args.clientId,
9874
+ scope: args.scope,
10098
9875
  startFrom: args.startFrom,
10099
9876
  limit
10100
9877
  });
@@ -10118,10 +9895,8 @@ var inputSchema15 = {
10118
9895
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10119
9896
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10120
9897
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10121
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10122
- clientId: z15.string().optional().describe("Associated client (Vectros UUID)."),
10123
9898
  scopes: z15.array(z15.string()).optional().describe(
10124
- '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.'
9899
+ '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.'
10125
9900
  )
10126
9901
  };
10127
9902
  var folderCreate = ({ client, log }) => ({
@@ -10138,8 +9913,6 @@ var folderCreate = ({ client, log }) => ({
10138
9913
  parentFolderId: args.parentId,
10139
9914
  slug: args.slug,
10140
9915
  userId: args.userId,
10141
- orgId: args.orgId,
10142
- clientId: args.clientId,
10143
9916
  scopes: args.scopes
10144
9917
  }
10145
9918
  });
@@ -10160,8 +9933,9 @@ var inputSchema16 = {
10160
9933
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10161
9934
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10162
9935
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10163
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10164
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9936
+ scopes: z16.array(z16.string()).optional().describe(
9937
+ '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).'
9938
+ ),
10165
9939
  expectedVersion: z16.number().int().optional().describe(
10166
9940
  "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."
10167
9941
  )
@@ -10176,16 +9950,14 @@ var folderUpdate = ({ client, log }) => ({
10176
9950
  const name = args.name;
10177
9951
  const description = args.description;
10178
9952
  const userId = args.userId;
10179
- const orgId = args.orgId;
10180
- const clientId = args.clientId;
9953
+ const scopes = args.scopes;
10181
9954
  const expectedVersion = args.expectedVersion;
10182
9955
  try {
10183
9956
  const body = {};
10184
9957
  if (name !== void 0) body.name = name;
10185
9958
  if (description !== void 0) body.description = description;
10186
9959
  if (userId !== void 0) body.userId = userId;
10187
- if (orgId !== void 0) body.orgId = orgId;
10188
- if (clientId !== void 0) body.clientId = clientId;
9960
+ if (scopes !== void 0) body.scopes = scopes;
10189
9961
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10190
9962
  const updated = await client.folders.patchFolder({ id, body });
10191
9963
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10351,10 +10123,8 @@ var inputSchema19 = {
10351
10123
  // Common (both modes):
10352
10124
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10353
10125
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10354
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10355
- clientId: z18.string().optional().describe("Owning client ID. Optional."),
10356
10126
  scopes: z18.array(z18.string()).optional().describe(
10357
- "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."
10127
+ "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."
10358
10128
  )
10359
10129
  };
10360
10130
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10402,9 +10172,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10402
10172
  payload: args.payload,
10403
10173
  schemaId,
10404
10174
  externalId: args.externalId,
10405
- userId: args.userId,
10406
- orgId: args.orgId,
10407
- clientId: args.clientId
10175
+ userId: args.userId
10408
10176
  };
10409
10177
  try {
10410
10178
  if (text) {
@@ -10511,7 +10279,9 @@ import { z as z19 } from "zod";
10511
10279
  var MCP_DEFAULT_LIMIT5 = 10;
10512
10280
  var MCP_MAX_LIMIT5 = 100;
10513
10281
  var inputSchema20 = {
10514
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10282
+ kind: z19.string().describe(
10283
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10284
+ ),
10515
10285
  externalId: z19.string().optional().describe(
10516
10286
  "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."
10517
10287
  ),
@@ -10530,11 +10300,12 @@ var inputSchema20 = {
10530
10300
  };
10531
10301
  var lookupPrincipal = ({ client, log }) => ({
10532
10302
  name: "lookup_principal",
10533
- title: "Look up a user / org / client identity",
10534
- 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.",
10303
+ title: "Look up a user identity or a namespaced identity entity",
10304
+ 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.",
10535
10305
  inputSchema: inputSchema20,
10536
10306
  handler: async (args) => {
10537
10307
  const kind = args.kind;
10308
+ const isUser = kind === "user";
10538
10309
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10539
10310
  const externalId = args.externalId;
10540
10311
  const type = args.type;
@@ -10548,13 +10319,7 @@ var lookupPrincipal = ({ client, log }) => ({
10548
10319
  try {
10549
10320
  let page;
10550
10321
  if (externalId !== void 0) {
10551
- if (kind === "user") {
10552
- page = await client.identity.listUsers({ externalId, limit });
10553
- } else if (kind === "org") {
10554
- page = await client.identity.listOrgs({ externalId, limit });
10555
- } else {
10556
- page = await client.identity.listClients({ externalId, limit });
10557
- }
10322
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10558
10323
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10559
10324
  } else if (field !== void 0) {
10560
10325
  const hasEquality = value !== void 0;
@@ -10583,13 +10348,7 @@ var lookupPrincipal = ({ client, log }) => ({
10583
10348
  );
10584
10349
  }
10585
10350
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10586
- if (kind === "user") {
10587
- page = await client.identity.lookupUsers(req);
10588
- } else if (kind === "org") {
10589
- page = await client.identity.lookupOrgs(req);
10590
- } else {
10591
- page = await client.identity.lookupClients(req);
10592
- }
10351
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10593
10352
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10594
10353
  } else {
10595
10354
  return toolError(
@@ -11045,6 +10804,133 @@ function parseToolsEnv(value) {
11045
10804
  return requested;
11046
10805
  }
11047
10806
 
10807
+ // src/resolve-key.ts
10808
+ import { execFile } from "child_process";
10809
+ import { statSync } from "fs";
10810
+ import path from "path";
10811
+ var HELPER_COMMAND = "vectros";
10812
+ var HELPER_TIMEOUT_MS = 1e4;
10813
+ var HELPER_MAX_BUFFER = 64 * 1024;
10814
+ var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
10815
+ var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
10816
+ var DETAIL_MAX_CHARS = 200;
10817
+ async function resolveApiKey(deps = {}) {
10818
+ const env = deps.env ?? process.env;
10819
+ const envKey = env.VECTROS_API_KEY;
10820
+ if (envKey && envKey.trim().length > 0) {
10821
+ return { key: envKey.trim(), source: "env" };
10822
+ }
10823
+ const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
10824
+ if (alias !== void 0 && !ALIAS_RE.test(alias)) {
10825
+ return {
10826
+ source: "none",
10827
+ reason: "bad-alias",
10828
+ detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
10829
+ };
10830
+ }
10831
+ const runHelper = deps.runHelper ?? defaultRunHelper;
10832
+ const outcome = await runHelper({ alias, env });
10833
+ switch (outcome.status) {
10834
+ case "ok":
10835
+ return { key: outcome.secret, source: "keyring", alias };
10836
+ case "cli-absent":
10837
+ return { source: "none", reason: "cli-absent", alias };
10838
+ // Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
10839
+ // seam, so redacting only inside the default implementation would leave any
10840
+ // other implementation's text to reach the fatal log raw. Belongs at the sink.
10841
+ case "no-usable-key":
10842
+ return {
10843
+ source: "none",
10844
+ reason: "no-usable-key",
10845
+ alias,
10846
+ detail: outcome.detail ? redactDetail(outcome.detail) : void 0
10847
+ };
10848
+ case "error":
10849
+ return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
10850
+ }
10851
+ }
10852
+ function noKeyMessage(resolved) {
10853
+ const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
10854
+ switch (resolved.reason) {
10855
+ case "cli-absent":
10856
+ 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>\`.`;
10857
+ case "no-usable-key":
10858
+ 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}.`;
10859
+ case "bad-alias":
10860
+ 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}.`;
10861
+ case "helper-failed":
10862
+ 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.`;
10863
+ default:
10864
+ return `no API key: ${setEnv}.`;
10865
+ }
10866
+ }
10867
+ function keyringNotice(resolved) {
10868
+ if (resolved.source !== "keyring") return void 0;
10869
+ if (resolved.alias !== void 0) {
10870
+ return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
10871
+ }
10872
+ return {
10873
+ level: "warn",
10874
+ alias: "(active)",
10875
+ 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."
10876
+ };
10877
+ }
10878
+ function redactDetail(message) {
10879
+ const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
10880
+ return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
10881
+ }
10882
+ function resolveCommandPath(command, env, platform = process.platform) {
10883
+ const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
10884
+ if (!pathVar) return void 0;
10885
+ const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
10886
+ for (const rawDir of pathVar.split(path.delimiter)) {
10887
+ const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
10888
+ if (!dir || !path.isAbsolute(dir)) continue;
10889
+ for (const ext of exts) {
10890
+ const candidate = path.join(dir, command + ext);
10891
+ try {
10892
+ if (statSync(candidate).isFile()) return candidate;
10893
+ } catch {
10894
+ }
10895
+ }
10896
+ }
10897
+ return void 0;
10898
+ }
10899
+ function mapExecResult(err, stdout, stderr = "") {
10900
+ if (!err) {
10901
+ const secret = stdout.trim();
10902
+ return secret ? { status: "ok", secret } : { status: "no-usable-key" };
10903
+ }
10904
+ const code = err.code;
10905
+ if (code === "ENOENT") return { status: "cli-absent" };
10906
+ const detail = redactDetail(stderr.trim() || err.message);
10907
+ if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
10908
+ return { status: "error", detail };
10909
+ }
10910
+ function defaultRunHelper({ alias, env }, deps = {}) {
10911
+ const platform = deps.platform ?? process.platform;
10912
+ const exec = deps.execFileImpl ?? execFile;
10913
+ const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
10914
+ if (!resolved) return Promise.resolve({ status: "cli-absent" });
10915
+ const isWindows = platform === "win32";
10916
+ const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
10917
+ const file = isWindows ? `"${resolved}"` : resolved;
10918
+ return new Promise((resolve2) => {
10919
+ exec(
10920
+ file,
10921
+ args,
10922
+ {
10923
+ env,
10924
+ timeout: HELPER_TIMEOUT_MS,
10925
+ maxBuffer: HELPER_MAX_BUFFER,
10926
+ windowsHide: true,
10927
+ shell: isWindows
10928
+ },
10929
+ (err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
10930
+ );
10931
+ });
10932
+ }
10933
+
11048
10934
  // src/cli.ts
11049
10935
  async function main() {
11050
10936
  if (process.argv.includes("--version") || process.argv.includes("-v")) {
@@ -11053,7 +10939,14 @@ async function main() {
11053
10939
  process.exit(0);
11054
10940
  }
11055
10941
  const log = createLogger2();
11056
- const apiKey = process.env.VECTROS_API_KEY;
10942
+ const resolved = await resolveApiKey();
10943
+ const apiKey = resolved.key;
10944
+ const notice = keyringNotice(resolved);
10945
+ if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
10946
+ if (!apiKey) {
10947
+ log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
10948
+ process.exit(1);
10949
+ }
11057
10950
  const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
11058
10951
  if (apiBaseUrl !== void 0) {
11059
10952
  try {