@kortexya/reasoninglayer 1.22.0 → 1.24.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 = "1.22.0";
10
+ var SDK_VERSION = "1.24.0";
11
11
  function resolveConfig(config) {
12
12
  if (!config.baseUrl) {
13
13
  throw new Error("ClientConfig.baseUrl is required");
@@ -958,7 +958,7 @@ var Sorts = class {
958
958
  ...params
959
959
  });
960
960
  /**
961
- * @description # Authorization Requires X-Tenant-Id header. The sort must belong to the tenant. # Errors - 404 Not Found: Sort doesn't exist - 400 Bad Request: Sort has children (would orphan them)
961
+ * @description # Authorization Requires X-Tenant-Id header. The sort must belong to the tenant. # The terms Deletion already refuses to orphan a CHILD SORT, and says so (`"would orphan 1 child sort(s)"`). It said nothing about the sort's TERMS and left them behind: still listed by `GET /api/v1/terms`, carrying a `sort_id` that answers `404`, unreachable by sort, with no schema to validate against and nothing reporting the state (#213). A term pointing at a deleted sort is the same kind of orphan as a child sort, so it gets the same guard. The disposition is the caller's and is named in the query: `terms=refuse` (the default) refuses while the sort is inhabited and says how many terms hold it; `terms=delete` deletes them with it and reports the count. Neither is silent, which is the whole of what was wrong. # Errors - 404 Not Found: Sort doesn't exist - 400 Bad Request: Sort has children (would orphan them), or holds terms under the default `terms=refuse`
962
962
  *
963
963
  * @tags sorts
964
964
  * @name DeleteSort
@@ -966,10 +966,27 @@ var Sorts = class {
966
966
  * @request DELETE:/api/v1/sorts/{id}
967
967
  * @secure
968
968
  */
969
- deleteSort = (id, params = {}) => this.http.request({
969
+ deleteSort = (id, query, params = {}) => this.http.request({
970
970
  path: `/api/v1/sorts/${id}`,
971
971
  method: "DELETE",
972
+ query,
972
973
  secure: true,
974
+ format: "json",
975
+ ...params
976
+ });
977
+ /**
978
+ * No description
979
+ *
980
+ * @tags sorts
981
+ * @name GenerateSortProposals
982
+ * @summary Turn recurrent observations into proposed sorts for review.
983
+ * @request POST:/api/v1/sorts/proposals/generate
984
+ */
985
+ generateSortProposals = (query, params = {}) => this.http.request({
986
+ path: `/api/v1/sorts/proposals/generate`,
987
+ method: "POST",
988
+ query,
989
+ format: "json",
973
990
  ...params
974
991
  });
975
992
  /**
@@ -1017,7 +1034,7 @@ var Sorts = class {
1017
1034
  ...params
1018
1035
  });
1019
1036
  /**
1020
- * @description Per Definition IV.5 (Milanese & Pasi 2024): ≾̇ = ((≾̃ .− ∼) ⊍ )
1037
+ * @description Per Definition IV.5 (Milanese & Pasi, IEEE TFS 2024 — CC-BY manuscript in reasoninglayer-sources/pdf_sources/), verbatim: ≺∼· ((≺∼ .− ∼) ⊍ )⊕ The combined chain preorder ≺∼ of Definition IV.1 with every DIRECTLY-similar pair deleted (`.−` zeroes the pair — it is not an arithmetic difference), the crisp order unioned back, and the result re-closed. A chain survives when its ENDPOINTS are not directly similar: slasher ⪯ horror ∼₀.₅ thriller keeps 0.5 while (horror, thriller) itself answers 0 — two similar sorts meet through their GLB instead (Fig. 4c: horror ⩏ thriller = slasher). The combined ≺∼ — where a direct ∼ edge IS a step; the coarse retrieval mode of Example V.4 — backs equivalence classes and term substitutability internally. (History: the differencing form here is ORIGINAL and faithful; #203 swapped in the combined semantics, and a 2026-08-23 pass re-documented that as correct from secondary sources. The accepted manuscript settled it the other way.)
1021
1038
  *
1022
1039
  * @tags sorts
1023
1040
  * @name GetPreorderDegree
@@ -1032,6 +1049,21 @@ var Sorts = class {
1032
1049
  format: "json",
1033
1050
  ...params
1034
1051
  });
1052
+ /**
1053
+ * @description Computed on the TENANT-VISIBLE hierarchy — unlike the legacy `equivalence-classes` route, which computes process-wide and filters (#114), so here αs and the order describe exactly the sorts the caller can see. Granularity per Example V.4: `combined` (Def. IV.1's ≺∼, default) or `similarity_deleted` (Def. IV.5's ≺∼·).
1054
+ *
1055
+ * @tags sorts
1056
+ * @name GetQuotientOrder
1057
+ * @summary Definition IV.9 in full over the caller's tenant lattice: the quotient classes with their degrees αs and the fuzzy partial order between them.
1058
+ * @request GET:/api/v1/sorts/quotient-order
1059
+ */
1060
+ getQuotientOrder = (query, params = {}) => this.http.request({
1061
+ path: `/api/v1/sorts/quotient-order`,
1062
+ method: "GET",
1063
+ query,
1064
+ format: "json",
1065
+ ...params
1066
+ });
1035
1067
  /**
1036
1068
  * @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`.
1037
1069
  *
@@ -1140,6 +1172,20 @@ var Sorts = class {
1140
1172
  format: "json",
1141
1173
  ...params
1142
1174
  });
1175
+ /**
1176
+ * No description
1177
+ *
1178
+ * @tags sorts
1179
+ * @name ListObservations
1180
+ * @summary List the tenant's unknown-term observations.
1181
+ * @request GET:/api/v1/sorts/proposals
1182
+ */
1183
+ listObservations = (params = {}) => this.http.request({
1184
+ path: `/api/v1/sorts/proposals`,
1185
+ method: "GET",
1186
+ format: "json",
1187
+ ...params
1188
+ });
1143
1189
  /**
1144
1190
  * @description By default, system-defined sorts (built-in types like Thing, Person, etc.) are excluded from the response. Use `include_system=true` to include them.
1145
1191
  *
@@ -1155,6 +1201,76 @@ var Sorts = class {
1155
1201
  format: "json",
1156
1202
  ...params
1157
1203
  });
1204
+ /**
1205
+ * @description The authoring half of the tenant's ubiquitous language: what a concept is called (`skos:prefLabel` stays the `name`), what else people call it (`altLabel`), what it means (`definition`), when to use it (`scopeNote`), what it sits beside (`related`), and whether it is still the term to use (`SortStatus`). Only fields present in the body mutate. Every referenced sort is resolved **before** anything is written, so a patch naming a concept that does not exist fails whole rather than half-applying.
1206
+ *
1207
+ * @tags sorts
1208
+ * @name PatchSort
1209
+ * @summary Curate one concept's vocabulary and lifecycle
1210
+ * @request PATCH:/api/v1/sorts/{id}
1211
+ * @secure
1212
+ */
1213
+ patchSort = (id, data, params = {}) => this.http.request({
1214
+ path: `/api/v1/sorts/${id}`,
1215
+ method: "PATCH",
1216
+ body: data,
1217
+ secure: true,
1218
+ type: "application/json",
1219
+ format: "json",
1220
+ ...params
1221
+ });
1222
+ /**
1223
+ * @description The feature-level twin of the sort rename `PATCH /api/v1/sorts/{id}` carries (#185), and it could not be built out of an add and a remove because removal did not exist (#213). Nominal for the SCHEMA: the declaration keeps everything it says and the position it holds in the declaration order, and every subsort that inherited it is renamed with it. It is NOT nominal for the DATA — a feature is keyed by name, not by id, so a term that binds the old name keeps its value under a name the sort no longer declares. That is well-sorted under the open world, which is why the count is reported rather than the rename refused; pass `cascade_terms` to move the values too. The new name is held to the same OSFQL identifier rule as a sort rename (#176), in the `feature_name` position — which admits no dot. Every bound constraint written over the renamed declaration moves with it. Renaming a sort's own OVERRIDE leaves it inheriting the ancestor's declaration under the OLD name, so nothing is un-declared and a cascade leaves the values alone — `still_declared` says so. A sort with more than 512 persisted subsorts is refused, for the same reason a removal is: an edit applied to part of a subtree can be neither finished nor undone. # Errors - 400 Bad Request: an unreadable name, a name already declared here or on a subsort, no such declaration, an inherited one, or a shared sort - 404 Not Found: no such sort for this tenant
1224
+ *
1225
+ * @tags sorts
1226
+ * @name PatchSortFeature
1227
+ * @summary Rename one feature declaration on a sort
1228
+ * @request PATCH:/api/v1/sorts/{id}/features/{feature}
1229
+ * @secure
1230
+ */
1231
+ patchSortFeature = (id, feature, data, params = {}) => this.http.request({
1232
+ path: `/api/v1/sorts/${id}/features/${feature}`,
1233
+ method: "PATCH",
1234
+ body: data,
1235
+ secure: true,
1236
+ type: "application/json",
1237
+ format: "json",
1238
+ ...params
1239
+ });
1240
+ /**
1241
+ * @description The analysis runs inside the hierarchy write lock (sync); the memory and audit writes happen strictly after the lock is released ([`SortDiscoveryOrchestrator::record`]), never under it.
1242
+ *
1243
+ * @tags sorts
1244
+ * @name ProposeSortsClosedLoop
1245
+ * @summary Run FCA sort discovery AND record the closed-loop trail (L5): every Proposed sort gets a memory decision-episode entry and a tamper-evident audit record, returned as receipts beside the analysis.
1246
+ * @request POST:/api/v1/sorts/discovery/propose
1247
+ */
1248
+ proposeSortsClosedLoop = (data, params = {}) => this.http.request({
1249
+ path: `/api/v1/sorts/discovery/propose`,
1250
+ method: "POST",
1251
+ body: data,
1252
+ type: "application/json",
1253
+ format: "json",
1254
+ ...params
1255
+ });
1256
+ /**
1257
+ * @description POST /api/v1/sorts/propose-structural-similarities Derives sort-proximity candidates from the lattice structure (exact Wu-Palmer by default; ancestor Jaccard or the Lorentz geometry on request) and enters them into the SAME review queue as the behavioural learner: `GET /learned-similarities` lists them (with their crisp-meet status as evidence), `…/approve` ratifies one into ∼, `…/reject` drops it. Nothing reaches the active ∼ relation without a reviewer — derived proximity is not a Def A.10 similarity (vision-keeper ruling 2026-08-30). # Authorization Requires X-Tenant-Id header; only pairs whose both ends are visible to the tenant are proposed.
1258
+ *
1259
+ * @tags sorts
1260
+ * @name ProposeStructuralSimilarities
1261
+ * @summary Propose structural similarity candidates for review
1262
+ * @request POST:/api/v1/sorts/propose-structural-similarities
1263
+ * @secure
1264
+ */
1265
+ proposeStructuralSimilarities = (data, params = {}) => this.http.request({
1266
+ path: `/api/v1/sorts/propose-structural-similarities`,
1267
+ method: "POST",
1268
+ body: data,
1269
+ secure: true,
1270
+ type: "application/json",
1271
+ format: "json",
1272
+ ...params
1273
+ });
1158
1274
  /**
1159
1275
  * @description POST /api/v1/sorts/learned-similarities/reject Rejects a proposed or conflicted learned similarity with a reason. Rejected similarities are not used in reasoning.
1160
1276
  *
@@ -1171,6 +1287,23 @@ var Sorts = class {
1171
1287
  format: "json",
1172
1288
  ...params
1173
1289
  });
1290
+ /**
1291
+ * @description The operation `Sort::remove_feature` could always express and no route could reach: every `remove_feature` call in this crate before #213 was `PsiTerm::remove_feature`, which drops a VALUE from a term — a different operation on a different type. The only route that amended a declaration at all was the backfill inside `bulk_create_sorts`, and it merges: a batch naming only the features to keep leaves the others in place. The declaration is removed from this sort and from every subsort that inherited it. An INHERITED declaration is refused with the ancestor named — it belongs to the sort that introduced it, and removing the copy here would be undone by the next propagation. # The terms Removing a declaration does not invalidate the values written under it. OSF is open: a term may carry a feature its sort does not declare, and only a `@closed` sort says otherwise. So the terms are REPORTED (`terms_binding`) and left alone unless `cascade_terms` asks for the value to go with the declaration. Removing the sort's own OVERRIDE of an ancestor's declaration puts it back to INHERITING that one, so the feature is still declared and the values are still governed — `still_declared` says so, and a cascade leaves them alone. # What goes with it Every bound constraint written over the removed declaration (`CHECK valid_to <= person.death_date` names `valid_to`), because one left naming a feature the sort no longer declares stops applying and is still emitted into the DDL export. ⚠️ Not recoverable through the sort DTOs — the route back is OSFQL `CHECK ON <sort> (…)`. # Refused for a large subtree A sort with more than 512 persisted subsorts is refused: the edit has to reach every subsort that materialised the inherited copy, and one applied to part of a subtree can be neither finished nor undone. # Errors - 400 Bad Request: no such declaration, an inherited one, or a shared sort - 404 Not Found: no such sort for this tenant
1292
+ *
1293
+ * @tags sorts
1294
+ * @name RemoveSortFeature
1295
+ * @summary Remove one feature declaration from a sort
1296
+ * @request DELETE:/api/v1/sorts/{id}/features/{feature}
1297
+ * @secure
1298
+ */
1299
+ removeSortFeature = (id, feature, query, params = {}) => this.http.request({
1300
+ path: `/api/v1/sorts/${id}/features/${feature}`,
1301
+ method: "DELETE",
1302
+ query,
1303
+ secure: true,
1304
+ format: "json",
1305
+ ...params
1306
+ });
1174
1307
  /**
1175
1308
  * No description
1176
1309
  *
@@ -1744,6 +1877,23 @@ var Inference = class {
1744
1877
  format: "json",
1745
1878
  ...params
1746
1879
  });
1880
+ /**
1881
+ * @description # The disposition is the caller's `?derivations=refuse` (the default) refuses while the rule still supports materialized conclusions and says how many; `?derivations=retract` withdraws them with it and reports the counts. A delete that silently drops derivations is as wrong as one that silently keeps them, so neither is the unnamed default. # Authorization Requires `X-Tenant-Id`. Runs the same delete guard as `DELETE /api/v1/terms/{id}` — a rule is a policy-relevant object, and withdrawing one changes what the engine will conclude. Honours `If-Match` against the conclusion's content ETag, and requires it under `OSFKB_REQUIRE_IF_MATCH=1`. Every request is captured by the audit middleware.
1882
+ *
1883
+ * @tags inference
1884
+ * @name DeleteRule
1885
+ * @summary Delete a rule.
1886
+ * @request DELETE:/api/v1/inference/rules/{id}
1887
+ * @secure
1888
+ */
1889
+ deleteRule = (id, query, params = {}) => this.http.request({
1890
+ path: `/api/v1/inference/rules/${id}`,
1891
+ method: "DELETE",
1892
+ query,
1893
+ secure: true,
1894
+ format: "json",
1895
+ ...params
1896
+ });
1747
1897
  /**
1748
1898
  * @description Never writes to the KB — returns validated drafts for human review.
1749
1899
  *
@@ -1866,16 +2016,16 @@ var Inference = class {
1866
2016
  ...params
1867
2017
  });
1868
2018
  /**
1869
- * @description # Authorization Requires X-Tenant-Id header.
2019
+ * @description # Authorization Requires X-Tenant-Id header, and the path tenant must equal it. # The path segment Named `{id}` because `DELETE` and `PUT` on the same path address ONE RULE by term id (#231), and one segment cannot carry two names. Here it is the tenant — and a redundant one, since any value but the authenticated principal is refused.
1870
2020
  *
1871
2021
  * @tags inference
1872
2022
  * @name GetRules
1873
2023
  * @summary Get all rules (clauses with antecedents) for a tenant
1874
- * @request GET:/api/v1/inference/rules/{tenant_id}
2024
+ * @request GET:/api/v1/inference/rules/{id}
1875
2025
  * @secure
1876
2026
  */
1877
- getRules = (tenantId, params = {}) => this.http.request({
1878
- path: `/api/v1/inference/rules/${tenantId}`,
2027
+ getRules = (id, params = {}) => this.http.request({
2028
+ path: `/api/v1/inference/rules/${id}`,
1879
2029
  method: "GET",
1880
2030
  secure: true,
1881
2031
  format: "json",
@@ -1933,6 +2083,24 @@ var Inference = class {
1933
2083
  format: "json",
1934
2084
  ...params
1935
2085
  });
2086
+ /**
2087
+ * @description # An edit addresses ONE clause "Edit the rule for X" is ambiguous, because the authoring UI's "add clause" writes a *second* rule with the same conclusion, OR-unioned with the first. The path names a single rule term — one disjunct — so a client cannot silently edit the wrong one. # The old rule is withdrawn, not amended Everything `DELETE` does happens, always with the retract disposition: an edit that leaves the pre-edit clause's conclusions standing is exactly the defect this route exists to fix. The replacement is created through the same code `POST /api/v1/inference/rules` runs, so creation's guards — #227's guard canonicalisation, #219's range restriction, #217's certainty distinction — hold for an edit too, and a rejected replacement leaves the rule base untouched because the build runs BEFORE the clause is de-indexed. The response carries `previous_rule_id` alongside the new rule: a rule's id is its conclusion term id, so an edit changes it by construction. When the replacement is content-addressed to the same id (identical conclusion under `OSFKB_RULE_STABLE_IDS=1`), the two are equal and the edit was applied in place — the outgoing clause's now-unused antecedents are still collected and deleted. # Authorization Identical to `DELETE`: the delete guard on the outgoing rule, `If-Match` against its conclusion, and audit capture.
2088
+ *
2089
+ * @tags inference
2090
+ * @name ReplaceRule
2091
+ * @summary Replace a rule.
2092
+ * @request PUT:/api/v1/inference/rules/{id}
2093
+ * @secure
2094
+ */
2095
+ replaceRule = (id, data, params = {}) => this.http.request({
2096
+ path: `/api/v1/inference/rules/${id}`,
2097
+ method: "PUT",
2098
+ body: data,
2099
+ secure: true,
2100
+ type: "application/json",
2101
+ format: "json",
2102
+ ...params
2103
+ });
1936
2104
  /**
1937
2105
  * @description In OSF/LIFE terms, the orchestrator pushes the conclusion gate and each antecedent gate toward the dual-weighted satisfaction objective `1 − ( w_D · K_D + w_K · K_K )` (paper eq. 4). Each call performs exactly one epoch over the supplied batch — the response carries the per-epoch metrics for that single epoch (multi-epoch aggregation is the caller's responsibility). # Authorization Requires `X-Tenant-Id` header.
1938
2106
  *
@@ -6776,6 +6944,24 @@ var Reasoning = class {
6776
6944
  constructor(http) {
6777
6945
  this.http = http;
6778
6946
  }
6947
+ /**
6948
+ * @description POST /api/v1/assessment/ordinal
6949
+ *
6950
+ * @tags reasoning
6951
+ * @name AssessOrdinal
6952
+ * @summary Grade criteria against evidence on an ordinal scale.
6953
+ * @request POST:/api/v1/assessment/ordinal
6954
+ * @secure
6955
+ */
6956
+ assessOrdinal = (data, params = {}) => this.http.request({
6957
+ path: `/api/v1/assessment/ordinal`,
6958
+ method: "POST",
6959
+ body: data,
6960
+ secure: true,
6961
+ type: "application/json",
6962
+ format: "json",
6963
+ ...params
6964
+ });
6779
6965
  /**
6780
6966
  * @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.
6781
6967
  *
@@ -7998,6 +8184,22 @@ var Analysis = class {
7998
8184
  constructor(http) {
7999
8185
  this.http = http;
8000
8186
  }
8187
+ /**
8188
+ * @description Enumerates formal concepts over the tenant's terms, scores each concept's extent against the target feature, and where a concept's own extent is too small to decide, climbs to the most specific generalization that can. Concepts defined by the target are refused as circular; concepts nothing above can certify are counted as abstentions.
8189
+ *
8190
+ * @tags analysis
8191
+ * @name AnalyzeCertifiedGeneralization
8192
+ * @summary Certify feature classes against a recorded outcome.
8193
+ * @request POST:/api/v1/analysis/certified-generalization
8194
+ */
8195
+ analyzeCertifiedGeneralization = (data, params = {}) => this.http.request({
8196
+ path: `/api/v1/analysis/certified-generalization`,
8197
+ method: "POST",
8198
+ body: data,
8199
+ type: "application/json",
8200
+ format: "json",
8201
+ ...params
8202
+ });
8001
8203
  /**
8002
8204
  * @description Runs Ganter's Next Closure algorithm on existing PsiTerms to discover formal concepts (feature-set intersections) not captured by existing sorts. Returns ranked recommendations with confidence scores and optional auto-creation. When `fuzzy_thresholds` is non-empty, also runs fuzzy FCA at each alpha-cut level.
8003
8205
  *
@@ -8014,6 +8216,22 @@ var Analysis = class {
8014
8216
  format: "json",
8015
8217
  ...params
8016
8218
  });
8219
+ /**
8220
+ * @description Membership is containment of the intent's feature names, so definitions mined on one population score another without a shared context. This is what makes mined concepts usable as features on data the mining never saw.
8221
+ *
8222
+ * @tags analysis
8223
+ * @name AssignConceptFeatures
8224
+ * @summary Apply supplied feature definitions to the tenant's terms.
8225
+ * @request POST:/api/v1/analysis/concept-features/assign
8226
+ */
8227
+ assignConceptFeatures = (data, params = {}) => this.http.request({
8228
+ path: `/api/v1/analysis/concept-features/assign`,
8229
+ method: "POST",
8230
+ body: data,
8231
+ type: "application/json",
8232
+ format: "json",
8233
+ ...params
8234
+ });
8017
8235
  /**
8018
8236
  * @description Returns a [`RuleBaseCertificateDto`]: whether forward reasoning is guaranteed to halt (with the ranking-function depth bound), and whether it is order-independent (with the theorem discharged, or a concrete conflicting rule pair). The analysis is read-only over the tenant's knowledge base.
8019
8237
  *
@@ -8070,6 +8288,102 @@ var Analysis = class {
8070
8288
  format: "json",
8071
8289
  ...params
8072
8290
  });
8291
+ /**
8292
+ * @description Each installed rule reads: *for any term of `subject_sort_id` carrying every feature in the conjunction, conclude `target_feature`* — at the conjunction's certified lower bound, which becomes the rule's fuzzy certainty. An empty `installed` list is an abstention: nothing certified at this bound, and the store is unchanged.
8293
+ *
8294
+ * @tags analysis
8295
+ * @name InstallConceptRules
8296
+ * @summary Mine the tenant's terms and install every certifying conjunction as a rule.
8297
+ * @request POST:/api/v1/analysis/concept-rules
8298
+ */
8299
+ installConceptRules = (data, params = {}) => this.http.request({
8300
+ path: `/api/v1/analysis/concept-rules`,
8301
+ method: "POST",
8302
+ body: data,
8303
+ type: "application/json",
8304
+ format: "json",
8305
+ ...params
8306
+ });
8307
+ /**
8308
+ * @description A candidate reached by neither kind of hypothesis comes back `undetermined_no_hypothesis`, and one reached by both comes back `undetermined_contradictory` — different facts, reported apart, because the second says the examples disagree and the first says they are silent.
8309
+ *
8310
+ * @tags analysis
8311
+ * @name LearnHypotheses
8312
+ * @summary Learn the descriptions of a class that no counter-example carries, and classify candidates against them.
8313
+ * @request POST:/api/v1/analysis/hypotheses
8314
+ */
8315
+ learnHypotheses = (data, params = {}) => this.http.request({
8316
+ path: `/api/v1/analysis/hypotheses`,
8317
+ method: "POST",
8318
+ body: data,
8319
+ type: "application/json",
8320
+ format: "json",
8321
+ ...params
8322
+ });
8323
+ /**
8324
+ * @description This is the symbolic object of symbolic data analysis: the unit of interest is the group, its description is interval-valued where its members differ, and — once stored — it is an ordinary sort. A candidate whose deciding feature was never measured comes back `residuated`, naming what it is waiting for, rather than being reported outside the cohort.
8325
+ *
8326
+ * @tags analysis
8327
+ * @name MaterializeCohort
8328
+ * @summary Store a group's shared description as a sort, and classify candidates against the cohort it becomes.
8329
+ * @request POST:/api/v1/analysis/cohorts
8330
+ */
8331
+ materializeCohort = (data, params = {}) => this.http.request({
8332
+ path: `/api/v1/analysis/cohorts`,
8333
+ method: "POST",
8334
+ body: data,
8335
+ type: "application/json",
8336
+ format: "json",
8337
+ ...params
8338
+ });
8339
+ /**
8340
+ * @description Searches the concept lattice downward from the top concept, scoring every conjunction on its own joint extent — not on a fold over its parts, which cannot recover an interaction. Conjunctions whose certified lower bound clears the population rate are returned strongest-first; an empty list is an abstention rather than a rate of zero.
8341
+ *
8342
+ * @tags analysis
8343
+ * @name MineConceptFeatures
8344
+ * @summary Mine the tenant's terms for conjunctions certifiably enriched for a target.
8345
+ * @request POST:/api/v1/analysis/concept-features
8346
+ */
8347
+ mineConceptFeatures = (data, params = {}) => this.http.request({
8348
+ path: `/api/v1/analysis/concept-features`,
8349
+ method: "POST",
8350
+ body: data,
8351
+ type: "application/json",
8352
+ format: "json",
8353
+ ...params
8354
+ });
8355
+ /**
8356
+ * @description The `accuracy_bound` is the reason to prefer this over a plain search: at zero the returned region is provably optimal, and above the caller's tolerance the honest reading is "not yet decided" rather than "here is the answer". `skipped` says how many terms could not be used, because a population that quietly shrank would make the bound optimistic.
8357
+ *
8358
+ * @tags analysis
8359
+ * @name MineIntervalPatterns
8360
+ * @summary Mine the numeric regions that best separate a class, and report how much better any region could still be.
8361
+ * @request POST:/api/v1/analysis/interval-patterns
8362
+ */
8363
+ mineIntervalPatterns = (data, params = {}) => this.http.request({
8364
+ path: `/api/v1/analysis/interval-patterns`,
8365
+ method: "POST",
8366
+ body: data,
8367
+ type: "application/json",
8368
+ format: "json",
8369
+ ...params
8370
+ });
8371
+ /**
8372
+ * @description A returned class with `generalized: true` and a `sort` naming neither of its members' sorts is the case this endpoint exists for: a point in the lattice that no attribute names, reached because the least upper bound of two sorts is a derivation in the hierarchy. An empty `classes` list is an abstention, not a rate of zero.
8373
+ *
8374
+ * @tags analysis
8375
+ * @name MineLggClasses
8376
+ * @summary Mine the tenant's terms for classes certifiably enriched for a target, generalizing by sort rather than by conjunction.
8377
+ * @request POST:/api/v1/analysis/lgg-classes
8378
+ */
8379
+ mineLggClasses = (data, params = {}) => this.http.request({
8380
+ path: `/api/v1/analysis/lgg-classes`,
8381
+ method: "POST",
8382
+ body: data,
8383
+ type: "application/json",
8384
+ format: "json",
8385
+ ...params
8386
+ });
8073
8387
  /**
8074
8388
  * @description The counterexample must have all premise features but lack at least one conclusion feature.
8075
8389
  *
@@ -8086,6 +8400,22 @@ var Analysis = class {
8086
8400
  format: "json",
8087
8401
  ...params
8088
8402
  });
8403
+ /**
8404
+ * @description A returned concept with `generalized: true` and a `sort` naming none of its members' sorts is the case this endpoint exists for: a point in the lattice no attribute names, reached because the least upper bound of two sorts is a derivation in the hierarchy. Read `truncated` before reading `concepts` as "what the population contains". An empty `concepts` list is an abstention, not a rate of zero. ⚠️ `concepts[].lower_bound` is a **ranking key, not a certificate**: the search chose those concepts by looking at the very degrees the bound is computed on. Send a `holdout` to get claims — the search then sees only the selection half, and `certificates[]` carries bounds measured on data it never saw, corrected for the number of claims rather than the number searched.
8405
+ *
8406
+ * @tags analysis
8407
+ * @name SearchLattice
8408
+ * @summary Search the tenant's terms for concepts certifiably enriched for a target, spending a stated budget where the evidence is rather than in worklist order.
8409
+ * @request POST:/api/v1/analysis/lattice-search
8410
+ */
8411
+ searchLattice = (data, params = {}) => this.http.request({
8412
+ path: `/api/v1/analysis/lattice-search`,
8413
+ method: "POST",
8414
+ body: data,
8415
+ type: "application/json",
8416
+ format: "json",
8417
+ ...params
8418
+ });
8089
8419
  /**
8090
8420
  * @description Builds a formal context from the tenant's knowledge base terms and initializes the Ganter exploration protocol.
8091
8421
  *
@@ -9023,7 +9353,7 @@ var Admin = class {
9023
9353
  ...params
9024
9354
  });
9025
9355
  /**
9026
- * @description Explicitly creates a tenant's inference state and sort hierarchy, optionally seeding initial sorts. Idempotent. No X-Tenant-Id header required.
9356
+ * @description Explicitly creates a tenant's registry row, inference state and sort hierarchy, optionally seeding initial sorts and storing a display label. Idempotent. No X-Tenant-Id header required. Refuses a deleted tenant's UUID with 409 rather than resurrecting it.
9027
9357
  *
9028
9358
  * @tags admin
9029
9359
  * @name CreateTenant
@@ -9039,11 +9369,41 @@ var Admin = class {
9039
9369
  ...params
9040
9370
  });
9041
9371
  /**
9042
- * @description Returns all tenant IDs that have terms or ingestion sessions, with counts. No X-Tenant-Id header required. Works in both PostgreSQL and in-memory modes.
9372
+ * @description Destructive self-service operation: clears every trace of the caller's own tenant's data, then tombstones its registry row. The tenant's UUID is refused everywhere with 410 afterwards and cannot be recreated. There is no un-delete.
9373
+ *
9374
+ * @tags admin
9375
+ * @name DeleteMyTenant
9376
+ * @summary Delete the authenticated tenant (wipe + tombstone)
9377
+ * @request POST:/api/v1/delete-tenant
9378
+ * @secure
9379
+ */
9380
+ deleteMyTenant = (params = {}) => this.http.request({
9381
+ path: `/api/v1/delete-tenant`,
9382
+ method: "POST",
9383
+ secure: true,
9384
+ format: "json",
9385
+ ...params
9386
+ });
9387
+ /**
9388
+ * @description Clears every trace of the tenant's data (identical to the clear-tenant wipe), then tombstones its registry row. A deleted tenant's UUID is refused everywhere with 410 and cannot be recreated (409). There is no un-delete.
9389
+ *
9390
+ * @tags admin
9391
+ * @name DeleteTenant
9392
+ * @summary Delete a tenant (wipe + tombstone)
9393
+ * @request DELETE:/api/v1/admin/tenants/{tenant_id}
9394
+ */
9395
+ deleteTenant = (tenantId, params = {}) => this.http.request({
9396
+ path: `/api/v1/admin/tenants/${tenantId}`,
9397
+ method: "DELETE",
9398
+ format: "json",
9399
+ ...params
9400
+ });
9401
+ /**
9402
+ * @description Returns every tenant registered in the tenant registry and not tombstoned, with its display label and term/session counts. A cleared tenant stays listed with zeroed counts; a deleted tenant is not listed. Requires the platform_admin role. Works in both PostgreSQL and in-memory modes.
9043
9403
  *
9044
9404
  * @tags admin
9045
9405
  * @name ListTenants
9046
- * @summary List all tenants with data
9406
+ * @summary List all live tenants
9047
9407
  * @request GET:/api/v1/admin/tenants
9048
9408
  */
9049
9409
  listTenants = (params = {}) => this.http.request({
@@ -9066,6 +9426,56 @@ var Admin = class {
9066
9426
  format: "json",
9067
9427
  ...params
9068
9428
  });
9429
+ /**
9430
+ * @description PLATFORM-scoped: a base is cross-tenant state, so only a platform admin may write it. Tenant deltas keep flowing through the Sentinel's pack surface (`/api/v1/sentinel/packs/...`), where D5 refuses any delta that loosens a base constraint.
9431
+ *
9432
+ * @tags admin
9433
+ * @name RegisterBasePack
9434
+ * @summary Register (or refresh) an industry BASE pack — the shared layer every tenant delta of that industry overlays (coupling plan WS7).
9435
+ * @request PUT:/api/v1/admin/packs/base
9436
+ */
9437
+ registerBasePack = (data, params = {}) => this.http.request({
9438
+ path: `/api/v1/admin/packs/base`,
9439
+ method: "PUT",
9440
+ body: data,
9441
+ type: "text/plain",
9442
+ format: "json",
9443
+ ...params
9444
+ });
9445
+ /**
9446
+ * @description Sets the caller's own tenant display label. `name: null` clears it. The label is metadata only — never unique, never a lookup key.
9447
+ *
9448
+ * @tags admin
9449
+ * @name RenameMyTenant
9450
+ * @summary Set, change, or clear the authenticated tenant's label
9451
+ * @request PATCH:/api/v1/tenants/me
9452
+ * @secure
9453
+ */
9454
+ renameMyTenant = (data, params = {}) => this.http.request({
9455
+ path: `/api/v1/tenants/me`,
9456
+ method: "PATCH",
9457
+ body: data,
9458
+ secure: true,
9459
+ type: "application/json",
9460
+ format: "json",
9461
+ ...params
9462
+ });
9463
+ /**
9464
+ * @description Sets the tenant's display label. `name: null` clears it. The label is metadata only — never unique, never a lookup key.
9465
+ *
9466
+ * @tags admin
9467
+ * @name RenameTenant
9468
+ * @summary Set, change, or clear a tenant's label
9469
+ * @request PATCH:/api/v1/admin/tenants/{tenant_id}
9470
+ */
9471
+ renameTenant = (tenantId, data, params = {}) => this.http.request({
9472
+ path: `/api/v1/admin/tenants/${tenantId}`,
9473
+ method: "PATCH",
9474
+ body: data,
9475
+ type: "application/json",
9476
+ format: "json",
9477
+ ...params
9478
+ });
9069
9479
  /**
9070
9480
  * @description Returns event-processing counters (submitted/processed/failed/in-flight), the materialization LSN, the last handler error (if any, truncated to 512 chars), the per-tenant materialization sentinel, the current derived-facts row count, and a racy hint about whether a rebuild is in flight. Intended for operator dashboards; the supervisor itself does not depend on this endpoint.
9071
9481
  *
@@ -9114,6 +9524,76 @@ var Ontology = class {
9114
9524
  constructor(http) {
9115
9525
  this.http = http;
9116
9526
  }
9527
+ /**
9528
+ * @description Every verdict is derived from the base itself — the lattice's parent edges, the feature bounds declared on sorts, and the disjointness rules the axiom integrator emitted. Nothing is trusted from the caller.
9529
+ *
9530
+ * @tags ontology
9531
+ * @name CheckOwl2
9532
+ * @summary Run the OWL 2 validators over the tenant's live ontology.
9533
+ * @request POST:/api/v1/ontology/checks/owl2
9534
+ * @secure
9535
+ */
9536
+ checkOwl2 = (data, params = {}) => this.http.request({
9537
+ path: `/api/v1/ontology/checks/owl2`,
9538
+ method: "POST",
9539
+ body: data,
9540
+ secure: true,
9541
+ type: "application/json",
9542
+ format: "json",
9543
+ ...params
9544
+ });
9545
+ /**
9546
+ * No description
9547
+ *
9548
+ * @tags ontology
9549
+ * @name CreateCompetencyQuestion
9550
+ * @summary Record a competency question.
9551
+ * @request POST:/api/v1/ontology/competency-questions
9552
+ * @secure
9553
+ */
9554
+ createCompetencyQuestion = (data, params = {}) => this.http.request({
9555
+ path: `/api/v1/ontology/competency-questions`,
9556
+ method: "POST",
9557
+ body: data,
9558
+ secure: true,
9559
+ type: "application/json",
9560
+ format: "json",
9561
+ ...params
9562
+ });
9563
+ /**
9564
+ * No description
9565
+ *
9566
+ * @tags ontology
9567
+ * @name EnrichOntology
9568
+ * @summary Propose external-ontology links. Writes nothing.
9569
+ * @request POST:/api/v1/ontology/enrich
9570
+ * @secure
9571
+ */
9572
+ enrichOntology = (data, params = {}) => this.http.request({
9573
+ path: `/api/v1/ontology/enrich`,
9574
+ method: "POST",
9575
+ body: data,
9576
+ secure: true,
9577
+ type: "application/json",
9578
+ format: "json",
9579
+ ...params
9580
+ });
9581
+ /**
9582
+ * No description
9583
+ *
9584
+ * @tags ontology
9585
+ * @name EvaluateCompetencyQuestions
9586
+ * @summary Run the accepted questions against the base.
9587
+ * @request POST:/api/v1/ontology/competency-questions/evaluate
9588
+ * @secure
9589
+ */
9590
+ evaluateCompetencyQuestions = (params = {}) => this.http.request({
9591
+ path: `/api/v1/ontology/competency-questions/evaluate`,
9592
+ method: "POST",
9593
+ secure: true,
9594
+ format: "json",
9595
+ ...params
9596
+ });
9117
9597
  /**
9118
9598
  * @description # Errors - 503 if no LLM is configured - 422 if the LLM returns invalid JSON after retries - 502 if the LLM service fails
9119
9599
  *
@@ -9132,6 +9612,72 @@ var Ontology = class {
9132
9612
  format: "json",
9133
9613
  ...params
9134
9614
  });
9615
+ /**
9616
+ * No description
9617
+ *
9618
+ * @tags ontology
9619
+ * @name ListCompetencyQuestions
9620
+ * @summary Every competency question the tenant holds.
9621
+ * @request GET:/api/v1/ontology/competency-questions
9622
+ * @secure
9623
+ */
9624
+ listCompetencyQuestions = (params = {}) => this.http.request({
9625
+ path: `/api/v1/ontology/competency-questions`,
9626
+ method: "GET",
9627
+ secure: true,
9628
+ format: "json",
9629
+ ...params
9630
+ });
9631
+ /**
9632
+ * @description Every figure is derived from the tenant's live lattice and term store. A stage is `complete` only when its bar is actually met; nothing here trusts the caller.
9633
+ *
9634
+ * @tags ontology
9635
+ * @name OntologyPipelineStatus
9636
+ * @summary Per-stage completeness of the ontology pipeline, measured from the base
9637
+ * @request GET:/api/v1/ontology/pipeline/status
9638
+ * @secure
9639
+ */
9640
+ ontologyPipelineStatus = (params = {}) => this.http.request({
9641
+ path: `/api/v1/ontology/pipeline/status`,
9642
+ method: "GET",
9643
+ secure: true,
9644
+ format: "json",
9645
+ ...params
9646
+ });
9647
+ /**
9648
+ * No description
9649
+ *
9650
+ * @tags ontology
9651
+ * @name OntologyQualityReport
9652
+ * @summary Judge the tenant's ontology.
9653
+ * @request GET:/api/v1/ontology/quality-report
9654
+ * @secure
9655
+ */
9656
+ ontologyQualityReport = (params = {}) => this.http.request({
9657
+ path: `/api/v1/ontology/quality-report`,
9658
+ method: "GET",
9659
+ secure: true,
9660
+ format: "json",
9661
+ ...params
9662
+ });
9663
+ /**
9664
+ * No description
9665
+ *
9666
+ * @tags ontology
9667
+ * @name SetCompetencyQuestionStatus
9668
+ * @summary Accept or reject a question.
9669
+ * @request PATCH:/api/v1/ontology/competency-questions/{key}
9670
+ * @secure
9671
+ */
9672
+ setCompetencyQuestionStatus = (key, data, params = {}) => this.http.request({
9673
+ path: `/api/v1/ontology/competency-questions/${key}`,
9674
+ method: "PATCH",
9675
+ body: data,
9676
+ secure: true,
9677
+ type: "application/json",
9678
+ format: "json",
9679
+ ...params
9680
+ });
9135
9681
  };
9136
9682
 
9137
9683
  // src/api-spec/generated/Generation.ts
@@ -9582,6 +10128,22 @@ var Compliance = class {
9582
10128
  format: "json",
9583
10129
  ...params
9584
10130
  });
10131
+ /**
10132
+ * No description
10133
+ *
10134
+ * @tags compliance
10135
+ * @name GetEuAiActConformity
10136
+ * @summary `GET /api/v1/compliance/conformity`
10137
+ * @request GET:/api/v1/compliance/conformity
10138
+ * @secure
10139
+ */
10140
+ getEuAiActConformity = (params = {}) => this.http.request({
10141
+ path: `/api/v1/compliance/conformity`,
10142
+ method: "GET",
10143
+ secure: true,
10144
+ format: "json",
10145
+ ...params
10146
+ });
9585
10147
  /**
9586
10148
  * No description
9587
10149
  *
@@ -12176,7 +12738,13 @@ function FeatureDescriptorDtoFromApiToFront(dto) {
12176
12738
  name: dto.name,
12177
12739
  expectedSort: dto.expected_sort ?? void 0,
12178
12740
  expectedTypeHint: dto.expected_type_hint ?? void 0,
12179
- required: dto.required,
12741
+ // The spec made this optional and documents the default explicitly:
12742
+ // "Defaults to `false` when absent." A relation is an appropriateness
12743
+ // declaration — it says what the value's sort must be, not that the
12744
+ // feature must be present — so the minimal relational descriptor omits it.
12745
+ // Kept non-optional on the SDK surface so a consumer never handles
12746
+ // `undefined` for a question the wire already answers.
12747
+ required: dto.required ?? false,
12180
12748
  constraint: dto.constraint ? ConstraintDtoFromApiToFront(dto.constraint) : void 0
12181
12749
  };
12182
12750
  }
@@ -12302,6 +12870,8 @@ function BulkCreateSortsRequestFromFrontToApi(model) {
12302
12870
  function BulkSortErrorFromApiToFront(dto) {
12303
12871
  return {
12304
12872
  name: dto.name,
12873
+ kind: dto.kind,
12874
+ sortCreated: dto.sort_created,
12305
12875
  error: dto.error
12306
12876
  };
12307
12877
  }
@@ -13771,6 +14341,35 @@ function GetRulesResponseFromApiToFront(dto) {
13771
14341
  rules: dto.rules.map(RuleEntryDtoFromApiToFront)
13772
14342
  };
13773
14343
  }
14344
+ function RuleWithdrawalReportFromApiToFront(dto) {
14345
+ return {
14346
+ ruleId: dto.rule_id,
14347
+ termsDeleted: dto.terms_deleted,
14348
+ termsRetainedShared: dto.terms_retained_shared,
14349
+ derivationsRemoved: dto.derivations_removed,
14350
+ derivationsWeakened: dto.derivations_weakened,
14351
+ derivationsTruncated: dto.derivations_truncated,
14352
+ consequencesInvalidated: dto.consequences_invalidated,
14353
+ queuedEventsCancelled: dto.queued_events_cancelled
14354
+ };
14355
+ }
14356
+ function RuleCertificationDeltaFromApiToFront(dto) {
14357
+ return {
14358
+ terminatedBefore: dto.terminated_before,
14359
+ terminatesAfter: dto.terminates_after,
14360
+ orderIndependentBefore: dto.order_independent_before,
14361
+ orderIndependentAfter: dto.order_independent_after,
14362
+ regressed: dto.regressed
14363
+ };
14364
+ }
14365
+ function ReplaceRuleResponseFromApiToFront(dto) {
14366
+ return {
14367
+ previousRuleId: dto.previous_rule_id,
14368
+ term: PsiTermDtoFromApiToFront(dto.term),
14369
+ withdrawal: RuleWithdrawalReportFromApiToFront(dto.withdrawal),
14370
+ certification: RuleCertificationDeltaFromApiToFront(dto.certification)
14371
+ };
14372
+ }
13774
14373
  function MetaSortsResponseFromApiToFront(dto) {
13775
14374
  return {
13776
14375
  absConstraint: dto.abs_constraint,
@@ -14258,6 +14857,89 @@ var InferenceClient = class {
14258
14857
  const response = await this.api.getRules(this.tenantId);
14259
14858
  return GetRulesResponseFromApiToFront(response.data);
14260
14859
  }
14860
+ /**
14861
+ * Withdraw one rule from the knowledge base.
14862
+ *
14863
+ * @param ruleId - Term id of the rule (its conclusion), as returned by
14864
+ * {@link InferenceClient.addRule} or {@link InferenceClient.getRules}.
14865
+ * @param options - `derivations` decides what happens to the conclusions the
14866
+ * rule derived. Defaults to `'refuse'`.
14867
+ * @returns What the withdrawal removed, tier by tier.
14868
+ * @throws {ApiError} 400 if the id names a fact rather than a rule, or if the
14869
+ * rule still supports derivations under the default `'refuse'`; 403 for a
14870
+ * system, plugin-owned or bootstrap rule; 404 if no such rule exists.
14871
+ *
14872
+ * @remarks
14873
+ * A rule is not a row. Withdrawing one deletes its conclusion AND the
14874
+ * antecedent pattern, guard and variable terms it exclusively owns — a
14875
+ * conclusion-only delete would leave those patterns readable as ordinary
14876
+ * facts — while keeping every term the rest of the knowledge base still
14877
+ * holds.
14878
+ *
14879
+ * `'refuse'` (the default) refuses while the rule still proves materialized
14880
+ * conclusions and says how many; `'retract'` withdraws them with it. A delete
14881
+ * that silently drops derivations is as wrong as one that silently keeps
14882
+ * them, so neither is the unnamed default.
14883
+ *
14884
+ * @example
14885
+ * ```typescript
14886
+ * const report = await client.inference.deleteRule(ruleId, { derivations: 'retract' });
14887
+ * console.log(report.termsDeleted, report.derivationsRemoved);
14888
+ * ```
14889
+ */
14890
+ async deleteRule(ruleId, options) {
14891
+ const response = await this.api.deleteRule(
14892
+ ruleId,
14893
+ options?.derivations === void 0 ? void 0 : { derivations: options.derivations }
14894
+ );
14895
+ return RuleWithdrawalReportFromApiToFront(response.data);
14896
+ }
14897
+ /**
14898
+ * Replace one rule with a new one.
14899
+ *
14900
+ * @param ruleId - Term id of the rule (its conclusion) to replace.
14901
+ * @param request - The replacement rule, in the same shape
14902
+ * {@link InferenceClient.addRule} takes.
14903
+ * @returns The replacement, the id it replaced, what the withdrawal removed,
14904
+ * and how the rule base's guarantees moved.
14905
+ * @throws {ApiError} 422 if the replacement is rejected by the authoring
14906
+ * guards — in which case the original rule is left live; 400/403/404 as for
14907
+ * {@link InferenceClient.deleteRule}.
14908
+ *
14909
+ * @remarks
14910
+ * A rule's id IS its conclusion term id, so an edit changes it by
14911
+ * construction. The response carries `previousRuleId` alongside the new
14912
+ * rule; a client holding the old id must adopt the new one.
14913
+ *
14914
+ * The path names ONE rule term — one disjunct. Two rules with the same
14915
+ * conclusion are OR-unioned, so "edit the rule for X" is ambiguous and this
14916
+ * addresses a single clause.
14917
+ *
14918
+ * @example
14919
+ * ```typescript
14920
+ * const result = await client.inference.replaceRule(ruleId, {
14921
+ * term: psi('retiree', { name: Var('N') }),
14922
+ * antecedents: [psi('person', { name: Var('N') })],
14923
+ * });
14924
+ * console.log(result.previousRuleId, '->', result.term.termId);
14925
+ * if (result.certification.regressed) {
14926
+ * console.warn('the edit weakened the rule base guarantees');
14927
+ * }
14928
+ * ```
14929
+ */
14930
+ async replaceRule(ruleId, request) {
14931
+ const wireRequest = {
14932
+ term: convertTermArg(request.term),
14933
+ antecedents: request.antecedents?.map(convertTermArg),
14934
+ certainty: request.certainty,
14935
+ aggregator: request.aggregator
14936
+ };
14937
+ const response = await this.api.replaceRule(
14938
+ ruleId,
14939
+ AddRuleRequestFromFrontToApi(wireRequest)
14940
+ );
14941
+ return ReplaceRuleResponseFromApiToFront(response.data);
14942
+ }
14261
14943
  /**
14262
14944
  * Query for matching data by searching rules and facts backwards from a goal pattern.
14263
14945
  *
@@ -17365,6 +18047,17 @@ function TrailEntryDtoFromApiToFront(dto) {
17365
18047
  prevLower: dto.prev_lower,
17366
18048
  prevUpper: dto.prev_upper
17367
18049
  };
18050
+ case "term_creation":
18051
+ return {
18052
+ type: "term_creation",
18053
+ termId: dto.term_id
18054
+ };
18055
+ case "term_removal":
18056
+ return {
18057
+ type: "term_removal",
18058
+ termId: dto.term_id,
18059
+ sortId: dto.sort_id
18060
+ };
17368
18061
  }
17369
18062
  }
17370
18063
  function ResiduationGoalDtoFromFrontToApi(model) {
@@ -22742,6 +23435,8 @@ function DiscoveredSortDtoFromApiToFront(dto) {
22742
23435
  description: dto.description,
22743
23436
  features: dto.features.map(DiscoveredFeatureDtoFromApiToFront),
22744
23437
  name: dto.name,
23438
+ sourceTypeKey: dto.source_type_key,
23439
+ sortName: dto.sort_name,
22745
23440
  sourceName: dto.source_name,
22746
23441
  suggestedParents: dto.suggested_parents
22747
23442
  };
@@ -27045,6 +27740,7 @@ function ClearTenantResponseFromApiToFront(dto) {
27045
27740
  function TenantInfoFromApiToFront(dto) {
27046
27741
  return {
27047
27742
  tenantId: dto.tenant_id,
27743
+ name: dto.name,
27048
27744
  termCount: dto.term_count,
27049
27745
  sessionCount: dto.session_count
27050
27746
  };
@@ -27056,6 +27752,7 @@ function ListTenantsResponseFromApiToFront(dto) {
27056
27752
  }
27057
27753
  function CreateTenantRequestFromFrontToApi(model) {
27058
27754
  return {
27755
+ name: model.name,
27059
27756
  owner_user_id: model.ownerUserId,
27060
27757
  seed_sorts: model.seedSorts,
27061
27758
  tenant_id: model.tenantId
@@ -27065,7 +27762,25 @@ function CreateTenantResponseFromApiToFront(dto) {
27065
27762
  return {
27066
27763
  created: dto.created,
27067
27764
  seededSorts: dto.seeded_sorts,
27068
- tenantId: dto.tenant_id
27765
+ tenantId: dto.tenant_id,
27766
+ name: dto.name
27767
+ };
27768
+ }
27769
+ function DeleteTenantResponseFromApiToFront(dto) {
27770
+ return {
27771
+ ...ClearTenantResponseFromApiToFront(dto),
27772
+ deletedAt: dto.deleted_at
27773
+ };
27774
+ }
27775
+ function UpdateTenantNameRequestFromFrontToApi(model) {
27776
+ return {
27777
+ name: model.name
27778
+ };
27779
+ }
27780
+ function UpdateTenantNameResponseFromApiToFront(dto) {
27781
+ return {
27782
+ tenantId: dto.tenant_id,
27783
+ name: dto.name
27069
27784
  };
27070
27785
  }
27071
27786
 
@@ -27216,6 +27931,128 @@ var AdminClient = class {
27216
27931
  const response = await this.api.createTenant(CreateTenantRequestFromFrontToApi(request));
27217
27932
  return CreateTenantResponseFromApiToFront(response.data);
27218
27933
  }
27934
+ /**
27935
+ * Delete a tenant (platform-admin).
27936
+ *
27937
+ * @param tenantId - The UUID of the tenant to delete.
27938
+ * @returns The wipe report plus the tombstone outcome.
27939
+ * @throws {ApiError} `404` when no registry row exists for the UUID; `410`
27940
+ * when the tenant was already deleted; `403` without the `platform_admin`
27941
+ * role; `500` when the data reset failed (a partial wipe may have occurred).
27942
+ *
27943
+ * @remarks
27944
+ * **DESTRUCTIVE AND IRREVERSIBLE. There is no un-delete.**
27945
+ *
27946
+ * Clears every trace of the tenant's data (identical to the clear-tenant
27947
+ * wipe), then tombstones its registry row. The tenant stops existing:
27948
+ * every later request naming its UUID is refused with `410`, it disappears
27949
+ * from `listTenants`, and `createTenant` on the same UUID refuses with `409`
27950
+ * rather than resurrecting it. A fresh UUID is the workaround.
27951
+ *
27952
+ * This is not {@link clearTenantData}: a clear wipes the tenant's data but
27953
+ * the tenant continues to exist — its id stays valid, it can be re-populated,
27954
+ * and it is still listed with zeroed counts. A delete retires the id.
27955
+ *
27956
+ * @example
27957
+ * ```typescript
27958
+ * const result = await client.admin.deleteTenant('550e8400-e29b-41d4-a716-446655440000');
27959
+ * console.log(result.message);
27960
+ * console.log(`Deleted at: ${result.deletedAt}`);
27961
+ * ```
27962
+ */
27963
+ async deleteTenant(tenantId) {
27964
+ const response = await this.api.deleteTenant(tenantId);
27965
+ return DeleteTenantResponseFromApiToFront(response.data);
27966
+ }
27967
+ /**
27968
+ * Delete the authenticated tenant (self-service).
27969
+ *
27970
+ * @returns The wipe report plus the tombstone outcome.
27971
+ * @throws {ApiError} `404` when the caller's tenant was never materialized;
27972
+ * `410` when it was already deleted; `500` when the data reset failed
27973
+ * (a partial wipe may have occurred).
27974
+ *
27975
+ * @remarks
27976
+ * **DESTRUCTIVE AND IRREVERSIBLE. There is no un-delete.**
27977
+ *
27978
+ * The self-service mirror of {@link deleteTenant}: the target tenant is
27979
+ * resolved server-side from the caller's own `X-Tenant-Id` header, never
27980
+ * from a path or body parameter, so it always deletes the authenticated
27981
+ * principal's own tenant. No `platform_admin` role is required. Afterwards
27982
+ * the tenant's UUID is refused with `410` everywhere and cannot be
27983
+ * recreated — the caller must switch to a different tenant id.
27984
+ *
27985
+ * This is not {@link clearMyTenantData}: a clear wipes the caller's data but
27986
+ * the tenant continues to exist. A delete retires the id permanently.
27987
+ *
27988
+ * @example
27989
+ * ```typescript
27990
+ * // Deletes the calling tenant's own identity — no tenant ID is passed.
27991
+ * const result = await client.admin.deleteMyTenant();
27992
+ * console.log(`Tenant retired at: ${result.deletedAt}`);
27993
+ * ```
27994
+ */
27995
+ async deleteMyTenant() {
27996
+ const response = await this.api.deleteMyTenant();
27997
+ return DeleteTenantResponseFromApiToFront(response.data);
27998
+ }
27999
+ /**
28000
+ * Set, change, or clear a tenant's label (platform-admin).
28001
+ *
28002
+ * @param tenantId - The UUID of the tenant to rename.
28003
+ * @param request - The new label. `name: null` (or an empty request) clears it.
28004
+ * @returns The tenant id and the label now stored.
28005
+ * @throws {ApiError} `404` when no registry row exists for the UUID; `410`
28006
+ * when the tenant is deleted (its label is frozen); `422` when the name is
28007
+ * empty after trim or over 200 characters; `403` without the
28008
+ * `platform_admin` role.
28009
+ *
28010
+ * @remarks
28011
+ * The label is display metadata only: not unique, not a lookup key, never
28012
+ * parsed. The UUID remains the tenant's only identity. The stored label
28013
+ * survives a clear and leaves with a delete.
28014
+ *
28015
+ * @example
28016
+ * ```typescript
28017
+ * const result = await client.admin.renameTenant('550e8400-…', { name: 'Research' });
28018
+ * console.log(result.name); // the stored, trimmed label
28019
+ * ```
28020
+ */
28021
+ async renameTenant(tenantId, request) {
28022
+ const response = await this.api.renameTenant(
28023
+ tenantId,
28024
+ UpdateTenantNameRequestFromFrontToApi(request)
28025
+ );
28026
+ return UpdateTenantNameResponseFromApiToFront(response.data);
28027
+ }
28028
+ /**
28029
+ * Set, change, or clear the authenticated tenant's label (self-service).
28030
+ *
28031
+ * @param request - The new label. `name: null` (or an empty request) clears it.
28032
+ * @returns The tenant id and the label now stored.
28033
+ * @throws {ApiError} `404` when the caller's tenant was never materialized;
28034
+ * `410` when it is deleted; `422` when the name is empty after trim or
28035
+ * over 200 characters.
28036
+ *
28037
+ * @remarks
28038
+ * The self-service mirror of {@link renameTenant}: the target tenant is
28039
+ * resolved server-side from the caller's own `X-Tenant-Id` header, so it
28040
+ * always renames the authenticated principal's own tenant. No
28041
+ * `platform_admin` role is required.
28042
+ *
28043
+ * @example
28044
+ * ```typescript
28045
+ * // Renames the calling tenant — no tenant ID is passed.
28046
+ * const result = await client.admin.renameMyTenant({ name: 'My workspace' });
28047
+ * console.log(result.name);
28048
+ * ```
28049
+ */
28050
+ async renameMyTenant(request) {
28051
+ const response = await this.api.renameMyTenant(
28052
+ UpdateTenantNameRequestFromFrontToApi(request)
28053
+ );
28054
+ return UpdateTenantNameResponseFromApiToFront(response.data);
28055
+ }
27219
28056
  };
27220
28057
 
27221
28058
  // src/normalizers/image-extraction.ts
@@ -28631,6 +29468,10 @@ function OsfqlValueFromApiToFront(value) {
28631
29468
  switch (value["type"]) {
28632
29469
  case "null":
28633
29470
  return { type: "null" };
29471
+ // The record does not carry the feature. No payload, and no `undefined`
29472
+ // either: dropping the key would hide the absence the answer is about.
29473
+ case "unbound":
29474
+ return { type: "unbound" };
28634
29475
  case "integer":
28635
29476
  return typeof payload === "number" ? { type: "integer", value: payload } : void 0;
28636
29477
  case "float":
@@ -28758,6 +29599,36 @@ function OsfqlDiagnoseResponseFromApiToFront(dto) {
28758
29599
  diagnostics: dto.diagnostics.map(OsfqlDiagnosticFromApiToFront)
28759
29600
  };
28760
29601
  }
29602
+ function OsfqlCatalogEntryFromApiToFront(dto) {
29603
+ return {
29604
+ id: dto.id,
29605
+ statement: dto.statement,
29606
+ family: dto.family,
29607
+ category: dto.category,
29608
+ subOps: dto.sub_ops,
29609
+ brief: dto.brief,
29610
+ full: dto.full,
29611
+ syntax: dto.syntax,
29612
+ examples: dto.examples,
29613
+ risk: dto.risk,
29614
+ execution: OsfqlCatalogExecutionFromApiToFront(dto.execution),
29615
+ uiAffinity: {
29616
+ display: dto.ui_affinity.display ?? void 0,
29617
+ action: dto.ui_affinity.action ?? void 0
29618
+ },
29619
+ returns: dto.returns,
29620
+ // Absent means "needs nothing", which is false for nearly every statement —
29621
+ // so an absent array is a wire-shape surprise, not a default. `?? []` keeps
29622
+ // the shipped type total; the engine sends the field for all entries.
29623
+ needs: dto.needs ?? [],
29624
+ pitfalls: dto.pitfalls ?? []
29625
+ };
29626
+ }
29627
+ function OsfqlCatalogExecutionFromApiToFront(dto) {
29628
+ if (dto === "Executes") return { status: "executes" };
29629
+ if (dto === "PlanOnly") return { status: "planOnly" };
29630
+ return { status: "partial", note: dto.Partial };
29631
+ }
28761
29632
 
28762
29633
  // src/resources/osfql.ts
28763
29634
  var OsfqlClient = class {
@@ -28870,24 +29741,34 @@ var OsfqlClient = class {
28870
29741
  return OsfqlDiagnoseResponseFromApiToFront(response.data);
28871
29742
  }
28872
29743
  /**
28873
- * Fetch the OSFQL statement catalog, optionally filtered by category.
29744
+ * Fetch the OSFQL statement catalog the engine's own description of every
29745
+ * statement it implements.
28874
29746
  *
28875
- * @param category - Optional category filter: `read`, `write`, `control`, or `meta`.
28876
- * @returns The raw catalog payload, typed as `unknown`.
29747
+ * @param category - Optional filter: `read`, `write`, `control`, or `meta`
29748
+ * (case-insensitive). Omit for the whole catalog; an unrecognised value
29749
+ * yields an empty list rather than an error.
29750
+ * @returns One {@link OsfqlCatalogEntry} per statement.
28877
29751
  * @throws {ApiError} If the request fails.
28878
29752
  *
28879
29753
  * @remarks
28880
- * This is a DEBUG/introspection endpoint. The backend publishes **no response schema** for
28881
- * it in the OpenAPI document, and its payload deliberately mixes casing (`risk` is
28882
- * snake_case while the sibling `family` / `category` enums are PascalCase). The SDK
28883
- * therefore returns the parsed JSON body as `unknown` rather than inventing a shipped type
28884
- * that the spec does not guarantee narrow it at the call site.
29754
+ * The backend publishes a response schema for this endpoint, so the payload
29755
+ * is normalized like any other. It previously returned `unknown` because the
29756
+ * spec carried none and because the endpoint answered HTTP 500 to every
29757
+ * request until `kortexya/reasoninglayer#176` repaired its response DTO, so
29758
+ * no caller had ever received a body to type.
29759
+ *
29760
+ * ⚠️ The enum VALUES mix casing deliberately and are preserved verbatim:
29761
+ * `risk` is snake_case (`additive_write`), while `family`, `category`,
29762
+ * `returns` and both halves of `uiAffinity` are PascalCase (`Query`, `Read`,
29763
+ * `Bindings`, `Table`). Only keys are camelCased.
28885
29764
  *
28886
29765
  * @example
28887
29766
  * ```typescript
28888
- * const catalog: unknown = await client.osfql.catalog('write');
28889
- * if (Array.isArray(catalog)) {
28890
- * console.log(catalog.length);
29767
+ * const catalog = await client.osfql.catalog('write');
29768
+ * for (const entry of catalog) {
29769
+ * if (entry.execution.status === 'partial') {
29770
+ * console.warn(`${entry.id} is partial: ${entry.execution.note}`);
29771
+ * }
28891
29772
  * }
28892
29773
  * ```
28893
29774
  */
@@ -28899,7 +29780,7 @@ var OsfqlClient = class {
28899
29780
  secure: true,
28900
29781
  format: "json"
28901
29782
  });
28902
- return response.data;
29783
+ return response.data.map(OsfqlCatalogEntryFromApiToFront);
28903
29784
  }
28904
29785
  };
28905
29786
 
@@ -28948,7 +29829,22 @@ function SchemaExcerptDtoFromApiToFront(dto) {
28948
29829
  featureNames: dto.feature_names
28949
29830
  };
28950
29831
  }
29832
+ function CitationCheckDtoFromApiToFront(dto) {
29833
+ return {
29834
+ marker: dto.marker,
29835
+ variable: dto.variable ?? void 0,
29836
+ assertedValue: dto.asserted_value ?? void 0,
29837
+ verdict: dto.verdict,
29838
+ repair: dto.repair ?? void 0,
29839
+ repairVariables: dto.repair_variables,
29840
+ observedValues: dto.observed_values,
29841
+ observedTotal: dto.observed_total,
29842
+ scope: dto.scope,
29843
+ scopeLabel: dto.scope_label ?? void 0
29844
+ };
29845
+ }
28951
29846
  function ClaimAnnotationDtoFromApiToFront(dto) {
29847
+ const wire = dto;
28952
29848
  return {
28953
29849
  text: dto.text,
28954
29850
  span: dto.span,
@@ -28958,7 +29854,8 @@ function ClaimAnnotationDtoFromApiToFront(dto) {
28958
29854
  sourceExcerpts: dto.source_excerpts?.map(SourceExcerptDtoFromApiToFront),
28959
29855
  schemaExcerpts: dto.schema_excerpts?.map(SchemaExcerptDtoFromApiToFront),
28960
29856
  osfqlQuery: dto.osfql_query ?? void 0,
28961
- derivationSummary: dto.derivation_summary ? DerivationSummaryDtoFromApiToFront(dto.derivation_summary) : void 0
29857
+ derivationSummary: dto.derivation_summary ? DerivationSummaryDtoFromApiToFront(dto.derivation_summary) : void 0,
29858
+ citationChecks: wire.citation_checks?.map(CitationCheckDtoFromApiToFront)
28962
29859
  };
28963
29860
  }
28964
29861
  function ProofTraceNodeDtoFromApiToFront(dto) {