@vectros-ai/cli 0.11.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to `@vectros-ai/cli` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org).
5
5
 
6
+ ## 0.12.0
7
+
8
+ ### Added
9
+
10
+ - **Blueprints can declare `basedOn` on a schema.** A blueprint schema may now set
11
+ `basedOn: <schemaId>` to mark itself as a customization of an existing same-named
12
+ schema in the context; the loader forwards it to `createSchema`. Previously a
13
+ blueprint declaring `basedOn` would fail blueprint validation outright (an
14
+ unrecognized field); now it's accepted and forwarded. No bundled blueprint uses
15
+ this yet — it's forward-looking plumbing for a blueprint author (or a re-apply
16
+ into a context that already has a same-named hand-authored schema) who would
17
+ otherwise hit a `400` with no escape.
18
+
19
+ ### Changed
20
+
21
+ - **Dependency maintenance** — repinned the bundled `@vectros-ai/sdk` to `0.37.0`
22
+ (additive `basedOn` schema customization, `specificityRank` on namespaces, and
23
+ search/RAG response fields) and the bundled `@vectros-ai/blueprints` to `0.9.0`.
24
+ The CLI bundles both into its published binary, so this is a rebuild against
25
+ their current versions.
26
+
6
27
  ## 0.11.0
7
28
 
8
29
  ### Fixed
