@kortexya/reasoninglayer 1.16.0 → 1.17.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 = "1.16.0";
8
+ var SDK_VERSION = "1.17.0";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -585,6 +585,8 @@ var USER_DATA_FIELDS = /* @__PURE__ */ new Set([
585
585
  "per_strategy_taxonomies",
586
586
  "propsOverride",
587
587
  "props_override",
588
+ "referencedTerms",
589
+ "referenced_terms",
588
590
  "roleMinimums",
589
591
  "role_minimums",
590
592
  "scope",
@@ -592,6 +594,8 @@ var USER_DATA_FIELDS = /* @__PURE__ */ new Set([
592
594
  "scores_by_name",
593
595
  "sortNames",
594
596
  "sort_names",
597
+ "toolResults",
598
+ "tool_results",
595
599
  "topK",
596
600
  "top_k",
597
601
  "values"
@@ -994,6 +998,22 @@ var Sorts = class {
994
998
  format: "json",
995
999
  ...params
996
1000
  });
1001
+ /**
1002
+ * No description
1003
+ *
1004
+ * @tags sorts
1005
+ * @name GetFuzzySubsumption
1006
+ * @summary Get the fuzzy subsumption degree `sub ⊑· sup` between two sorts
1007
+ * @request POST:/api/v1/sorts/subsumption/get
1008
+ */
1009
+ getFuzzySubsumption = (data, params = {}) => this.http.request({
1010
+ path: `/api/v1/sorts/subsumption/get`,
1011
+ method: "POST",
1012
+ body: data,
1013
+ type: "application/json" /* Json */,
1014
+ format: "json",
1015
+ ...params
1016
+ });
997
1017
  /**
998
1018
  * @description Per Definition IV.5 (Milanese & Pasi 2024): ≾̇ = ((≾̃ .− ∼) ⊍ ≤)⁺
999
1019
  *
@@ -1011,16 +1031,17 @@ var Sorts = class {
1011
1031
  ...params
1012
1032
  });
1013
1033
  /**
1014
- * No description
1034
+ * @description With `?format=osfql` the sort is returned as its commented OSFQL `DEFINE` block (`text/plain`, `ETag` = SHA-256 of the body) instead of the JSON DTO — the single-sort companion of `GET /api/v1/sorts/schema`.
1015
1035
  *
1016
1036
  * @tags sorts
1017
1037
  * @name GetSort
1018
1038
  * @summary Get a sort by ID
1019
1039
  * @request GET:/api/v1/sorts/{id}
1020
1040
  */
1021
- getSort = (id, params = {}) => this.http.request({
1041
+ getSort = (id, query, params = {}) => this.http.request({
1022
1042
  path: `/api/v1/sorts/${id}`,
1023
1043
  method: "GET",
1044
+ query,
1024
1045
  format: "json",
1025
1046
  ...params
1026
1047
  });
@@ -1040,6 +1061,22 @@ var Sorts = class {
1040
1061
  format: "json",
1041
1062
  ...params
1042
1063
  });
1064
+ /**
1065
+ * @description The bulk companion of `?format=osfql` on the by-id route: a single deterministic, re-parseable `text/plain` block of commented `DEFINE` statements (one per sort, ordered by name) for LLM prompt conditioning and replayable export. Supports the tenant listing's filters (`name_prefix`, `include_system`, `needs_review`, `llm_extracted`, and `offset`/`limit`, applied after the deterministic ordering so pages are stable). The `ETag` is the SHA-256 of the body, so prompt-conditioning consumers get a stable cache key for "schema unchanged".
1066
+ *
1067
+ * @tags sorts
1068
+ * @name GetSortsSchema
1069
+ * @summary Export the authenticated tenant's schema as one OSFQL DDL block
1070
+ * @request GET:/api/v1/sorts/schema
1071
+ * @secure
1072
+ */
1073
+ getSortsSchema = (query, params = {}) => this.http.request({
1074
+ path: `/api/v1/sorts/schema`,
1075
+ method: "GET",
1076
+ query,
1077
+ secure: true,
1078
+ ...params
1079
+ });
1043
1080
  /**
1044
1081
  * No description
1045
1082
  *
@@ -1146,6 +1183,22 @@ var Sorts = class {
1146
1183
  format: "json",
1147
1184
  ...params
1148
1185
  });
1186
+ /**
1187
+ * @description Subsumption is **directional**: ⊑·(s₁, s₂) and ⊑·(s₂, s₁) are different assertions. For the symmetric relation use `/api/v1/sorts/similarity`. The degree must be in [0, 1] and the assignment must keep the relation a fuzzy partial order (max–min transitivity, antisymmetry); one that does not is rejected rather than stored.
1188
+ *
1189
+ * @tags sorts
1190
+ * @name SetFuzzySubsumption
1191
+ * @summary Set the fuzzy subsumption degree `sub ⊑· sup` between two sorts
1192
+ * @request POST:/api/v1/sorts/subsumption
1193
+ */
1194
+ setFuzzySubsumption = (data, params = {}) => this.http.request({
1195
+ path: `/api/v1/sorts/subsumption`,
1196
+ method: "POST",
1197
+ body: data,
1198
+ type: "application/json" /* Json */,
1199
+ format: "json",
1200
+ ...params
1201
+ });
1149
1202
  /**
1150
1203
  * @description Similarity is symmetric: ∼(s₁, s₂) = ∼(s₂, s₁) Degree must be in [0, 1] range.
1151
1204
  *
@@ -1621,11 +1674,11 @@ var Inference = class {
1621
1674
  ...params
1622
1675
  });
1623
1676
  /**
1624
- * @description # DEPRECATED This endpoint is deprecated. Use `DELETE /api/v1/terms/{term_id}` for individual terms. # TRUE HOMOICONIC API # Authorization Requires X-Tenant-Id header.
1677
+ * @description This drops the hydrated base facts, the forward-chain `persist_derived` facts and the residuation store, then forgets the hydration flag so the next request reloads the base facts from PostgreSQL. **It does not delete durable data.** The terms are the authority; this is their cache. That makes it the retraction primitive forward chaining otherwise lacks. Chaining is monotonic — delete a `blocks` edge and the derived "A blocks B" survives every later pass, so the KB keeps asserting a relationship the user removed. Clearing and re-chaining rebuilds the closure from the terms that actually exist. # History Until 2026-07-28 this handler enumerated every term in the tenant and deleted it from PostgreSQL, while calling itself "clear facts" and reporting `"Cleared N facts/rules"`. It is reachable with an ordinary tenant credential — unlike `/api/v1/admin/clear-tenant/{tenant_id}`, which gateways block — so a caller reading the name, the path or the response body had no way to know it was a tenant wipe. It destroyed a live tenant that way. Use `DELETE /api/v1/terms/{term_id}` to delete a term, and the admin route to wipe a tenant; deleting durable data must not be something an endpoint does as a side effect of its name. # Authorization Requires X-Tenant-Id header, and the path tenant must match it.
1625
1678
  *
1626
1679
  * @tags inference
1627
1680
  * @name ClearFacts
1628
- * @summary Clear all facts and rules for a tenant
1681
+ * @summary Clear a tenant's in-memory inference working set.
1629
1682
  * @request DELETE:/api/v1/inference/facts/{tenant_id}
1630
1683
  * @secure
1631
1684
  */
@@ -3041,6 +3094,21 @@ var StructuredIngestion = class {
3041
3094
  secure: true,
3042
3095
  ...params
3043
3096
  });
3097
+ /**
3098
+ * @description Refused with 409 while a registered source still references the file's path (the source's adapter would otherwise hold a dangling `file_path`). After that source is unregistered, the delete succeeds (204). A missing sidecar (no such upload id) is 404.
3099
+ *
3100
+ * @tags structured_ingestion
3101
+ * @name DeleteSourceFile
3102
+ * @summary Delete a tenant-uploaded source file (#107).
3103
+ * @request DELETE:/api/v1/sources/files/{id}
3104
+ * @secure
3105
+ */
3106
+ deleteSourceFile = (id, params = {}) => this.http.request({
3107
+ path: `/api/v1/sources/files/${id}`,
3108
+ method: "DELETE",
3109
+ secure: true,
3110
+ ...params
3111
+ });
3044
3112
  /**
3045
3113
  * @description Performs schema introspection on the source to discover types (sorts), features (fields), and relations. This is a preview operation - no data is ingested. `type_filter` narrows the discovery to a named subset **without re-registering the source** — the escape hatch a client uses after `/tables` when the source is over the discovery cap (#66, Gap 2). It conjoins with the source config's own `include_tables`: a request narrows *within* the registration, it cannot widen past it.
3046
3114
  *
@@ -3093,6 +3161,22 @@ var StructuredIngestion = class {
3093
3161
  format: "json",
3094
3162
  ...params
3095
3163
  });
3164
+ /**
3165
+ * @description Walks `{base}/{tenant_id}/*\/​.meta.json`. A missing tenant dir yields an empty list (200), not 404 — a tenant that never uploaded is not an error.
3166
+ *
3167
+ * @tags structured_ingestion
3168
+ * @name ListSourceFiles
3169
+ * @summary List the calling tenant's uploaded source files (#107).
3170
+ * @request GET:/api/v1/sources/files
3171
+ * @secure
3172
+ */
3173
+ listSourceFiles = (params = {}) => this.http.request({
3174
+ path: `/api/v1/sources/files`,
3175
+ method: "GET",
3176
+ secure: true,
3177
+ format: "json",
3178
+ ...params
3179
+ });
3096
3180
  /**
3097
3181
  * No description
3098
3182
  *
@@ -3159,6 +3243,24 @@ var StructuredIngestion = class {
3159
3243
  format: "json",
3160
3244
  ...params
3161
3245
  });
3246
+ /**
3247
+ * @description Multipart, one field named `file`. Streamed to disk under `{base}/{tenant_id}/{id}/{safe_name}` with a `.meta.json` sidecar. The response `path` is the engine-internal location handed to `POST /api/v1/sources` as `config.file_path` (csv/parquet) or `config.database_path` (sqlite).
3248
+ *
3249
+ * @tags structured_ingestion
3250
+ * @name UploadSourceFile
3251
+ * @summary Upload a file-based source artifact for the calling tenant (#107).
3252
+ * @request POST:/api/v1/sources/files
3253
+ * @secure
3254
+ */
3255
+ uploadSourceFile = (data, params = {}) => this.http.request({
3256
+ path: `/api/v1/sources/files`,
3257
+ method: "POST",
3258
+ body: data,
3259
+ secure: true,
3260
+ type: "multipart/form-data" /* FormData */,
3261
+ format: "json",
3262
+ ...params
3263
+ });
3162
3264
  };
3163
3265
 
3164
3266
  // src/api-spec/generated/NeuroSymbolic.ts
@@ -5862,6 +5964,22 @@ var Extraction = class {
5862
5964
  constructor(http) {
5863
5965
  this.http = http;
5864
5966
  }
5967
+ /**
5968
+ * @description Read-only with respect to the knowledge base: certification inspects the tenant's sort lattice and never writes a term. Certificates *are* written to the verification certificate store, so the batch is auditable afterwards.
5969
+ *
5970
+ * @tags extraction
5971
+ * @name CertifyExtraction
5972
+ * @summary `POST /api/v1/extraction/certify` — gate a batch of extraction candidates through the OSF well-sortedness certifier before they may become durable KB content.
5973
+ * @request POST:/api/v1/extraction/certify
5974
+ */
5975
+ certifyExtraction = (data, params = {}) => this.http.request({
5976
+ path: `/api/v1/extraction/certify`,
5977
+ method: "POST",
5978
+ body: data,
5979
+ type: "application/json" /* Json */,
5980
+ format: "json",
5981
+ ...params
5982
+ });
5865
5983
  /**
5866
5984
  * @description Uses GLiNER2 (zero-shot NER) with sort names from the tenant's knowledge base, guaranteeing that all returned entity labels are valid sort names. Label selection (when no explicit labels provided): Embed the input text and ANN-search the pre-computed sort embedding index (Qdrant) for the most semantically similar HPO sorts. This is O(log n) and typically returns 20-100 highly relevant labels from 19K+ HPO sorts. Requires: - GLiNER2 NER service (`GLINER_NER_URL`) - Qdrant vector store for semantic label selection If either is not configured, returns a 500 error.
5867
5985
  *
@@ -6653,7 +6771,7 @@ var Reasoning = class {
6653
6771
  this.http = http;
6654
6772
  }
6655
6773
  /**
6656
- * @description POST /api/v1/reasoning/disentailment Disentailment A =/=> B means: "if A holds, then B must NOT hold" Returns whether the disentailment is violated (conflict: both A and B hold)
6774
+ * @description POST /api/v1/reasoning/disentailment Disentailment A =/=> B means: "if A holds, then B must NOT hold". Returns whether the disentailment is violated — the conflict where the facts establish A and B follows anyway. This is hierarchy-aware and graded on the same footing as the entailment route, so a conflict reachable only through the sort lattice (a `contaminated` clause held by a `lead_paint` fact that subsumes it) is detected without that clause being supplied as a fact. `A ⇏ B` is violated exactly to the degree `A ⇒ B` is established, so `degree` here reports the complement: how strongly the disentailment still holds.
6657
6775
  *
6658
6776
  * @tags reasoning
6659
6777
  * @name Disentailment
@@ -6669,7 +6787,7 @@ var Reasoning = class {
6669
6787
  ...params
6670
6788
  });
6671
6789
  /**
6672
- * @description POST /api/v1/reasoning/entailment Returns whether antecedent entails consequent
6790
+ * @description POST /api/v1/reasoning/entailment Answers `facts antecedent ⇒ consequent`, hierarchy-aware and graded. A clause holds in the fact base to the degree that some fact *witnesses* it — that is, to the degree the clause subsumes a fact — so a `sparrow` fact establishes the clause `animal` without an `animal` fact being supplied. The consequent is additionally established when it subsumes the antecedent it would follow from. See [`osfkb_domain::operations::homoiconic_entailment`] for the full semantics. `entails` is the crisp reading of `degree`; `degree`, `antecedent_degree` and `consequent_degree` are computed from the sort lattice (crisply, and through explicit fuzzy `⊑·` relations and approved sort similarity), never cast from the boolean.
6673
6791
  *
6674
6792
  * @tags reasoning
6675
6793
  * @name Entailment
@@ -8698,6 +8816,20 @@ var Health = class {
8698
8816
  format: "json",
8699
8817
  ...params
8700
8818
  });
8819
+ /**
8820
+ * No description
8821
+ *
8822
+ * @tags health
8823
+ * @name HealthCheckApi
8824
+ * @summary `GET /api/v1/health` — the same enriched health check under the `/api/v1` prefix. The playground front proxy forwards only `/api/*` to the engine (and answers the bare `/health` itself with a static OK), so THIS is the path that makes the deployed `build_info.version` publicly readable — a stale rollout must never be indistinguishable from a fresh one.
8825
+ * @request GET:/api/v1/health
8826
+ */
8827
+ healthCheckApi = (params = {}) => this.http.request({
8828
+ path: `/api/v1/health`,
8829
+ method: "GET",
8830
+ format: "json",
8831
+ ...params
8832
+ });
8701
8833
  };
8702
8834
 
8703
8835
  // src/api-spec/generated/Scheduling.ts
@@ -9038,6 +9170,24 @@ var Generation = class {
9038
9170
  format: "json",
9039
9171
  ...params
9040
9172
  });
9173
+ /**
9174
+ * @description POST /api/v1/text/generate
9175
+ *
9176
+ * @tags generation
9177
+ * @name GenerateText
9178
+ * @summary Run the caller's system prompt over their text.
9179
+ * @request POST:/api/v1/text/generate
9180
+ * @secure
9181
+ */
9182
+ generateText = (data, params = {}) => this.http.request({
9183
+ path: `/api/v1/text/generate`,
9184
+ method: "POST",
9185
+ body: data,
9186
+ secure: true,
9187
+ type: "application/json" /* Json */,
9188
+ format: "json",
9189
+ ...params
9190
+ });
9041
9191
  /**
9042
9192
  * @description Returns `503` when no in-process Gemma is loaded (server started without `OSFKB_OSFQL_GEMMA_DIR`), `400` on an empty prompt, and `422` when the tenant has no persisted lattice to constrain to (ingest a theory with `persist:true` first).
9043
9193
  *
@@ -9374,6 +9524,58 @@ var Compliance = class {
9374
9524
  format: "json",
9375
9525
  ...params
9376
9526
  });
9527
+ /**
9528
+ * No description
9529
+ *
9530
+ * @tags compliance
9531
+ * @name CreateDsr
9532
+ * @summary File a GDPR data subject request
9533
+ * @request POST:/api/v1/dsr
9534
+ * @secure
9535
+ */
9536
+ createDsr = (data, params = {}) => this.http.request({
9537
+ path: `/api/v1/dsr`,
9538
+ method: "POST",
9539
+ body: data,
9540
+ secure: true,
9541
+ type: "application/json" /* Json */,
9542
+ format: "json",
9543
+ ...params
9544
+ });
9545
+ /**
9546
+ * @description **Dry run by default.** An exact match on an identifying feature is the only deterministic way to resolve a person to terms, but exactness is not uniqueness — two people share a name. Erasing on a bare match would silently destroy a homonym's data, and erasure is irreversible, so the plan has to be inspectable before it runs. Pass `confirm: true` once the match has been reviewed.
9547
+ *
9548
+ * @tags compliance
9549
+ * @name EraseSubject
9550
+ * @summary Plan or execute erasure of a data subject's terms
9551
+ * @request POST:/api/v1/dsr/{id}/erase
9552
+ * @secure
9553
+ */
9554
+ eraseSubject = (id, data, params = {}) => this.http.request({
9555
+ path: `/api/v1/dsr/${id}/erase`,
9556
+ method: "POST",
9557
+ body: data,
9558
+ secure: true,
9559
+ type: "application/json" /* Json */,
9560
+ format: "json",
9561
+ ...params
9562
+ });
9563
+ /**
9564
+ * No description
9565
+ *
9566
+ * @tags compliance
9567
+ * @name GetDsr
9568
+ * @summary Read a data subject request
9569
+ * @request GET:/api/v1/dsr/{id}
9570
+ * @secure
9571
+ */
9572
+ getDsr = (id, params = {}) => this.http.request({
9573
+ path: `/api/v1/dsr/${id}`,
9574
+ method: "GET",
9575
+ secure: true,
9576
+ format: "json",
9577
+ ...params
9578
+ });
9377
9579
  /**
9378
9580
  * No description
9379
9581
  *
@@ -9407,6 +9609,22 @@ var Compliance = class {
9407
9609
  format: "json",
9408
9610
  ...params
9409
9611
  });
9612
+ /**
9613
+ * No description
9614
+ *
9615
+ * @tags compliance
9616
+ * @name ListDsr
9617
+ * @summary List a data subject's requests
9618
+ * @request GET:/api/v1/dsr
9619
+ * @secure
9620
+ */
9621
+ listDsr = (params = {}) => this.http.request({
9622
+ path: `/api/v1/dsr`,
9623
+ method: "GET",
9624
+ secure: true,
9625
+ format: "json",
9626
+ ...params
9627
+ });
9410
9628
  /**
9411
9629
  * No description
9412
9630
  *
@@ -9888,6 +10106,24 @@ var OntologyBridge = class {
9888
10106
  format: "json",
9889
10107
  ...params
9890
10108
  });
10109
+ /**
10110
+ * @description The gap this closes (#133): the engine could lower OSFQL to a source's native language and could execute native queries, and the two were never reachable together over HTTP. `POST /api/v1/osfql` runs against the knowledge base and never consults a binding; `POST /api/v1/ontology/transpile` emits the query text and stops. A `transpile`-mode source — which deliberately ingests nothing — therefore had no way to be queried at all, and asking about its data returned an empty result indistinguishable from a broken connector. The dialect is derived from the source's type, never taken from the caller: the binding says which source answers for the sort, and that source's type is the only dialect that could run. Letting a caller name one would let them ask for Cypher against Postgres. The emitted query is returned with the rows. Transpile mode's claim is that OSFQL becomes a native query against the operator's own database; returning only rows leaves that unverifiable.
10111
+ *
10112
+ * @tags ontology_bridge
10113
+ * @name ExecuteTranspiled
10114
+ * @summary Transpile an OSFQL MATCH and execute it on the source it is bound to.
10115
+ * @request POST:/api/v1/ontology/query
10116
+ * @secure
10117
+ */
10118
+ executeTranspiled = (data, params = {}) => this.http.request({
10119
+ path: `/api/v1/ontology/query`,
10120
+ method: "POST",
10121
+ body: data,
10122
+ secure: true,
10123
+ type: "application/json" /* Json */,
10124
+ format: "json",
10125
+ ...params
10126
+ });
9891
10127
  /**
9892
10128
  * @description Produces query tools, write tools, and inference tools from the current sort hierarchy and SQL bindings, along with a system prompt suitable for grounding an LLM.
9893
10129
  *
@@ -9957,7 +10193,7 @@ var OntologyBridge = class {
9957
10193
  ...params
9958
10194
  });
9959
10195
  /**
9960
- * @description Parses the OSFQL query, compiles it, and transpiles the first `ScanBySort` operation to SQL using the current sort-table bindings.
10196
+ * @description Parses the OSFQL query, compiles it, and transpiles EVERY `ScanBySort` operation into one statement using the current sort-table bindings — a JOIN for the SQL dialects, a multi-pattern MATCH for Cypher. A plan operation that is not a scan is refused by name rather than dropped: `fully_transpilable` is what a caller checks to decide whether the emitted text is the whole question, and it reported `true` for a query half of which was never emitted (#134).
9961
10197
  *
9962
10198
  * @tags ontology_bridge
9963
10199
  * @name Transpile
@@ -10256,6 +10492,24 @@ var Speakers = class {
10256
10492
  format: "json",
10257
10493
  ...params
10258
10494
  });
10495
+ /**
10496
+ * @description POST /api/v1/speakers/identify
10497
+ *
10498
+ * @tags speakers
10499
+ * @name IdentifySpeakers
10500
+ * @summary Identify which enrolled voices speak in a piece of audio — no transcript.
10501
+ * @request POST:/api/v1/speakers/identify
10502
+ * @secure
10503
+ */
10504
+ identifySpeakers = (data, params = {}) => this.http.request({
10505
+ path: `/api/v1/speakers/identify`,
10506
+ method: "POST",
10507
+ body: data,
10508
+ secure: true,
10509
+ type: "application/json" /* Json */,
10510
+ format: "json",
10511
+ ...params
10512
+ });
10259
10513
  /**
10260
10514
  * @description GET /api/v1/speakers
10261
10515
  *
@@ -10522,6 +10776,22 @@ var Documents = class {
10522
10776
  constructor(http) {
10523
10777
  this.http = http;
10524
10778
  }
10779
+ /**
10780
+ * No description
10781
+ *
10782
+ * @tags documents
10783
+ * @name EraseDocument
10784
+ * @summary Erase a document and everything extracted from it
10785
+ * @request DELETE:/api/v1/documents/{id}
10786
+ * @secure
10787
+ */
10788
+ eraseDocument = (id, params = {}) => this.http.request({
10789
+ path: `/api/v1/documents/${id}`,
10790
+ method: "DELETE",
10791
+ secure: true,
10792
+ format: "json",
10793
+ ...params
10794
+ });
10525
10795
  /**
10526
10796
  * No description
10527
10797
  *
@@ -19740,20 +20010,21 @@ var IngestionSession = class {
19740
20010
  }));
19741
20011
  return;
19742
20012
  }
19743
- const timer = setTimeout(resolve, ms);
20013
+ let onAbort;
20014
+ const timer = setTimeout(() => {
20015
+ if (signal && onAbort) {
20016
+ signal.removeEventListener("abort", onAbort);
20017
+ }
20018
+ resolve();
20019
+ }, ms);
19744
20020
  if (signal) {
19745
- const onAbort = () => {
20021
+ onAbort = () => {
19746
20022
  clearTimeout(timer);
19747
20023
  reject(new ReasoningLayerError("Ingestion polling was aborted", {
19748
20024
  cause: signal.reason
19749
20025
  }));
19750
20026
  };
19751
20027
  signal.addEventListener("abort", onAbort, { once: true });
19752
- const originalResolve = resolve;
19753
- resolve = () => {
19754
- signal.removeEventListener("abort", onAbort);
19755
- originalResolve();
19756
- };
19757
20028
  }
19758
20029
  });
19759
20030
  }
@@ -28748,7 +29019,15 @@ function PaperMetadataFromApiToFront(dto) {
28748
29019
  abstractText: dto.abstract_text ?? null,
28749
29020
  citationCount: dto.citation_count ?? null,
28750
29021
  source: dto.source,
28751
- fullTextUrl: dto.full_text_url ?? null
29022
+ fullTextUrl: dto.full_text_url ?? null,
29023
+ paperKey: dto.paper_key ?? null
29024
+ };
29025
+ }
29026
+ function PaperRefFromApiToFront(dto) {
29027
+ return {
29028
+ paperKey: dto.paper_key,
29029
+ doi: dto.doi ?? null,
29030
+ title: dto.title
28752
29031
  };
28753
29032
  }
28754
29033
  function PaperSearchResultFromApiToFront(dto) {
@@ -28782,6 +29061,8 @@ function ResearchCycleResultFromApiToFront(dto) {
28782
29061
  papersIngested: dto.papers_ingested,
28783
29062
  claimsVerified: dto.claims_verified,
28784
29063
  contradictionsDetected: dto.contradictions_detected,
29064
+ contradictionsResolved: dto.contradictions_resolved ?? 0,
29065
+ claimsMerged: dto.claims_merged ?? 0,
28785
29066
  processingTimeMs: dto.processing_time_ms,
28786
29067
  searchQueries: dto.search_queries ?? []
28787
29068
  };
@@ -28794,6 +29075,7 @@ function ResearchSessionResponseFromApiToFront(raw) {
28794
29075
  status: dto.status,
28795
29076
  error: dto.error ?? null,
28796
29077
  cycles: (dto.cycles ?? []).map(ResearchCycleResultFromApiToFront),
29078
+ papers: (dto.papers ?? []).map(PaperMetadataFromApiToFront),
28797
29079
  totalPapersIngested: dto.total_papers_ingested,
28798
29080
  totalFindings: dto.total_findings,
28799
29081
  totalContradictions: dto.total_contradictions,
@@ -28838,7 +29120,9 @@ function EvidenceItemSummaryFromApiToFront(dto) {
28838
29120
  qualityWeight: dto.quality_weight,
28839
29121
  supports: dto.supports,
28840
29122
  contribution: dto.contribution,
28841
- paperDoi: dto.paper_doi ?? null
29123
+ paperDoi: dto.paper_doi ?? null,
29124
+ paperKey: dto.paper_key ?? null,
29125
+ paperTitle: dto.paper_title ?? null
28842
29126
  };
28843
29127
  }
28844
29128
  function ProvenanceStepFromApiToFront(dto) {
@@ -28849,6 +29133,13 @@ function ProvenanceStepFromApiToFront(dto) {
28849
29133
  timestamp: dto.timestamp ?? null
28850
29134
  };
28851
29135
  }
29136
+ function ResiduatedFeatureFromApiToFront(dto) {
29137
+ return {
29138
+ featureName: dto.feature_name,
29139
+ neededSort: dto.needed_sort ?? null,
29140
+ infoGain: dto.info_gain
29141
+ };
29142
+ }
28852
29143
  function ResearchFindingFromApiToFront(dto) {
28853
29144
  return {
28854
29145
  claimId: dto.claim_id,
@@ -28859,7 +29150,9 @@ function ResearchFindingFromApiToFront(dto) {
28859
29150
  contradictingEvidence: (dto.contradicting_evidence ?? []).map(EvidenceItemSummaryFromApiToFront),
28860
29151
  provenanceChain: (dto.provenance_chain ?? []).map(ProvenanceStepFromApiToFront),
28861
29152
  residuated: dto.residuated,
28862
- residuationReason: dto.residuation_reason ?? null
29153
+ residuationReason: dto.residuation_reason ?? null,
29154
+ residuatedFeatures: (dto.residuated_features ?? []).map(ResiduatedFeatureFromApiToFront),
29155
+ sources: (dto.sources ?? []).map(PaperRefFromApiToFront)
28863
29156
  };
28864
29157
  }
28865
29158
  function ResearchFindingsResponseFromApiToFront(raw) {
@@ -28887,6 +29180,17 @@ function ResearchGapsResponseFromApiToFront(raw) {
28887
29180
  total: dto.total
28888
29181
  };
28889
29182
  }
29183
+ function ContradictionResolutionFromApiToFront(dto) {
29184
+ return {
29185
+ preferredClaimId: dto.preferred_claim_id,
29186
+ dismissedClaimId: dto.dismissed_claim_id,
29187
+ preferredTruthfulness: dto.preferred_truthfulness,
29188
+ dismissedTruthfulness: dto.dismissed_truthfulness,
29189
+ strategy: dto.strategy,
29190
+ confidence: dto.confidence,
29191
+ explanation: dto.explanation
29192
+ };
29193
+ }
28890
29194
  function ContradictionFromApiToFront(dto) {
28891
29195
  return {
28892
29196
  claimAId: dto.claim_a_id,
@@ -28894,7 +29198,10 @@ function ContradictionFromApiToFront(dto) {
28894
29198
  statementA: dto.statement_a,
28895
29199
  statementB: dto.statement_b,
28896
29200
  confidence: dto.confidence,
28897
- explanation: dto.explanation
29201
+ explanation: dto.explanation,
29202
+ resolution: dto.resolution ? ContradictionResolutionFromApiToFront(dto.resolution) : null,
29203
+ claimASources: (dto.claim_a_sources ?? []).map(PaperRefFromApiToFront),
29204
+ claimBSources: (dto.claim_b_sources ?? []).map(PaperRefFromApiToFront)
28898
29205
  };
28899
29206
  }
28900
29207
  function ResearchContradictionsResponseFromApiToFront(raw) {
@@ -28915,7 +29222,9 @@ function ResearchStatisticsFromApiToFront(dto) {
28915
29222
  totalContradictions: dto.total_contradictions,
28916
29223
  totalProcessingTimeMs: dto.total_processing_time_ms,
28917
29224
  gapsResolved: dto.gaps_resolved,
28918
- gapsRemaining: dto.gaps_remaining
29225
+ gapsRemaining: dto.gaps_remaining,
29226
+ claimsMerged: dto.claims_merged ?? 0,
29227
+ contradictionsResolved: dto.contradictions_resolved ?? 0
28919
29228
  };
28920
29229
  }
28921
29230
  function ReportVerificationFromApiToFront(dto) {