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