package/dist/cli.js CHANGED
@@ -1614,7 +1614,7 @@ var require_proper_lockfile = __commonJS({
1614
1614
  // src/cli-bootstrap.ts
1615
1615
  var readline = __toESM(require("readline/promises"));
1616
1616
 
1617
- // ../../node_modules/@vectros-ai/sdk/dist/index.mjs
1617
+ // node_modules/@vectros-ai/sdk/dist/index.mjs
1618
1618
  var __defProp2 = Object.defineProperty;
1619
1619
  var __export = (target, all) => {
1620
1620
  for (var name in all)
@@ -6224,7 +6224,7 @@ var DocumentsClient = class {
6224
6224
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents");
6225
6225
  }
6226
6226
  /**
6227
- * Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply an `externalId` to make the create idempotent — if a document with the same `externalId` already exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set `?upsert=true` (this also requires the `documents:u` scope). Requires the `documents:c` scope.
6227
+ * Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply an `externalId` to make the create idempotent — if a document with the same `externalId` already exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set `?upsert=true` (this also requires the `documents:u` scope). Requires the `documents:c` scope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires the `documents:r` scope — a credential holding `documents:c` alone receives a `400` ("already exists") on collision instead of the document.
6228
6228
  *
6229
6229
  * @param {Vectros.IngestDocumentRequest} request
6230
6230
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6550,25 +6550,29 @@ var DocumentsClient = class {
6550
6550
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/v1/documents/{id}");
6551
6551
  }
6552
6552
  /**
6553
- * Finds documents of a given type by field value. Supported fields: `externalId` (the document's first-class external identifier — no schema declaration required) and any field declared as a lookup field on the bound schema. A lookup on a sensitive field is rejected here because the value would appear in the URL query string; use POST /v1/documents/lookup (the request-body variant) for a sensitive field instead. Results are paginated: set `limit` for the page size and feed the returned `nextCursor` back as `startFrom` to fetch the next page. The response is a `{data, nextCursor}` envelope. Requires the `documents:r` scope.
6553
+ * Finds documents of a given type by field value. Supported fields: `externalId` (the document's first-class external identifier — no schema declaration required) and any field declared as a lookup field on the bound schema. A lookup on a sensitive field is rejected here because the value would appear in the URL query string; use POST /v1/documents/lookup (the request-body variant) for a sensitive field instead. `type`'s schema resolves with basedOn-aware shadowing: your own `userId`- or `scope`-owned variant if you have one, otherwise the shared base — for a scoped credential the owner is always your own token identity; `userId`/`scope` here only apply as an explicit owner selector for a root API key. Results are paginated: set `limit` for the page size and feed the returned `nextCursor` back as `startFrom` to fetch the next page. The response is a `{data, nextCursor}` envelope. Requires the `documents:r` scope.
6554
6554
  *
6555
6555
  * @param {Vectros.LookupDocumentsRequest} request
6556
6556
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
6557
6557
  *
6558
+ * @throws {@link Vectros.BadRequestError}
6559
+ *
6558
6560
  * @example
6559
6561
  * await client.documents.lookupDocuments({
6560
6562
  * type: "invoice",
6561
6563
  * field: "po_number",
6562
6564
  * value: "PO-1001",
6563
6565
  * prefix: "PO-2024",
6564
- * startFrom: "550e8400-e29b-41d4-a716-446655440000"
6566
+ * startFrom: "550e8400-e29b-41d4-a716-446655440000",
6567
+ * userId: "550e8400-e29b-41d4-a716-446655440000",
6568
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6565
6569
  * })
6566
6570
  */
6567
6571
  lookupDocuments(request, requestOptions) {
6568
6572
  return HttpResponsePromise.fromPromise(this.__lookupDocuments(request, requestOptions));
6569
6573
  }
6570
6574
  async __lookupDocuments(request, requestOptions) {
6571
- const { type: type_, field, value, from: from_, to, prefix, startFrom, limit, order } = request;
6575
+ const { type: type_, field, value, from: from_, to, prefix, startFrom, limit, order, userId, scope } = request;
6572
6576
  const _queryParams = {
6573
6577
  type: type_,
6574
6578
  field,
@@ -6578,7 +6582,9 @@ var DocumentsClient = class {
6578
6582
  prefix,
6579
6583
  startFrom,
6580
6584
  limit,
6581
- order: order != null ? order : void 0
6585
+ order: order != null ? order : void 0,
6586
+ userId,
6587
+ scope
6582
6588
  };
6583
6589
  const _authRequest = await this._options.authProvider.getAuthRequest();
6584
6590
  const _headers = mergeHeaders(
@@ -6604,11 +6610,16 @@ var DocumentsClient = class {
6604
6610
  return { data: _response.body, rawResponse: _response.rawResponse };
6605
6611
  }
6606
6612
  if (_response.error.reason === "status-code") {
6607
- throw new VectrosError({
6608
- statusCode: _response.error.statusCode,
6609
- body: _response.error.body,
6610
- rawResponse: _response.rawResponse
6611
- });
6613
+ switch (_response.error.statusCode) {
6614
+ case 400:
6615
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6616
+ default:
6617
+ throw new VectrosError({
6618
+ statusCode: _response.error.statusCode,
6619
+ body: _response.error.body,
6620
+ rawResponse: _response.rawResponse
6621
+ });
6622
+ }
6612
6623
  }
6613
6624
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents/lookup");
6614
6625
  }
@@ -6976,7 +6987,7 @@ var FoldersClient = class {
6976
6987
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/folders");
6977
6988
  }
6978
6989
  /**
6979
- * Creates a folder to organize your documents and records. If `parentFolderId` is omitted, the folder is created under your context's default root folder. Folder creation is idempotent by (slug + parent): if a folder with the same slug already exists under the same parent, that existing folder is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing folder was returned) tells the two apart. To overwrite an existing folder's mutable fields instead of returning it unchanged, set `?upsert=true` (this also requires the `folders:u` scope). Requires the `folders:c` scope.
6990
+ * Creates a folder to organize your documents and records. If `parentFolderId` is omitted, the folder is created under your context's default root folder. Folder creation is idempotent by (slug + parent): if a folder with the same slug already exists under the same parent, that existing folder is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing folder was returned) tells the two apart. To overwrite an existing folder's mutable fields instead of returning it unchanged, set `?upsert=true` (this also requires the `folders:u` scope). Requires the `folders:c` scope to create. Being returned the existing folder on a collision is a read of that folder's data and additionally requires the `folders:r` scope — a credential holding `folders:c` alone receives a `400` ("already exists") on collision instead of the folder.
6980
6991
  *
6981
6992
  * @param {Vectros.CreateFolderRequest} request
6982
6993
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7434,7 +7445,7 @@ var IdentityClient = class {
7434
7445
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
7435
7446
  }
7436
7447
  /**
7437
- * 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.
7448
+ * 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 to create. Being returned the existing entity on a collision is a read of that entity's data and additionally requires the `entities:r:<namespace>` scope — a credential holding `entities:c:<namespace>` alone receives a `400` ("already in use") on collision instead of the entity.
7438
7449
  *
7439
7450
  * @param {Vectros.CreateEntityRequest} request
7440
7451
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7878,7 +7889,7 @@ var IdentityClient = class {
7878
7889
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
7879
7890
  }
7880
7891
  /**
7881
- * 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.
7892
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
7882
7893
  *
7883
7894
  * @param {Vectros.UpdateNamespaceRequest} request
7884
7895
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7891,7 +7902,8 @@ var IdentityClient = class {
7891
7902
  * await client.identity.updateNamespace({
7892
7903
  * namespace: "team",
7893
7904
  * body: {
7894
- * namespace: "team"
7905
+ * namespace: "team",
7906
+ * specificityRank: 1500
7895
7907
  * }
7896
7908
  * })
7897
7909
  */
@@ -8056,7 +8068,7 @@ var IdentityClient = class {
8056
8068
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
8057
8069
  }
8058
8070
  /**
8059
- * 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.
8071
+ * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
8060
8072
  *
8061
8073
  * @param {Vectros.NamespaceRequest} request
8062
8074
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8067,7 +8079,8 @@ var IdentityClient = class {
8067
8079
  *
8068
8080
  * @example
8069
8081
  * await client.identity.registerNamespace({
8070
- * namespace: "team"
8082
+ * namespace: "team",
8083
+ * specificityRank: 1500
8071
8084
  * })
8072
8085
  */
8073
8086
  registerNamespace(request, requestOptions) {
@@ -8184,7 +8197,7 @@ var IdentityClient = class {
8184
8197
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users");
8185
8198
  }
8186
8199
  /**
8187
- * Creates a user identity in your account. The operation is idempotent on `externalId`: if a user 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 user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope.
8200
+ * Creates a user identity in your account. The operation is idempotent on `externalId`: if a user 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 user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope to create. Being returned the existing user on a collision is a read of that user's data and additionally requires the `users:r` scope — a credential holding `users:c` alone receives a `400` ("already exists") on collision instead of the user.
8188
8201
  *
8189
8202
  * @param {Vectros.CreateUserRequest} request
8190
8203
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -9055,7 +9068,7 @@ var RecordsClient = class {
9055
9068
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/records");
9056
9069
  }
9057
9070
  /**
9058
- * Creates a new record of a given type. The `payload` is validated against that type's schema before the record is stored. Identify the type by sending `typeName`, `schemaId`, or both (they must agree); if you send only `schemaId`, the type is taken from that schema. Optionally supply an `externalId` to make the create idempotent — if a record with the same `externalId` already exists in your context, that existing record is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing record was returned) tells the two apart. To overwrite an existing record's content instead of returning it unchanged, set `?upsert=true` (this also requires the `records:u:<type>` scope). Requires the `records:c:<type>` scope.
9071
+ * Creates a new record of a given type. The `payload` is validated against that type's schema before the record is stored. Identify the type by sending `typeName`, `schemaId`, or both (they must agree); if you send only `schemaId`, the type is taken from that schema. Optionally supply an `externalId` to make the create idempotent — if a record with the same `externalId` already exists in your context, that existing record is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing record was returned) tells the two apart. To overwrite an existing record's content instead of returning it unchanged, set `?upsert=true` (this also requires the `records:u:<type>` scope). Requires the `records:c:<type>` scope to create. Being returned the existing record on a collision is a read of that record's data and additionally requires the `records:r:<type>` scope — a credential holding `records:c:<type>` alone receives a `400` ("already exists") on collision instead of the record.
9059
9072
  *
9060
9073
  * @param {Vectros.CreateRecordRequest} request
9061
9074
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -9646,6 +9659,8 @@ var SchemasClient = class {
9646
9659
  * @param {Vectros.ListSchemasRequest} request
9647
9660
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
9648
9661
  *
9662
+ * @throws {@link Vectros.BadRequestError}
9663
+ *
9649
9664
  * @example
9650
9665
  * await client.schemas.listSchemas({
9651
9666
  * userId: "550e8400-e29b-41d4-a716-446655440000",
@@ -9692,16 +9707,21 @@ var SchemasClient = class {
9692
9707
  return { data: _response.body, rawResponse: _response.rawResponse };
9693
9708
  }
9694
9709
  if (_response.error.reason === "status-code") {
9695
- throw new VectrosError({
9696
- statusCode: _response.error.statusCode,
9697
- body: _response.error.body,
9698
- rawResponse: _response.rawResponse
9699
- });
9710
+ switch (_response.error.statusCode) {
9711
+ case 400:
9712
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
9713
+ default:
9714
+ throw new VectrosError({
9715
+ statusCode: _response.error.statusCode,
9716
+ body: _response.error.body,
9717
+ rawResponse: _response.rawResponse
9718
+ });
9719
+ }
9700
9720
  }
9701
9721
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas");
9702
9722
  }
9703
9723
  /**
9704
- * Defines a new record type with optional field definitions, validation rules, and lookup indexes. Idempotent by `typeName` within the same ownership scope: re-creating an existing `typeName` returns the existing schema rather than failing. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing schema was returned) tells the two apart. To reconcile an existing schema to the submitted shape instead of returning it unchanged, set `?upsert=true` (this also requires the `schemas:w` scope; only legal schema changes are applied — migration-locked changes are rejected). Requires the `schemas:w` scope.
9724
+ * Defines a new record type with optional field definitions, validation rules, and lookup indexes. Idempotent by `typeName` within the same ownership scope: re-creating an existing `typeName` returns the existing schema rather than failing. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing schema was returned) tells the two apart. To reconcile an existing schema to the submitted shape instead of returning it unchanged, set `?upsert=true` (this also requires the `schemas:u` scope; only legal schema changes are applied — migration-locked changes are rejected). Requires the `schemas:c` scope to create. Being returned the existing schema on a collision is a read of that schema's data and additionally requires the `schemas:r` scope — a credential holding `schemas:c` alone receives a `400` ("already in use") on collision instead of the schema.
9705
9725
  *
9706
9726
  * @param {Vectros.CreateSchemaRequest} request
9707
9727
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -9845,7 +9865,7 @@ var SchemasClient = class {
9845
9865
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}");
9846
9866
  }
9847
9867
  /**
9848
- * Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Requires the `schemas:w` scope.
9868
+ * Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Requires the `schemas:u` scope.
9849
9869
  *
9850
9870
  * @param {Vectros.UpdateSchemaRequest} request
9851
9871
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -9914,7 +9934,7 @@ var SchemasClient = class {
9914
9934
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/schemas/{id}");
9915
9935
  }
9916
9936
  /**
9917
- * Permanently deletes a record schema. The request is refused with 409 if records of this type still exist — delete those records first, since every record must reference a live schema. Requires the `schemas:w` scope.
9937
+ * Permanently deletes a record schema. The request is refused with 409 if records of this type still exist — delete those records first, since every record must reference a live schema. A lineage base (a schema other schemas declare `basedOn`) also cannot be deleted while any such variant still exists — delete the variant schema(s) first. Requires the `schemas:d` scope.
9918
9938
  *
9919
9939
  * @param {Vectros.DeleteSchemaRequest} request
9920
9940
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -10311,7 +10331,14 @@ var BlueprintSchemaSchema = import_zod.z.object({
10311
10331
  // With a scoped token these must be consistent with the profile's dataScope
10312
10332
  // (a cross-consistency lint is deferred to the lint slice).
10313
10333
  userId: import_zod.z.string().min(1).optional(),
10314
- scopes: import_zod.z.array(import_zod.z.string().min(1)).max(2).optional()
10334
+ scopes: import_zod.z.array(import_zod.z.string().min(1)).max(2).optional(),
10335
+ // The id of an existing schema this one is a CUSTOMIZATION of, when a schema
10336
+ // named `typeName` already exists in this context — required in that case,
10337
+ // and must be omitted when this create is the first schema under that name
10338
+ // (it becomes that name's shared base). Must point directly at the base (one
10339
+ // hop); immutable once set. Mirrors the `basedOn` field on the platform's
10340
+ // schema-create request.
10341
+ basedOn: import_zod.z.string().min(1).optional()
10315
10342
  }).strict();
10316
10343
  var BlueprintAccessProfileSchema = import_zod.z.object({
10317
10344
  // Validated structurally here; the SCOPE GATE (in @vectros-ai/cli) is
@@ -13469,7 +13496,8 @@ async function runLoader(client, input) {
13469
13496
  capabilities: toCapabilities(s.capabilities),
13470
13497
  active: s.active,
13471
13498
  userId: s.userId,
13472
- scopes: s.scopes
13499
+ scopes: s.scopes,
13500
+ basedOn: s.basedOn
13473
13501
  };
13474
13502
  const resp = await ctxClient.schemas.createSchema({ upsert: true, body: schemaBody });
13475
13503
  if (resp.id) schemaIds[s.typeName] = resp.id;
@@ -18346,9 +18374,9 @@ function emitJoined(alias, context, principalId, role, keyId, reused) {
18346
18374
 
18347
18375
  // src/build-info.ts
18348
18376
  var BUILD_INFO = {
18349
- cli: true ? "0.11.0" : "dev",
18350
- sdk: true ? "0.36.0" : "dev",
18351
- blueprints: true ? "0.8.0" : "dev"
18377
+ cli: true ? "0.12.0" : "dev",
18378
+ sdk: true ? "0.37.0" : "dev",
18379
+ blueprints: true ? "0.9.0" : "dev"
18352
18380
  };
18353
18381
  function formatBuildInfo() {
18354
18382
  return `vectros ${BUILD_INFO.cli} (sdk ${BUILD_INFO.sdk}, blueprints ${BUILD_INFO.blueprints})`;