@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-http.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
 
8802
8600
  // src/log.ts
@@ -9081,10 +8879,8 @@ var inputSchema = {
9081
8879
  ),
9082
8880
  // Ownership.
9083
8881
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9084
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9085
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9086
8882
  scope: z.string().optional().describe(
9087
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
8883
+ 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9088
8884
  ),
9089
8885
  // Date window.
9090
8886
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9103,7 +8899,7 @@ var inputSchema = {
9103
8899
  var hybridSearch = ({ client, log }) => ({
9104
8900
  name: "hybrid_search",
9105
8901
  title: "Hybrid search",
9106
- description: "Search your tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/orgId/clientId), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
8902
+ 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\".",
9107
8903
  inputSchema,
9108
8904
  handler: async (args) => {
9109
8905
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9121,8 +8917,6 @@ var hybridSearch = ({ client, log }) => ({
9121
8917
  typeName: args.typeName,
9122
8918
  filters: args.filters,
9123
8919
  userId: args.userId,
9124
- orgId: args.orgId,
9125
- clientId: args.clientId,
9126
8920
  scope: args.scope,
9127
8921
  createdAfter: args.createdAfter,
9128
8922
  createdBefore: args.createdBefore,
@@ -9207,10 +9001,8 @@ var inputSchema2 = {
9207
9001
  ),
9208
9002
  // List-mode args:
9209
9003
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9210
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9211
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9212
9004
  scope: z2.string().optional().describe(
9213
- 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9005
+ 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9214
9006
  ),
9215
9007
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9216
9008
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9220,7 +9012,7 @@ var inputSchema2 = {
9220
9012
  var recordQuery = ({ client, log }) => ({
9221
9013
  name: "record_query",
9222
9014
  title: "Record query (list or lookup)",
9223
- description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId`/`orgId`/`clientId`.\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9015
+ description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9224
9016
  inputSchema: inputSchema2,
9225
9017
  handler: async (args) => {
9226
9018
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9274,8 +9066,6 @@ var recordQuery = ({ client, log }) => ({
9274
9066
  page = await client.records.listRecords({
9275
9067
  type,
9276
9068
  userId: args.userId,
9277
- orgId: args.orgId,
9278
- clientId: args.clientId,
9279
9069
  scope: args.scope,
9280
9070
  startFrom,
9281
9071
  limit
@@ -9410,10 +9200,8 @@ var inputSchema4 = {
9410
9200
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9411
9201
  folderId: z4.string().optional().describe("Group this record into a folder."),
9412
9202
  userId: z4.string().optional().describe("Owning user id."),
9413
- orgId: z4.string().optional().describe("Owning organization id."),
9414
- clientId: z4.string().optional().describe("Associated client id."),
9415
9203
  scopes: z4.array(z4.string()).optional().describe(
9416
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9204
+ 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
9417
9205
  )
9418
9206
  };
9419
9207
  var recordCreate = ({ client, log }) => ({
@@ -9433,8 +9221,6 @@ var recordCreate = ({ client, log }) => ({
9433
9221
  status: args.status,
9434
9222
  folderId: args.folderId,
9435
9223
  userId: args.userId,
9436
- orgId: args.orgId,
9437
- clientId: args.clientId,
9438
9224
  scopes: args.scopes
9439
9225
  }
9440
9226
  });
@@ -9538,10 +9324,8 @@ var inputSchema7 = {
9538
9324
  // answer on a specific owner / folder / type / metadata subset, not just the
9539
9325
  // whole-tenant corpus.
9540
9326
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9541
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9542
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9543
9327
  scope: z7.string().optional().describe(
9544
- 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9328
+ 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9545
9329
  ),
9546
9330
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9547
9331
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9569,8 +9353,6 @@ var ragAsk = ({ client, log }) => ({
9569
9353
  mode: searchArg.mode ?? "HYBRID",
9570
9354
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9571
9355
  userId: searchArg.userId,
9572
- orgId: searchArg.orgId,
9573
- clientId: searchArg.clientId,
9574
9356
  scope: searchArg.scope,
9575
9357
  folderId: searchArg.folderId,
9576
9358
  rootFolderId: searchArg.rootFolderId,
@@ -9716,32 +9498,32 @@ var inputSchema9 = {
9716
9498
  userId: z9.string().optional().describe(
9717
9499
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9718
9500
  ),
9719
- orgId: z9.string().optional().describe(
9720
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9501
+ scope: z9.string().optional().describe(
9502
+ 'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces. Optional; default returns all schemas the credential can see.'
9721
9503
  ),
9722
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9723
- "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. The identity surfaces (user/org/client) are account-wide. Optional."
9504
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9505
+ "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. Identity entities in any namespace (org/client/one you registered) bind under the single `entity` surface; `user` and `entity` are account-wide. Optional."
9724
9506
  ),
9725
9507
  recordType: z9.string().optional().describe(
9726
- 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|org|client` for an identity schema. Takes precedence over userId/orgId. Optional.'
9508
+ 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
9727
9509
  )
9728
9510
  };
9729
9511
  var listSchemas = ({ client, log }) => ({
9730
9512
  name: "list_schemas",
9731
9513
  title: "List record schemas",
9732
- description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/org/client \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`orgId`; default returns everything the credential can see.',
9514
+ description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
9733
9515
  inputSchema: inputSchema9,
9734
9516
  handler: async (args) => {
9735
9517
  const userId = args.userId;
9736
- const orgId = args.orgId;
9518
+ const scope = args.scope;
9737
9519
  const surface = args.surface;
9738
9520
  const recordType = args.recordType;
9739
9521
  try {
9740
9522
  const schemas = await drainPages(
9741
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9523
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9742
9524
  );
9743
9525
  log.debug(
9744
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9526
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9745
9527
  "list_schemas ok"
9746
9528
  );
9747
9529
  return {
@@ -9866,10 +9648,8 @@ var inputSchema11 = {
9866
9648
  // List-mode args:
9867
9649
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9868
9650
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9869
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9870
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9871
9651
  scope: z11.string().optional().describe(
9872
- 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9652
+ 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9873
9653
  ),
9874
9654
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9875
9655
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9879,7 +9659,7 @@ var inputSchema11 = {
9879
9659
  var documentQuery = ({ client, log }) => ({
9880
9660
  name: "document_query",
9881
9661
  title: "Document query (list or lookup)",
9882
- description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`orgId`/`clientId`/`scope`.\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9662
+ description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9883
9663
  inputSchema: inputSchema11,
9884
9664
  handler: async (args) => {
9885
9665
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9939,8 +9719,6 @@ var documentQuery = ({ client, log }) => ({
9939
9719
  page = await client.documents.listDocuments({
9940
9720
  folderId: args.folderId,
9941
9721
  userId: args.userId,
9942
- orgId: args.orgId,
9943
- clientId: args.clientId,
9944
9722
  scope: args.scope,
9945
9723
  startFrom,
9946
9724
  limit
@@ -9981,8 +9759,9 @@ var inputSchema12 = {
9981
9759
  "Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
9982
9760
  ),
9983
9761
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9984
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9985
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9762
+ scopes: z12.array(z12.string()).optional().describe(
9763
+ '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).'
9764
+ ),
9986
9765
  expectedVersion: z12.number().int().optional().describe(
9987
9766
  "Optimistic concurrency: the version you last read. If the document changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
9988
9767
  )
@@ -10002,8 +9781,7 @@ var documentUpdate = ({ client, log }) => ({
10002
9781
  const folderId = args.folderId;
10003
9782
  const status = args.status;
10004
9783
  const userId = args.userId;
10005
- const orgId = args.orgId;
10006
- const clientId = args.clientId;
9784
+ const scopes = args.scopes;
10007
9785
  const expectedVersion = args.expectedVersion;
10008
9786
  try {
10009
9787
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10015,8 +9793,7 @@ var documentUpdate = ({ client, log }) => ({
10015
9793
  if (folderId !== void 0) body.folderId = folderId;
10016
9794
  if (status !== void 0) body.status = status;
10017
9795
  if (userId !== void 0) body.userId = userId;
10018
- if (orgId !== void 0) body.orgId = orgId;
10019
- if (clientId !== void 0) body.clientId = clientId;
9796
+ if (scopes !== void 0) body.scopes = scopes;
10020
9797
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10021
9798
  const updated = await client.documents.patchDocument({
10022
9799
  id: resolved.id,
@@ -10066,8 +9843,9 @@ var inputSchema14 = {
10066
9843
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10067
9844
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10068
9845
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10069
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10070
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9846
+ scope: z14.string().optional().describe(
9847
+ '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.'
9848
+ ),
10071
9849
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10072
9850
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10073
9851
  `List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
@@ -10076,7 +9854,7 @@ var inputSchema14 = {
10076
9854
  var folderQuery = ({ client, log }) => ({
10077
9855
  name: "folder_query",
10078
9856
  title: "Folder query (list or get)",
10079
- description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId`/`orgId`/`clientId`.\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
9857
+ description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
10080
9858
  inputSchema: inputSchema14,
10081
9859
  handler: async (args) => {
10082
9860
  const id = args.id;
@@ -10090,8 +9868,7 @@ var folderQuery = ({ client, log }) => ({
10090
9868
  const page = await client.folders.listFolders({
10091
9869
  parentFolderId: args.parentId,
10092
9870
  userId: args.userId,
10093
- orgId: args.orgId,
10094
- clientId: args.clientId,
9871
+ scope: args.scope,
10095
9872
  startFrom: args.startFrom,
10096
9873
  limit
10097
9874
  });
@@ -10115,10 +9892,8 @@ var inputSchema15 = {
10115
9892
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10116
9893
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10117
9894
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10118
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10119
- clientId: z15.string().optional().describe("Associated client (Vectros UUID)."),
10120
9895
  scopes: z15.array(z15.string()).optional().describe(
10121
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9896
+ 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
10122
9897
  )
10123
9898
  };
10124
9899
  var folderCreate = ({ client, log }) => ({
@@ -10135,8 +9910,6 @@ var folderCreate = ({ client, log }) => ({
10135
9910
  parentFolderId: args.parentId,
10136
9911
  slug: args.slug,
10137
9912
  userId: args.userId,
10138
- orgId: args.orgId,
10139
- clientId: args.clientId,
10140
9913
  scopes: args.scopes
10141
9914
  }
10142
9915
  });
@@ -10157,8 +9930,9 @@ var inputSchema16 = {
10157
9930
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10158
9931
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10159
9932
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10160
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10161
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9933
+ scopes: z16.array(z16.string()).optional().describe(
9934
+ '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).'
9935
+ ),
10162
9936
  expectedVersion: z16.number().int().optional().describe(
10163
9937
  "Optimistic concurrency: the version you last read. If the folder changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
10164
9938
  )
@@ -10173,16 +9947,14 @@ var folderUpdate = ({ client, log }) => ({
10173
9947
  const name = args.name;
10174
9948
  const description = args.description;
10175
9949
  const userId = args.userId;
10176
- const orgId = args.orgId;
10177
- const clientId = args.clientId;
9950
+ const scopes = args.scopes;
10178
9951
  const expectedVersion = args.expectedVersion;
10179
9952
  try {
10180
9953
  const body = {};
10181
9954
  if (name !== void 0) body.name = name;
10182
9955
  if (description !== void 0) body.description = description;
10183
9956
  if (userId !== void 0) body.userId = userId;
10184
- if (orgId !== void 0) body.orgId = orgId;
10185
- if (clientId !== void 0) body.clientId = clientId;
9957
+ if (scopes !== void 0) body.scopes = scopes;
10186
9958
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10187
9959
  const updated = await client.folders.patchFolder({ id, body });
10188
9960
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10348,10 +10120,8 @@ var inputSchema19 = {
10348
10120
  // Common (both modes):
10349
10121
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10350
10122
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10351
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10352
- clientId: z18.string().optional().describe("Owning client ID. Optional."),
10353
10123
  scopes: z18.array(z18.string()).optional().describe(
10354
- "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. `org:`/`client:` entries are equivalent to the orgId/clientId fields. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10124
+ "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10355
10125
  )
10356
10126
  };
10357
10127
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10399,9 +10169,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10399
10169
  payload: args.payload,
10400
10170
  schemaId,
10401
10171
  externalId: args.externalId,
10402
- userId: args.userId,
10403
- orgId: args.orgId,
10404
- clientId: args.clientId
10172
+ userId: args.userId
10405
10173
  };
10406
10174
  try {
10407
10175
  if (text) {
@@ -10508,7 +10276,9 @@ import { z as z19 } from "zod";
10508
10276
  var MCP_DEFAULT_LIMIT5 = 10;
10509
10277
  var MCP_MAX_LIMIT5 = 100;
10510
10278
  var inputSchema20 = {
10511
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10279
+ kind: z19.string().describe(
10280
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10281
+ ),
10512
10282
  externalId: z19.string().optional().describe(
10513
10283
  "Resolve mode: your own stable identifier for the principal. Returns the single matching principal (with its Vectros UUID), or an empty array if none. The fastest path to the UUID the ownership filters need. Takes precedence if both this and a `field` lookup are supplied."
10514
10284
  ),
@@ -10527,11 +10297,12 @@ var inputSchema20 = {
10527
10297
  };
10528
10298
  var lookupPrincipal = ({ client, log }) => ({
10529
10299
  name: "lookup_principal",
10530
- title: "Look up a user / org / client identity",
10531
- description: "Resolve a user, org, or client identity. Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
10300
+ title: "Look up a user identity or a namespaced identity entity",
10301
+ description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
10532
10302
  inputSchema: inputSchema20,
10533
10303
  handler: async (args) => {
10534
10304
  const kind = args.kind;
10305
+ const isUser = kind === "user";
10535
10306
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10536
10307
  const externalId = args.externalId;
10537
10308
  const type = args.type;
@@ -10545,13 +10316,7 @@ var lookupPrincipal = ({ client, log }) => ({
10545
10316
  try {
10546
10317
  let page;
10547
10318
  if (externalId !== void 0) {
10548
- if (kind === "user") {
10549
- page = await client.identity.listUsers({ externalId, limit });
10550
- } else if (kind === "org") {
10551
- page = await client.identity.listOrgs({ externalId, limit });
10552
- } else {
10553
- page = await client.identity.listClients({ externalId, limit });
10554
- }
10319
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10555
10320
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10556
10321
  } else if (field !== void 0) {
10557
10322
  const hasEquality = value !== void 0;
@@ -10580,13 +10345,7 @@ var lookupPrincipal = ({ client, log }) => ({
10580
10345
  );
10581
10346
  }
10582
10347
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10583
- if (kind === "user") {
10584
- page = await client.identity.lookupUsers(req);
10585
- } else if (kind === "org") {
10586
- page = await client.identity.lookupOrgs(req);
10587
- } else {
10588
- page = await client.identity.lookupClients(req);
10589
- }
10348
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10590
10349
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10591
10350
  } else {
10592
10351
  return toolError(
@@ -11178,10 +10937,144 @@ function parseToolsEnv(value) {
11178
10937
  return requested;
11179
10938
  }
11180
10939
 
10940
+ // src/resolve-key.ts
10941
+ import { execFile } from "child_process";
10942
+ import { statSync } from "fs";
10943
+ import path from "path";
10944
+ var HELPER_COMMAND = "vectros";
10945
+ var HELPER_TIMEOUT_MS = 1e4;
10946
+ var HELPER_MAX_BUFFER = 64 * 1024;
10947
+ var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
10948
+ var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
10949
+ var DETAIL_MAX_CHARS = 200;
10950
+ async function resolveApiKey(deps = {}) {
10951
+ const env = deps.env ?? process.env;
10952
+ const envKey = env.VECTROS_API_KEY;
10953
+ if (envKey && envKey.trim().length > 0) {
10954
+ return { key: envKey.trim(), source: "env" };
10955
+ }
10956
+ const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
10957
+ if (alias !== void 0 && !ALIAS_RE.test(alias)) {
10958
+ return {
10959
+ source: "none",
10960
+ reason: "bad-alias",
10961
+ detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
10962
+ };
10963
+ }
10964
+ const runHelper = deps.runHelper ?? defaultRunHelper;
10965
+ const outcome = await runHelper({ alias, env });
10966
+ switch (outcome.status) {
10967
+ case "ok":
10968
+ return { key: outcome.secret, source: "keyring", alias };
10969
+ case "cli-absent":
10970
+ return { source: "none", reason: "cli-absent", alias };
10971
+ // Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
10972
+ // seam, so redacting only inside the default implementation would leave any
10973
+ // other implementation's text to reach the fatal log raw. Belongs at the sink.
10974
+ case "no-usable-key":
10975
+ return {
10976
+ source: "none",
10977
+ reason: "no-usable-key",
10978
+ alias,
10979
+ detail: outcome.detail ? redactDetail(outcome.detail) : void 0
10980
+ };
10981
+ case "error":
10982
+ return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
10983
+ }
10984
+ }
10985
+ function noKeyMessage(resolved) {
10986
+ const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
10987
+ switch (resolved.reason) {
10988
+ case "cli-absent":
10989
+ 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>\`.`;
10990
+ case "no-usable-key":
10991
+ 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}.`;
10992
+ case "bad-alias":
10993
+ 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}.`;
10994
+ case "helper-failed":
10995
+ 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.`;
10996
+ default:
10997
+ return `no API key: ${setEnv}.`;
10998
+ }
10999
+ }
11000
+ function keyringNotice(resolved) {
11001
+ if (resolved.source !== "keyring") return void 0;
11002
+ if (resolved.alias !== void 0) {
11003
+ return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
11004
+ }
11005
+ return {
11006
+ level: "warn",
11007
+ alias: "(active)",
11008
+ 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."
11009
+ };
11010
+ }
11011
+ function redactDetail(message) {
11012
+ const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
11013
+ return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
11014
+ }
11015
+ function resolveCommandPath(command, env, platform = process.platform) {
11016
+ const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
11017
+ if (!pathVar) return void 0;
11018
+ const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
11019
+ for (const rawDir of pathVar.split(path.delimiter)) {
11020
+ const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
11021
+ if (!dir || !path.isAbsolute(dir)) continue;
11022
+ for (const ext of exts) {
11023
+ const candidate = path.join(dir, command + ext);
11024
+ try {
11025
+ if (statSync(candidate).isFile()) return candidate;
11026
+ } catch {
11027
+ }
11028
+ }
11029
+ }
11030
+ return void 0;
11031
+ }
11032
+ function mapExecResult(err, stdout, stderr = "") {
11033
+ if (!err) {
11034
+ const secret = stdout.trim();
11035
+ return secret ? { status: "ok", secret } : { status: "no-usable-key" };
11036
+ }
11037
+ const code = err.code;
11038
+ if (code === "ENOENT") return { status: "cli-absent" };
11039
+ const detail = redactDetail(stderr.trim() || err.message);
11040
+ if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
11041
+ return { status: "error", detail };
11042
+ }
11043
+ function defaultRunHelper({ alias, env }, deps = {}) {
11044
+ const platform = deps.platform ?? process.platform;
11045
+ const exec = deps.execFileImpl ?? execFile;
11046
+ const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
11047
+ if (!resolved) return Promise.resolve({ status: "cli-absent" });
11048
+ const isWindows = platform === "win32";
11049
+ const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
11050
+ const file = isWindows ? `"${resolved}"` : resolved;
11051
+ return new Promise((resolve2) => {
11052
+ exec(
11053
+ file,
11054
+ args,
11055
+ {
11056
+ env,
11057
+ timeout: HELPER_TIMEOUT_MS,
11058
+ maxBuffer: HELPER_MAX_BUFFER,
11059
+ windowsHide: true,
11060
+ shell: isWindows
11061
+ },
11062
+ (err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
11063
+ );
11064
+ });
11065
+ }
11066
+
11181
11067
  // src/cli-http.ts
11182
11068
  async function main() {
11183
11069
  const log = createLogger2();
11184
- const apiKey = process.env.VECTROS_API_KEY;
11070
+ const resolved = await resolveApiKey();
11071
+ const apiKey = resolved.key;
11072
+ const notice = keyringNotice(resolved);
11073
+ if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
11074
+ if (!apiKey) {
11075
+ log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
11076
+ process.exit(1);
11077
+ }
11185
11078
  const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
11186
11079
  if (apiBaseUrl !== void 0) {
11187
11080
  try {