@vectros-ai/mcp-server 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli-http.js CHANGED
@@ -41,7 +41,6 @@ __export(api_exports, {
41
41
  BatchWriteRequest: () => BatchWriteRequest,
42
42
  BatchWriteResult: () => BatchWriteResult,
43
43
  ChatMessage: () => ChatMessage,
44
- ClientRequest: () => ClientRequest,
45
44
  ConflictError: () => ConflictError,
46
45
  ContentDeltaEvent: () => ContentDeltaEvent,
47
46
  ContentTooLargeError: () => ContentTooLargeError,
@@ -50,6 +49,7 @@ __export(api_exports, {
50
49
  DocumentRequest: () => DocumentRequest,
51
50
  DocumentResponse: () => DocumentResponse,
52
51
  DoneEvent: () => DoneEvent,
52
+ EntityRequest: () => EntityRequest,
53
53
  ErasureCertificate: () => ErasureCertificate,
54
54
  ErasureRequest: () => ErasureRequest,
55
55
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -61,16 +61,15 @@ __export(api_exports, {
61
61
  FileUploadRequest: () => FileUploadRequest,
62
62
  ForbiddenError: () => ForbiddenError,
63
63
  IdentityLookupRequest: () => IdentityLookupRequest,
64
+ IndexFailure: () => IndexFailure,
64
65
  InternalServerError: () => InternalServerError,
65
- ListClientsRequestOrder: () => ListClientsRequestOrder,
66
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
66
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
67
67
  ListUsersRequestOrder: () => ListUsersRequestOrder,
68
68
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
69
69
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
70
70
  ModelDataVersionResponse: () => ModelDataVersionResponse,
71
71
  NotFoundError: () => NotFoundError,
72
72
  NotImplementedError: () => NotImplementedError,
73
- OrgRequest: () => OrgRequest,
74
73
  PaymentRequiredError: () => PaymentRequiredError,
75
74
  PingResponse: () => PingResponse,
76
75
  RagSearch: () => RagSearch,
@@ -311,11 +310,6 @@ var UnauthorizedError = class extends VectrosError {
311
310
  var auth_exports = {};
312
311
  var ErasureRequest;
313
312
  ((ErasureRequest2) => {
314
- ErasureRequest2.SubjectType = {
315
- User: "user",
316
- Client: "client",
317
- Org: "org"
318
- };
319
313
  ErasureRequest2.AuditDisposition = {
320
314
  RetainRedacted: "retain-redacted",
321
315
  Purge: "purge"
@@ -327,11 +321,6 @@ var ExportRequest;
327
321
  Tenant: "tenant",
328
322
  Subject: "subject"
329
323
  };
330
- ExportRequest2.SubjectType = {
331
- User: "user",
332
- Client: "client",
333
- Org: "org"
334
- };
335
324
  ExportRequest2.Format = {
336
325
  Ndjson: "ndjson"
337
326
  };
@@ -370,15 +359,10 @@ var LookupDocumentsRequestOrder = {
370
359
  var folders_exports = {};
371
360
  var identity_exports = {};
372
361
  __export(identity_exports, {
373
- ListClientsRequestOrder: () => ListClientsRequestOrder,
374
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
362
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
375
363
  ListUsersRequestOrder: () => ListUsersRequestOrder
376
364
  });
377
- var ListClientsRequestOrder = {
378
- Asc: "asc",
379
- Desc: "desc"
380
- };
381
- var ListOrgsRequestOrder = {
365
+ var ListEntitiesRequestOrder = {
382
366
  Asc: "asc",
383
367
  Desc: "desc"
384
368
  };
@@ -477,13 +461,6 @@ var ChatMessage;
477
461
  Assistant: "assistant"
478
462
  };
479
463
  })(ChatMessage || (ChatMessage = {}));
480
- var ClientRequest;
481
- ((ClientRequest2) => {
482
- ClientRequest2.Status = {
483
- Active: "ACTIVE",
484
- Suspended: "SUSPENDED"
485
- };
486
- })(ClientRequest || (ClientRequest = {}));
487
464
  var ContentDeltaEvent;
488
465
  ((ContentDeltaEvent2) => {
489
466
  ContentDeltaEvent2.Event = {
@@ -538,6 +515,13 @@ var DoneEvent;
538
515
  Done: "done"
539
516
  };
540
517
  })(DoneEvent || (DoneEvent = {}));
518
+ var EntityRequest;
519
+ ((EntityRequest2) => {
520
+ EntityRequest2.Status = {
521
+ Active: "ACTIVE",
522
+ Suspended: "SUSPENDED"
523
+ };
524
+ })(EntityRequest || (EntityRequest = {}));
541
525
  var ErasureCertificate;
542
526
  ((ErasureCertificate2) => {
543
527
  ErasureCertificate2.AuditDisposition = {
@@ -553,11 +537,6 @@ var ErasureRequestResponse;
553
537
  Completed: "completed",
554
538
  Failed: "failed"
555
539
  };
556
- ErasureRequestResponse2.SubjectType = {
557
- User: "user",
558
- Client: "client",
559
- Org: "org"
560
- };
561
540
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
562
541
  var ErrorEvent;
563
542
  ((ErrorEvent2) => {
@@ -583,11 +562,6 @@ var ExportRequestResponse;
583
562
  Tenant: "tenant",
584
563
  Subject: "subject"
585
564
  };
586
- ExportRequestResponse2.SubjectType = {
587
- User: "user",
588
- Client: "client",
589
- Org: "org"
590
- };
591
565
  })(ExportRequestResponse || (ExportRequestResponse = {}));
592
566
  var FieldDef;
593
567
  ((FieldDef2) => {
@@ -601,13 +575,6 @@ var FieldDef;
601
575
  Object: "object",
602
576
  Reference: "reference"
603
577
  };
604
- FieldDef2.TargetSurface = {
605
- Record: "record",
606
- Document: "document",
607
- User: "user",
608
- Org: "org",
609
- Client: "client"
610
- };
611
578
  })(FieldDef || (FieldDef = {}));
612
579
  var IdentityLookupRequest;
613
580
  ((IdentityLookupRequest2) => {
@@ -616,6 +583,17 @@ var IdentityLookupRequest;
616
583
  Desc: "desc"
617
584
  };
618
585
  })(IdentityLookupRequest || (IdentityLookupRequest = {}));
586
+ var IndexFailure;
587
+ ((IndexFailure2) => {
588
+ IndexFailure2.Code = {
589
+ SourceUnavailable: "SOURCE_UNAVAILABLE",
590
+ TextIndexFailed: "TEXT_INDEX_FAILED",
591
+ EmbeddingFailed: "EMBEDDING_FAILED",
592
+ IndexingFailed: "INDEXING_FAILED",
593
+ VectorLimitExceeded: "VECTOR_LIMIT_EXCEEDED",
594
+ Internal: "INTERNAL"
595
+ };
596
+ })(IndexFailure || (IndexFailure = {}));
619
597
  var ModelDataVersionResponse;
620
598
  ((ModelDataVersionResponse2) => {
621
599
  ModelDataVersionResponse2.ChangeType = {
@@ -624,13 +602,6 @@ var ModelDataVersionResponse;
624
602
  Delete: "DELETE"
625
603
  };
626
604
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
627
- var OrgRequest;
628
- ((OrgRequest2) => {
629
- OrgRequest2.Status = {
630
- Active: "ACTIVE",
631
- Suspended: "SUSPENDED"
632
- };
633
- })(OrgRequest || (OrgRequest = {}));
634
605
  var PingResponse;
635
606
  ((PingResponse2) => {
636
607
  PingResponse2.Environment = {
@@ -660,11 +631,6 @@ var RagSearch;
660
631
  })(RagSearch || (RagSearch = {}));
661
632
  var ReadAccessLogResponse;
662
633
  ((ReadAccessLogResponse2) => {
663
- ReadAccessLogResponse2.SubjectType = {
664
- User: "user",
665
- Client: "client",
666
- Org: "org"
667
- };
668
634
  ReadAccessLogResponse2.Action = {
669
635
  Read: "read",
670
636
  List: "list",
@@ -734,8 +700,7 @@ var SchemaRequest;
734
700
  Record: "record",
735
701
  Document: "document",
736
702
  User: "user",
737
- Org: "org",
738
- Client: "client"
703
+ Entity: "entity"
739
704
  };
740
705
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
741
706
  })(SchemaRequest || (SchemaRequest = {}));
@@ -758,8 +723,7 @@ var SchemaResponse;
758
723
  Record: "record",
759
724
  Document: "document",
760
725
  User: "user",
761
- Org: "org",
762
- Client: "client"
726
+ Entity: "entity"
763
727
  };
764
728
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
765
729
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2314,7 +2278,7 @@ function withNoOpAuthProvider(options) {
2314
2278
  authProvider: new NoOpAuthProvider()
2315
2279
  };
2316
2280
  }
2317
- function handleNonStatusCodeError(error, rawResponse, method, path) {
2281
+ function handleNonStatusCodeError(error, rawResponse, method, path2) {
2318
2282
  switch (error.reason) {
2319
2283
  case "non-json":
2320
2284
  throw new VectrosError({
@@ -2328,7 +2292,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
2328
2292
  rawResponse
2329
2293
  });
2330
2294
  case "timeout":
2331
- throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
2295
+ throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path2}.`, {
2332
2296
  cause: error.cause
2333
2297
  });
2334
2298
  case "unknown":
@@ -2400,7 +2364,7 @@ var AuthClient = class {
2400
2364
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2401
2365
  }
2402
2366
  /**
2403
- * 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.
2367
+ * 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.
2404
2368
  *
2405
2369
  * @param {Vectros.GetAccessLogRequest} request
2406
2370
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2413,7 +2377,6 @@ var AuthClient = class {
2413
2377
  * subjectType: "user",
2414
2378
  * subjectId: "user_abc123",
2415
2379
  * contextId: "ctx_intake",
2416
- * clientId: "client_xyz789",
2417
2380
  * action: "read",
2418
2381
  * callerKeyId: "key_abc123",
2419
2382
  * resourceType: "intake_form",
@@ -2428,7 +2391,6 @@ var AuthClient = class {
2428
2391
  subjectType,
2429
2392
  subjectId,
2430
2393
  contextId,
2431
- clientId,
2432
2394
  from: from_,
2433
2395
  to,
2434
2396
  action,
@@ -2443,7 +2405,6 @@ var AuthClient = class {
2443
2405
  subjectType,
2444
2406
  subjectId,
2445
2407
  contextId,
2446
- clientId,
2447
2408
  from: from_,
2448
2409
  to,
2449
2410
  action,
@@ -2877,7 +2838,7 @@ var AuthClient = class {
2877
2838
  );
2878
2839
  }
2879
2840
  /**
2880
- * 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.
2841
+ * 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.
2881
2842
  *
2882
2843
  * @param {Vectros.CreateAccessProfileRequest} request
2883
2844
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4149,7 +4110,7 @@ var AuthClient = class {
4149
4110
  );
4150
4111
  }
4151
4112
  /**
4152
- * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user, organization, or client. Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4113
+ * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user or identity entity (in any namespace). Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4153
4114
  *
4154
4115
  * @param {Vectros.TokenRequest} request
4155
4116
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4167,7 +4128,7 @@ var AuthClient = class {
4167
4128
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4168
4129
  * },
4169
4130
  * dataScope: {
4170
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4131
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4171
4132
  * }
4172
4133
  * },
4173
4134
  * expiresInSeconds: 3600
@@ -4366,7 +4327,7 @@ var ComplianceClient = class {
4366
4327
  this._options = normalizeClientOptionsWithAuth(options);
4367
4328
  }
4368
4329
  /**
4369
- * Submits a right-to-erasure request for a single end-subject (a user, client, or organization). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4330
+ * Submits a right-to-erasure request for a single end-subject (a user, or an identity entity in any namespace). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4370
4331
  *
4371
4332
  * @param {Vectros.ErasureRequest} request
4372
4333
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4617,7 +4578,7 @@ var DocumentsClient = class {
4617
4578
  this._options = normalizeClientOptionsWithAuth(options);
4618
4579
  }
4619
4580
  /**
4620
- * 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.
4581
+ * 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.
4621
4582
  *
4622
4583
  * @param {Vectros.ListDocumentsRequest} request
4623
4584
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4625,8 +4586,6 @@ var DocumentsClient = class {
4625
4586
  * @example
4626
4587
  * await client.documents.listDocuments({
4627
4588
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4628
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4629
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4630
4589
  * scope: "group:eng-team",
4631
4590
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4632
4591
  * startFrom: "doc_prev123"
@@ -4636,11 +4595,9 @@ var DocumentsClient = class {
4636
4595
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4637
4596
  }
4638
4597
  async __listDocuments(request = {}, requestOptions) {
4639
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4598
+ const { userId, scope, folderId, startFrom, limit } = request;
4640
4599
  const _queryParams = {
4641
4600
  userId,
4642
- orgId,
4643
- clientId,
4644
4601
  scope,
4645
4602
  folderId,
4646
4603
  startFrom,
@@ -5373,7 +5330,7 @@ var FoldersClient = class {
5373
5330
  this._options = normalizeClientOptionsWithAuth(options);
5374
5331
  }
5375
5332
  /**
5376
- * 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.
5333
+ * 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.
5377
5334
  *
5378
5335
  * @param {Vectros.ListFoldersRequest} request
5379
5336
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5381,9 +5338,8 @@ var FoldersClient = class {
5381
5338
  * @example
5382
5339
  * await client.folders.listFolders({
5383
5340
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5384
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5385
5341
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5386
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5342
+ * scope: "group:eng-team",
5387
5343
  * startFrom: "fld_prev123"
5388
5344
  * })
5389
5345
  */
@@ -5391,12 +5347,11 @@ var FoldersClient = class {
5391
5347
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5392
5348
  }
5393
5349
  async __listFolders(request = {}, requestOptions) {
5394
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5350
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5395
5351
  const _queryParams = {
5396
5352
  parentFolderId,
5397
- orgId,
5398
5353
  userId,
5399
- clientId,
5354
+ scope,
5400
5355
  startFrom,
5401
5356
  limit
5402
5357
  };
@@ -5682,7 +5637,7 @@ var FoldersClient = class {
5682
5637
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5683
5638
  }
5684
5639
  /**
5685
- * 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.
5640
+ * 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.
5686
5641
  *
5687
5642
  * @param {Vectros.PatchFolderRequest} request
5688
5643
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5815,54 +5770,48 @@ var IdentityClient = class {
5815
5770
  this._options = normalizeClientOptionsWithAuth(options);
5816
5771
  }
5817
5772
  /**
5818
- * 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.
5773
+ * 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.
5819
5774
  *
5820
- * @param {Vectros.ListClientsRequest} request
5775
+ * @param {Vectros.ListEntitiesRequest} request
5821
5776
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5822
5777
  *
5823
5778
  * @example
5824
- * await client.identity.listClients({
5825
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5826
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5827
- * externalId: "patient_789",
5828
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5829
- * type: "client_v1",
5830
- * field: "industry",
5831
- * value: "healthcare",
5832
- * prefix: "health"
5779
+ * await client.identity.listEntities({
5780
+ * namespace: "team"
5833
5781
  * })
5834
5782
  */
5835
- listClients(request = {}, requestOptions) {
5836
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5783
+ listEntities(request, requestOptions) {
5784
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5837
5785
  }
5838
- async __listClients(request = {}, requestOptions) {
5786
+ async __listEntities(request, requestOptions) {
5839
5787
  const {
5840
- orgId,
5788
+ namespace,
5841
5789
  userId,
5842
5790
  externalId,
5843
- startFrom,
5844
- limit,
5791
+ scope,
5845
5792
  type: type_,
5846
5793
  field,
5847
5794
  value,
5848
5795
  from: from_,
5849
5796
  to,
5850
5797
  prefix,
5851
- order
5798
+ order,
5799
+ startFrom,
5800
+ limit
5852
5801
  } = request;
5853
5802
  const _queryParams = {
5854
- orgId,
5855
5803
  userId,
5856
5804
  externalId,
5857
- startFrom,
5858
- limit,
5805
+ scope,
5859
5806
  type: type_,
5860
5807
  field,
5861
5808
  value,
5862
5809
  from: from_,
5863
5810
  to,
5864
5811
  prefix,
5865
- order: order != null ? order : void 0
5812
+ order: order != null ? order : void 0,
5813
+ startFrom,
5814
+ limit
5866
5815
  };
5867
5816
  const _authRequest = await this._options.authProvider.getAuthRequest();
5868
5817
  const _headers = mergeHeaders(
@@ -5873,7 +5822,7 @@ var IdentityClient = class {
5873
5822
  const _response = await fetcher({
5874
5823
  url: url_exports.join(
5875
5824
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5876
- "v1/clients"
5825
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5877
5826
  ),
5878
5827
  method: "GET",
5879
5828
  headers: _headers,
@@ -5894,12 +5843,12 @@ var IdentityClient = class {
5894
5843
  rawResponse: _response.rawResponse
5895
5844
  });
5896
5845
  }
5897
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5846
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5898
5847
  }
5899
5848
  /**
5900
- * 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.
5849
+ * 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.
5901
5850
  *
5902
- * @param {Vectros.CreateClientRequest} request
5851
+ * @param {Vectros.CreateEntityRequest} request
5903
5852
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5904
5853
  *
5905
5854
  * @throws {@link Vectros.BadRequestError}
@@ -5907,17 +5856,18 @@ var IdentityClient = class {
5907
5856
  * @throws {@link Vectros.TooManyRequestsError}
5908
5857
  *
5909
5858
  * @example
5910
- * await client.identity.createClient({
5859
+ * await client.identity.createEntity({
5860
+ * namespace: "team",
5911
5861
  * body: {
5912
- * externalId: "patient_789"
5862
+ * externalId: "team_eng_platform"
5913
5863
  * }
5914
5864
  * })
5915
5865
  */
5916
- createClient(request, requestOptions) {
5917
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5866
+ createEntity(request, requestOptions) {
5867
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5918
5868
  }
5919
- async __createClient(request, requestOptions) {
5920
- const { upsert, body: _body } = request;
5869
+ async __createEntity(request, requestOptions) {
5870
+ const { namespace, upsert, body: _body } = request;
5921
5871
  const _queryParams = {
5922
5872
  upsert
5923
5873
  };
@@ -5930,7 +5880,7 @@ var IdentityClient = class {
5930
5880
  const _response = await fetcher({
5931
5881
  url: url_exports.join(
5932
5882
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5933
- "v1/clients"
5883
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5934
5884
  ),
5935
5885
  method: "POST",
5936
5886
  headers: _headers,
@@ -5963,26 +5913,27 @@ var IdentityClient = class {
5963
5913
  });
5964
5914
  }
5965
5915
  }
5966
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5916
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5967
5917
  }
5968
5918
  /**
5969
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5919
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5970
5920
  *
5971
- * @param {Vectros.GetClientRequest} request
5921
+ * @param {Vectros.GetEntityRequest} request
5972
5922
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5973
5923
  *
5974
5924
  * @throws {@link Vectros.NotFoundError}
5975
5925
  *
5976
5926
  * @example
5977
- * await client.identity.getClient({
5978
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5927
+ * await client.identity.getEntity({
5928
+ * namespace: "team",
5929
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5979
5930
  * })
5980
5931
  */
5981
- getClient(request, requestOptions) {
5982
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5932
+ getEntity(request, requestOptions) {
5933
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5983
5934
  }
5984
- async __getClient(request, requestOptions) {
5985
- const { id } = request;
5935
+ async __getEntity(request, requestOptions) {
5936
+ const { namespace, id } = request;
5986
5937
  const _authRequest = await this._options.authProvider.getAuthRequest();
5987
5938
  const _headers = mergeHeaders(
5988
5939
  _authRequest.headers,
@@ -5992,7 +5943,7 @@ var IdentityClient = class {
5992
5943
  const _response = await fetcher({
5993
5944
  url: url_exports.join(
5994
5945
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5995
- `v1/clients/${url_exports.encodePathParam(id)}`
5946
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5996
5947
  ),
5997
5948
  method: "GET",
5998
5949
  headers: _headers,
@@ -6018,30 +5969,31 @@ var IdentityClient = class {
6018
5969
  });
6019
5970
  }
6020
5971
  }
6021
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5972
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
6022
5973
  }
6023
5974
  /**
6024
- * 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.
5975
+ * 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.
6025
5976
  *
6026
- * @param {Vectros.UpdateClientRequest} request
5977
+ * @param {Vectros.UpdateEntityRequest} request
6027
5978
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6028
5979
  *
6029
5980
  * @throws {@link Vectros.NotFoundError}
6030
5981
  * @throws {@link Vectros.TooManyRequestsError}
6031
5982
  *
6032
5983
  * @example
6033
- * await client.identity.updateClient({
5984
+ * await client.identity.updateEntity({
5985
+ * namespace: "team",
6034
5986
  * id: "id",
6035
5987
  * body: {
6036
- * externalId: "patient_789"
5988
+ * externalId: "team_eng_platform"
6037
5989
  * }
6038
5990
  * })
6039
5991
  */
6040
- updateClient(request, requestOptions) {
6041
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5992
+ updateEntity(request, requestOptions) {
5993
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6042
5994
  }
6043
- async __updateClient(request, requestOptions) {
6044
- const { id, body: _body } = request;
5995
+ async __updateEntity(request, requestOptions) {
5996
+ const { namespace, id, body: _body } = request;
6045
5997
  const _authRequest = await this._options.authProvider.getAuthRequest();
6046
5998
  const _headers = mergeHeaders(
6047
5999
  _authRequest.headers,
@@ -6051,7 +6003,7 @@ var IdentityClient = class {
6051
6003
  const _response = await fetcher({
6052
6004
  url: url_exports.join(
6053
6005
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6054
- `v1/clients/${url_exports.encodePathParam(id)}`
6006
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6055
6007
  ),
6056
6008
  method: "PUT",
6057
6009
  headers: _headers,
@@ -6082,27 +6034,28 @@ var IdentityClient = class {
6082
6034
  });
6083
6035
  }
6084
6036
  }
6085
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6037
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6086
6038
  }
6087
6039
  /**
6088
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6040
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6089
6041
  *
6090
- * @param {Vectros.DeleteClientRequest} request
6042
+ * @param {Vectros.DeleteEntityRequest} request
6091
6043
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6092
6044
  *
6093
6045
  * @throws {@link Vectros.NotFoundError}
6094
6046
  * @throws {@link Vectros.TooManyRequestsError}
6095
6047
  *
6096
6048
  * @example
6097
- * await client.identity.deleteClient({
6049
+ * await client.identity.deleteEntity({
6050
+ * namespace: "team",
6098
6051
  * id: "id"
6099
6052
  * })
6100
6053
  */
6101
- deleteClient(request, requestOptions) {
6102
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6054
+ deleteEntity(request, requestOptions) {
6055
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6103
6056
  }
6104
- async __deleteClient(request, requestOptions) {
6105
- const { id } = request;
6057
+ async __deleteEntity(request, requestOptions) {
6058
+ const { namespace, id } = request;
6106
6059
  const _authRequest = await this._options.authProvider.getAuthRequest();
6107
6060
  const _headers = mergeHeaders(
6108
6061
  _authRequest.headers,
@@ -6112,7 +6065,7 @@ var IdentityClient = class {
6112
6065
  const _response = await fetcher({
6113
6066
  url: url_exports.join(
6114
6067
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6115
- `v1/clients/${url_exports.encodePathParam(id)}`
6068
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6116
6069
  ),
6117
6070
  method: "DELETE",
6118
6071
  headers: _headers,
@@ -6140,27 +6093,36 @@ var IdentityClient = class {
6140
6093
  });
6141
6094
  }
6142
6095
  }
6143
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6096
+ return handleNonStatusCodeError(
6097
+ _response.error,
6098
+ _response.rawResponse,
6099
+ "DELETE",
6100
+ "/v1/entities/{namespace}/{id}"
6101
+ );
6144
6102
  }
6145
6103
  /**
6146
- * 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.
6104
+ * 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.
6147
6105
  *
6148
- * @param {Vectros.IdentityLookupRequest} request
6106
+ * @param {Vectros.LookupEntitiesRequest} request
6149
6107
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6150
6108
  *
6151
6109
  * @throws {@link Vectros.BadRequestError}
6152
6110
  * @throws {@link Vectros.TooManyRequestsError}
6153
6111
  *
6154
6112
  * @example
6155
- * await client.identity.lookupClients({
6156
- * type: "person_v1",
6157
- * field: "ssn"
6113
+ * await client.identity.lookupEntities({
6114
+ * namespace: "team",
6115
+ * body: {
6116
+ * type: "person_v1",
6117
+ * field: "ssn"
6118
+ * }
6158
6119
  * })
6159
6120
  */
6160
- lookupClients(request, requestOptions) {
6161
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6121
+ lookupEntities(request, requestOptions) {
6122
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6162
6123
  }
6163
- async __lookupClients(request, requestOptions) {
6124
+ async __lookupEntities(request, requestOptions) {
6125
+ const { namespace, body: _body } = request;
6164
6126
  const _authRequest = await this._options.authProvider.getAuthRequest();
6165
6127
  const _headers = mergeHeaders(
6166
6128
  _authRequest.headers,
@@ -6170,14 +6132,14 @@ var IdentityClient = class {
6170
6132
  const _response = await fetcher({
6171
6133
  url: url_exports.join(
6172
6134
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6173
- "v1/clients/lookup"
6135
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6174
6136
  ),
6175
6137
  method: "POST",
6176
6138
  headers: _headers,
6177
6139
  contentType: "application/json",
6178
6140
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6179
6141
  requestType: "json",
6180
- body: request,
6142
+ body: _body,
6181
6143
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6182
6144
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6183
6145
  abortSignal: requestOptions?.abortSignal,
@@ -6201,26 +6163,32 @@ var IdentityClient = class {
6201
6163
  });
6202
6164
  }
6203
6165
  }
6204
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6166
+ return handleNonStatusCodeError(
6167
+ _response.error,
6168
+ _response.rawResponse,
6169
+ "POST",
6170
+ "/v1/entities/{namespace}/lookup"
6171
+ );
6205
6172
  }
6206
6173
  /**
6207
- * 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.
6174
+ * 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.
6208
6175
  *
6209
- * @param {Vectros.GetClientVersionsRequest} request
6176
+ * @param {Vectros.GetEntityVersionsRequest} request
6210
6177
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6211
6178
  *
6212
6179
  * @throws {@link Vectros.NotFoundError}
6213
6180
  *
6214
6181
  * @example
6215
- * await client.identity.getClientVersions({
6182
+ * await client.identity.getEntityVersions({
6183
+ * namespace: "team",
6216
6184
  * id: "id"
6217
6185
  * })
6218
6186
  */
6219
- getClientVersions(request, requestOptions) {
6220
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6187
+ getEntityVersions(request, requestOptions) {
6188
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6221
6189
  }
6222
- async __getClientVersions(request, requestOptions) {
6223
- const { id, startFrom } = request;
6190
+ async __getEntityVersions(request, requestOptions) {
6191
+ const { namespace, id, startFrom } = request;
6224
6192
  const _queryParams = {
6225
6193
  startFrom
6226
6194
  };
@@ -6233,7 +6201,7 @@ var IdentityClient = class {
6233
6201
  const _response = await fetcher({
6234
6202
  url: url_exports.join(
6235
6203
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6236
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6204
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6237
6205
  ),
6238
6206
  method: "GET",
6239
6207
  headers: _headers,
@@ -6259,174 +6227,31 @@ var IdentityClient = class {
6259
6227
  });
6260
6228
  }
6261
6229
  }
6262
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6263
- }
6264
- /**
6265
- * 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.
6266
- *
6267
- * @param {Vectros.ListOrgsRequest} request
6268
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6269
- *
6270
- * @example
6271
- * await client.identity.listOrgs({
6272
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6273
- * externalId: "clinic_001",
6274
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6275
- * type: "org_v1",
6276
- * field: "region",
6277
- * value: "us-east",
6278
- * prefix: "us-"
6279
- * })
6280
- */
6281
- listOrgs(request = {}, requestOptions) {
6282
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6283
- }
6284
- async __listOrgs(request = {}, requestOptions) {
6285
- const {
6286
- userId,
6287
- externalId,
6288
- startFrom,
6289
- limit,
6290
- type: type_,
6291
- field,
6292
- value,
6293
- from: from_,
6294
- to,
6295
- prefix,
6296
- order
6297
- } = request;
6298
- const _queryParams = {
6299
- userId,
6300
- externalId,
6301
- startFrom,
6302
- limit,
6303
- type: type_,
6304
- field,
6305
- value,
6306
- from: from_,
6307
- to,
6308
- prefix,
6309
- order: order != null ? order : void 0
6310
- };
6311
- const _authRequest = await this._options.authProvider.getAuthRequest();
6312
- const _headers = mergeHeaders(
6313
- _authRequest.headers,
6314
- this._options?.headers,
6315
- requestOptions?.headers
6230
+ return handleNonStatusCodeError(
6231
+ _response.error,
6232
+ _response.rawResponse,
6233
+ "GET",
6234
+ "/v1/entities/{namespace}/{id}/versions"
6316
6235
  );
6317
- const _response = await fetcher({
6318
- url: url_exports.join(
6319
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6320
- "v1/orgs"
6321
- ),
6322
- method: "GET",
6323
- headers: _headers,
6324
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6325
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6326
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6327
- abortSignal: requestOptions?.abortSignal,
6328
- fetchFn: this._options?.fetch,
6329
- logging: this._options.logging
6330
- });
6331
- if (_response.ok) {
6332
- return { data: _response.body, rawResponse: _response.rawResponse };
6333
- }
6334
- if (_response.error.reason === "status-code") {
6335
- throw new VectrosError({
6336
- statusCode: _response.error.statusCode,
6337
- body: _response.error.body,
6338
- rawResponse: _response.rawResponse
6339
- });
6340
- }
6341
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6342
6236
  }
6343
6237
  /**
6344
- * 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.
6238
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6345
6239
  *
6346
- * @param {Vectros.CreateOrgRequest} request
6347
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6348
- *
6349
- * @throws {@link Vectros.BadRequestError}
6350
- * @throws {@link Vectros.ForbiddenError}
6351
- * @throws {@link Vectros.TooManyRequestsError}
6352
- *
6353
- * @example
6354
- * await client.identity.createOrg({
6355
- * body: {
6356
- * externalId: "clinic_001"
6357
- * }
6358
- * })
6359
- */
6360
- createOrg(request, requestOptions) {
6361
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6362
- }
6363
- async __createOrg(request, requestOptions) {
6364
- const { upsert, body: _body } = request;
6365
- const _queryParams = {
6366
- upsert
6367
- };
6368
- const _authRequest = await this._options.authProvider.getAuthRequest();
6369
- const _headers = mergeHeaders(
6370
- _authRequest.headers,
6371
- this._options?.headers,
6372
- requestOptions?.headers
6373
- );
6374
- const _response = await fetcher({
6375
- url: url_exports.join(
6376
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6377
- "v1/orgs"
6378
- ),
6379
- method: "POST",
6380
- headers: _headers,
6381
- contentType: "application/json",
6382
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6383
- requestType: "json",
6384
- body: _body,
6385
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6386
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6387
- abortSignal: requestOptions?.abortSignal,
6388
- fetchFn: this._options?.fetch,
6389
- logging: this._options.logging
6390
- });
6391
- if (_response.ok) {
6392
- return { data: _response.body, rawResponse: _response.rawResponse };
6393
- }
6394
- if (_response.error.reason === "status-code") {
6395
- switch (_response.error.statusCode) {
6396
- case 400:
6397
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6398
- case 403:
6399
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6400
- case 429:
6401
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6402
- default:
6403
- throw new VectrosError({
6404
- statusCode: _response.error.statusCode,
6405
- body: _response.error.body,
6406
- rawResponse: _response.rawResponse
6407
- });
6408
- }
6409
- }
6410
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6411
- }
6412
- /**
6413
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6414
- *
6415
- * @param {Vectros.GetOrgRequest} request
6240
+ * @param {Vectros.GetNamespaceRequest} request
6416
6241
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6417
6242
  *
6418
6243
  * @throws {@link Vectros.NotFoundError}
6419
6244
  *
6420
6245
  * @example
6421
- * await client.identity.getOrg({
6422
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6246
+ * await client.identity.getNamespace({
6247
+ * namespace: "team"
6423
6248
  * })
6424
6249
  */
6425
- getOrg(request, requestOptions) {
6426
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6250
+ getNamespace(request, requestOptions) {
6251
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6427
6252
  }
6428
- async __getOrg(request, requestOptions) {
6429
- const { id } = request;
6253
+ async __getNamespace(request, requestOptions) {
6254
+ const { namespace } = request;
6430
6255
  const _authRequest = await this._options.authProvider.getAuthRequest();
6431
6256
  const _headers = mergeHeaders(
6432
6257
  _authRequest.headers,
@@ -6436,7 +6261,7 @@ var IdentityClient = class {
6436
6261
  const _response = await fetcher({
6437
6262
  url: url_exports.join(
6438
6263
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6439
- `v1/orgs/${url_exports.encodePathParam(id)}`
6264
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6440
6265
  ),
6441
6266
  method: "GET",
6442
6267
  headers: _headers,
@@ -6462,30 +6287,31 @@ var IdentityClient = class {
6462
6287
  });
6463
6288
  }
6464
6289
  }
6465
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6290
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6466
6291
  }
6467
6292
  /**
6468
- * 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.
6293
+ * 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.
6469
6294
  *
6470
- * @param {Vectros.UpdateOrgRequest} request
6295
+ * @param {Vectros.UpdateNamespaceRequest} request
6471
6296
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6472
6297
  *
6298
+ * @throws {@link Vectros.ForbiddenError}
6473
6299
  * @throws {@link Vectros.NotFoundError}
6474
6300
  * @throws {@link Vectros.TooManyRequestsError}
6475
6301
  *
6476
6302
  * @example
6477
- * await client.identity.updateOrg({
6478
- * id: "id",
6303
+ * await client.identity.updateNamespace({
6304
+ * namespace: "team",
6479
6305
  * body: {
6480
- * externalId: "clinic_001"
6306
+ * namespace: "team"
6481
6307
  * }
6482
6308
  * })
6483
6309
  */
6484
- updateOrg(request, requestOptions) {
6485
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6310
+ updateNamespace(request, requestOptions) {
6311
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6486
6312
  }
6487
- async __updateOrg(request, requestOptions) {
6488
- const { id, body: _body } = request;
6313
+ async __updateNamespace(request, requestOptions) {
6314
+ const { namespace, body: _body } = request;
6489
6315
  const _authRequest = await this._options.authProvider.getAuthRequest();
6490
6316
  const _headers = mergeHeaders(
6491
6317
  _authRequest.headers,
@@ -6495,7 +6321,7 @@ var IdentityClient = class {
6495
6321
  const _response = await fetcher({
6496
6322
  url: url_exports.join(
6497
6323
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6498
- `v1/orgs/${url_exports.encodePathParam(id)}`
6324
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6499
6325
  ),
6500
6326
  method: "PUT",
6501
6327
  headers: _headers,
@@ -6514,6 +6340,8 @@ var IdentityClient = class {
6514
6340
  }
6515
6341
  if (_response.error.reason === "status-code") {
6516
6342
  switch (_response.error.statusCode) {
6343
+ case 403:
6344
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6517
6345
  case 404:
6518
6346
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6519
6347
  case 429:
@@ -6526,27 +6354,28 @@ var IdentityClient = class {
6526
6354
  });
6527
6355
  }
6528
6356
  }
6529
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6357
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6530
6358
  }
6531
6359
  /**
6532
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6360
+ * 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.
6533
6361
  *
6534
- * @param {Vectros.DeleteOrgRequest} request
6362
+ * @param {Vectros.DeleteNamespaceRequest} request
6535
6363
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6536
6364
  *
6365
+ * @throws {@link Vectros.ForbiddenError}
6537
6366
  * @throws {@link Vectros.NotFoundError}
6538
6367
  * @throws {@link Vectros.TooManyRequestsError}
6539
6368
  *
6540
6369
  * @example
6541
- * await client.identity.deleteOrg({
6542
- * id: "id"
6370
+ * await client.identity.deleteNamespace({
6371
+ * namespace: "team"
6543
6372
  * })
6544
6373
  */
6545
- deleteOrg(request, requestOptions) {
6546
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6374
+ deleteNamespace(request, requestOptions) {
6375
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6547
6376
  }
6548
- async __deleteOrg(request, requestOptions) {
6549
- const { id } = request;
6377
+ async __deleteNamespace(request, requestOptions) {
6378
+ const { namespace } = request;
6550
6379
  const _authRequest = await this._options.authProvider.getAuthRequest();
6551
6380
  const _headers = mergeHeaders(
6552
6381
  _authRequest.headers,
@@ -6556,7 +6385,7 @@ var IdentityClient = class {
6556
6385
  const _response = await fetcher({
6557
6386
  url: url_exports.join(
6558
6387
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6559
- `v1/orgs/${url_exports.encodePathParam(id)}`
6388
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6560
6389
  ),
6561
6390
  method: "DELETE",
6562
6391
  headers: _headers,
@@ -6572,6 +6401,8 @@ var IdentityClient = class {
6572
6401
  }
6573
6402
  if (_response.error.reason === "status-code") {
6574
6403
  switch (_response.error.statusCode) {
6404
+ case 403:
6405
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6575
6406
  case 404:
6576
6407
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6577
6408
  case 429:
@@ -6584,27 +6415,26 @@ var IdentityClient = class {
6584
6415
  });
6585
6416
  }
6586
6417
  }
6587
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6418
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6588
6419
  }
6589
6420
  /**
6590
- * 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.
6421
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6591
6422
  *
6592
- * @param {Vectros.IdentityLookupRequest} request
6423
+ * @param {Vectros.ListNamespacesRequest} request
6593
6424
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6594
6425
  *
6595
- * @throws {@link Vectros.BadRequestError}
6596
- * @throws {@link Vectros.TooManyRequestsError}
6597
- *
6598
6426
  * @example
6599
- * await client.identity.lookupOrgs({
6600
- * type: "person_v1",
6601
- * field: "ssn"
6602
- * })
6427
+ * await client.identity.listNamespaces()
6603
6428
  */
6604
- lookupOrgs(request, requestOptions) {
6605
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6429
+ listNamespaces(request = {}, requestOptions) {
6430
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6606
6431
  }
6607
- async __lookupOrgs(request, requestOptions) {
6432
+ async __listNamespaces(request = {}, requestOptions) {
6433
+ const { startFrom, limit } = request;
6434
+ const _queryParams = {
6435
+ startFrom,
6436
+ limit
6437
+ };
6608
6438
  const _authRequest = await this._options.authProvider.getAuthRequest();
6609
6439
  const _headers = mergeHeaders(
6610
6440
  _authRequest.headers,
@@ -6614,14 +6444,11 @@ var IdentityClient = class {
6614
6444
  const _response = await fetcher({
6615
6445
  url: url_exports.join(
6616
6446
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6617
- "v1/orgs/lookup"
6447
+ "v1/namespaces"
6618
6448
  ),
6619
- method: "POST",
6449
+ method: "GET",
6620
6450
  headers: _headers,
6621
- contentType: "application/json",
6622
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6623
- requestType: "json",
6624
- body: request,
6451
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6625
6452
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6626
6453
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6627
6454
  abortSignal: requestOptions?.abortSignal,
@@ -6632,42 +6459,33 @@ var IdentityClient = class {
6632
6459
  return { data: _response.body, rawResponse: _response.rawResponse };
6633
6460
  }
6634
6461
  if (_response.error.reason === "status-code") {
6635
- switch (_response.error.statusCode) {
6636
- case 400:
6637
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6638
- case 429:
6639
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6640
- default:
6641
- throw new VectrosError({
6642
- statusCode: _response.error.statusCode,
6643
- body: _response.error.body,
6644
- rawResponse: _response.rawResponse
6645
- });
6646
- }
6462
+ throw new VectrosError({
6463
+ statusCode: _response.error.statusCode,
6464
+ body: _response.error.body,
6465
+ rawResponse: _response.rawResponse
6466
+ });
6647
6467
  }
6648
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6468
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6649
6469
  }
6650
6470
  /**
6651
- * 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.
6471
+ * 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.
6652
6472
  *
6653
- * @param {Vectros.GetOrgVersionsRequest} request
6473
+ * @param {Vectros.NamespaceRequest} request
6654
6474
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6655
6475
  *
6656
- * @throws {@link Vectros.NotFoundError}
6476
+ * @throws {@link Vectros.BadRequestError}
6477
+ * @throws {@link Vectros.ForbiddenError}
6478
+ * @throws {@link Vectros.TooManyRequestsError}
6657
6479
  *
6658
6480
  * @example
6659
- * await client.identity.getOrgVersions({
6660
- * id: "id"
6481
+ * await client.identity.registerNamespace({
6482
+ * namespace: "team"
6661
6483
  * })
6662
6484
  */
6663
- getOrgVersions(request, requestOptions) {
6664
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6485
+ registerNamespace(request, requestOptions) {
6486
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6665
6487
  }
6666
- async __getOrgVersions(request, requestOptions) {
6667
- const { id, startFrom } = request;
6668
- const _queryParams = {
6669
- startFrom
6670
- };
6488
+ async __registerNamespace(request, requestOptions) {
6671
6489
  const _authRequest = await this._options.authProvider.getAuthRequest();
6672
6490
  const _headers = mergeHeaders(
6673
6491
  _authRequest.headers,
@@ -6677,11 +6495,14 @@ var IdentityClient = class {
6677
6495
  const _response = await fetcher({
6678
6496
  url: url_exports.join(
6679
6497
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6680
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6498
+ "v1/namespaces"
6681
6499
  ),
6682
- method: "GET",
6500
+ method: "POST",
6683
6501
  headers: _headers,
6684
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6502
+ contentType: "application/json",
6503
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6504
+ requestType: "json",
6505
+ body: request,
6685
6506
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6686
6507
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6687
6508
  abortSignal: requestOptions?.abortSignal,
@@ -6693,8 +6514,12 @@ var IdentityClient = class {
6693
6514
  }
6694
6515
  if (_response.error.reason === "status-code") {
6695
6516
  switch (_response.error.statusCode) {
6696
- case 404:
6697
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6517
+ case 400:
6518
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6519
+ case 403:
6520
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6521
+ case 429:
6522
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6698
6523
  default:
6699
6524
  throw new VectrosError({
6700
6525
  statusCode: _response.error.statusCode,
@@ -6703,7 +6528,7 @@ var IdentityClient = class {
6703
6528
  });
6704
6529
  }
6705
6530
  }
6706
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6531
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6707
6532
  }
6708
6533
  /**
6709
6534
  * 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.
@@ -7580,7 +7405,7 @@ var RecordsClient = class {
7580
7405
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7581
7406
  }
7582
7407
  /**
7583
- * 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.
7408
+ * 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.
7584
7409
  *
7585
7410
  * @param {Vectros.ListRecordsRequest} request
7586
7411
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7590,8 +7415,6 @@ var RecordsClient = class {
7590
7415
  * type: "intake_form",
7591
7416
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7592
7417
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7593
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7594
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7595
7418
  * scope: "group:eng-team",
7596
7419
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7597
7420
  * })
@@ -7600,24 +7423,11 @@ var RecordsClient = class {
7600
7423
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7601
7424
  }
7602
7425
  async __listRecords(request = {}, requestOptions) {
7603
- const {
7604
- type: type_,
7605
- folderId,
7606
- userId,
7607
- orgId,
7608
- clientId,
7609
- scope,
7610
- startFrom,
7611
- limit,
7612
- includePayload,
7613
- recent
7614
- } = request;
7426
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7615
7427
  const _queryParams = {
7616
7428
  type: type_,
7617
7429
  folderId,
7618
7430
  userId,
7619
- orgId,
7620
- clientId,
7621
7431
  scope,
7622
7432
  startFrom,
7623
7433
  limit,
@@ -7917,7 +7727,7 @@ var RecordsClient = class {
7917
7727
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7918
7728
  }
7919
7729
  /**
7920
- * 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.
7730
+ * 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.
7921
7731
  *
7922
7732
  * @param {Vectros.PatchRecordRequest} request
7923
7733
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8243,7 +8053,7 @@ var SchemasClient = class {
8243
8053
  this._options = normalizeClientOptionsWithAuth(options);
8244
8054
  }
8245
8055
  /**
8246
- * 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.
8056
+ * 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.
8247
8057
  *
8248
8058
  * @param {Vectros.ListSchemasRequest} request
8249
8059
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8251,7 +8061,7 @@ var SchemasClient = class {
8251
8061
  * @example
8252
8062
  * await client.schemas.listSchemas({
8253
8063
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8254
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8064
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8255
8065
  * surface: "document",
8256
8066
  * recordType: "intake_form",
8257
8067
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8261,10 +8071,10 @@ var SchemasClient = class {
8261
8071
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8262
8072
  }
8263
8073
  async __listSchemas(request = {}, requestOptions) {
8264
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8074
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8265
8075
  const _queryParams = {
8266
8076
  userId,
8267
- orgId,
8077
+ scope,
8268
8078
  surface,
8269
8079
  recordType,
8270
8080
  startFrom,
@@ -8710,12 +8520,12 @@ var VectrosClient = class {
8710
8520
  get auth() {
8711
8521
  return this._auth ?? (this._auth = new AuthClient(this._options));
8712
8522
  }
8713
- get identity() {
8714
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8715
- }
8716
8523
  get documents() {
8717
8524
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8718
8525
  }
8526
+ get identity() {
8527
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8528
+ }
8719
8529
  get compliance() {
8720
8530
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8721
8531
  }
@@ -8813,8 +8623,8 @@ function warnOnSuboptimalKey(key, log) {
8813
8623
 
8814
8624
  // src/build-info.ts
8815
8625
  var BUILD_INFO = {
8816
- mcpServer: true ? "0.9.0" : "dev",
8817
- sdk: true ? "0.34.0" : "dev"
8626
+ mcpServer: true ? "0.11.0" : "dev",
8627
+ sdk: true ? "0.36.0" : "dev"
8818
8628
  };
8819
8629
 
8820
8630
  // src/log.ts
@@ -9018,31 +8828,45 @@ async function consumeStream(stream, onProgress) {
9018
8828
  }
9019
8829
 
9020
8830
  // src/tools/errors.ts
8831
+ function asErrorBody(body) {
8832
+ if (body && typeof body === "object") return body;
8833
+ return void 0;
8834
+ }
9021
8835
  function toolError(toolName, err, docPointer) {
9022
8836
  let summary = `${toolName} failed`;
9023
8837
  let detail = String(err);
8838
+ let errorCode;
8839
+ let requestId;
9024
8840
  if (err instanceof StreamError) {
9025
8841
  summary = `${toolName} stream error`;
9026
8842
  detail = err.message;
9027
8843
  } else if (err instanceof Error) {
9028
8844
  const e = err;
9029
8845
  detail = e.message;
8846
+ const body = asErrorBody(e.body);
8847
+ if (body) {
8848
+ if (typeof body.message === "string" && body.message.trim().length > 0) detail = body.message;
8849
+ if (typeof body.errorCode === "string" && body.errorCode.length > 0) errorCode = body.errorCode;
8850
+ if (typeof body.requestId === "string" && body.requestId.length > 0) requestId = body.requestId;
8851
+ }
9030
8852
  if (e.statusCode) {
9031
- summary = `${toolName} failed: HTTP ${e.statusCode}`;
8853
+ summary = `${toolName} failed: HTTP ${e.statusCode}${errorCode ? ` (${errorCode})` : ""}`;
9032
8854
  } else if (e.name && e.name !== "Error") {
9033
8855
  summary = `${toolName} failed: ${e.name}`;
9034
8856
  }
9035
8857
  }
9036
- const pointer = docPointer ? `
8858
+ const trailer = (errorCode ? `
8859
+ errorCode: ${errorCode}` : "") + (requestId ? `
8860
+ requestId: ${requestId}` : "") + (docPointer ? `
9037
8861
 
9038
- See: ${docPointer}` : "";
8862
+ See: ${docPointer}` : "");
9039
8863
  return {
9040
8864
  isError: true,
9041
8865
  content: [
9042
8866
  {
9043
8867
  type: "text",
9044
8868
  text: `${summary}
9045
- ${detail}${pointer}`
8869
+ ${detail}${trailer}`
9046
8870
  }
9047
8871
  ]
9048
8872
  };
@@ -9099,10 +8923,8 @@ var inputSchema = {
9099
8923
  ),
9100
8924
  // Ownership.
9101
8925
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9102
- orgId: import_zod.z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9103
- clientId: import_zod.z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9104
8926
  scope: import_zod.z.string().optional().describe(
9105
- '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.'
8927
+ '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.'
9106
8928
  ),
9107
8929
  // Date window.
9108
8930
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9121,7 +8943,7 @@ var inputSchema = {
9121
8943
  var hybridSearch = ({ client, log }) => ({
9122
8944
  name: "hybrid_search",
9123
8945
  title: "Hybrid search",
9124
- 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\".",
8946
+ description: 'Search your tenant\'s indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/scope), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller\'s scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword (BM25) leg matched nothing (all textScores 0) \u2014 typically the default PHRASE mode finding no contiguous match for a long natural-language query. Loosen the keyword leg: shorten the query to its key terms, or set textMode "AND" (all terms, higher precision) or "OR" (any term, broad recall).',
9125
8947
  inputSchema,
9126
8948
  handler: async (args) => {
9127
8949
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9139,8 +8961,6 @@ var hybridSearch = ({ client, log }) => ({
9139
8961
  typeName: args.typeName,
9140
8962
  filters: args.filters,
9141
8963
  userId: args.userId,
9142
- orgId: args.orgId,
9143
- clientId: args.clientId,
9144
8964
  scope: args.scope,
9145
8965
  createdAfter: args.createdAfter,
9146
8966
  createdBefore: args.createdBefore,
@@ -9225,10 +9045,8 @@ var inputSchema2 = {
9225
9045
  ),
9226
9046
  // List-mode args:
9227
9047
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9228
- orgId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this org."),
9229
- clientId: import_zod2.z.string().optional().describe("List mode: scope to records associated with this client."),
9230
9048
  scope: import_zod2.z.string().optional().describe(
9231
- '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.'
9049
+ '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.'
9232
9050
  ),
9233
9051
  startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9234
9052
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9238,7 +9056,7 @@ var inputSchema2 = {
9238
9056
  var recordQuery = ({ client, log }) => ({
9239
9057
  name: "record_query",
9240
9058
  title: "Record query (list or lookup)",
9241
- 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.",
9059
+ 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.",
9242
9060
  inputSchema: inputSchema2,
9243
9061
  handler: async (args) => {
9244
9062
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9292,8 +9110,6 @@ var recordQuery = ({ client, log }) => ({
9292
9110
  page = await client.records.listRecords({
9293
9111
  type,
9294
9112
  userId: args.userId,
9295
- orgId: args.orgId,
9296
- clientId: args.clientId,
9297
9113
  scope: args.scope,
9298
9114
  startFrom,
9299
9115
  limit
@@ -9379,7 +9195,7 @@ var inputSchema3 = {
9379
9195
  var recordGet = ({ client, log }) => ({
9380
9196
  name: "record_get",
9381
9197
  title: "Get a record by id or externalId",
9382
- description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window.",
9198
+ description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window. The response carries the record's processing `indexStatus`; when it is FAILED an `indexFailure.code` explains whether the content is still searchable (e.g. VECTOR_LIMIT_EXCEEDED keeps keyword search vs INDEXING_FAILED = not findable at all) \u2014 branch on the `code`, not the message.",
9383
9199
  inputSchema: inputSchema3,
9384
9200
  handler: async (args) => {
9385
9201
  const id = args.id;
@@ -9417,7 +9233,7 @@ var import_zod4 = require("zod");
9417
9233
  var inputSchema4 = {
9418
9234
  type: import_zod4.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9419
9235
  fields: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).describe(
9420
- "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values."
9236
+ "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values. Every number must fall within the signed 64-bit range (a value outside it, or with >38 significant digits, is refused with a 400 naming the field) \u2014 send a larger whole number (e.g. a big external id) as a STRING, which stores it exactly and supports exact-match lookup."
9421
9237
  ),
9422
9238
  externalId: import_zod4.z.string().optional().describe(
9423
9239
  "Stable caller-supplied id. Immutable; unique per type. Re-creating with the same externalId returns the existing record (idempotent) \u2014 use it to make creates safely retryable."
@@ -9428,16 +9244,14 @@ var inputSchema4 = {
9428
9244
  status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9429
9245
  folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9430
9246
  userId: import_zod4.z.string().optional().describe("Owning user id."),
9431
- orgId: import_zod4.z.string().optional().describe("Owning organization id."),
9432
- clientId: import_zod4.z.string().optional().describe("Associated client id."),
9433
9247
  scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
9434
- '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.'
9248
+ '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.'
9435
9249
  )
9436
9250
  };
9437
9251
  var recordCreate = ({ client, log }) => ({
9438
9252
  name: "record_create",
9439
9253
  title: "Create a record",
9440
- description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c.",
9254
+ description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c (and records:r to receive the existing record on a collision).",
9441
9255
  inputSchema: inputSchema4,
9442
9256
  handler: async (args) => {
9443
9257
  const type = args.type;
@@ -9451,8 +9265,6 @@ var recordCreate = ({ client, log }) => ({
9451
9265
  status: args.status,
9452
9266
  folderId: args.folderId,
9453
9267
  userId: args.userId,
9454
- orgId: args.orgId,
9455
- clientId: args.clientId,
9456
9268
  scopes: args.scopes
9457
9269
  }
9458
9270
  });
@@ -9556,10 +9368,8 @@ var inputSchema7 = {
9556
9368
  // answer on a specific owner / folder / type / metadata subset, not just the
9557
9369
  // whole-tenant corpus.
9558
9370
  userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9559
- orgId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9560
- clientId: import_zod7.z.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9561
9371
  scope: import_zod7.z.string().optional().describe(
9562
- '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.'
9372
+ '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.'
9563
9373
  ),
9564
9374
  folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9565
9375
  rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9587,8 +9397,6 @@ var ragAsk = ({ client, log }) => ({
9587
9397
  mode: searchArg.mode ?? "HYBRID",
9588
9398
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9589
9399
  userId: searchArg.userId,
9590
- orgId: searchArg.orgId,
9591
- clientId: searchArg.clientId,
9592
9400
  scope: searchArg.scope,
9593
9401
  folderId: searchArg.folderId,
9594
9402
  rootFolderId: searchArg.rootFolderId,
@@ -9734,32 +9542,32 @@ var inputSchema9 = {
9734
9542
  userId: import_zod9.z.string().optional().describe(
9735
9543
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9736
9544
  ),
9737
- orgId: import_zod9.z.string().optional().describe(
9738
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9545
+ scope: import_zod9.z.string().optional().describe(
9546
+ '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.'
9739
9547
  ),
9740
- surface: import_zod9.z.enum(["record", "document", "user", "org", "client"]).optional().describe(
9741
- "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."
9548
+ surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
9549
+ "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."
9742
9550
  ),
9743
9551
  recordType: import_zod9.z.string().optional().describe(
9744
- '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.'
9552
+ '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.'
9745
9553
  )
9746
9554
  };
9747
9555
  var listSchemas = ({ client, log }) => ({
9748
9556
  name: "list_schemas",
9749
9557
  title: "List record schemas",
9750
- 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.',
9558
+ 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.',
9751
9559
  inputSchema: inputSchema9,
9752
9560
  handler: async (args) => {
9753
9561
  const userId = args.userId;
9754
- const orgId = args.orgId;
9562
+ const scope = args.scope;
9755
9563
  const surface = args.surface;
9756
9564
  const recordType = args.recordType;
9757
9565
  try {
9758
9566
  const schemas = await drainPages(
9759
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9567
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9760
9568
  );
9761
9569
  log.debug(
9762
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9570
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9763
9571
  "list_schemas ok"
9764
9572
  );
9765
9573
  return {
@@ -9801,7 +9609,7 @@ function isNotAvailable(err) {
9801
9609
  var documentGet = ({ client, log }) => ({
9802
9610
  name: "document_get",
9803
9611
  title: "Get document metadata (and optionally text)",
9804
- description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`.",
9612
+ description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`. When `indexStatus` is FAILED the response also carries `indexFailure` with a machine-readable `code` telling you whether the content is still findable \u2014 e.g. TEXT_INDEX_FAILED / VECTOR_LIMIT_EXCEEDED (one leg still serves it) vs INDEXING_FAILED (not findable by search at all). Branch on `code`, not on the message.",
9805
9613
  inputSchema: inputSchema10,
9806
9614
  handler: async (args) => {
9807
9615
  const documentId = args.documentId;
@@ -9884,10 +9692,8 @@ var inputSchema11 = {
9884
9692
  // List-mode args:
9885
9693
  folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9886
9694
  userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
9887
- orgId: import_zod11.z.string().optional().describe("List mode: scope to documents belonging to this org."),
9888
- clientId: import_zod11.z.string().optional().describe("List mode: scope to documents associated with this client."),
9889
9695
  scope: import_zod11.z.string().optional().describe(
9890
- '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.'
9696
+ '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.'
9891
9697
  ),
9892
9698
  startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9893
9699
  limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9897,7 +9703,7 @@ var inputSchema11 = {
9897
9703
  var documentQuery = ({ client, log }) => ({
9898
9704
  name: "document_query",
9899
9705
  title: "Document query (list or lookup)",
9900
- 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.",
9706
+ 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.",
9901
9707
  inputSchema: inputSchema11,
9902
9708
  handler: async (args) => {
9903
9709
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9957,8 +9763,6 @@ var documentQuery = ({ client, log }) => ({
9957
9763
  page = await client.documents.listDocuments({
9958
9764
  folderId: args.folderId,
9959
9765
  userId: args.userId,
9960
- orgId: args.orgId,
9961
- clientId: args.clientId,
9962
9766
  scope: args.scope,
9963
9767
  startFrom,
9964
9768
  limit
@@ -9999,8 +9803,9 @@ var inputSchema12 = {
9999
9803
  "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."
10000
9804
  ),
10001
9805
  userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10002
- orgId: import_zod12.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10003
- clientId: import_zod12.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9806
+ scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
9807
+ '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).'
9808
+ ),
10004
9809
  expectedVersion: import_zod12.z.number().int().optional().describe(
10005
9810
  "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."
10006
9811
  )
@@ -10020,8 +9825,7 @@ var documentUpdate = ({ client, log }) => ({
10020
9825
  const folderId = args.folderId;
10021
9826
  const status = args.status;
10022
9827
  const userId = args.userId;
10023
- const orgId = args.orgId;
10024
- const clientId = args.clientId;
9828
+ const scopes = args.scopes;
10025
9829
  const expectedVersion = args.expectedVersion;
10026
9830
  try {
10027
9831
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10033,8 +9837,7 @@ var documentUpdate = ({ client, log }) => ({
10033
9837
  if (folderId !== void 0) body.folderId = folderId;
10034
9838
  if (status !== void 0) body.status = status;
10035
9839
  if (userId !== void 0) body.userId = userId;
10036
- if (orgId !== void 0) body.orgId = orgId;
10037
- if (clientId !== void 0) body.clientId = clientId;
9840
+ if (scopes !== void 0) body.scopes = scopes;
10038
9841
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10039
9842
  const updated = await client.documents.patchDocument({
10040
9843
  id: resolved.id,
@@ -10084,8 +9887,9 @@ var inputSchema14 = {
10084
9887
  id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
10085
9888
  parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10086
9889
  userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10087
- orgId: import_zod14.z.string().optional().describe("List mode: scope to folders belonging to this org."),
10088
- clientId: import_zod14.z.string().optional().describe("List mode: scope to folders associated with this client."),
9890
+ scope: import_zod14.z.string().optional().describe(
9891
+ '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.'
9892
+ ),
10089
9893
  startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10090
9894
  limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10091
9895
  `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\`.`
@@ -10094,7 +9898,7 @@ var inputSchema14 = {
10094
9898
  var folderQuery = ({ client, log }) => ({
10095
9899
  name: "folder_query",
10096
9900
  title: "Folder query (list or get)",
10097
- 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.",
9901
+ 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.",
10098
9902
  inputSchema: inputSchema14,
10099
9903
  handler: async (args) => {
10100
9904
  const id = args.id;
@@ -10108,8 +9912,7 @@ var folderQuery = ({ client, log }) => ({
10108
9912
  const page = await client.folders.listFolders({
10109
9913
  parentFolderId: args.parentId,
10110
9914
  userId: args.userId,
10111
- orgId: args.orgId,
10112
- clientId: args.clientId,
9915
+ scope: args.scope,
10113
9916
  startFrom: args.startFrom,
10114
9917
  limit
10115
9918
  });
@@ -10133,16 +9936,14 @@ var inputSchema15 = {
10133
9936
  parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10134
9937
  slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10135
9938
  userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10136
- orgId: import_zod15.z.string().optional().describe("Owning org (Vectros UUID)."),
10137
- clientId: import_zod15.z.string().optional().describe("Associated client (Vectros UUID)."),
10138
9939
  scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
10139
- '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.'
9940
+ '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.'
10140
9941
  )
10141
9942
  };
10142
9943
  var folderCreate = ({ client, log }) => ({
10143
9944
  name: "folder_create",
10144
9945
  title: "Create a folder",
10145
- description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c.",
9946
+ description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c (and folders:r to receive the existing folder on a collision).",
10146
9947
  inputSchema: inputSchema15,
10147
9948
  handler: async (args) => {
10148
9949
  try {
@@ -10153,8 +9954,6 @@ var folderCreate = ({ client, log }) => ({
10153
9954
  parentFolderId: args.parentId,
10154
9955
  slug: args.slug,
10155
9956
  userId: args.userId,
10156
- orgId: args.orgId,
10157
- clientId: args.clientId,
10158
9957
  scopes: args.scopes
10159
9958
  }
10160
9959
  });
@@ -10175,8 +9974,9 @@ var inputSchema16 = {
10175
9974
  name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
10176
9975
  description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10177
9976
  userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10178
- orgId: import_zod16.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10179
- clientId: import_zod16.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9977
+ scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
9978
+ '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).'
9979
+ ),
10180
9980
  expectedVersion: import_zod16.z.number().int().optional().describe(
10181
9981
  "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."
10182
9982
  )
@@ -10191,16 +9991,14 @@ var folderUpdate = ({ client, log }) => ({
10191
9991
  const name = args.name;
10192
9992
  const description = args.description;
10193
9993
  const userId = args.userId;
10194
- const orgId = args.orgId;
10195
- const clientId = args.clientId;
9994
+ const scopes = args.scopes;
10196
9995
  const expectedVersion = args.expectedVersion;
10197
9996
  try {
10198
9997
  const body = {};
10199
9998
  if (name !== void 0) body.name = name;
10200
9999
  if (description !== void 0) body.description = description;
10201
10000
  if (userId !== void 0) body.userId = userId;
10202
- if (orgId !== void 0) body.orgId = orgId;
10203
- if (clientId !== void 0) body.clientId = clientId;
10001
+ if (scopes !== void 0) body.scopes = scopes;
10204
10002
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10205
10003
  const updated = await client.folders.patchFolder({ id, body });
10206
10004
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10244,7 +10042,7 @@ var inputSchema18 = {
10244
10042
  var currentIdentity = ({ log, apiKey, environment }) => ({
10245
10043
  name: "current_identity",
10246
10044
  title: "Current identity (tenant + principal scope)",
10247
- description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, and (for scoped keys) allowedActions + dataScope. Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood. Backend may still be rolling out the extended /v1/ping response shape \u2014 until then this tool returns a minimal shape; richer fields appear automatically as backend ships.",
10045
+ description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood.",
10248
10046
  inputSchema: inputSchema18,
10249
10047
  handler: async () => {
10250
10048
  try {
@@ -10342,7 +10140,7 @@ var inputSchema19 = {
10342
10140
  "Index strategy. HYBRID (BM25 + dense, default; best for general retrieval), SEMANTIC (dense only; concept-driven queries), TEXT (BM25 only; exact-match / keyword), NONE (store-only / archival \u2014 retrievable by id and structured-field lookup but never in search results). Omit to inherit the bound schema's default."
10343
10141
  ),
10344
10142
  externalId: import_zod18.z.string().optional().describe(
10345
- "Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create."
10143
+ 'Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create. Receiving the existing document back is a read of it and needs documents:r in addition to documents:c; a create-only key gets an "already exists" error instead of the document.'
10346
10144
  ),
10347
10145
  upsert: import_zod18.z.boolean().optional().describe(
10348
10146
  "When true, re-ingesting an existing externalId OVERWRITES that document and re-indexes the new body (text mode) / re-uploads and re-indexes the new file (file mode), instead of returning the existing one unchanged. This is the curation/re-sync primitive: edit a source, re-ingest with upsert:true, and the search index reflects the new content. Requires the documents:u scope. IMPORTANT: pass the SAME schemaId (and type) you used originally \u2014 externalId is unique WITHIN a type, so omitting schemaId resolves in the untyped namespace and mints a duplicate instead of updating. The response `created` flag confirms which happened (created:true = a new document was minted)."
@@ -10351,12 +10149,12 @@ var inputSchema19 = {
10351
10149
  "Bind this document to a record schema. When set, `payload` is validated against the schema and its lookup fields become directly queryable via document_query (records parity). Resolve a schema id from its type via list_schemas. Omit for an untyped document."
10352
10150
  ),
10353
10151
  payload: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.unknown()).optional().describe(
10354
- "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata."
10152
+ "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata. Every number must fall within the signed 64-bit range \u2014 send a larger whole number as a STRING (stored exactly, exact-match lookup), else the ingest is refused with a 400 naming the field."
10355
10153
  ),
10356
10154
  // Inline text mode (mutually exclusive with filePath):
10357
10155
  text: import_zod18.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10358
10156
  storeText: import_zod18.z.boolean().optional().describe(
10359
- "Whether the document's text is retained after indexing (default true). Applies to BOTH modes and is fixed at ingest time. Text mode: the ingested body is always retained (this flag is effectively always true \u2014 the body is the document). File mode: true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards the extracted text once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable."
10157
+ "FILE MODE ONLY. Whether the uploaded file's EXTRACTED text is retained after indexing (default true), fixed at ingest. true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards it once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable. NOT accepted with `text`: a text-ingested body is the document itself and is ALWAYS retained, so the backend has no storeText knob on the text path \u2014 passing it with `text` is rejected rather than silently ignored."
10360
10158
  ),
10361
10159
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10362
10160
  filePath: import_zod18.z.string().min(1).optional().describe(
@@ -10366,16 +10164,14 @@ var inputSchema19 = {
10366
10164
  // Common (both modes):
10367
10165
  folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10368
10166
  userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10369
- orgId: import_zod18.z.string().optional().describe("Owning org ID. Optional."),
10370
- clientId: import_zod18.z.string().optional().describe("Owning client ID. Optional."),
10371
10167
  scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
10372
- "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."
10168
+ "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."
10373
10169
  )
10374
10170
  };
10375
10171
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10376
10172
  name: "document_ingest",
10377
10173
  title: "Ingest a new document (text body or file upload)",
10378
- description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText defaults to true and is fixed at ingest: in file mode, false discards the extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained.",
10174
+ description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate \u2014 requires documents:r in addition to documents:c, since being handed the existing document is a read of it). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText is a FILE-MODE knob (default true): false discards the uploaded file's extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained, so storeText is not accepted with `text`.",
10379
10175
  inputSchema: inputSchema19,
10380
10176
  handler: async (args) => {
10381
10177
  const title = args.title;
@@ -10412,14 +10208,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10412
10208
  )
10413
10209
  );
10414
10210
  }
10211
+ if (text && args.storeText !== void 0) {
10212
+ return toolError(
10213
+ "document_ingest",
10214
+ new Error(
10215
+ "`storeText` is not supported with `text` \u2014 a text-ingested body is the document itself and is always retained; the text path has no storeText control. Omit it (text mode), or use `filePath` mode where storeText:false discards the uploaded file's extracted text after indexing."
10216
+ )
10217
+ );
10218
+ }
10415
10219
  const common = {
10416
10220
  folderId: args.folderId,
10417
10221
  payload: args.payload,
10418
10222
  schemaId,
10419
10223
  externalId: args.externalId,
10420
- userId: args.userId,
10421
- orgId: args.orgId,
10422
- clientId: args.clientId
10224
+ userId: args.userId
10423
10225
  };
10424
10226
  try {
10425
10227
  if (text) {
@@ -10526,7 +10328,9 @@ var import_zod19 = require("zod");
10526
10328
  var MCP_DEFAULT_LIMIT5 = 10;
10527
10329
  var MCP_MAX_LIMIT5 = 100;
10528
10330
  var inputSchema20 = {
10529
- kind: import_zod19.z.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10331
+ kind: import_zod19.z.string().describe(
10332
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10333
+ ),
10530
10334
  externalId: import_zod19.z.string().optional().describe(
10531
10335
  "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."
10532
10336
  ),
@@ -10545,11 +10349,12 @@ var inputSchema20 = {
10545
10349
  };
10546
10350
  var lookupPrincipal = ({ client, log }) => ({
10547
10351
  name: "lookup_principal",
10548
- title: "Look up a user / org / client identity",
10549
- 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.",
10352
+ title: "Look up a user identity or a namespaced identity entity",
10353
+ 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.",
10550
10354
  inputSchema: inputSchema20,
10551
10355
  handler: async (args) => {
10552
10356
  const kind = args.kind;
10357
+ const isUser = kind === "user";
10553
10358
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10554
10359
  const externalId = args.externalId;
10555
10360
  const type = args.type;
@@ -10563,13 +10368,7 @@ var lookupPrincipal = ({ client, log }) => ({
10563
10368
  try {
10564
10369
  let page;
10565
10370
  if (externalId !== void 0) {
10566
- if (kind === "user") {
10567
- page = await client.identity.listUsers({ externalId, limit });
10568
- } else if (kind === "org") {
10569
- page = await client.identity.listOrgs({ externalId, limit });
10570
- } else {
10571
- page = await client.identity.listClients({ externalId, limit });
10572
- }
10371
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10573
10372
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10574
10373
  } else if (field !== void 0) {
10575
10374
  const hasEquality = value !== void 0;
@@ -10598,13 +10397,7 @@ var lookupPrincipal = ({ client, log }) => ({
10598
10397
  );
10599
10398
  }
10600
10399
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10601
- if (kind === "user") {
10602
- page = await client.identity.lookupUsers(req);
10603
- } else if (kind === "org") {
10604
- page = await client.identity.lookupOrgs(req);
10605
- } else {
10606
- page = await client.identity.lookupClients(req);
10607
- }
10400
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10608
10401
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10609
10402
  } else {
10610
10403
  return toolError(
@@ -10727,7 +10520,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10727
10520
  name: "identity",
10728
10521
  uri: "vectros://identity",
10729
10522
  title: "Current identity (tenant + principal scope)",
10730
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, environment, principalType, principalKeyId, and (for scoped keys) allowedActions + dataScope. Until backend ships the extended /v1/ping response, returns a minimal derived shape; richer fields appear automatically as backend rolls out.",
10523
+ description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, and (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). The /v1/ping backing call ships this extended shape today.",
10731
10524
  mimeType: "application/json",
10732
10525
  read: async () => {
10733
10526
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -11196,10 +10989,144 @@ function parseToolsEnv(value) {
11196
10989
  return requested;
11197
10990
  }
11198
10991
 
10992
+ // src/resolve-key.ts
10993
+ var import_node_child_process = require("child_process");
10994
+ var import_node_fs = require("fs");
10995
+ var import_node_path2 = __toESM(require("path"));
10996
+ var HELPER_COMMAND = "vectros";
10997
+ var HELPER_TIMEOUT_MS = 1e4;
10998
+ var HELPER_MAX_BUFFER = 64 * 1024;
10999
+ var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
11000
+ var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
11001
+ var DETAIL_MAX_CHARS = 200;
11002
+ async function resolveApiKey(deps = {}) {
11003
+ const env = deps.env ?? process.env;
11004
+ const envKey = env.VECTROS_API_KEY;
11005
+ if (envKey && envKey.trim().length > 0) {
11006
+ return { key: envKey.trim(), source: "env" };
11007
+ }
11008
+ const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
11009
+ if (alias !== void 0 && !ALIAS_RE.test(alias)) {
11010
+ return {
11011
+ source: "none",
11012
+ reason: "bad-alias",
11013
+ detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
11014
+ };
11015
+ }
11016
+ const runHelper = deps.runHelper ?? defaultRunHelper;
11017
+ const outcome = await runHelper({ alias, env });
11018
+ switch (outcome.status) {
11019
+ case "ok":
11020
+ return { key: outcome.secret, source: "keyring", alias };
11021
+ case "cli-absent":
11022
+ return { source: "none", reason: "cli-absent", alias };
11023
+ // Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
11024
+ // seam, so redacting only inside the default implementation would leave any
11025
+ // other implementation's text to reach the fatal log raw. Belongs at the sink.
11026
+ case "no-usable-key":
11027
+ return {
11028
+ source: "none",
11029
+ reason: "no-usable-key",
11030
+ alias,
11031
+ detail: outcome.detail ? redactDetail(outcome.detail) : void 0
11032
+ };
11033
+ case "error":
11034
+ return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
11035
+ }
11036
+ }
11037
+ function noKeyMessage(resolved) {
11038
+ const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
11039
+ switch (resolved.reason) {
11040
+ case "cli-absent":
11041
+ 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>\`.`;
11042
+ case "no-usable-key":
11043
+ 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}.`;
11044
+ case "bad-alias":
11045
+ 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}.`;
11046
+ case "helper-failed":
11047
+ 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.`;
11048
+ default:
11049
+ return `no API key: ${setEnv}.`;
11050
+ }
11051
+ }
11052
+ function keyringNotice(resolved) {
11053
+ if (resolved.source !== "keyring") return void 0;
11054
+ if (resolved.alias !== void 0) {
11055
+ return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
11056
+ }
11057
+ return {
11058
+ level: "warn",
11059
+ alias: "(active)",
11060
+ 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."
11061
+ };
11062
+ }
11063
+ function redactDetail(message) {
11064
+ const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
11065
+ return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
11066
+ }
11067
+ function resolveCommandPath(command, env, platform = process.platform) {
11068
+ const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
11069
+ if (!pathVar) return void 0;
11070
+ const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
11071
+ for (const rawDir of pathVar.split(import_node_path2.default.delimiter)) {
11072
+ const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
11073
+ if (!dir || !import_node_path2.default.isAbsolute(dir)) continue;
11074
+ for (const ext of exts) {
11075
+ const candidate = import_node_path2.default.join(dir, command + ext);
11076
+ try {
11077
+ if ((0, import_node_fs.statSync)(candidate).isFile()) return candidate;
11078
+ } catch {
11079
+ }
11080
+ }
11081
+ }
11082
+ return void 0;
11083
+ }
11084
+ function mapExecResult(err, stdout, stderr = "") {
11085
+ if (!err) {
11086
+ const secret = stdout.trim();
11087
+ return secret ? { status: "ok", secret } : { status: "no-usable-key" };
11088
+ }
11089
+ const code = err.code;
11090
+ if (code === "ENOENT") return { status: "cli-absent" };
11091
+ const detail = redactDetail(stderr.trim() || err.message);
11092
+ if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
11093
+ return { status: "error", detail };
11094
+ }
11095
+ function defaultRunHelper({ alias, env }, deps = {}) {
11096
+ const platform = deps.platform ?? process.platform;
11097
+ const exec = deps.execFileImpl ?? import_node_child_process.execFile;
11098
+ const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
11099
+ if (!resolved) return Promise.resolve({ status: "cli-absent" });
11100
+ const isWindows = platform === "win32";
11101
+ const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
11102
+ const file = isWindows ? `"${resolved}"` : resolved;
11103
+ return new Promise((resolve2) => {
11104
+ exec(
11105
+ file,
11106
+ args,
11107
+ {
11108
+ env,
11109
+ timeout: HELPER_TIMEOUT_MS,
11110
+ maxBuffer: HELPER_MAX_BUFFER,
11111
+ windowsHide: true,
11112
+ shell: isWindows
11113
+ },
11114
+ (err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
11115
+ );
11116
+ });
11117
+ }
11118
+
11199
11119
  // src/cli-http.ts
11200
11120
  async function main() {
11201
11121
  const log = createLogger2();
11202
- const apiKey = process.env.VECTROS_API_KEY;
11122
+ const resolved = await resolveApiKey();
11123
+ const apiKey = resolved.key;
11124
+ const notice = keyringNotice(resolved);
11125
+ if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
11126
+ if (!apiKey) {
11127
+ log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
11128
+ process.exit(1);
11129
+ }
11203
11130
  const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
11204
11131
  if (apiBaseUrl !== void 0) {
11205
11132
  try {