@kortexya/reasoninglayer 6.0.0 → 6.2.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 = "6.0.0";
8
+ var SDK_VERSION = "6.2.0";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -9781,6 +9781,22 @@ var Analysis = class {
9781
9781
  format: "json",
9782
9782
  ...params
9783
9783
  });
9784
+ /**
9785
+ * @description Computes the concepts of the population's schema-presence context under the declared bounds and, when asked, its observed implication basis; the export carries the incidence, the bounds and each result's completeness so an importer can replay all of it.
9786
+ *
9787
+ * @tags analysis
9788
+ * @name ExportFca
9789
+ * @summary Export the FCA of an explicit population.
9790
+ * @request POST:/api/v1/analysis/fca-exports
9791
+ */
9792
+ exportFca = (data, params = {}) => this.http.request({
9793
+ path: `/api/v1/analysis/fca-exports`,
9794
+ method: "POST",
9795
+ body: data,
9796
+ type: "application/json",
9797
+ format: "json",
9798
+ ...params
9799
+ });
9784
9800
  /**
9785
9801
  * No description
9786
9802
  *
@@ -10030,6 +10046,22 @@ var Analysis = class {
10030
10046
  format: "json",
10031
10047
  ...params
10032
10048
  });
10049
+ /**
10050
+ * @description Replays the export natively: decodes its context, recomputes a graded incidence from its degrees and cut, recomputes its concepts and basis under its declared bounds, and requires each claim, completeness included, to equal its recomputation; every object must name a source term of the caller's tenant. A refusal accepts nothing and names its reason.
10051
+ *
10052
+ * @tags analysis
10053
+ * @name VerifyFcaExport
10054
+ * @summary Verify an FCA export for import into the caller's tenant.
10055
+ * @request POST:/api/v1/analysis/fca-exports/verify
10056
+ */
10057
+ verifyFcaExport = (data, params = {}) => this.http.request({
10058
+ path: `/api/v1/analysis/fca-exports/verify`,
10059
+ method: "POST",
10060
+ body: data,
10061
+ type: "application/json",
10062
+ format: "json",
10063
+ ...params
10064
+ });
10033
10065
  };
10034
10066
 
10035
10067
  // src/api-spec/generated/Functions.ts
@@ -20705,6 +20737,7 @@ var RESPONSE_COMPONENTS = {
20705
20737
  document_id: [1, 0],
20706
20738
  entities_extracted: [1, 0],
20707
20739
  entities_refused: [1, { array: "RefusedEntityDto" }],
20740
+ fca_discovery: [2, "FcaIngestionReportDto"],
20708
20741
  processing_time_ms: [1, 0],
20709
20742
  relations_extracted: [1, 0],
20710
20743
  relations_integrated: [1, 0],
@@ -21295,6 +21328,50 @@ var RESPONSE_COMPONENTS = {
21295
21328
  }
21296
21329
  },
21297
21330
  FailedReviewDto: { object: { reason: [1, 0], review_id: [1, 0] } },
