@kortexya/reasoninglayer 7.2.0 → 8.1.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/index.cjs CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  };
8
8
 
9
9
  // src/config.ts
10
- var SDK_VERSION = "7.2.0";
10
+ var SDK_VERSION = "8.1.0";
11
11
  function resolveConfig(config) {
12
12
  if (!config.baseUrl) {
13
13
  throw new Error("ClientConfig.baseUrl is required");
@@ -16968,6 +16968,23 @@ var Vocabulary = class {
16968
16968
  format: "json",
16969
16969
  ...params
16970
16970
  });
16971
+ /**
16972
+ * No description
16973
+ *
16974
+ * @tags vocabulary
16975
+ * @name LookupRecords
16976
+ * @summary `GET /api/v1/vocabulary/records` — the records of one view with the ids asked (#632). A client names the few records a finding, a conflict or a list cites without reading a whole release or change set; the view is the cached release or candidate view, so a lookup costs the ids asked.
16977
+ * @request GET:/api/v1/vocabulary/records
16978
+ * @secure
16979
+ */
16980
+ lookupRecords = (query, params = {}) => this.http.request({
16981
+ path: `/api/v1/vocabulary/records`,
16982
+ method: "GET",
16983
+ query,
16984
+ secure: true,
16985
+ format: "json",
16986
+ ...params
16987
+ });
16971
16988
  /**
16972
16989
  * No description
16973
16990
  *
@@ -17106,6 +17123,23 @@ var Vocabulary = class {
17106
17123
  format: "json",
17107
17124
  ...params
17108
17125
  });
17126
+ /**
17127
+ * No description
17128
+ *
17129
+ * @tags vocabulary
17130
+ * @name RevisionRecords
17131
+ * @summary `GET /api/v1/vocabulary/revisions/{revision_id}/records` — the records the revision's cumulative change set inserts or replaces, by id, optionally of one kind (#628). The revision answer counts them; this read pages them from the cached candidate view, so a page costs a page once the revision is indexed (#630).
17132
+ * @request GET:/api/v1/vocabulary/revisions/{revision_id}/records
17133
+ * @secure
17134
+ */
17135
+ revisionRecords = (revisionId, query, params = {}) => this.http.request({
17136
+ path: `/api/v1/vocabulary/revisions/${revisionId}/records`,
17137
+ method: "GET",
17138
+ query,
17139
+ secure: true,
17140
+ format: "json",
17141
+ ...params
17142
+ });
17109
17143
  /**
17110
17144
  * No description
17111
17145
  *
@@ -19573,7 +19607,8 @@ var RESPONSE_COMPONENTS = {
19573
19607
  created_by: [1, 0],
19574
19608
  minted_ids: [1, { object: {} }],
19575
19609
  outcome: [1, 0],
19576
- records: [1, { array: 0 }],
19610
+ proposal_counts: [1, { object: {} }],
19611
+ record_counts: [1, { object: {} }],
19577
19612
  removals: [1, { array: 0 }],
19578
19613
  replayed: [1, 0],
19579
19614
  revision_id: [1, 0],
@@ -25336,6 +25371,14 @@ var RESPONSE_COMPONENTS = {
25336
25371
  },
25337
25372
  RecordEpisodeResponse: { object: { episode_id: [1, 0], message: [1, 0] } },
25338
25373
  RecordFeatureChangeDto: { object: { feature: [1, 0] } },
25374
+ RecordLookupResponse: {
25375
+ object: {
25376
+ context: [2, "ContextRefDto"],
25377
+ items: [1, { array: 0 }],
25378
+ missing: [1, { array: 0 }],
25379
+ view: [1, "ViewRefDto"]
25380
+ }
25381
+ },
25339
25382
  RecordPageResponse: { object: { items: [1, { array: 0 }], release_id: [1, 0] } },
25340
25383
  RecordSafeHarborStatus: {
25341
25384
  object: {
@@ -25718,6 +25761,7 @@ var RESPONSE_COMPONENTS = {
25718
25761
  revision_id: [1, 0]
25719
25762
  }
25720
25763
  },
25764
+ RevisionRecordPageResponse: { object: { items: [1, { array: 0 }], revision_id: [1, 0] } },
25721
25765
  RevisionSummaryDto: {
25722
25766
  object: {
25723
25767
  authors: [1, { array: 0 }],
@@ -30562,6 +30606,11 @@ var RESPONSE_OPERATIONS = {
30562
30606
  path: "/api/v1/workflows",
30563
30607
  responses: { 200: "WorkflowListResponse" }
30564
30608
  },
30609
+ lookupRecords: {
30610
+ method: "GET",
30611
+ path: "/api/v1/vocabulary/records",
30612
+ responses: { 200: "RecordLookupResponse" }
30613
+ },
30565
30614
  markChoicePoint: {
30566
30615
  method: "POST",
30567
30616
  path: "/api/v1/execution/sessions/{session_id}/mark",
@@ -31289,6 +31338,11 @@ var RESPONSE_OPERATIONS = {
31289
31338
  path: "/api/v1/vocabulary/revisions/{revision_id}/diff",
31290
31339
  responses: { 200: "RevisionDiffDto" }
31291
31340
  },
31341
+ revisionRecords: {
31342
+ method: "GET",
31343
+ path: "/api/v1/vocabulary/revisions/{revision_id}/records",
31344
+ responses: { 200: "RevisionRecordPageResponse" }
31345
+ },
31292
31346
  revokeApproverRoleHandler: {
31293
31347
  method: "DELETE",
31294
31348
  path: "/api/v1/action-reviews/role-bindings/{principal}",
@@ -39284,14 +39338,16 @@ var NamespacesClient = class {
39284
39338
  *
39285
39339
  * @param namespaceId - Namespace UUID.
39286
39340
  * @param requestOptions - Per-call options (timeout, retries, signal, headers).
39287
- * @returns The counters of this engine process since `countedSince`.
39341
+ * @returns The engine's durable counters for the namespace since `countedSince`.
39288
39342
  * @throws {ForbiddenError} 403 without a native `manage_answer_cache` grant.
39289
39343
  * @throws {NotFoundError} 404 for a namespace not in this tenant.
39290
- * @throws {ServiceUnavailableError} 503 when the namespace state or authority is unavailable.
39344
+ * @throws {ServiceUnavailableError} 503 when the namespace state, authority or savings storage is unavailable.
39291
39345
  *
39292
39346
  * @remarks
39293
39347
  * `GET /api/v1/namespaces/{id}/answer-cache-savings`. The counters are
39294
- * process-local and not durable; token savings are not measured
39348
+ * durable and summed across engine processes and restarts; another
39349
+ * process's counts arrive within its five-second write interval. Token
39350
+ * savings are not measured
39295
39351
  * (`tokenUsageMeasured: false`). Response mapped from snake_case.
39296
39352
  *
39297
39353
  * @example
@@ -70659,6 +70715,12 @@ function TaxonomyPolicyInputFromFrontToApi(record) {
70659
70715
  }
70660
70716
  return out;
70661
70717
  }
70718
+ function DefinitionPolicyInputFromFrontToApi(record) {
70719
+ return {
70720
+ scheme: VocabularyRecordRefFromFrontToApi(record.scheme),
70721
+ definitions: record.definitions
70722
+ };
70723
+ }
70662
70724
  function ExternalConceptInputFromFrontToApi(record) {
70663
70725
  const out = {
70664
70726
  authority: record.authority,
@@ -70817,10 +70879,19 @@ function VocabularyRecordInputFromFrontToApi(record) {
70817
70879
  };
70818
70880
  case "collection_member":
70819
70881
  return { kind: "collection_member", ...CollectionMemberInputFromFrontToApi(record) };
70882
+ case "definition_policy":
70883
+ return { kind: "definition_policy", ...DefinitionPolicyInputFromFrontToApi(record) };
70820
70884
  }
70821
70885
  }
70822
70886
  function VocabularyRecordOperationFromFrontToApi(operation) {
70823
- return operation.op === "upsert" ? { op: "upsert", record: VocabularyRecordInputFromFrontToApi(operation.record) } : { op: "remove", record_id: operation.recordId };
70887
+ switch (operation.op) {
70888
+ case "upsert":
70889
+ return { op: "upsert", record: VocabularyRecordInputFromFrontToApi(operation.record) };
70890
+ case "remove":
70891
+ return { op: "remove", record_id: operation.recordId };
70892
+ case "accept_proposals":
70893
+ return { op: "accept_proposals" };
70894
+ }
70824
70895
  }
70825
70896
  function CreateVocabularyCandidateRequestFromFrontToApi(request) {
70826
70897
  return {
@@ -71182,6 +71253,16 @@ function VocabularyTaxonomyPolicyRecordFromApiToFront(dto) {
71182
71253
  if (present(dto.partitive_transitive)) out.partitiveTransitive = dto.partitive_transitive;
71183
71254
  return out;
71184
71255
  }
71256
+ function VocabularyDefinitionPolicyRecordFromApiToFront(dto) {
71257
+ return {
71258
+ recordId: dto.record_id,
71259
+ revision: dto.revision,
71260
+ changeReason: dto.change_reason,
71261
+ scheme: dto.scheme,
71262
+ policy: dto.policy,
71263
+ definitions: dto.definitions
71264
+ };
71265
+ }
71185
71266
  function VocabularyExternalConceptRecordFromApiToFront(dto) {
71186
71267
  const out = {
71187
71268
  recordId: dto.record_id,
@@ -71400,6 +71481,11 @@ function VocabularyRecordViewFromApiToFront(dto) {
71400
71481
  kind: "migration_decision",
71401
71482
  ...VocabularyMigrationDecisionRecordFromApiToFront(dto)
71402
71483
  };
71484
+ case "definition_policy":
71485
+ return {
71486
+ kind: "definition_policy",
71487
+ ...VocabularyDefinitionPolicyRecordFromApiToFront(dto)
71488
+ };
71403
71489
  }
71404
71490
  }
71405
71491
  function FindingContextFromApiToFront(dto) {
@@ -71767,7 +71853,8 @@ function VocabularyCandidateRevisionFromApiToFront(dto) {
71767
71853
  createdBy: dto.created_by,
71768
71854
  createdAt: dto.created_at,
71769
71855
  changeReason: dto.change_reason,
71770
- records: dto.records.map(VocabularyRecordViewFromApiToFront),
71856
+ recordCounts: dataMap(dto.record_counts),
71857
+ proposalCounts: dataMap(dto.proposal_counts),
71771
71858
  removals: dto.removals,
71772
71859
  mintedIds: dataMap(dto.minted_ids),
71773
71860
  advisoryFindings: dto.advisory_findings.map(VocabularyFindingFromApiToFront),
@@ -71948,6 +72035,23 @@ function VocabularyRecordPageFromApiToFront(dto) {
71948
72035
  if (present(dto.next_cursor)) out.nextCursor = dto.next_cursor;
71949
72036
  return out;
71950
72037
  }
72038
+ function VocabularyRevisionRecordPageFromApiToFront(dto) {
72039
+ const out = {
72040
+ revisionId: dto.revision_id,
72041
+ items: dto.items.map(VocabularyRecordViewFromApiToFront)
72042
+ };
72043
+ if (present(dto.next_cursor)) out.nextCursor = dto.next_cursor;
72044
+ return out;
72045
+ }
72046
+ function VocabularyRecordLookupFromApiToFront(dto) {
72047
+ const out = {
72048
+ view: ViewRefFromApiToFront(dto.view),
72049
+ items: dto.items.map(VocabularyRecordViewFromApiToFront),
72050
+ missing: dto.missing
72051
+ };
72052
+ if (present(dto.context)) out.context = VocabularyContextRefFromApiToFront(dto.context);
72053
+ return out;
72054
+ }
71951
72055
  function VocabularyActivationResultFromApiToFront(dto) {
71952
72056
  const out = {
71953
72057
  releaseId: dto.release_id,
@@ -73074,7 +73178,7 @@ var VocabularyClient = class {
73074
73178
  return decodeResponse(response, VocabularyCandidateRevisionFromApiToFront);
73075
73179
  }
73076
73180
  /**
73077
- * One revision: its baseline, authors, records and removals.
73181
+ * One revision: its baseline, authors, record counts and removals.
73078
73182
  *
73079
73183
  * @param revisionId - The revision (UUID).
73080
73184
  * @param requestOptions - Per-call options (timeout, retries, signal, headers).
@@ -73083,18 +73187,84 @@ var VocabularyClient = class {
73083
73187
  * @throws {@link VocabularyRefusedError} 409 `vocabulary_plugin_unavailable`.
73084
73188
  *
73085
73189
  * @remarks
73086
- * `GET /api/v1/vocabulary/revisions/{revision_id}`.
73190
+ * `GET /api/v1/vocabulary/revisions/{revision_id}`. The answer counts the
73191
+ * records by kind (`recordCounts`) and the proposals among them
73192
+ * (`proposalCounts`); read the records with
73193
+ * {@link VocabularyClient.listRevisionRecords} or
73194
+ * {@link VocabularyClient.lookupRecords}.
73087
73195
  *
73088
73196
  * @example
73089
73197
  * ```typescript
73090
73198
  * const revision = await client.vocabulary.getRevision(revisionId);
73091
- * const concepts = revision.records.filter((r) => r.kind === 'concept');
73199
+ * const conceptCount = revision.recordCounts['concept'] ?? 0;
73200
+ * const toAccept = Object.values(revision.proposalCounts).reduce((n, c) => n + c, 0);
73092
73201
  * ```
73093
73202
  */
73094
73203
  async getRevision(revisionId, requestOptions) {
73095
73204
  const response = await this.api.getRevision(revisionId, toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
73096
73205
  return decodeResponse(response, VocabularyCandidateRevisionFromApiToFront);
73097
73206
  }
73207
+ /**
73208
+ * One page of the records a revision's cumulative change set inserts or
73209
+ * replaces.
73210
+ *
73211
+ * @param revisionId - The revision (UUID).
73212
+ * @param query - A record-kind filter and cursor paging (`limit` 1 to 500).
73213
+ * @param requestOptions - Per-call options (timeout, retries, signal, headers).
73214
+ * @returns The records and the next cursor.
73215
+ * @throws {@link NotFoundError} 404 for an unknown revision.
73216
+ * @throws {@link VocabularyRefusedError} 400 `invalid_request`; 409
73217
+ * `vocabulary_plugin_unavailable`.
73218
+ *
73219
+ * @remarks
73220
+ * `GET /api/v1/vocabulary/revisions/{revision_id}/records?kind&cursor&limit`.
73221
+ * Records come by id; the engine default page size is 50.
73222
+ *
73223
+ * @example
73224
+ * ```typescript
73225
+ * const page = await client.vocabulary.listRevisionRecords(revisionId, { kind: 'concept' });
73226
+ * ```
73227
+ */
73228
+ async listRevisionRecords(revisionId, query, requestOptions) {
73229
+ const wire = pageQuery(query);
73230
+ if (query?.kind !== void 0) wire.kind = query.kind;
73231
+ const response = await this.api.revisionRecords(revisionId, wire, toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
73232
+ return decodeResponse(response, VocabularyRevisionRecordPageFromApiToFront);
73233
+ }
73234
+ /**
73235
+ * The records of one view with the ids asked: what a client needs to name
73236
+ * or open the few records a finding, a rebase conflict or a list cites,
73237
+ * without reading a whole release or change set.
73238
+ *
73239
+ * @param ids - The record ids (UUIDs): 1 to 500 distinct ids.
73240
+ * @param query - The view.
73241
+ * @param requestOptions - Per-call options (timeout, retries, signal, headers).
73242
+ * @returns The records the view holds, in the order asked and each once,
73243
+ * and the ids it does not hold.
73244
+ * @throws {@link NotFoundError} 404 for an unknown release or revision.
73245
+ * @throws {@link VocabularyRefusedError} 400 `invalid_request` (an id that is
73246
+ * not a UUID, no id, or more than 500); 409 `vocabulary_plugin_unavailable`.
73247
+ *
73248
+ * @remarks
73249
+ * `GET /api/v1/vocabulary/records?ids&view&release_id&revision_id`. An id
73250
+ * the candidate removes is `missing` in its candidate view. Duplicate ids
73251
+ * are answered once.
73252
+ *
73253
+ * @example
73254
+ * ```typescript
73255
+ * const { items, missing } = await client.vocabulary.lookupRecords(finding.subjects, {
73256
+ * view: { view: 'candidate', revisionId },
73257
+ * });
73258
+ * ```
73259
+ */
73260
+ async lookupRecords(ids, query, requestOptions) {
73261
+ const wire = {
73262
+ ...viewQuery(query?.view),
73263
+ ids: ids.join(",")
73264
+ };
73265
+ const response = await this.api.lookupRecords(wire, toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
73266
+ return decodeResponse(response, VocabularyRecordLookupFromApiToFront);
73267
+ }
73098
73268
  /**
73099
73269
  * A revision against its baseline: records added, changed (with per-feature
73100
73270
  * before/after values) and removed.