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