21331
+ FcaBasisClaimDto: {
21332
+ object: {
21333
+ complete: [1, 0],
21334
+ implications: [1, { array: "FcaImplicationRecordDto" }],
21335
+ max_candidates: [1, 0],
21336
+ max_work: [1, 0]
21337
+ }
21338
+ },
21339
+ FcaConceptClaimDto: {
21340
+ object: {
21341
+ complete: [1, 0],
21342
+ concepts: [1, { array: "FcaConceptRecordDto" }],
21343
+ max_concepts: [1, 0],
21344
+ max_visited_concepts: [1, 0],
21345
+ max_work: [1, 0],
21346
+ min_extent_size: [1, 0],
21347
+ min_intent_size: [1, 0]
21348
+ }
21349
+ },
21350
+ FcaConceptRecordDto: { object: { extent: [1, { array: 0 }], intent: [1, { array: 0 }] } },
21351
+ FcaContextDto: {
21352
+ object: {
21353
+ attributes: [1, { array: 0 }],
21354
+ incidence: [1, { array: { array: 0 } }],
21355
+ objects: [1, { array: 0 }],
21356
+ version: [1, 0]
21357
+ }
21358
+ },
21359
+ FcaExportDto: {
21360
+ object: {
21361
+ basis: [2, "FcaBasisClaimDto"],
21362
+ concepts: [1, "FcaConceptClaimDto"],
21363
+ context: [1, "FcaContextDto"],
21364
+ graded: [2, "FcaGradedIncidenceDto"],
21365
+ version: [1, 0]
21366
+ }
21367
+ },
21368
+ FcaGradedDegreeDto: { object: { attribute: [1, 0], degree: [1, 0] } },
21369
+ FcaGradedIncidenceDto: {
21370
+ object: { alpha: [1, 0], degrees: [1, { array: { array: "FcaGradedDegreeDto" } }] }
21371
+ },
21372
+ FcaImplicationRecordDto: {
21373
+ object: { conclusion: [1, { array: 0 }], premise: [1, { array: 0 }] }
21374
+ },
21298
21375
  FcaIngestionRecommendationDto: {
21299
21376
  object: {
21300
21377
  confidence: [1, 0],
@@ -26310,6 +26387,9 @@ var RESPONSE_COMPONENTS = {
26310
26387
  }
26311
26388
  },
26312
26389
  VerificationStepDto: { object: { description: [1, 0], name: [1, 0], passed: [1, 0] } },
26390
+ VerifiedFcaImportDto: {
26391
+ object: { concepts: [1, 0], concepts_complete: [1, 0], sources: [1, { array: 0 }] }
26392
+ },
26313
26393
  VerifyClaimResponse: {
26314
26394
  object: {
26315
26395
  contradicting_count: [1, 0],
@@ -27860,6 +27940,11 @@ var RESPONSE_OPERATIONS = {
27860
27940
  path: "/api/v1/dsr/{id}/export",
27861
27941
  responses: { 200: "DsrExportResponse" }
27862
27942
  },
27943
+ exportFca: {
27944
+ method: "POST",
27945
+ path: "/api/v1/analysis/fca-exports",
27946
+ responses: { 200: "FcaExportDto" }
27947
+ },
27863
27948
  exportJsonl: {
27864
27949
  method: "POST",
27865
27950
  path: "/api/v1/synthetic/export-jsonl",
@@ -30633,6 +30718,11 @@ var RESPONSE_OPERATIONS = {
30633
30718
  path: "/api/v1/synthetic/verify-faithfulness",
30634
30719
  responses: { 200: "VerifyFaithfulnessResponse" }
30635
30720
  },
30721
+ verifyFcaExport: {
30722
+ method: "POST",
30723
+ path: "/api/v1/analysis/fca-exports/verify",
30724
+ responses: { 200: "VerifiedFcaImportDto" }
30725
+ },
30636
30726
  verifyIntegrity: {
30637
30727
  method: "POST",
30638
30728
  path: "/api/v1/audit/verify-integrity",
@@ -41353,7 +41443,8 @@ function DocumentStatsDtoFromApiToFront(dto) {
41353
41443
  relationsIntegrated: dto.relations_integrated,
41354
41444
  sortNames: dto.sort_names,
41355
41445
  termIds: dto.term_ids,
41356
- totalTokens: dto.total_tokens
41446
+ totalTokens: dto.total_tokens,
41447
+ fcaDiscovery: dto.fca_discovery ? FcaIngestionReportFromApiToFront(dto.fca_discovery) : void 0
41357
41448
  };
41358
41449
  }
41359
41450
  function SessionStatsResponseFromApiToFront(dto) {
@@ -49702,6 +49793,7 @@ function StartExplorationRequestFromFrontToApi(model) {
49702
49793
  min_intent_size: model.minIntentSize,
49703
49794
  max_terms: model.maxTerms,
49704
49795
  ...model.sortNames !== void 0 ? { sort_names: model.sortNames } : {},
49796
+ ...model.semantics !== void 0 ? { semantics: DiscoverySemanticsFromFrontToApi(model.semantics) } : {},
49705
49797
  ...explorationSearchBoundsFromFrontToApi(model)
49706
49798
  };
49707
49799
  }
@@ -49736,6 +49828,7 @@ function RefuteRequestFromFrontToApi(model) {
49736
49828
  question_id: model.questionId,
49737
49829
  label: model.label,
49738
49830
  features: model.features,
49831
+ ...model.values !== void 0 ? { values: featuresFromFrontToApi(model.values) } : {},
49739
49832
  ...explorationSearchBoundsFromFrontToApi(model)
49740
49833
  };
49741
49834
  }
@@ -49778,6 +49871,28 @@ function SortLicenceResponseFromApiToFront(dto) {
49778
49871
  installedRules: dto.installed_rules
49779
49872
  };
49780
49873
  }
49874
+ function FcaExportRequestFromFrontToApi(model) {
49875
+ return {
49876
+ term_ids: model.termIds,
49877
+ max_concepts: model.maxConcepts,
49878
+ min_extent_size: model.minExtentSize,
49879
+ min_intent_size: model.minIntentSize,
49880
+ max_work: model.maxWork,
49881
+ max_visited_concepts: model.maxVisitedConcepts,
49882
+ include_basis: model.includeBasis,
49883
+ basis_max_work: model.basisMaxWork,
49884
+ basis_max_candidates: model.basisMaxCandidates
49885
+ };
49886
+ }
49887
+ function VerifiedFcaImportFromApiToFront(dto) {
49888
+ return {
49889
+ sources: dto.sources,
49890
+ concepts: dto.concepts,
49891
+ conceptsComplete: dto.concepts_complete,
49892
+ implications: dto.implications ?? null,
49893
+ basisComplete: dto.basis_complete ?? null
49894
+ };
49895
+ }
49781
49896
  function ConfluenceConflictDtoFromApiToFront(dto) {
49782
49897
  return {
49783
49898
  kind: dto.kind,
@@ -49846,13 +49961,39 @@ var AnalysisClient = class {
49846
49961
  /**
49847
49962
  * Start an interactive attribute exploration session.
49848
49963
  *
49849
- * @param request - Exploration parameters.
49850
- * @returns Session ID and first question.
49964
+ * @param request - Exploration parameters: the sort scope (`sortNames`),
49965
+ * the attribute `semantics`, and the search bounds.
49966
+ * @param requestOptions - Per-call request options.
49967
+ * @returns Session ID, the formal context's attribute and object counts,
49968
+ * the first question, and the search report.
49969
+ * @throws {ForbiddenError} 403 with code `exploration_actor_required` when
49970
+ * the request carries no gateway human actor (`authenticatedUser`).
49971
+ * @throws {BadRequestError} 400 for an unknown sort name, a refused
49972
+ * population bound (`exploration_population_limit`), native-predicate
49973
+ * semantics, or a scaled interpretation that is not complete.
49974
+ *
49975
+ * @remarks
49976
+ * The converted body is sent verbatim (no further key conversion): the
49977
+ * feature names that key a `scaled` semantics' `schemes` reach the engine
49978
+ * exactly as written. A missing `question` does not mean the basis is
49979
+ * complete: read `search.stop`.
49980
+ *
49981
+ * @example
49982
+ * ```typescript
49983
+ * const started = await client.analysis.startExploration({
49984
+ * sortNames: ['member'],
49985
+ * semantics: {
49986
+ * kind: 'scaled',
49987
+ * schemes: { age: { kind: 'interordinal', thresholds: [65] } },
49988
+ * },
49989
+ * });
49990
+ * console.log(started.attributeCount, started.objectCount, started.search.stop);
49991
+ * ```
49851
49992
  */
49852
49993
  async startExploration(request, requestOptions) {
49853
49994
  const response = await this.api.startExploration(
49854
49995
  StartExplorationRequestFromFrontToApi(request),
49855
- toRequestParams(requestOptions)
49996
+ mergeRequestParams({ headers: { [RAW_BODY_HEADER]: "1" } }, requestOptions)
49856
49997
  );
49857
49998
  return decodeResponse(response, StartExplorationResponseFromApiToFront);
49858
49999
  }
@@ -49921,7 +50062,13 @@ var AnalysisClient = class {
49921
50062
  * @throws {NotFoundError} 404 when the session does not exist.
49922
50063
  *
49923
50064
  * @remarks
49924
- * Body `{ question_id, label, features }`; `questionId` is required.
50065
+ * Body `{ question_id, label, features, values? }`; `questionId` is
50066
+ * required. A presence session takes the counterexample's feature names in
50067
+ * `features`. A scaled session takes `features: []` and the counterexample
50068
+ * as a record of tagged values in `values`, which the session's scales
50069
+ * project into attributes; the engine refuses a label list or an
50070
+ * unreadable value there with `400`, and refuses `values` in a presence
50071
+ * session.
49925
50072
  *
49926
50073
  * The exploration continues after an answered question and poses one
49927
50074
  * question for each pseudo-intent, so a session asks every implication of
@@ -49934,6 +50081,13 @@ var AnalysisClient = class {
49934
50081
  * label: 'penguin',
49935
50082
  * features: ['bird'],
49936
50083
  * });
50084
+ * // In a scaled session:
50085
+ * await client.analysis.refuteImplication(sessionId, {
50086
+ * questionId: question.questionId,
50087
+ * label: 'young cardholder',
50088
+ * features: [],
50089
+ * values: toTaggedFeatures({ age: 30, senior_card: true }),
50090
+ * });
49937
50091
  * ```
49938
50092
  */
49939
50093
  async refuteImplication(sessionId, request, requestOptions) {
@@ -50054,6 +50208,59 @@ var AnalysisClient = class {
50054
50208
  );
50055
50209
  return decodeResponse(response, SortLicenceResponseFromApiToFront);
50056
50210
  }
50211
+ /**
50212
+ * Export the native FCA of an explicit population.
50213
+ *
50214
+ * @param request - The population and the enumeration (and basis) bounds.
50215
+ * @param requestOptions - Per-call request options.
50216
+ * @returns The replayable export, in its wire form.
50217
+ * @throws {BadRequestError} 400 for an invalid population or budgets beyond
50218
+ * the supported limits.
50219
+ *
50220
+ * @remarks
50221
+ * The engine computes the concepts of the population's schema-presence
50222
+ * context under the declared bounds and, when asked, its observed
50223
+ * implication basis; the export carries the incidence, the bounds and each
50224
+ * result's completeness so an importer can replay all of it with
50225
+ * {@link verifyFcaExport}.
50226
+ *
50227
+ * @example
50228
+ * ```typescript
50229
+ * const exported = await client.analysis.exportFca({ termIds, includeBasis: true });
50230
+ * const verified = await client.analysis.verifyFcaExport(exported);
50231
+ * console.log(verified.concepts, verified.conceptsComplete);
50232
+ * ```
50233
+ */
50234
+ async exportFca(request, requestOptions) {
50235
+ const response = await this.api.exportFca(
50236
+ FcaExportRequestFromFrontToApi(request),
50237
+ toRequestParams(requestOptions)
50238
+ );
50239
+ return decodeResponse(response, (dto) => dto);
50240
+ }
50241
+ /**
50242
+ * Verify an FCA export for import into the caller's tenant.
50243
+ *
50244
+ * @param fcaExport - The export, exactly as {@link exportFca} returned it.
50245
+ * @param requestOptions - Per-call request options.
50246
+ * @returns What native replay reproduced.
50247
+ * @throws {BadRequestError} 400 when the declared bounds or universe exceed
50248
+ * the supported limits.
50249
+ * @throws {ApiError} 422 (`status` 422, `errorCode` `fca_export_refused`) when
50250
+ * a claim, the incidence or the scope does not survive native replay;
50251
+ * nothing is accepted.
50252
+ *
50253
+ * @remarks
50254
+ * The engine decodes the export's context, recomputes a graded incidence
50255
+ * from its degrees and cut, recomputes its concepts and basis under its
50256
+ * declared bounds, and requires each claim, completeness included, to equal
50257
+ * its recomputation; every object must name a source term of the caller's
50258
+ * tenant.
50259
+ */
50260
+ async verifyFcaExport(fcaExport, requestOptions) {
50261
+ const response = await this.api.verifyFcaExport(fcaExport, toRequestParams(requestOptions));
50262
+ return decodeResponse(response, VerifiedFcaImportFromApiToFront);
50263
+ }
50057
50264
  /**
50058
50265
  * Invite a gateway human user to an exploration session.
50059
50266
  *