@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.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/config.ts
8
- var SDK_VERSION = "1.22.0";
8
+ var SDK_VERSION = "1.24.0";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -956,7 +956,7 @@ var Sorts = class {
956
956
  ...params
957
957
  });
958
958
  /**
959
- * @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)
959
+ * @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`
960
960
  *
961
961
  * @tags sorts
962
962
  * @name DeleteSort
@@ -964,10 +964,27 @@ var Sorts = class {
964
964
  * @request DELETE:/api/v1/sorts/{id}
965
965
  * @secure
966
966
  */
967
- deleteSort = (id, params = {}) => this.http.request({
967
+ deleteSort = (id, query, params = {}) => this.http.request({
968
968
  path: `/api/v1/sorts/${id}`,
969
969
  method: "DELETE",
970
+ query,
970
971
  secure: true,
972
+ format: "json",
973
+ ...params
974
+ });
975
+ /**
976
+ * No description
977
+ *
978
+ * @tags sorts
979
+ * @name GenerateSortProposals
980
+ * @summary Turn recurrent observations into proposed sorts for review.
981
+ * @request POST:/api/v1/sorts/proposals/generate
982
+ */
983
+ generateSortProposals = (query, params = {}) => this.http.request({
984
+ path: `/api/v1/sorts/proposals/generate`,
985
+ method: "POST",
986
+ query,
987
+ format: "json",
971
988
  ...params
972
989
  });
973
990
  /**
@@ -1015,7 +1032,7 @@ var Sorts = class {
1015
1032
  ...params
1016
1033
  });
1017
1034
  /**
1018
- * @description Per Definition IV.5 (Milanese & Pasi 2024): ≾̇ = ((≾̃ .− ∼) ⊍ )
1035
+ * @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.)
1019
1036
  *
1020
1037
  * @tags sorts
1021
1038
  * @name GetPreorderDegree
@@ -1030,6 +1047,21 @@ var Sorts = class {
1030
1047
  format: "json",
1031
1048
  ...params
1032
1049
  });
1050
+ /**
1051
+ * @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 ≺∼·).
1052
+ *
1053
+ * @tags sorts
1054
+ * @name GetQuotientOrder
1055
+ * @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.
1056
+ * @request GET:/api/v1/sorts/quotient-order
1057
+ */
1058
+ getQuotientOrder = (query, params = {}) => this.http.request({
1059
+ path: `/api/v1/sorts/quotient-order`,
1060
+ method: "GET",
1061
+ query,
1062
+ format: "json",
1063
+ ...params
1064
+ });
1033
1065
  /**
1034
1066
  * @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`.
1035
1067
  *
@@ -1138,6 +1170,20 @@ var Sorts = class {
1138
1170
  format: "json",
1139
1171
  ...params
1140
1172
  });
1173
+ /**
1174
+ * No description
1175
+ *
1176
+ * @tags sorts
1177
+ * @name ListObservations
1178
+ * @summary List the tenant's unknown-term observations.
1179
+ * @request GET:/api/v1/sorts/proposals
1180
+ */
1181
+ listObservations = (params = {}) => this.http.request({
1182
+ path: `/api/v1/sorts/proposals`,
1183
+ method: "GET",
1184
+ format: "json",
1185
+ ...params
1186
+ });
1141
1187
  /**
1142
1188
  * @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.
1143
1189
  *
@@ -1153,6 +1199,76 @@ var Sorts = class {
1153
1199
  format: "json",
1154
1200
  ...params
1155
1201
  });
1202
+ /**
1203
+ * @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.
1204
+ *
1205
+ * @tags sorts
1206
+ * @name PatchSort
1207
+ * @summary Curate one concept's vocabulary and lifecycle
1208
+ * @request PATCH:/api/v1/sorts/{id}
1209
+ * @secure
1210
+ */
1211
+ patchSort = (id, data, params = {}) => this.http.request({
1212
+ path: `/api/v1/sorts/${id}`,
1213
+ method: "PATCH",
1214
+ body: data,
1215
+ secure: true,
1216
+ type: "application/json",
1217
+ format: "json",
1218
+ ...params
1219
+ });
1220
+ /**
1221
+ * @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
1222
+ *
1223
+ * @tags sorts
1224
+ * @name PatchSortFeature
1225
+ * @summary Rename one feature declaration on a sort
1226
+ * @request PATCH:/api/v1/sorts/{id}/features/{feature}
1227
+ * @secure
1228
+ */
1229
+ patchSortFeature = (id, feature, data, params = {}) => this.http.request({
1230
+ path: `/api/v1/sorts/${id}/features/${feature}`,
1231
+ method: "PATCH",
1232
+ body: data,
1233
+ secure: true,
1234
+ type: "application/json",
1235
+ format: "json",
1236
+ ...params
1237
+ });
1238
+ /**
1239
+ * @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.
1240
+ *
1241
+ * @tags sorts
1242
+ * @name ProposeSortsClosedLoop
1243
+ * @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.
1244
+ * @request POST:/api/v1/sorts/discovery/propose
1245
+ */
1246
+ proposeSortsClosedLoop = (data, params = {}) => this.http.request({
1247
+ path: `/api/v1/sorts/discovery/propose`,
1248
+ method: "POST",
1249
+ body: data,
1250
+ type: "application/json",
1251
+ format: "json",
1252
+ ...params
1253
+ });
1254
+ /**
1255
+ * @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.
1256
+ *
1257
+ * @tags sorts
1258
+ * @name ProposeStructuralSimilarities
1259
+ * @summary Propose structural similarity candidates for review
1260
+ * @request POST:/api/v1/sorts/propose-structural-similarities
1261
+ * @secure
1262
+ */
1263
+ proposeStructuralSimilarities = (data, params = {}) => this.http.request({
1264
+ path: `/api/v1/sorts/propose-structural-similarities`,
1265
+ method: "POST",
1266
+ body: data,
1267
+ secure: true,
1268
+ type: "application/json",
1269
+ format: "json",
1270
+ ...params
1271
+ });
1156
1272
  /**
1157
1273
  * @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.
1158
1274
  *
@@ -1169,6 +1285,23 @@ var Sorts = class {
1169
1285
  format: "json",
1170
1286
  ...params
1171
1287
  });
1288
+ /**
1289
+ * @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
1290
+ *
1291
+ * @tags sorts
1292
+ * @name RemoveSortFeature
1293
+ * @summary Remove one feature declaration from a sort
1294
+ * @request DELETE:/api/v1/sorts/{id}/features/{feature}
1295
+ * @secure
1296
+ */
1297
+ removeSortFeature = (id, feature, query, params = {}) => this.http.request({
1298
+ path: `/api/v1/sorts/${id}/features/${feature}`,
1299
+ method: "DELETE",
1300
+ query,
1301
+ secure: true,
1302
+ format: "json",
1303
+ ...params
1304
+ });
1172
1305
  /**
1173
1306
  * No description
1174
1307
  *
@@ -1742,6 +1875,23 @@ var Inference = class {
1742
1875
  format: "json",
1743
1876
  ...params
1744
1877
  });
1878
+ /**
1879
+ * @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.
1880
+ *
1881
+ * @tags inference
1882
+ * @name DeleteRule
1883
+ * @summary Delete a rule.
1884
+ * @request DELETE:/api/v1/inference/rules/{id}
1885
+ * @secure
1886
+ */
1887
+ deleteRule = (id, query, params = {}) => this.http.request({
1888
+ path: `/api/v1/inference/rules/${id}`,
1889
+ method: "DELETE",
1890
+ query,
1891
+ secure: true,
1892
+ format: "json",
1893
+ ...params
1894
+ });
1745
1895
  /**
1746
1896
  * @description Never writes to the KB — returns validated drafts for human review.
1747
1897
  *
@@ -1864,16 +2014,16 @@ var Inference = class {
1864
2014
  ...params
1865
2015
  });
1866
2016
  /**
1867
- * @description # Authorization Requires X-Tenant-Id header.
2017
+ * @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.
1868
2018
  *
1869
2019
  * @tags inference
1870
2020
  * @name GetRules
1871
2021
  * @summary Get all rules (clauses with antecedents) for a tenant
1872
- * @request GET:/api/v1/inference/rules/{tenant_id}
2022
+ * @request GET:/api/v1/inference/rules/{id}
1873
2023
  * @secure
1874
2024
  */
1875
- getRules = (tenantId, params = {}) => this.http.request({
1876
- path: `/api/v1/inference/rules/${tenantId}`,
2025
+ getRules = (id, params = {}) => this.http.request({
2026
+ path: `/api/v1/inference/rules/${id}`,
1877
2027
  method: "GET",
1878
2028
  secure: true,
1879
2029
  format: "json",
@@ -1931,6 +2081,24 @@ var Inference = class {
1931
2081
  format: "json",
1932
2082
  ...params
1933
2083
  });
2084
+ /**
2085
+ * @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.
2086
+ *
2087
+ * @tags inference
2088
+ * @name ReplaceRule
2089
+ * @summary Replace a rule.
2090
+ * @request PUT:/api/v1/inference/rules/{id}
2091
+ * @secure
2092
+ */
2093
+ replaceRule = (id, data, params = {}) => this.http.request({
2094
+ path: `/api/v1/inference/rules/${id}`,
2095
+ method: "PUT",
2096
+ body: data,
2097
+ secure: true,
2098
+ type: "application/json",
2099
+ format: "json",
2100
+ ...params
2101
+ });
1934
2102
  /**
1935
2103
  * @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.
1936
2104
  *
@@ -6774,6 +6942,24 @@ var Reasoning = class {
6774
6942
  constructor(http) {
6775
6943
  this.http = http;
6776
6944
  }
6945
+ /**
6946
+ * @description POST /api/v1/assessment/ordinal
6947
+ *
6948
+ * @tags reasoning
6949
+ * @name AssessOrdinal
6950
+ * @summary Grade criteria against evidence on an ordinal scale.
6951
+ * @request POST:/api/v1/assessment/ordinal
6952
+ * @secure
6953
+ */
6954
+ assessOrdinal = (data, params = {}) => this.http.request({
6955
+ path: `/api/v1/assessment/ordinal`,
6956
+ method: "POST",
6957
+ body: data,
6958
+ secure: true,
6959
+ type: "application/json",
6960
+ format: "json",
6961
+ ...params
6962
+ });
6777
6963
  /**
6778
6964
  * @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.
6779
6965
  *
@@ -7996,6 +8182,22 @@ var Analysis = class {
7996
8182
  constructor(http) {
7997
8183
  this.http = http;
7998
8184
  }
8185
+ /**
8186
+ * @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.
8187
+ *
8188
+ * @tags analysis
8189
+ * @name AnalyzeCertifiedGeneralization
8190
+ * @summary Certify feature classes against a recorded outcome.
8191
+ * @request POST:/api/v1/analysis/certified-generalization
8192
+ */
8193
+ analyzeCertifiedGeneralization = (data, params = {}) => this.http.request({
8194
+ path: `/api/v1/analysis/certified-generalization`,
8195
+ method: "POST",
8196
+ body: data,
8197
+ type: "application/json",
8198
+ format: "json",
8199
+ ...params
8200
+ });
7999
8201
  /**
8000
8202
  * @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.
8001
8203
  *
@@ -8012,6 +8214,22 @@ var Analysis = class {
8012
8214
  format: "json",
8013
8215
  ...params
8014
8216
  });
8217
+ /**
8218
+ * @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.
8219
+ *
8220
+ * @tags analysis
8221
+ * @name AssignConceptFeatures
8222
+ * @summary Apply supplied feature definitions to the tenant's terms.
8223
+ * @request POST:/api/v1/analysis/concept-features/assign
8224
+ */
8225
+ assignConceptFeatures = (data, params = {}) => this.http.request({
8226
+ path: `/api/v1/analysis/concept-features/assign`,
8227
+ method: "POST",
8228
+ body: data,
8229
+ type: "application/json",
8230
+ format: "json",
8231
+ ...params
8232
+ });
8015
8233
  /**
8016
8234
  * @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.
8017
8235
  *
@@ -8068,6 +8286,102 @@ var Analysis = class {
8068
8286
  format: "json",
8069
8287
  ...params
8070
8288
  });
8289
+ /**
8290
+ * @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.
8291
+ *
8292
+ * @tags analysis
8293
+ * @name InstallConceptRules
8294
+ * @summary Mine the tenant's terms and install every certifying conjunction as a rule.
8295
+ * @request POST:/api/v1/analysis/concept-rules
8296
+ */
8297
+ installConceptRules = (data, params = {}) => this.http.request({
8298
+ path: `/api/v1/analysis/concept-rules`,
8299
+ method: "POST",
8300
+ body: data,
8301
+ type: "application/json",
8302
+ format: "json",
8303
+ ...params
8304
+ });
8305
+ /**
8306
+ * @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.
8307
+ *
8308
+ * @tags analysis
8309
+ * @name LearnHypotheses
8310
+ * @summary Learn the descriptions of a class that no counter-example carries, and classify candidates against them.
8311
+ * @request POST:/api/v1/analysis/hypotheses
8312
+ */
8313
+ learnHypotheses = (data, params = {}) => this.http.request({
8314
+ path: `/api/v1/analysis/hypotheses`,
8315
+ method: "POST",
8316
+ body: data,
8317
+ type: "application/json",
8318
+ format: "json",
8319
+ ...params
8320
+ });
8321
+ /**
8322
+ * @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.
8323
+ *
8324
+ * @tags analysis
8325
+ * @name MaterializeCohort
8326
+ * @summary Store a group's shared description as a sort, and classify candidates against the cohort it becomes.
8327
+ * @request POST:/api/v1/analysis/cohorts
8328
+ */
8329
+ materializeCohort = (data, params = {}) => this.http.request({
8330
+ path: `/api/v1/analysis/cohorts`,
8331
+ method: "POST",
8332
+ body: data,
8333
+ type: "application/json",
8334
+ format: "json",
8335
+ ...params
8336
+ });
8337
+ /**
8338
+ * @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.
8339
+ *
8340
+ * @tags analysis
8341
+ * @name MineConceptFeatures
8342
+ * @summary Mine the tenant's terms for conjunctions certifiably enriched for a target.
8343
+ * @request POST:/api/v1/analysis/concept-features
8344
+ */
8345
+ mineConceptFeatures = (data, params = {}) => this.http.request({
8346
+ path: `/api/v1/analysis/concept-features`,
8347
+ method: "POST",
8348
+ body: data,
8349
+ type: "application/json",
8350
+ format: "json",
8351
+ ...params
8352
+ });
8353
+ /**
8354
+ * @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.
8355
+ *
8356
+ * @tags analysis
8357
+ * @name MineIntervalPatterns
8358
+ * @summary Mine the numeric regions that best separate a class, and report how much better any region could still be.
8359
+ * @request POST:/api/v1/analysis/interval-patterns
8360
+ */
8361
+ mineIntervalPatterns = (data, params = {}) => this.http.request({
8362
+ path: `/api/v1/analysis/interval-patterns`,
8363
+ method: "POST",
8364
+ body: data,
8365
+ type: "application/json",
8366
+ format: "json",
8367
+ ...params
8368
+ });
8369
+ /**
8370
+ * @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.
8371
+ *
8372
+ * @tags analysis
8373
+ * @name MineLggClasses
8374
+ * @summary Mine the tenant's terms for classes certifiably enriched for a target, generalizing by sort rather than by conjunction.
8375
+ * @request POST:/api/v1/analysis/lgg-classes
8376
+ */
8377
+ mineLggClasses = (data, params = {}) => this.http.request({
8378
+ path: `/api/v1/analysis/lgg-classes`,
8379
+ method: "POST",
8380
+ body: data,
8381
+ type: "application/json",
8382
+ format: "json",
8383
+ ...params
8384
+ });
8071
8385
  /**
8072
8386
  * @description The counterexample must have all premise features but lack at least one conclusion feature.
8073
8387
  *
@@ -8084,6 +8398,22 @@ var Analysis = class {
8084
8398
  format: "json",
8085
8399
  ...params
8086
8400
  });
8401
+ /**
8402
+ * @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.
8403
+ *
8404
+ * @tags analysis
8405
+ * @name SearchLattice
8406
+ * @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.
8407
+ * @request POST:/api/v1/analysis/lattice-search
8408
+ */
8409
+ searchLattice = (data, params = {}) => this.http.request({
8410
+ path: `/api/v1/analysis/lattice-search`,
8411
+ method: "POST",
8412
+ body: data,
8413
+ type: "application/json",
8414
+ format: "json",
8415
+ ...params
8416
+ });
8087
8417
  /**
8088
8418
  * @description Builds a formal context from the tenant's knowledge base terms and initializes the Ganter exploration protocol.
8089
8419
  *
@@ -9021,7 +9351,7 @@ var Admin = class {
9021
9351
  ...params
9022
9352
  });
9023
9353
  /**
9024
- * @description Explicitly creates a tenant's inference state and sort hierarchy, optionally seeding initial sorts. Idempotent. No X-Tenant-Id header required.
9354
+ * @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.
9025
9355
  *
9026
9356
  * @tags admin
9027
9357
  * @name CreateTenant
@@ -9037,11 +9367,41 @@ var Admin = class {
9037
9367
  ...params
9038
9368
  });
9039
9369
  /**
9040
- * @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.
9370
+ * @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.
9371
+ *
9372
+ * @tags admin
9373
+ * @name DeleteMyTenant
9374
+ * @summary Delete the authenticated tenant (wipe + tombstone)
9375
+ * @request POST:/api/v1/delete-tenant
9376
+ * @secure
9377
+ */
9378
+ deleteMyTenant = (params = {}) => this.http.request({
9379
+ path: `/api/v1/delete-tenant`,
9380
+ method: "POST",
9381
+ secure: true,
9382
+ format: "json",
9383
+ ...params
9384
+ });
9385
+ /**
9386
+ * @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.
9387
+ *
9388
+ * @tags admin
9389
+ * @name DeleteTenant
9390
+ * @summary Delete a tenant (wipe + tombstone)
9391
+ * @request DELETE:/api/v1/admin/tenants/{tenant_id}
9392
+ */
9393
+ deleteTenant = (tenantId, params = {}) => this.http.request({
9394
+ path: `/api/v1/admin/tenants/${tenantId}`,
9395
+ method: "DELETE",
9396
+ format: "json",
9397
+ ...params
9398
+ });
9399
+ /**
9400
+ * @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.
9041
9401
  *
9042
9402
  * @tags admin
9043
9403
  * @name ListTenants
9044
- * @summary List all tenants with data
9404
+ * @summary List all live tenants
9045
9405
  * @request GET:/api/v1/admin/tenants
9046
9406
  */
9047
9407
  listTenants = (params = {}) => this.http.request({
@@ -9064,6 +9424,56 @@ var Admin = class {
9064
9424
  format: "json",
9065
9425
  ...params
9066
9426
  });
9427
+ /**
9428
+ * @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.
9429
+ *
9430
+ * @tags admin
9431
+ * @name RegisterBasePack
9432
+ * @summary Register (or refresh) an industry BASE pack — the shared layer every tenant delta of that industry overlays (coupling plan WS7).
9433
+ * @request PUT:/api/v1/admin/packs/base
9434
+ */
9435
+ registerBasePack = (data, params = {}) => this.http.request({
9436
+ path: `/api/v1/admin/packs/base`,
9437
+ method: "PUT",
9438
+ body: data,
9439
+ type: "text/plain",
9440
+ format: "json",
9441
+ ...params
9442
+ });
9443
+ /**
9444
+ * @description Sets the caller's own tenant display label. `name: null` clears it. The label is metadata only — never unique, never a lookup key.
9445
+ *
9446
+ * @tags admin
9447
+ * @name RenameMyTenant
9448
+ * @summary Set, change, or clear the authenticated tenant's label
9449
+ * @request PATCH:/api/v1/tenants/me
9450
+ * @secure
9451
+ */
9452
+ renameMyTenant = (data, params = {}) => this.http.request({
9453
+ path: `/api/v1/tenants/me`,
9454
+ method: "PATCH",
9455
+ body: data,
9456
+ secure: true,
9457
+ type: "application/json",
9458
+ format: "json",
9459
+ ...params
9460
+ });
9461
+ /**
9462
+ * @description Sets the tenant's display label. `name: null` clears it. The label is metadata only — never unique, never a lookup key.
9463
+ *
9464
+ * @tags admin
9465
+ * @name RenameTenant
9466
+ * @summary Set, change, or clear a tenant's label
9467
+ * @request PATCH:/api/v1/admin/tenants/{tenant_id}
9468
+ */
9469
+ renameTenant = (tenantId, data, params = {}) => this.http.request({
9470
+ path: `/api/v1/admin/tenants/${tenantId}`,
9471
+ method: "PATCH",
9472
+ body: data,
9473
+ type: "application/json",
9474
+ format: "json",
9475
+ ...params
9476
+ });
9067
9477
  /**
9068
9478
  * @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.
9069
9479
  *
@@ -9112,6 +9522,76 @@ var Ontology = class {
9112
9522
  constructor(http) {
9113
9523
  this.http = http;
9114
9524
  }
9525
+ /**
9526
+ * @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.
9527
+ *
9528
+ * @tags ontology
9529
+ * @name CheckOwl2
9530
+ * @summary Run the OWL 2 validators over the tenant's live ontology.
9531
+ * @request POST:/api/v1/ontology/checks/owl2
9532
+ * @secure
9533
+ */
9534
+ checkOwl2 = (data, params = {}) => this.http.request({
9535
+ path: `/api/v1/ontology/checks/owl2`,
9536
+ method: "POST",
9537
+ body: data,
9538
+ secure: true,
9539
+ type: "application/json",
9540
+ format: "json",
9541
+ ...params
9542
+ });
9543
+ /**
9544
+ * No description
9545
+ *
9546
+ * @tags ontology
9547
+ * @name CreateCompetencyQuestion
9548
+ * @summary Record a competency question.
9549
+ * @request POST:/api/v1/ontology/competency-questions
9550
+ * @secure
9551
+ */
9552
+ createCompetencyQuestion = (data, params = {}) => this.http.request({
9553
+ path: `/api/v1/ontology/competency-questions`,
9554
+ method: "POST",
9555
+ body: data,
9556
+ secure: true,
9557
+ type: "application/json",
9558
+ format: "json",
9559
+ ...params
9560
+ });
9561
+ /**
9562
+ * No description
9563
+ *
9564
+ * @tags ontology
9565
+ * @name EnrichOntology
9566
+ * @summary Propose external-ontology links. Writes nothing.
9567
+ * @request POST:/api/v1/ontology/enrich
9568
+ * @secure
9569
+ */
9570
+ enrichOntology = (data, params = {}) => this.http.request({
9571
+ path: `/api/v1/ontology/enrich`,
9572
+ method: "POST",
9573
+ body: data,
9574
+ secure: true,
9575
+ type: "application/json",
9576
+ format: "json",
9577
+ ...params
9578
+ });
9579
+ /**
9580
+ * No description
9581
+ *
9582
+ * @tags ontology
9583
+ * @name EvaluateCompetencyQuestions
9584
+ * @summary Run the accepted questions against the base.
9585
+ * @request POST:/api/v1/ontology/competency-questions/evaluate
9586
+ * @secure
9587
+ */
9588
+ evaluateCompetencyQuestions = (params = {}) => this.http.request({
9589
+ path: `/api/v1/ontology/competency-questions/evaluate`,
9590
+ method: "POST",
9591
+ secure: true,
9592
+ format: "json",
9593
+ ...params
9594
+ });
9115
9595
  /**
9116
9596
  * @description # Errors - 503 if no LLM is configured - 422 if the LLM returns invalid JSON after retries - 502 if the LLM service fails
9117
9597
  *
@@ -9130,6 +9610,72 @@ var Ontology = class {
9130
9610
  format: "json",
9131
9611
  ...params
9132
9612
  });
9613
+ /**
9614
+ * No description
9615
+ *
9616
+ * @tags ontology
9617
+ * @name ListCompetencyQuestions
9618
+ * @summary Every competency question the tenant holds.
9619
+ * @request GET:/api/v1/ontology/competency-questions
9620
+ * @secure
9621
+ */
9622
+ listCompetencyQuestions = (params = {}) => this.http.request({
9623
+ path: `/api/v1/ontology/competency-questions`,
9624
+ method: "GET",
9625
+ secure: true,
9626
+ format: "json",
9627
+ ...params
9628
+ });
9629
+ /**
9630
+ * @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.
9631
+ *
9632
+ * @tags ontology
9633
+ * @name OntologyPipelineStatus
9634
+ * @summary Per-stage completeness of the ontology pipeline, measured from the base
9635
+ * @request GET:/api/v1/ontology/pipeline/status
9636
+ * @secure
9637
+ */
9638
+ ontologyPipelineStatus = (params = {}) => this.http.request({
9639
+ path: `/api/v1/ontology/pipeline/status`,
9640
+ method: "GET",
9641
+ secure: true,
9642
+ format: "json",
9643
+ ...params
9644
+ });
9645
+ /**
9646
+ * No description
9647
+ *
9648
+ * @tags ontology
9649
+ * @name OntologyQualityReport
9650
+ * @summary Judge the tenant's ontology.
9651
+ * @request GET:/api/v1/ontology/quality-report
9652
+ * @secure
9653
+ */
9654
+ ontologyQualityReport = (params = {}) => this.http.request({
9655
+ path: `/api/v1/ontology/quality-report`,
9656
+ method: "GET",
9657
+ secure: true,
9658
+ format: "json",
9659
+ ...params
9660
+ });
9661
+ /**
9662
+ * No description
9663
+ *
9664
+ * @tags ontology
9665
+ * @name SetCompetencyQuestionStatus
9666
+ * @summary Accept or reject a question.
9667
+ * @request PATCH:/api/v1/ontology/competency-questions/{key}
9668
+ * @secure
9669
+ */
9670
+ setCompetencyQuestionStatus = (key, data, params = {}) => this.http.request({
9671
+ path: `/api/v1/ontology/competency-questions/${key}`,
9672
+ method: "PATCH",
9673
+ body: data,
9674
+ secure: true,
9675
+ type: "application/json",
9676
+ format: "json",
9677
+ ...params
9678
+ });
9133
9679
  };
9134
9680
 
9135
9681
  // src/api-spec/generated/Generation.ts
@@ -9580,6 +10126,22 @@ var Compliance = class {
9580
10126
  format: "json",
9581
10127
  ...params
9582
10128
  });
10129
+ /**
10130
+ * No description
10131
+ *
10132
+ * @tags compliance
10133
+ * @name GetEuAiActConformity
10134
+ * @summary `GET /api/v1/compliance/conformity`
10135
+ * @request GET:/api/v1/compliance/conformity
10136
+ * @secure
10137
+ */
10138
+ getEuAiActConformity = (params = {}) => this.http.request({
10139
+ path: `/api/v1/compliance/conformity`,
10140
+ method: "GET",
10141
+ secure: true,
10142
+ format: "json",
10143
+ ...params
10144
+ });
9583
10145
  /**
9584
10146
  * No description
9585
10147
  *
@@ -12174,7 +12736,13 @@ function FeatureDescriptorDtoFromApiToFront(dto) {
12174
12736
  name: dto.name,
12175
12737
  expectedSort: dto.expected_sort ?? void 0,
12176
12738
  expectedTypeHint: dto.expected_type_hint ?? void 0,
12177
- required: dto.required,
12739
+ // The spec made this optional and documents the default explicitly:
12740
+ // "Defaults to `false` when absent." A relation is an appropriateness
12741
+ // declaration — it says what the value's sort must be, not that the
12742
+ // feature must be present — so the minimal relational descriptor omits it.
12743
+ // Kept non-optional on the SDK surface so a consumer never handles
12744
+ // `undefined` for a question the wire already answers.
12745
+ required: dto.required ?? false,
12178
12746
  constraint: dto.constraint ? ConstraintDtoFromApiToFront(dto.constraint) : void 0
12179
12747
  };
12180
12748
  }
@@ -12300,6 +12868,8 @@ function BulkCreateSortsRequestFromFrontToApi(model) {
12300
12868
  function BulkSortErrorFromApiToFront(dto) {
12301
12869
  return {
12302
12870
  name: dto.name,
12871
+ kind: dto.kind,
12872
+ sortCreated: dto.sort_created,
12303
12873
  error: dto.error
12304
12874
  };
12305
12875
  }
@@ -13769,6 +14339,35 @@ function GetRulesResponseFromApiToFront(dto) {
13769
14339
  rules: dto.rules.map(RuleEntryDtoFromApiToFront)
13770
14340
  };
13771
14341
  }
14342
+ function RuleWithdrawalReportFromApiToFront(dto) {
14343
+ return {
14344
+ ruleId: dto.rule_id,
14345
+ termsDeleted: dto.terms_deleted,
14346
+ termsRetainedShared: dto.terms_retained_shared,
14347
+ derivationsRemoved: dto.derivations_removed,
14348
+ derivationsWeakened: dto.derivations_weakened,
14349
+ derivationsTruncated: dto.derivations_truncated,
14350
+ consequencesInvalidated: dto.consequences_invalidated,
14351
+ queuedEventsCancelled: dto.queued_events_cancelled
14352
+ };
14353
+ }
14354
+ function RuleCertificationDeltaFromApiToFront(dto) {
14355
+ return {
14356
+ terminatedBefore: dto.terminated_before,
14357
+ terminatesAfter: dto.terminates_after,
14358
+ orderIndependentBefore: dto.order_independent_before,
14359
+ orderIndependentAfter: dto.order_independent_after,
14360
+ regressed: dto.regressed
14361
+ };
14362
+ }
14363
+ function ReplaceRuleResponseFromApiToFront(dto) {
14364
+ return {
14365
+ previousRuleId: dto.previous_rule_id,
14366
+ term: PsiTermDtoFromApiToFront(dto.term),
14367
+ withdrawal: RuleWithdrawalReportFromApiToFront(dto.withdrawal),
14368
+ certification: RuleCertificationDeltaFromApiToFront(dto.certification)
14369
+ };
14370
+ }
13772
14371
  function MetaSortsResponseFromApiToFront(dto) {
13773
14372
  return {
13774
14373
  absConstraint: dto.abs_constraint,
@@ -14256,6 +14855,89 @@ var InferenceClient = class {
14256
14855
  const response = await this.api.getRules(this.tenantId);
14257
14856
  return GetRulesResponseFromApiToFront(response.data);
14258
14857
  }
14858
+ /**
14859
+ * Withdraw one rule from the knowledge base.
14860
+ *
14861
+ * @param ruleId - Term id of the rule (its conclusion), as returned by
14862
+ * {@link InferenceClient.addRule} or {@link InferenceClient.getRules}.
14863
+ * @param options - `derivations` decides what happens to the conclusions the
14864
+ * rule derived. Defaults to `'refuse'`.
14865
+ * @returns What the withdrawal removed, tier by tier.
14866
+ * @throws {ApiError} 400 if the id names a fact rather than a rule, or if the
14867
+ * rule still supports derivations under the default `'refuse'`; 403 for a
14868
+ * system, plugin-owned or bootstrap rule; 404 if no such rule exists.
14869
+ *
14870
+ * @remarks
14871
+ * A rule is not a row. Withdrawing one deletes its conclusion AND the
14872
+ * antecedent pattern, guard and variable terms it exclusively owns — a
14873
+ * conclusion-only delete would leave those patterns readable as ordinary
14874
+ * facts — while keeping every term the rest of the knowledge base still
14875
+ * holds.
14876
+ *
14877
+ * `'refuse'` (the default) refuses while the rule still proves materialized
14878
+ * conclusions and says how many; `'retract'` withdraws them with it. A delete
14879
+ * that silently drops derivations is as wrong as one that silently keeps
14880
+ * them, so neither is the unnamed default.
14881
+ *
14882
+ * @example
14883
+ * ```typescript
14884
+ * const report = await client.inference.deleteRule(ruleId, { derivations: 'retract' });
14885
+ * console.log(report.termsDeleted, report.derivationsRemoved);
14886
+ * ```
14887
+ */
14888
+ async deleteRule(ruleId, options) {
14889
+ const response = await this.api.deleteRule(
14890
+ ruleId,
14891
+ options?.derivations === void 0 ? void 0 : { derivations: options.derivations }
14892
+ );
14893
+ return RuleWithdrawalReportFromApiToFront(response.data);
14894
+ }
14895
+ /**
14896
+ * Replace one rule with a new one.
14897
+ *
14898
+ * @param ruleId - Term id of the rule (its conclusion) to replace.
14899
+ * @param request - The replacement rule, in the same shape
14900
+ * {@link InferenceClient.addRule} takes.
14901
+ * @returns The replacement, the id it replaced, what the withdrawal removed,
14902
+ * and how the rule base's guarantees moved.
14903
+ * @throws {ApiError} 422 if the replacement is rejected by the authoring
14904
+ * guards — in which case the original rule is left live; 400/403/404 as for
14905
+ * {@link InferenceClient.deleteRule}.
14906
+ *
14907
+ * @remarks
14908
+ * A rule's id IS its conclusion term id, so an edit changes it by
14909
+ * construction. The response carries `previousRuleId` alongside the new
14910
+ * rule; a client holding the old id must adopt the new one.
14911
+ *
14912
+ * The path names ONE rule term — one disjunct. Two rules with the same
14913
+ * conclusion are OR-unioned, so "edit the rule for X" is ambiguous and this
14914
+ * addresses a single clause.
14915
+ *
14916
+ * @example
14917
+ * ```typescript
14918
+ * const result = await client.inference.replaceRule(ruleId, {
14919
+ * term: psi('retiree', { name: Var('N') }),
14920
+ * antecedents: [psi('person', { name: Var('N') })],
14921
+ * });
14922
+ * console.log(result.previousRuleId, '->', result.term.termId);
14923
+ * if (result.certification.regressed) {
14924
+ * console.warn('the edit weakened the rule base guarantees');
14925
+ * }
14926
+ * ```
14927
+ */
14928
+ async replaceRule(ruleId, request) {
14929
+ const wireRequest = {
14930
+ term: convertTermArg(request.term),
14931
+ antecedents: request.antecedents?.map(convertTermArg),
14932
+ certainty: request.certainty,
14933
+ aggregator: request.aggregator
14934
+ };
14935
+ const response = await this.api.replaceRule(
14936
+ ruleId,
14937
+ AddRuleRequestFromFrontToApi(wireRequest)
14938
+ );
14939
+ return ReplaceRuleResponseFromApiToFront(response.data);
14940
+ }
14259
14941
  /**
14260
14942
  * Query for matching data by searching rules and facts backwards from a goal pattern.
14261
14943
  *
@@ -17363,6 +18045,17 @@ function TrailEntryDtoFromApiToFront(dto) {
17363
18045
  prevLower: dto.prev_lower,
17364
18046
  prevUpper: dto.prev_upper
17365
18047
  };
18048
+ case "term_creation":
18049
+ return {
18050
+ type: "term_creation",
18051
+ termId: dto.term_id
18052
+ };
18053
+ case "term_removal":
18054
+ return {
18055
+ type: "term_removal",
18056
+ termId: dto.term_id,
18057
+ sortId: dto.sort_id
18058
+ };
17366
18059
  }
17367
18060
  }
17368
18061
  function ResiduationGoalDtoFromFrontToApi(model) {
@@ -22740,6 +23433,8 @@ function DiscoveredSortDtoFromApiToFront(dto) {
22740
23433
  description: dto.description,
22741
23434
  features: dto.features.map(DiscoveredFeatureDtoFromApiToFront),
22742
23435
  name: dto.name,
23436
+ sourceTypeKey: dto.source_type_key,
23437
+ sortName: dto.sort_name,
22743
23438
  sourceName: dto.source_name,
22744
23439
  suggestedParents: dto.suggested_parents
22745
23440
  };
@@ -27043,6 +27738,7 @@ function ClearTenantResponseFromApiToFront(dto) {
27043
27738
  function TenantInfoFromApiToFront(dto) {
27044
27739
  return {
27045
27740
  tenantId: dto.tenant_id,
27741
+ name: dto.name,
27046
27742
  termCount: dto.term_count,
27047
27743
  sessionCount: dto.session_count
27048
27744
  };
@@ -27054,6 +27750,7 @@ function ListTenantsResponseFromApiToFront(dto) {
27054
27750
  }
27055
27751
  function CreateTenantRequestFromFrontToApi(model) {
27056
27752
  return {
27753
+ name: model.name,
27057
27754
  owner_user_id: model.ownerUserId,
27058
27755
  seed_sorts: model.seedSorts,
27059
27756
  tenant_id: model.tenantId
@@ -27063,7 +27760,25 @@ function CreateTenantResponseFromApiToFront(dto) {
27063
27760
  return {
27064
27761
  created: dto.created,
27065
27762
  seededSorts: dto.seeded_sorts,
27066
- tenantId: dto.tenant_id
27763
+ tenantId: dto.tenant_id,
27764
+ name: dto.name
27765
+ };
27766
+ }
27767
+ function DeleteTenantResponseFromApiToFront(dto) {
27768
+ return {
27769
+ ...ClearTenantResponseFromApiToFront(dto),
27770
+ deletedAt: dto.deleted_at
27771
+ };
27772
+ }
27773
+ function UpdateTenantNameRequestFromFrontToApi(model) {
27774
+ return {
27775
+ name: model.name
27776
+ };
27777
+ }
27778
+ function UpdateTenantNameResponseFromApiToFront(dto) {
27779
+ return {
27780
+ tenantId: dto.tenant_id,
27781
+ name: dto.name
27067
27782
  };
27068
27783
  }
27069
27784
 
@@ -27214,6 +27929,128 @@ var AdminClient = class {
27214
27929
  const response = await this.api.createTenant(CreateTenantRequestFromFrontToApi(request));
27215
27930
  return CreateTenantResponseFromApiToFront(response.data);
27216
27931
  }
27932
+ /**
27933
+ * Delete a tenant (platform-admin).
27934
+ *
27935
+ * @param tenantId - The UUID of the tenant to delete.
27936
+ * @returns The wipe report plus the tombstone outcome.
27937
+ * @throws {ApiError} `404` when no registry row exists for the UUID; `410`
27938
+ * when the tenant was already deleted; `403` without the `platform_admin`
27939
+ * role; `500` when the data reset failed (a partial wipe may have occurred).
27940
+ *
27941
+ * @remarks
27942
+ * **DESTRUCTIVE AND IRREVERSIBLE. There is no un-delete.**
27943
+ *
27944
+ * Clears every trace of the tenant's data (identical to the clear-tenant
27945
+ * wipe), then tombstones its registry row. The tenant stops existing:
27946
+ * every later request naming its UUID is refused with `410`, it disappears
27947
+ * from `listTenants`, and `createTenant` on the same UUID refuses with `409`
27948
+ * rather than resurrecting it. A fresh UUID is the workaround.
27949
+ *
27950
+ * This is not {@link clearTenantData}: a clear wipes the tenant's data but
27951
+ * the tenant continues to exist — its id stays valid, it can be re-populated,
27952
+ * and it is still listed with zeroed counts. A delete retires the id.
27953
+ *
27954
+ * @example
27955
+ * ```typescript
27956
+ * const result = await client.admin.deleteTenant('550e8400-e29b-41d4-a716-446655440000');
27957
+ * console.log(result.message);
27958
+ * console.log(`Deleted at: ${result.deletedAt}`);
27959
+ * ```
27960
+ */
27961
+ async deleteTenant(tenantId) {
27962
+ const response = await this.api.deleteTenant(tenantId);
27963
+ return DeleteTenantResponseFromApiToFront(response.data);
27964
+ }
27965
+ /**
27966
+ * Delete the authenticated tenant (self-service).
27967
+ *
27968
+ * @returns The wipe report plus the tombstone outcome.
27969
+ * @throws {ApiError} `404` when the caller's tenant was never materialized;
27970
+ * `410` when it was already deleted; `500` when the data reset failed
27971
+ * (a partial wipe may have occurred).
27972
+ *
27973
+ * @remarks
27974
+ * **DESTRUCTIVE AND IRREVERSIBLE. There is no un-delete.**
27975
+ *
27976
+ * The self-service mirror of {@link deleteTenant}: the target tenant is
27977
+ * resolved server-side from the caller's own `X-Tenant-Id` header, never
27978
+ * from a path or body parameter, so it always deletes the authenticated
27979
+ * principal's own tenant. No `platform_admin` role is required. Afterwards
27980
+ * the tenant's UUID is refused with `410` everywhere and cannot be
27981
+ * recreated — the caller must switch to a different tenant id.
27982
+ *
27983
+ * This is not {@link clearMyTenantData}: a clear wipes the caller's data but
27984
+ * the tenant continues to exist. A delete retires the id permanently.
27985
+ *
27986
+ * @example
27987
+ * ```typescript
27988
+ * // Deletes the calling tenant's own identity — no tenant ID is passed.
27989
+ * const result = await client.admin.deleteMyTenant();
27990
+ * console.log(`Tenant retired at: ${result.deletedAt}`);
27991
+ * ```
27992
+ */
27993
+ async deleteMyTenant() {
27994
+ const response = await this.api.deleteMyTenant();
27995
+ return DeleteTenantResponseFromApiToFront(response.data);
27996
+ }
27997
+ /**
27998
+ * Set, change, or clear a tenant's label (platform-admin).
27999
+ *
28000
+ * @param tenantId - The UUID of the tenant to rename.
28001
+ * @param request - The new label. `name: null` (or an empty request) clears it.
28002
+ * @returns The tenant id and the label now stored.
28003
+ * @throws {ApiError} `404` when no registry row exists for the UUID; `410`
28004
+ * when the tenant is deleted (its label is frozen); `422` when the name is
28005
+ * empty after trim or over 200 characters; `403` without the
28006
+ * `platform_admin` role.
28007
+ *
28008
+ * @remarks
28009
+ * The label is display metadata only: not unique, not a lookup key, never
28010
+ * parsed. The UUID remains the tenant's only identity. The stored label
28011
+ * survives a clear and leaves with a delete.
28012
+ *
28013
+ * @example
28014
+ * ```typescript
28015
+ * const result = await client.admin.renameTenant('550e8400-…', { name: 'Research' });
28016
+ * console.log(result.name); // the stored, trimmed label
28017
+ * ```
28018
+ */
28019
+ async renameTenant(tenantId, request) {
28020
+ const response = await this.api.renameTenant(
28021
+ tenantId,
28022
+ UpdateTenantNameRequestFromFrontToApi(request)
28023
+ );
28024
+ return UpdateTenantNameResponseFromApiToFront(response.data);
28025
+ }
28026
+ /**
28027
+ * Set, change, or clear the authenticated tenant's label (self-service).
28028
+ *
28029
+ * @param request - The new label. `name: null` (or an empty request) clears it.
28030
+ * @returns The tenant id and the label now stored.
28031
+ * @throws {ApiError} `404` when the caller's tenant was never materialized;
28032
+ * `410` when it is deleted; `422` when the name is empty after trim or
28033
+ * over 200 characters.
28034
+ *
28035
+ * @remarks
28036
+ * The self-service mirror of {@link renameTenant}: the target tenant is
28037
+ * resolved server-side from the caller's own `X-Tenant-Id` header, so it
28038
+ * always renames the authenticated principal's own tenant. No
28039
+ * `platform_admin` role is required.
28040
+ *
28041
+ * @example
28042
+ * ```typescript
28043
+ * // Renames the calling tenant — no tenant ID is passed.
28044
+ * const result = await client.admin.renameMyTenant({ name: 'My workspace' });
28045
+ * console.log(result.name);
28046
+ * ```
28047
+ */
28048
+ async renameMyTenant(request) {
28049
+ const response = await this.api.renameMyTenant(
28050
+ UpdateTenantNameRequestFromFrontToApi(request)
28051
+ );
28052
+ return UpdateTenantNameResponseFromApiToFront(response.data);
28053
+ }
27217
28054
  };
27218
28055
 
27219
28056
  // src/normalizers/image-extraction.ts
@@ -28629,6 +29466,10 @@ function OsfqlValueFromApiToFront(value) {
28629
29466
  switch (value["type"]) {
28630
29467
  case "null":
28631
29468
  return { type: "null" };
29469
+ // The record does not carry the feature. No payload, and no `undefined`
29470
+ // either: dropping the key would hide the absence the answer is about.
29471
+ case "unbound":
29472
+ return { type: "unbound" };
28632
29473
  case "integer":
28633
29474
  return typeof payload === "number" ? { type: "integer", value: payload } : void 0;
28634
29475
  case "float":
@@ -28756,6 +29597,36 @@ function OsfqlDiagnoseResponseFromApiToFront(dto) {
28756
29597
  diagnostics: dto.diagnostics.map(OsfqlDiagnosticFromApiToFront)
28757
29598
  };
28758
29599
  }
29600
+ function OsfqlCatalogEntryFromApiToFront(dto) {
29601
+ return {
29602
+ id: dto.id,
29603
+ statement: dto.statement,
29604
+ family: dto.family,
29605
+ category: dto.category,
29606
+ subOps: dto.sub_ops,
29607
+ brief: dto.brief,
29608
+ full: dto.full,
29609
+ syntax: dto.syntax,
29610
+ examples: dto.examples,
29611
+ risk: dto.risk,
29612
+ execution: OsfqlCatalogExecutionFromApiToFront(dto.execution),
29613
+ uiAffinity: {
29614
+ display: dto.ui_affinity.display ?? void 0,
29615
+ action: dto.ui_affinity.action ?? void 0
29616
+ },
29617
+ returns: dto.returns,
29618
+ // Absent means "needs nothing", which is false for nearly every statement —
29619
+ // so an absent array is a wire-shape surprise, not a default. `?? []` keeps
29620
+ // the shipped type total; the engine sends the field for all entries.
29621
+ needs: dto.needs ?? [],
29622
+ pitfalls: dto.pitfalls ?? []
29623
+ };
29624
+ }
29625
+ function OsfqlCatalogExecutionFromApiToFront(dto) {
29626
+ if (dto === "Executes") return { status: "executes" };
29627
+ if (dto === "PlanOnly") return { status: "planOnly" };
29628
+ return { status: "partial", note: dto.Partial };
29629
+ }
28759
29630
 
28760
29631
  // src/resources/osfql.ts
28761
29632
  var OsfqlClient = class {
@@ -28868,24 +29739,34 @@ var OsfqlClient = class {
28868
29739
  return OsfqlDiagnoseResponseFromApiToFront(response.data);
28869
29740
  }
28870
29741
  /**
28871
- * Fetch the OSFQL statement catalog, optionally filtered by category.
29742
+ * Fetch the OSFQL statement catalog the engine's own description of every
29743
+ * statement it implements.
28872
29744
  *
28873
- * @param category - Optional category filter: `read`, `write`, `control`, or `meta`.
28874
- * @returns The raw catalog payload, typed as `unknown`.
29745
+ * @param category - Optional filter: `read`, `write`, `control`, or `meta`
29746
+ * (case-insensitive). Omit for the whole catalog; an unrecognised value
29747
+ * yields an empty list rather than an error.
29748
+ * @returns One {@link OsfqlCatalogEntry} per statement.
28875
29749
  * @throws {ApiError} If the request fails.
28876
29750
  *
28877
29751
  * @remarks
28878
- * This is a DEBUG/introspection endpoint. The backend publishes **no response schema** for
28879
- * it in the OpenAPI document, and its payload deliberately mixes casing (`risk` is
28880
- * snake_case while the sibling `family` / `category` enums are PascalCase). The SDK
28881
- * therefore returns the parsed JSON body as `unknown` rather than inventing a shipped type
28882
- * that the spec does not guarantee narrow it at the call site.
29752
+ * The backend publishes a response schema for this endpoint, so the payload
29753
+ * is normalized like any other. It previously returned `unknown` because the
29754
+ * spec carried none and because the endpoint answered HTTP 500 to every
29755
+ * request until `kortexya/reasoninglayer#176` repaired its response DTO, so
29756
+ * no caller had ever received a body to type.
29757
+ *
29758
+ * ⚠️ The enum VALUES mix casing deliberately and are preserved verbatim:
29759
+ * `risk` is snake_case (`additive_write`), while `family`, `category`,
29760
+ * `returns` and both halves of `uiAffinity` are PascalCase (`Query`, `Read`,
29761
+ * `Bindings`, `Table`). Only keys are camelCased.
28883
29762
  *
28884
29763
  * @example
28885
29764
  * ```typescript
28886
- * const catalog: unknown = await client.osfql.catalog('write');
28887
- * if (Array.isArray(catalog)) {
28888
- * console.log(catalog.length);
29765
+ * const catalog = await client.osfql.catalog('write');
29766
+ * for (const entry of catalog) {
29767
+ * if (entry.execution.status === 'partial') {
29768
+ * console.warn(`${entry.id} is partial: ${entry.execution.note}`);
29769
+ * }
28889
29770
  * }
28890
29771
  * ```
28891
29772
  */
@@ -28897,7 +29778,7 @@ var OsfqlClient = class {
28897
29778
  secure: true,
28898
29779
  format: "json"
28899
29780
  });
28900
- return response.data;
29781
+ return response.data.map(OsfqlCatalogEntryFromApiToFront);
28901
29782
  }
28902
29783
  };
28903
29784
 
@@ -28946,7 +29827,22 @@ function SchemaExcerptDtoFromApiToFront(dto) {
28946
29827
  featureNames: dto.feature_names
28947
29828
  };
28948
29829
  }
29830
+ function CitationCheckDtoFromApiToFront(dto) {
29831
+ return {
29832
+ marker: dto.marker,
29833
+ variable: dto.variable ?? void 0,
29834
+ assertedValue: dto.asserted_value ?? void 0,
29835
+ verdict: dto.verdict,
29836
+ repair: dto.repair ?? void 0,
29837
+ repairVariables: dto.repair_variables,
29838
+ observedValues: dto.observed_values,
29839
+ observedTotal: dto.observed_total,
29840
+ scope: dto.scope,
29841
+ scopeLabel: dto.scope_label ?? void 0
29842
+ };
29843
+ }
28949
29844
  function ClaimAnnotationDtoFromApiToFront(dto) {
29845
+ const wire = dto;
28950
29846
  return {
28951
29847
  text: dto.text,
28952
29848
  span: dto.span,
@@ -28956,7 +29852,8 @@ function ClaimAnnotationDtoFromApiToFront(dto) {
28956
29852
  sourceExcerpts: dto.source_excerpts?.map(SourceExcerptDtoFromApiToFront),
28957
29853
  schemaExcerpts: dto.schema_excerpts?.map(SchemaExcerptDtoFromApiToFront),
28958
29854
  osfqlQuery: dto.osfql_query ?? void 0,
28959
- derivationSummary: dto.derivation_summary ? DerivationSummaryDtoFromApiToFront(dto.derivation_summary) : void 0
29855
+ derivationSummary: dto.derivation_summary ? DerivationSummaryDtoFromApiToFront(dto.derivation_summary) : void 0,
29856
+ citationChecks: wire.citation_checks?.map(CitationCheckDtoFromApiToFront)
28960
29857
  };
28961
29858
  }
28962
29859
  function ProofTraceNodeDtoFromApiToFront(dto) {