@kortexya/reasoninglayer 1.23.0 → 1.25.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.d.ts CHANGED
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
109
109
  * This is the single source of truth for the version constant.
110
110
  * The `scripts/release.sh` script updates this value alongside `package.json`.
111
111
  */
112
- declare const SDK_VERSION = "1.23.0";
112
+ declare const SDK_VERSION = "1.25.0";
113
113
  /**
114
114
  * Authentication mode for the SDK.
115
115
  *
@@ -764,11 +764,12 @@ interface AddRuleRequest$1 {
764
764
  */
765
765
  antecedents?: TermInputDto$1[];
766
766
  /**
767
- * Certainty factor (default: 1.0)
767
+ * Certainty factor. `None` (absent) is a crisp rule — degree 1.0; an
768
+ * explicit `0.0` is the t-norm annihilator, a rule that can never
769
+ * contribute a proof. The two are distinct on the wire (#217).
768
770
  * @format double
769
- * @default 1
770
771
  */
771
- certainty?: number;
772
+ certainty?: number | null;
772
773
  /** The conclusion term (head of the rule) */
773
774
  term: TermInputDto$1;
774
775
  }
@@ -2645,7 +2646,7 @@ interface BindingSummaryDto$1 {
2645
2646
  * uniqueness constraint backs it or an operator ticked it, and those two
2646
2647
  * have opposite durability.
2647
2648
  */
2648
- key_provenance: KeyProvenanceDto;
2649
+ key_provenance: KeyProvenanceDto$1;
2649
2650
  /** Sort ID (UUID string). */
2650
2651
  sort_id: string;
2651
2652
  /**
@@ -8052,7 +8053,7 @@ interface DiscoveredFeatureDto$1 {
8052
8053
  * rebuild of the source: a uniqueness constraint does, a graph's internal
8053
8054
  * record id does not.
8054
8055
  */
8055
- identifier_provenance?: null | KeyProvenanceDto;
8056
+ identifier_provenance?: null | KeyProvenanceDto$1;
8056
8057
  /** Whether the field is a primary key/identifier */
8057
8058
  is_identifier: boolean;
8058
8059
  /** Whether the field is a relation */
@@ -11354,6 +11355,8 @@ type FeatureInputValueDto$1 = {
11354
11355
  } | {
11355
11356
  /** @format uuid */
11356
11357
  sort_ref: string;
11358
+ } | {
11359
+ type: string;
11357
11360
  } | {
11358
11361
  name: string;
11359
11362
  } | {
@@ -11414,7 +11417,23 @@ type FeatureTypeDto$1 = "string" | "integer" | "real" | "boolean" | "reference"
11414
11417
  * - null
11415
11418
  * - array of FeatureValueDto
11416
11419
  */
11417
- type FeatureValueDto$1 = string | number | boolean | null | FeatureValueDto$1[];
11420
+ type FeatureValueDto$1 = {
11421
+ term_id: string;
11422
+ var_name: string;
11423
+ } | {
11424
+ /**
11425
+ * Feature value in a Ψ-term (untagged union). Can be:
11426
+ * - UUID string (term reference)
11427
+ * - string value
11428
+ * - integer (i64)
11429
+ * - number (f64)
11430
+ * - boolean
11431
+ * - null
11432
+ * - array of FeatureValueDto
11433
+ */
11434
+ literal: FeatureValueDto$1;
11435
+ term_id: string;
11436
+ } | string | number | boolean | null | FeatureValueDto$1[];
11418
11437
  /** Request to finalize a live oversight session. */
11419
11438
  interface FinalizeSessionRequest {
11420
11439
  /** Optional execution log (for full provenance) */
@@ -11852,7 +11871,11 @@ interface ForwardChainRequest$1 {
11852
11871
  * Default: false (standard symbolic-only forward chaining)
11853
11872
  */
11854
11873
  enable_provenance_tags?: boolean;
11855
- /** Initial facts (optional - uses existing facts if not provided) */
11874
+ /**
11875
+ * Initial facts (optional). The run's fact universe is the union of the
11876
+ * tenant's (gateway-visible) existing facts and these seeds, so a seed
11877
+ * AUGMENTS the base — it never replaces it (#218).
11878
+ */
11856
11879
  initial_facts?: TermInputDto$1[];
11857
11880
  /**
11858
11881
  * Maximum facts to derive
@@ -12092,6 +12115,37 @@ type FunctionBodyDto$1 = {
12092
12115
  program: string;
12093
12116
  type: "Neural";
12094
12117
  };
12118
+ /** One thing that calls a function. */
12119
+ interface FunctionCallerDto {
12120
+ /** Where the reference lives. */
12121
+ kind: FunctionCallerKind$1;
12122
+ /**
12123
+ * The calling function's name, or the rule conclusion's display, so a
12124
+ * refusal names something the caller can find.
12125
+ */
12126
+ name: string;
12127
+ /**
12128
+ * Term id of the calling rule's conclusion, or of the `function_call`
12129
+ * goal term when no rule holds it. Absent for a function caller, which is
12130
+ * identified by name.
12131
+ * @format uuid
12132
+ */
12133
+ term_id?: string | null;
12134
+ }
12135
+ /** What names a function — where the reference lives. */
12136
+ type FunctionCallerKind$1 = "function" | "rule";
12137
+ /**
12138
+ * What `DELETE /api/v1/functions/{name}` does about the things that CALL the
12139
+ * function.
12140
+ *
12141
+ * A function is reachable by name from two places: another registered
12142
+ * function's clause body (`FunctionCall`), and a rule's `function_call` goal.
12143
+ * Removing it underneath either leaves the caller naming something that no
12144
+ * longer resolves, and the failure surfaces at evaluation time — which is
12145
+ * exactly what "no route at all, recover with a tenant wipe" already produced
12146
+ * and what this route exists to stop being the default.
12147
+ */
12148
+ type FunctionCallersDisposition$1 = "refuse" | "orphan";
12095
12149
  /** A single clause in a function definition */
12096
12150
  interface FunctionClauseDto$1 {
12097
12151
  /** Function body - what to compute */
@@ -12182,6 +12236,36 @@ type FunctionValueDto$1 = {
12182
12236
  } | {
12183
12237
  type: "Uninstantiated";
12184
12238
  };
12239
+ /**
12240
+ * What withdrawing a registered function removed.
12241
+ *
12242
+ * A function is carried twice — the durable `meta.function` carrier Ψ-term
12243
+ * that is the source of truth, and the evaluator's own registry used for
12244
+ * dispatch — so both are reported. Forgetting either leaves it half-alive.
12245
+ */
12246
+ interface FunctionWithdrawalReport$1 {
12247
+ /**
12248
+ * Everything that still names the function, left calling something that
12249
+ * no longer resolves. Empty on the ordinary withdrawal; non-empty only
12250
+ * under `?callers=orphan`, which is the disposition that permits it.
12251
+ */
12252
+ callers_orphaned?: FunctionCallerDto[];
12253
+ /**
12254
+ * Whether the durable `meta.function` carrier Ψ-term was deleted. `false`
12255
+ * means the function is gone from this process but its carrier survives,
12256
+ * so a restart would bring it back — the operator's cue to retry.
12257
+ */
12258
+ carrier_deleted: boolean;
12259
+ /** Whether it left the in-process registry and the evaluator. */
12260
+ deregistered: boolean;
12261
+ /**
12262
+ * Its stable id, as the registration reported it.
12263
+ * @format uuid
12264
+ */
12265
+ function_id: string;
12266
+ /** The function that was withdrawn. */
12267
+ name: string;
12268
+ }
12185
12269
  /**
12186
12270
  * Request: render the LIFE-function definitions in the tenant's
12187
12271
  * term store.
@@ -16224,7 +16308,7 @@ type KbChangeDto$1 = {
16224
16308
  * *do the term ids survive a rebuild of the source?* — are readable without
16225
16309
  * inferring anything from a column's name.
16226
16310
  */
16227
- interface KeyProvenanceDto {
16311
+ interface KeyProvenanceDto$1 {
16228
16312
  /**
16229
16313
  * Which side settled the key: `discovery`, `client`, `nobody` (a keyless
16230
16314
  * binding), or `unrecorded`.
@@ -19792,34 +19876,21 @@ interface Objective$1 {
19792
19876
  }
19793
19877
  /** Direction of the objective function. */
19794
19878
  type ObjectiveSense$1 = "minimize" | "maximize";
19795
- /** One observation on the wire. */
19879
+ /** One observed unit. */
19796
19880
  interface ObservationDto$1 {
19881
+ /** Binary treatment indicator (`true` = treated). */
19882
+ a: boolean;
19797
19883
  /**
19798
- * Sightings so far.
19799
- * @format int64
19800
- * @min 0
19801
- */
19802
- count: number;
19803
- /** Distinct source documents. */
19804
- documents: string[];
19805
- /**
19806
- * Unix seconds of the first sighting.
19884
+ * Discrete covariate stratum (integer code — bin a categorical or
19885
+ * coarsened-continuous confounder).
19807
19886
  * @format int64
19808
19887
  */
19809
- first_seen: number;
19888
+ x: number;
19810
19889
  /**
19811
- * Unix seconds of the latest sighting.
19812
- * @format int64
19890
+ * Observed outcome.
19891
+ * @format double
19813
19892
  */
19814
- last_seen: number;
19815
- /** The normalised identity observations aggregate under. */
19816
- normalized: string;
19817
- /** Who saw it (`ingestion`, `extraction_certificate`, `sentinel_near_miss`). */
19818
- producers: string[];
19819
- /** The proposed sort's id, once a generate pass minted one. */
19820
- proposed_sort_id?: string | null;
19821
- /** Representative surface form. */
19822
- surface: string;
19893
+ y: number;
19823
19894
  }
19824
19895
  /** Observational inputs for PN / PS */
19825
19896
  interface ObservationalProbabilitiesDto$1 {
@@ -19842,7 +19913,7 @@ interface ObservationalProbabilitiesDto$1 {
19842
19913
  /** Response of `GET /api/v1/sorts/proposals`. */
19843
19914
  interface ObservationsResponse {
19844
19915
  /** Observations, most recurrent first. */
19845
- observations: ObservationDto$1[];
19916
+ observations: SightingDto[];
19846
19917
  }
19847
19918
  interface ObserveMultiRequest$1 {
19848
19919
  /** Map of variable name to value */
@@ -23199,6 +23270,121 @@ interface RepairHintDto {
23199
23270
  /** The feature or predicate the hint applies to. */
23200
23271
  target: string;
23201
23272
  }
23273
+ /**
23274
+ * Request body of `PUT /api/v1/functions/{name}` — the definition that
23275
+ * replaces the one registered under the path name.
23276
+ *
23277
+ * # Why it accepts the register payload verbatim
23278
+ *
23279
+ * `POST /functions/register` takes `{tenant_id, name, arity, clauses}`, and
23280
+ * that is the payload a client already has in hand when it decides to replace
23281
+ * something. Sending it to `PUT` is the obvious move, and under
23282
+ * `deny_unknown_fields` it would answer `422 unknown field 'tenant_id'` —
23283
+ * technically correct and unhelpful, since the caller's actual question is
23284
+ * about the two `name`s (#234).
23285
+ *
23286
+ * So both are declared, and each is handled explicitly rather than dropped:
23287
+ *
23288
+ * * `tenant_id` is **accepted and ignored**, exactly as `register_function`
23289
+ * ignores it — the tenant comes from the authenticated principal, and
23290
+ * trusting a body field would let a caller write into another tenant.
23291
+ * * `name`, when present, **must equal the path's**. A mismatch is refused
23292
+ * with both names rather than silently applying the clauses to whichever
23293
+ * one the route happened to read.
23294
+ *
23295
+ * A *declared* field that is deliberately ignored is a different thing from
23296
+ * an *undeclared* key that is silently dropped. The first is a documented
23297
+ * contract; the second is the defect this issue is about.
23298
+ */
23299
+ interface ReplaceFunctionRequest {
23300
+ /**
23301
+ * The number of named arguments the replacement accepts.
23302
+ * @min 0
23303
+ */
23304
+ arity: number;
23305
+ /** The replacement's pattern-matched clauses, tried in order. */
23306
+ clauses: FunctionClauseDto$1[];
23307
+ /**
23308
+ * The function's name. Optional, and when present it must equal the
23309
+ * path's — this route replaces a definition, it does not rename one.
23310
+ *
23311
+ * A rename would keep every caller's reference pointing at the OLD name,
23312
+ * which no longer resolves; that is a withdrawal plus a registration, and
23313
+ * the caller should say so.
23314
+ */
23315
+ name?: string | null;
23316
+ /**
23317
+ * Accepted so the `register` payload works verbatim, and **ignored**: the
23318
+ * tenant is the authenticated principal's, never a body field.
23319
+ * @format uuid
23320
+ */
23321
+ tenant_id?: string | null;
23322
+ }
23323
+ /**
23324
+ * Response of `PUT /api/v1/functions/{name}`.
23325
+ *
23326
+ * # Why the previous signature is reported
23327
+ *
23328
+ * A function's identity is its NAME, so a replacement keeps every caller's
23329
+ * reference valid — which is what makes an arity change dangerous rather than
23330
+ * merely breaking: a caller passing the old number of arguments keeps
23331
+ * resolving and starts failing at evaluation time with an arity error. The
23332
+ * response names the change so a client can say so.
23333
+ */
23334
+ interface ReplaceFunctionResponse$1 {
23335
+ /**
23336
+ * `true` when the arity changed. Every caller's reference stays valid and
23337
+ * every call passing the old count now fails at evaluation time.
23338
+ */
23339
+ arity_changed: boolean;
23340
+ /**
23341
+ * Everything that calls this function. Reported rather than refused: the
23342
+ * replacement keeps the name resolvable, so a caller is not orphaned —
23343
+ * but one written against the old signature may no longer be correct.
23344
+ */
23345
+ callers?: FunctionCallerDto[];
23346
+ /** What the replacement looks like. */
23347
+ current: FunctionSummaryDto$1;
23348
+ /**
23349
+ * The replacement's id. A fresh registration mints a new one, so this
23350
+ * differs from the previous definition's.
23351
+ * @format uuid
23352
+ */
23353
+ function_id: string;
23354
+ /** The function's name — unchanged by the replacement, by construction. */
23355
+ name: string;
23356
+ /** What the replaced definition looked like. */
23357
+ previous: FunctionSummaryDto$1;
23358
+ }
23359
+ /**
23360
+ * Response of `PUT /api/v1/inference/rules/{id}`.
23361
+ *
23362
+ * ## Why two ids
23363
+ *
23364
+ * A rule's id **is** its head term id. Under `OSFKB_RULE_STABLE_IDS=1` that id
23365
+ * is content-addressed, so an edit that changes the head changes the id by
23366
+ * construction; under the default it is random, so a replacement changes it
23367
+ * anyway. There is no identity under which an edited rule is the same rule, so
23368
+ * the response names both: the id that was withdrawn, and the id that now
23369
+ * holds the edited clause. A client holding the old id must adopt the new one.
23370
+ */
23371
+ interface ReplaceRuleResponse$1 {
23372
+ /** How the edit moved the rule base's guarantees. */
23373
+ certification: RuleCertificationDeltaDto;
23374
+ /**
23375
+ * The id the rule had before the edit. Every durable reference to it —
23376
+ * `derived_facts.rule_id`, each `proofs[].rule_id`, queued dataflow
23377
+ * events — was retracted rather than migrated: a conclusion proved by the
23378
+ * pre-edit clause is not proved by the post-edit one, which is the point
23379
+ * of the edit.
23380
+ * @format uuid
23381
+ */
23382
+ previous_rule_id: string;
23383
+ /** The replacement rule, as created. */
23384
+ term: PsiTermDto$1;
23385
+ /** What withdrawing the previous rule removed. */
23386
+ withdrawal: RuleWithdrawalReport$1;
23387
+ }
23202
23388
  /** Oversight verification result for the report. */
23203
23389
  interface ReportVerification {
23204
23390
  /**
@@ -24780,6 +24966,34 @@ interface RuleBaseCertificateDto {
24780
24966
  /** The termination guarantee (or why it could not be established). */
24781
24967
  termination: TerminationDto;
24782
24968
  }
24969
+ /**
24970
+ * How an edit changed the rule base's termination and order-independence
24971
+ * guarantees.
24972
+ *
24973
+ * An edit can turn a certified-terminating rule base into a non-terminating
24974
+ * one, or introduce a functional conflict. `GET /api/v1/analysis/rule-base/certify`
24975
+ * computes the certificate live, so there is no stale cache to invalidate —
24976
+ * but a caller who never asks would discover the change when the next chain
24977
+ * run diverges. The write path therefore certifies before and after and
24978
+ * reports the delta.
24979
+ */
24980
+ interface RuleCertificationDeltaDto {
24981
+ /** Whether it is order-independent after. */
24982
+ order_independent_after: boolean;
24983
+ /** Whether it was order-independent before the edit. */
24984
+ order_independent_before: boolean;
24985
+ /**
24986
+ * `true` when the edit weakened either guarantee. The edit is still
24987
+ * applied — refusing it would make a rule base unfixable once a previous
24988
+ * edit had broken it — but a client that ignores this field is flying
24989
+ * blind into a diverging chain run.
24990
+ */
24991
+ regressed: boolean;
24992
+ /** Whether the rule base terminated before the edit. */
24993
+ terminated_before: boolean;
24994
+ /** Whether it terminates after. */
24995
+ terminates_after: boolean;
24996
+ }
24783
24997
  /** A rule clause (OSF clause) */
24784
24998
  interface RuleClauseDto$1 {
24785
24999
  /** Constraints on variables in this clause */
@@ -24800,6 +25014,32 @@ type RuleConstraintDto$1 = {
24800
25014
  var2: string;
24801
25015
  type: "equal";
24802
25016
  };
25017
+ /**
25018
+ * What `DELETE /api/v1/inference/rules/{id}` and
25019
+ * `PUT /api/v1/inference/rules/{id}` do about the conclusions the withdrawn
25020
+ * rule derived.
25021
+ *
25022
+ * A rule is not a row. Deleting one that silently keeps its derivations
25023
+ * leaves the knowledge base asserting conclusions whose only justification is
25024
+ * gone; deleting one that silently drops them destroys conclusions the caller
25025
+ * may not have known were at stake. Neither is a default anybody can audit,
25026
+ * so the disposition is named in the query — the same cut
25027
+ * `DELETE /api/v1/sorts/{id}?terms=…` applies to a sort's terms (#213).
25028
+ *
25029
+ * ## What it governs, and what it does not
25030
+ *
25031
+ * This decides the **materialized** tier only (`derived_facts`), because that
25032
+ * tier cannot re-derive itself synchronously — a row the withdrawal leaves
25033
+ * standing stays until the supervisor or a rebuild says otherwise.
25034
+ *
25035
+ * The **in-memory** tier is exact either way and needs no disposition: the
25036
+ * withdrawal walks the truth-maintenance cone from each deleted term and then
25037
+ * re-derives through the same cached `CHAIN;` plan the OSFQL service runs, so
25038
+ * every conclusion the surviving rules still prove comes back and every one
25039
+ * they do not is gone. The report's `consequences_invalidated` says how many
25040
+ * fell before the re-derivation.
25041
+ */
25042
+ type RuleDerivationsDisposition$1 = "refuse" | "retract";
24803
25043
  /** A draft inference rule. */
24804
25044
  interface RuleDraftDto$1 {
24805
25045
  /** Antecedent conditions (body). */
@@ -24832,12 +25072,63 @@ interface RuleEntryDto$1 {
24832
25072
  certainty?: number | null;
24833
25073
  /** The head (consequent) of the rule. */
24834
25074
  head: PsiTermDto$1;
25075
+ /**
25076
+ * When [`Self::withdrawable`] is false, the refusal a withdrawal attempt
25077
+ * would produce — the same prose, and the same `code`, the mutation route
25078
+ * answers with.
25079
+ *
25080
+ * Absent for a withdrawable rule.
25081
+ */
25082
+ not_withdrawable?: null | RuleNotWithdrawableDto;
25083
+ /**
25084
+ * Where this rule came from, from the reading tenant's point of view.
25085
+ *
25086
+ * The listing deliberately returns the PLUGIN-MERGED rule set and admits
25087
+ * the reserved system tenant's rules, because they fire in every tenant's
25088
+ * proof — so three of the withdrawal route's five refusal classes describe
25089
+ * rules that appear here (#232 §1).
25090
+ */
25091
+ origin: RuleOriginDto;
24835
25092
  /**
24836
25093
  * Rule term ID.
24837
25094
  * @format uuid
24838
25095
  */
24839
25096
  rule_id: string;
25097
+ /**
25098
+ * Whether `DELETE`/`PUT` on this rule will act rather than refuse.
25099
+ *
25100
+ * Derived from the same walk the mutation routes run, so the listing and
25101
+ * the refusal cannot disagree. The engine stays the authority: a caller
25102
+ * may still be refused by a state change between this read and the write.
25103
+ */
25104
+ withdrawable: boolean;
25105
+ }
25106
+ /**
25107
+ * Why a listed rule cannot be withdrawn, in the same terms the mutation route
25108
+ * would answer with.
25109
+ */
25110
+ interface RuleNotWithdrawableDto {
25111
+ /**
25112
+ * The stable machine-readable discriminator the `DELETE` would carry —
25113
+ * `rule_system_owned`, `rule_plugin_owned` or `rule_bootstrap`.
25114
+ */
25115
+ code: string;
25116
+ /**
25117
+ * The refusal in words, naming the lifecycle operation that DOES withdraw
25118
+ * this rule.
25119
+ */
25120
+ reason: string;
24840
25121
  }
25122
+ /**
25123
+ * Where a listed rule came from.
25124
+ *
25125
+ * The client-facing projection of the engine's provenance walk. A UI keys the
25126
+ * row's actions on this rather than on `_plugin_id` — the underscore-prefixed
25127
+ * provenance meta-feature the marketplace stamps on a plugin's clauses, which
25128
+ * is documented as invisible to domain queries and cannot tell a system-wide
25129
+ * plugin from a tenant-scoped one, nor see a bootstrap rule at all.
25130
+ */
25131
+ type RuleOriginDto = "tenant" | "system_plugin" | "tenant_plugin" | "bootstrap";
24841
25132
  /** Response with rule store info */
24842
25133
  interface RuleStoreResponse$1 {
24843
25134
  /** @min 0 */
@@ -24885,6 +25176,63 @@ interface RuleUtilityDto$1 {
24885
25176
  */
24886
25177
  utility: number;
24887
25178
  }
25179
+ /**
25180
+ * What withdrawing a rule removed, in every tier that held part of it.
25181
+ *
25182
+ * A rule is one head row, N body rows, a rule-index entry, a set of in-memory
25183
+ * justifications, a set of `derived_facts` rows and their proof objects, and
25184
+ * the derived terms themselves. A response reporting only "deleted" would
25185
+ * name none of that, so each tier is counted separately.
25186
+ */
25187
+ interface RuleWithdrawalReport$1 {
25188
+ /**
25189
+ * In-memory consequences invalidated by the truth-maintenance cone, before
25190
+ * the surviving ones were re-derived.
25191
+ * @min 0
25192
+ */
25193
+ consequences_invalidated: number;
25194
+ /**
25195
+ * Materialized derivations (`derived_facts` rows) whose last proof this
25196
+ * rule was, so the row itself is gone.
25197
+ * @min 0
25198
+ */
25199
+ derivations_removed: number;
25200
+ /**
25201
+ * Whether the derivation walk hit its visit cap and stopped early. A
25202
+ * truncated retraction is not a complete one; re-issue the request.
25203
+ */
25204
+ derivations_truncated: boolean;
25205
+ /**
25206
+ * Materialized derivations that lost this rule's proofs but remain proved
25207
+ * by another rule. These are correctly left standing.
25208
+ * @min 0
25209
+ */
25210
+ derivations_weakened: number;
25211
+ /**
25212
+ * Incomplete dataflow queue entries cancelled because they named this rule.
25213
+ * @min 0
25214
+ */
25215
+ queued_events_cancelled: number;
25216
+ /**
25217
+ * The rule that was withdrawn.
25218
+ * @format uuid
25219
+ */
25220
+ rule_id: string;
25221
+ /**
25222
+ * Terms deleted with it: the head plus the body, guard, variable and
25223
+ * operand terms the rule exclusively owned.
25224
+ * @min 0
25225
+ */
25226
+ terms_deleted: number;
25227
+ /**
25228
+ * Terms of the rule's graph that were **kept** because something outside
25229
+ * the rule still holds them — another rule's antecedent, or a fact the
25230
+ * rule's body referenced. Deleting these would destroy data the rest of
25231
+ * the knowledge base owns.
25232
+ * @min 0
25233
+ */
25234
+ terms_retained_shared: number;
25235
+ }
24888
25236
  /** The payload an AG-UI client POSTs to start (or continue) a run. */
24889
25237
  interface RunAgentInput {
24890
25238
  /** Contextual key-value items. */
@@ -25972,6 +26320,46 @@ interface ShiftEffectResponse$1 {
25972
26320
  */
25973
26321
  std_error: number;
25974
26322
  }
26323
+ /**
26324
+ * One sighting on the wire — one unknown surface form the lattice does not
26325
+ * declare, with its recurrence evidence.
26326
+ *
26327
+ * Named `SightingDto`, not `ObservationDto`: the OpenAPI components namespace
26328
+ * is FLAT, and `crates/api/src/dto/semiparametric.rs` already registers an
26329
+ * `ObservationDto` — the `(x, a, y)` causal unit. Two live structs under one
26330
+ * schema name meant the spec silently kept only one, and the survivor
26331
+ * documented the wrong request body for `POST /api/v1/causal/ate` (#216). The
26332
+ * name is the schema; a rename costs nothing on the wire because the JSON
26333
+ * field names are the struct's, unchanged.
26334
+ */
26335
+ interface SightingDto {
26336
+ /**
26337
+ * Sightings so far.
26338
+ * @format int64
26339
+ * @min 0
26340
+ */
26341
+ count: number;
26342
+ /** Distinct source documents. */
26343
+ documents: string[];
26344
+ /**
26345
+ * Unix seconds of the first sighting.
26346
+ * @format int64
26347
+ */
26348
+ first_seen: number;
26349
+ /**
26350
+ * Unix seconds of the latest sighting.
26351
+ * @format int64
26352
+ */
26353
+ last_seen: number;
26354
+ /** The normalised identity observations aggregate under. */
26355
+ normalized: string;
26356
+ /** Who saw it (`ingestion`, `extraction_certificate`, `sentinel_near_miss`). */
26357
+ producers: string[];
26358
+ /** The proposed sort's id, once a generate pass minted one. */
26359
+ proposed_sort_id?: string | null;
26360
+ /** Representative surface form. */
26361
+ surface: string;
26362
+ }
25975
26363
  /** A single similarity entry for bulk operations */
25976
26364
  interface SimilarityEntry {
25977
26365
  /**
@@ -32050,20 +32438,71 @@ type FeatureTargetDto = TaggedFeatureValueDto | string;
32050
32438
  * Do NOT use with term CRUD or query endpoints — use {@link ValueDto} instead.
32051
32439
  *
32052
32440
  * The backend Rust type is `FeatureValueDto` in `dto/homoiconic.rs` with
32053
- * `#[serde(untagged)]`. Variant ordering:
32054
- * 1. TermRef (UUID string)
32055
- * 2. TermRefs/List (array of FeatureValueDto)
32056
- * 3. String
32057
- * 4. Integer (i64)
32058
- * 5. Real (f64)
32059
- * 6. Boolean
32060
- * 7. Null (uninstantiated)
32441
+ * `#[serde(untagged)]`. Variant ordering — **load-bearing**, because an
32442
+ * untagged union tries its variants in declaration order and an object with
32443
+ * extra keys still matches an earlier variant that ignores them:
32444
+ * 1. Variable (`{term_id, var_name}`)
32445
+ * 2. Literal (`{term_id, literal}`)
32446
+ * 3. TermRef (`{term_id}`)
32447
+ * 4. TermRefs/List (array of FeatureValueDto)
32448
+ * 5. String
32449
+ * 6. Integer (i64)
32450
+ * 7. Real (f64)
32451
+ * 8. Boolean
32452
+ * 9. Null (uninstantiated)
32061
32453
  *
32062
32454
  * **Ambiguity note**: UUID strings and regular strings are both `string` in TypeScript.
32063
32455
  * The backend distinguishes them by UUID format. The SDK provides
32064
32456
  * `discriminateFeatureValue()` in `utils/discrimination.ts` for response parsing.
32065
32457
  */
32066
- type FeatureValueDto = string | number | boolean | null | FeatureValueDto[];
32458
+ type FeatureValueDto = VariableFeatureValue | LiteralFeatureValue | TermRefFeatureValue | string | number | boolean | null | FeatureValueDto[];
32459
+ /**
32460
+ * A feature bound to a LOGIC VARIABLE, carrying the name the rule author wrote.
32461
+ *
32462
+ * @remarks
32463
+ * A variable and a reference to a stored term are both `Value::Reference` in
32464
+ * the engine, so both used to arrive as a bare {@link TermRefFeatureValue} —
32465
+ * nothing in a rule's features said that `name` was bound to `?N` rather than
32466
+ * to a term, and the name existed only inside the `display` prose (#232 §2).
32467
+ *
32468
+ * `termId` is the variable term's, so **two features bound to the same variable
32469
+ * carry the same id**. That is how a client reads the coreference which makes
32470
+ * `senior(name: ?N) WHEN person(name: ?N)` a join rather than two independent
32471
+ * patterns.
32472
+ */
32473
+ interface VariableFeatureValue {
32474
+ /** The variable term's UUID. Shared by every feature bound to it. */
32475
+ term_id: string;
32476
+ /** The variable's name as authored, e.g. `?N`. */
32477
+ var_name: string;
32478
+ }
32479
+ /**
32480
+ * A feature bound to an INTERNED LITERAL WRAPPER, carrying the scalar it holds.
32481
+ *
32482
+ * @remarks
32483
+ * The engine interns a guard's bound as a term — `65` becomes an
32484
+ * `integer_type` Ψ-term — so reading it used to cost one `GET /terms/{id}` per
32485
+ * guard, and the summary that exists to save that round trip named the
32486
+ * wrapper's SORT rather than its value (#232 §4).
32487
+ */
32488
+ interface LiteralFeatureValue {
32489
+ /** The wrapper term's UUID. */
32490
+ term_id: string;
32491
+ /** The scalar the wrapper holds. */
32492
+ literal: FeatureValueDto;
32493
+ }
32494
+ /**
32495
+ * A reference to another term, with nothing said about what it is.
32496
+ *
32497
+ * @remarks
32498
+ * What a reference falls back to when it is neither a named variable nor an
32499
+ * interned literal — an ordinary stored term, or an anonymous variable, which
32500
+ * carries no name to report.
32501
+ */
32502
+ interface TermRefFeatureValue {
32503
+ /** The referenced term's UUID. */
32504
+ term_id: string;
32505
+ }
32067
32506
 
32068
32507
  type values_BellShape = BellShape;
32069
32508
  type values_BooleanValue = BooleanValue;
@@ -32079,6 +32518,7 @@ type values_GaussianProductShape = GaussianProductShape;
32079
32518
  type values_GaussianShape = GaussianShape;
32080
32519
  type values_IntegerValue = IntegerValue;
32081
32520
  type values_ListValue = ListValue;
32521
+ type values_LiteralFeatureValue = LiteralFeatureValue;
32082
32522
  type values_PiShapeShape = PiShapeShape;
32083
32523
  type values_PiecewiseLinearShape = PiecewiseLinearShape;
32084
32524
  type values_RealValue = RealValue;
@@ -32092,13 +32532,15 @@ type values_SortIdValue = SortIdValue;
32092
32532
  type values_SpikeShape = SpikeShape;
32093
32533
  type values_StringValue = StringValue;
32094
32534
  type values_TaggedFeatureValueDto = TaggedFeatureValueDto;
32535
+ type values_TermRefFeatureValue = TermRefFeatureValue;
32095
32536
  type values_TrapezoidalShape = TrapezoidalShape;
32096
32537
  type values_TriangularShape = TriangularShape;
32097
32538
  type values_UninstantiatedValue = UninstantiatedValue;
32098
32539
  type values_ValueDto = ValueDto;
32540
+ type values_VariableFeatureValue = VariableFeatureValue;
32099
32541
  type values_ZShapeShape = ZShapeShape;
32100
32542
  declare namespace values {
32101
- export type { values_BellShape as BellShape, values_BooleanValue as BooleanValue, values_CauchyShape as CauchyShape, values_CosineShape as CosineShape, values_CyclicGaussianShape as CyclicGaussianShape, values_FeatureTargetDto as FeatureTargetDto, values_FeatureValueDto as FeatureValueDto, values_FuzzyNumberValue as FuzzyNumberValue, values_FuzzyScalarValue as FuzzyScalarValue, values_FuzzyShapeDto as FuzzyShapeDto, values_GaussianProductShape as GaussianProductShape, values_GaussianShape as GaussianShape, values_IntegerValue as IntegerValue, values_ListValue as ListValue, values_PiShapeShape as PiShapeShape, values_PiecewiseLinearShape as PiecewiseLinearShape, values_RealValue as RealValue, values_ReferenceValue as ReferenceValue, values_SShapeShape as SShapeShape, values_SetValue as SetValue, values_SigmoidDifferenceShape as SigmoidDifferenceShape, values_SigmoidProductShape as SigmoidProductShape, values_SigmoidShape as SigmoidShape, values_SortIdValue as SortIdValue, values_SpikeShape as SpikeShape, values_StringValue as StringValue, values_TaggedFeatureValueDto as TaggedFeatureValueDto, values_TrapezoidalShape as TrapezoidalShape, values_TriangularShape as TriangularShape, values_UninstantiatedValue as UninstantiatedValue, values_ValueDto as ValueDto, values_ZShapeShape as ZShapeShape };
32543
+ export type { values_BellShape as BellShape, values_BooleanValue as BooleanValue, values_CauchyShape as CauchyShape, values_CosineShape as CosineShape, values_CyclicGaussianShape as CyclicGaussianShape, values_FeatureTargetDto as FeatureTargetDto, values_FeatureValueDto as FeatureValueDto, values_FuzzyNumberValue as FuzzyNumberValue, values_FuzzyScalarValue as FuzzyScalarValue, values_FuzzyShapeDto as FuzzyShapeDto, values_GaussianProductShape as GaussianProductShape, values_GaussianShape as GaussianShape, values_IntegerValue as IntegerValue, values_ListValue as ListValue, values_LiteralFeatureValue as LiteralFeatureValue, values_PiShapeShape as PiShapeShape, values_PiecewiseLinearShape as PiecewiseLinearShape, values_RealValue as RealValue, values_ReferenceValue as ReferenceValue, values_SShapeShape as SShapeShape, values_SetValue as SetValue, values_SigmoidDifferenceShape as SigmoidDifferenceShape, values_SigmoidProductShape as SigmoidProductShape, values_SigmoidShape as SigmoidShape, values_SortIdValue as SortIdValue, values_SpikeShape as SpikeShape, values_StringValue as StringValue, values_TaggedFeatureValueDto as TaggedFeatureValueDto, values_TermRefFeatureValue as TermRefFeatureValue, values_TrapezoidalShape as TrapezoidalShape, values_TriangularShape as TriangularShape, values_UninstantiatedValue as UninstantiatedValue, values_ValueDto as ValueDto, values_VariableFeatureValue as VariableFeatureValue, values_ZShapeShape as ZShapeShape };
32102
32544
  }
32103
32545
 
32104
32546
  /**
@@ -33697,6 +34139,11 @@ interface FindBySortRequest {
33697
34139
  sortName?: string | null;
33698
34140
  /** Optional filter for feature-based filtering. */
33699
34141
  filter?: Record<string, string> | null;
34142
+ /**
34143
+ * Cap on the number of terms returned, applied after the filter. Omit (or
34144
+ * pass 0) for no cap.
34145
+ */
34146
+ limit?: number | null;
33700
34147
  }
33701
34148
  /**
33702
34149
  * Request to validate a term against its sort's type witnesses.
@@ -34361,6 +34808,19 @@ declare class Inference<SecurityDataType = unknown> {
34361
34808
  /** Also delete referenced terms */
34362
34809
  delete_references?: boolean;
34363
34810
  }, params?: RequestParams) => Promise<HttpResponse<DeleteGoalResponse$1, void>>;
34811
+ /**
34812
+ * @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.
34813
+ *
34814
+ * @tags inference
34815
+ * @name DeleteRule
34816
+ * @summary Delete a rule.
34817
+ * @request DELETE:/api/v1/inference/rules/{id}
34818
+ * @secure
34819
+ */
34820
+ deleteRule: (id: string, query?: {
34821
+ /** What to do about the conclusions this rule derived. */
34822
+ derivations?: RuleDerivationsDisposition$1;
34823
+ }, params?: RequestParams) => Promise<HttpResponse<RuleWithdrawalReport$1, void>>;
34364
34824
  /**
34365
34825
  * @description Never writes to the KB — returns validated drafts for human review.
34366
34826
  *
@@ -34443,15 +34903,15 @@ declare class Inference<SecurityDataType = unknown> {
34443
34903
  */
34444
34904
  getMetaSorts: (params?: RequestParams) => Promise<HttpResponse<MetaSortsResponse$1, any>>;
34445
34905
  /**
34446
- * @description # Authorization Requires X-Tenant-Id header.
34906
+ * @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.
34447
34907
  *
34448
34908
  * @tags inference
34449
34909
  * @name GetRules
34450
34910
  * @summary Get all rules (clauses with antecedents) for a tenant
34451
- * @request GET:/api/v1/inference/rules/{tenant_id}
34911
+ * @request GET:/api/v1/inference/rules/{id}
34452
34912
  * @secure
34453
34913
  */
34454
- getRules: (tenantId: string, params?: RequestParams) => Promise<HttpResponse<GetRulesResponse$1, any>>;
34914
+ getRules: (id: string, params?: RequestParams) => Promise<HttpResponse<GetRulesResponse$1, any>>;
34455
34915
  /**
34456
34916
  * @description # TRUE HOMOICONICITY Goals are Ψ-terms persisted to PostgreSQL. This endpoint returns all goals for the authenticated tenant with summary information. # Authorization Requires X-Tenant-Id header.
34457
34917
  *
@@ -34482,6 +34942,16 @@ declare class Inference<SecurityDataType = unknown> {
34482
34942
  * @secure
34483
34943
  */
34484
34944
  predictWithOrchestrator: (data: OrchestratorPredictRequest, params?: RequestParams) => Promise<HttpResponse<OrchestratorPredictResponse, void>>;
34945
+ /**
34946
+ * @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.
34947
+ *
34948
+ * @tags inference
34949
+ * @name ReplaceRule
34950
+ * @summary Replace a rule.
34951
+ * @request PUT:/api/v1/inference/rules/{id}
34952
+ * @secure
34953
+ */
34954
+ replaceRule: (id: string, data: AddRuleRequest$1, params?: RequestParams) => Promise<HttpResponse<ReplaceRuleResponse$1, void>>;
34485
34955
  /**
34486
34956
  * @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.
34487
34957
  *
@@ -35170,6 +35640,58 @@ interface RuleEntryDto {
35170
35640
  body: PsiTermDto[];
35171
35641
  /** Optional certainty/confidence for the rule. */
35172
35642
  certainty?: number | null;
35643
+ /**
35644
+ * Where this rule came from, from the reading tenant's point of view.
35645
+ *
35646
+ * @remarks
35647
+ * The listing deliberately returns the PLUGIN-MERGED rule set and admits the
35648
+ * reserved system tenant's rules, because they fire in every tenant's proof
35649
+ * — so three of the withdrawal route's five refusal classes describe rules
35650
+ * that appear here.
35651
+ */
35652
+ origin: RuleOrigin;
35653
+ /**
35654
+ * Whether `deleteRule` / `replaceRule` will act on this rule rather than
35655
+ * refuse.
35656
+ *
35657
+ * @remarks
35658
+ * Derived from the same walk the mutation routes run, so the listing and the
35659
+ * refusal cannot disagree. The engine stays the authority: a caller may
35660
+ * still be refused by a state change between this read and the write.
35661
+ */
35662
+ withdrawable: boolean;
35663
+ /**
35664
+ * When {@link RuleEntryDto.withdrawable} is false, the refusal a withdrawal
35665
+ * would produce — the same `code` and prose the mutation route answers with.
35666
+ * Absent for a withdrawable rule.
35667
+ */
35668
+ notWithdrawable?: RuleNotWithdrawable;
35669
+ }
35670
+ /**
35671
+ * Where a listed rule came from.
35672
+ *
35673
+ * @remarks
35674
+ * A UI keys a row's actions on this rather than on `_plugin_id` — the
35675
+ * underscore-prefixed provenance meta-feature the marketplace stamps on a
35676
+ * plugin's clauses, which is documented as invisible to domain queries, cannot
35677
+ * tell a system-wide plugin from a tenant-scoped one, and sees nothing at all
35678
+ * for a bootstrap rule.
35679
+ *
35680
+ * - `tenant` — authored in this tenant. The only withdrawable origin.
35681
+ * - `system_plugin` — a system-wide plugin's rule, firing in every tenant's proof.
35682
+ * - `tenant_plugin` — contributed by a plugin installed in this tenant.
35683
+ * - `bootstrap` — engine machinery (an Allen relation, a handler mapping).
35684
+ */
35685
+ type RuleOrigin = 'tenant' | 'system_plugin' | 'tenant_plugin' | 'bootstrap';
35686
+ /** Why a listed rule cannot be withdrawn, in the mutation route's own terms. */
35687
+ interface RuleNotWithdrawable {
35688
+ /**
35689
+ * The stable discriminator the `DELETE` would carry — `rule_system_owned`,
35690
+ * `rule_plugin_owned` or `rule_bootstrap`.
35691
+ */
35692
+ code: string;
35693
+ /** The refusal in words, naming the lifecycle operation that DOES withdraw it. */
35694
+ reason: string;
35173
35695
  }
35174
35696
  /** Response listing all rules for a tenant. */
35175
35697
  interface GetRulesResponse {
@@ -35178,6 +35700,91 @@ interface GetRulesResponse {
35178
35700
  /** The rules (clauses with antecedents). */
35179
35701
  rules: RuleEntryDto[];
35180
35702
  }
35703
+ /** What a rule withdrawal does about the conclusions the rule derived. */
35704
+ type RuleDerivationsDisposition = 'refuse' | 'retract';
35705
+ /**
35706
+ * What withdrawing a rule removed, in every tier that held part of it.
35707
+ *
35708
+ * @remarks
35709
+ * A rule is not a row. It is one conclusion term, N antecedent pattern terms,
35710
+ * a rule-index entry, a set of in-memory justifications, a set of materialized
35711
+ * derivations with their proof objects, and the derived terms themselves. Each
35712
+ * tier is counted separately, because a response reporting only "deleted" would
35713
+ * name none of it.
35714
+ */
35715
+ interface RuleWithdrawalReport {
35716
+ /** The rule that was withdrawn (UUID). */
35717
+ ruleId: string;
35718
+ /**
35719
+ * Terms deleted with it: the conclusion plus the antecedent, guard, variable
35720
+ * and operand terms the rule exclusively owned.
35721
+ */
35722
+ termsDeleted: number;
35723
+ /**
35724
+ * Terms of the rule's graph that were KEPT because something outside the rule
35725
+ * still holds them — another rule's antecedent, or a fact the body
35726
+ * referenced. Deleting these would destroy data the rest of the knowledge
35727
+ * base owns.
35728
+ */
35729
+ termsRetainedShared: number;
35730
+ /** Materialized derivations whose last proof this rule was, so the row is gone. */
35731
+ derivationsRemoved: number;
35732
+ /**
35733
+ * Materialized derivations that lost this rule's proofs but remain proved by
35734
+ * another rule. These are correctly left standing.
35735
+ */
35736
+ derivationsWeakened: number;
35737
+ /**
35738
+ * Whether the derivation walk hit its visit cap and stopped early. A
35739
+ * truncated retraction is not a complete one; re-issue the request.
35740
+ */
35741
+ derivationsTruncated: boolean;
35742
+ /**
35743
+ * In-memory consequences invalidated by the truth-maintenance cone, before
35744
+ * the surviving ones were re-derived.
35745
+ */
35746
+ consequencesInvalidated: number;
35747
+ /** Incomplete dataflow queue entries cancelled because they named this rule. */
35748
+ queuedEventsCancelled: number;
35749
+ }
35750
+ /** How an edit changed the rule base's termination and order-independence guarantees. */
35751
+ interface RuleCertificationDelta {
35752
+ /** Whether the rule base terminated before the edit. */
35753
+ terminatedBefore: boolean;
35754
+ /** Whether it terminates after. */
35755
+ terminatesAfter: boolean;
35756
+ /** Whether it was order-independent before the edit. */
35757
+ orderIndependentBefore: boolean;
35758
+ /** Whether it is order-independent after. */
35759
+ orderIndependentAfter: boolean;
35760
+ /**
35761
+ * `true` when the edit weakened either guarantee. The edit is still applied —
35762
+ * refusing it would make a rule base unfixable once a previous edit had
35763
+ * broken it — but a client that ignores this is flying blind into a diverging
35764
+ * chain run.
35765
+ */
35766
+ regressed: boolean;
35767
+ }
35768
+ /** Result of replacing a rule. */
35769
+ interface ReplaceRuleResponse {
35770
+ /**
35771
+ * The id the rule had before the edit.
35772
+ *
35773
+ * @remarks
35774
+ * A rule's id IS its conclusion term id, so an edit changes it by
35775
+ * construction. Durable references to the old id are retracted rather than
35776
+ * migrated: a conclusion proved by the pre-edit clause is not proved by the
35777
+ * post-edit one, which is the point of the edit. A client holding the old id
35778
+ * must adopt the new one.
35779
+ */
35780
+ previousRuleId: string;
35781
+ /** The replacement rule, as created. */
35782
+ term: PsiTermDto;
35783
+ /** What withdrawing the previous rule removed. */
35784
+ withdrawal: RuleWithdrawalReport;
35785
+ /** How the edit moved the rule base's guarantees. */
35786
+ certification: RuleCertificationDelta;
35787
+ }
35181
35788
  /**
35182
35789
  * Response listing the meta-sorts (built-in system sorts) for inference.
35183
35790
  *
@@ -35507,17 +36114,23 @@ type inference_NafProveRequest = NafProveRequest;
35507
36114
  type inference_NafProveResponse = NafProveResponse;
35508
36115
  type inference_ProofDto = ProofDto;
35509
36116
  type inference_ProvenanceTagDto = ProvenanceTagDto;
36117
+ type inference_ReplaceRuleResponse = ReplaceRuleResponse;
35510
36118
  type inference_RuleAggregatorDto = RuleAggregatorDto;
36119
+ type inference_RuleCertificationDelta = RuleCertificationDelta;
36120
+ type inference_RuleDerivationsDisposition = RuleDerivationsDisposition;
35511
36121
  type inference_RuleDraftClarificationQuestionDto = RuleDraftClarificationQuestionDto;
35512
36122
  type inference_RuleDraftDto = RuleDraftDto;
35513
36123
  type inference_RuleEntryDto = RuleEntryDto;
36124
+ type inference_RuleNotWithdrawable = RuleNotWithdrawable;
36125
+ type inference_RuleOrigin = RuleOrigin;
35514
36126
  type inference_RuleTermDraftDto = RuleTermDraftDto;
36127
+ type inference_RuleWithdrawalReport = RuleWithdrawalReport;
35515
36128
  type inference_SolutionDto = SolutionDto;
35516
36129
  type inference_TaggedDerivedFact = TaggedDerivedFact;
35517
36130
  type inference_TaggedForwardChainRequest = TaggedForwardChainRequest;
35518
36131
  type inference_TaggedForwardChainResponse = TaggedForwardChainResponse;
35519
36132
  declare namespace inference {
35520
- export type { inference_AddFactRequest as AddFactRequest, inference_AddFactResponse as AddFactResponse, inference_AddRuleRequest as AddRuleRequest, inference_AddRuleResponse as AddRuleResponse, inference_AllenRelation as AllenRelation, inference_BackwardChainRequest as BackwardChainRequest, inference_BackwardChainResponse as BackwardChainResponse, inference_BayesianEffectDto as BayesianEffectDto, inference_BayesianPredictRequest as BayesianPredictRequest, inference_BayesianPredictResponse as BayesianPredictResponse, inference_BindingDto as BindingDto, inference_BulkAddFactsRequest as BulkAddFactsRequest, inference_BulkAddFactsResponse as BulkAddFactsResponse, inference_BulkAddRulesRequest as BulkAddRulesRequest, inference_BulkAddRulesResponse as BulkAddRulesResponse, inference_BulkFuzzyProveRequest as BulkFuzzyProveRequest, inference_BulkFuzzyProveResponse as BulkFuzzyProveResponse, inference_ClearFactsResponse as ClearFactsResponse, inference_ConstraintInputDto as ConstraintInputDto, inference_CreateGoalRequest as CreateGoalRequest, inference_CreateGoalResponse as CreateGoalResponse, inference_DeleteGoalResponse as DeleteGoalResponse, inference_DraftRulesRequest as DraftRulesRequest, inference_DraftRulesResponse as DraftRulesResponse, inference_FactConfidenceEntry as FactConfidenceEntry, inference_ForwardChainRequest as ForwardChainRequest, inference_ForwardChainResponse as ForwardChainResponse, inference_FuzzyProveRequest as FuzzyProveRequest, inference_FuzzyProveResponse as FuzzyProveResponse, inference_GetFactsResponse as GetFactsResponse, inference_GetRulesResponse as GetRulesResponse, inference_GoalDto as GoalDto, inference_GoalSummaryDto as GoalSummaryDto, inference_GuardOp as GuardOp, inference_HomoiconicSubstitutionDto as HomoiconicSubstitutionDto, inference_ListGoalsResponse as ListGoalsResponse, inference_LiteralInputDto as LiteralInputDto, inference_MetaSortsResponse as MetaSortsResponse, inference_NafProveRequest as NafProveRequest, inference_NafProveResponse as NafProveResponse, inference_ProofDto as ProofDto, inference_ProvenanceTagDto as ProvenanceTagDto, inference_RuleAggregatorDto as RuleAggregatorDto, inference_RuleDraftClarificationQuestionDto as RuleDraftClarificationQuestionDto, inference_RuleDraftDto as RuleDraftDto, inference_RuleEntryDto as RuleEntryDto, inference_RuleTermDraftDto as RuleTermDraftDto, inference_SolutionDto as SolutionDto, inference_TaggedDerivedFact as TaggedDerivedFact, inference_TaggedForwardChainRequest as TaggedForwardChainRequest, inference_TaggedForwardChainResponse as TaggedForwardChainResponse };
36133
+ export type { inference_AddFactRequest as AddFactRequest, inference_AddFactResponse as AddFactResponse, inference_AddRuleRequest as AddRuleRequest, inference_AddRuleResponse as AddRuleResponse, inference_AllenRelation as AllenRelation, inference_BackwardChainRequest as BackwardChainRequest, inference_BackwardChainResponse as BackwardChainResponse, inference_BayesianEffectDto as BayesianEffectDto, inference_BayesianPredictRequest as BayesianPredictRequest, inference_BayesianPredictResponse as BayesianPredictResponse, inference_BindingDto as BindingDto, inference_BulkAddFactsRequest as BulkAddFactsRequest, inference_BulkAddFactsResponse as BulkAddFactsResponse, inference_BulkAddRulesRequest as BulkAddRulesRequest, inference_BulkAddRulesResponse as BulkAddRulesResponse, inference_BulkFuzzyProveRequest as BulkFuzzyProveRequest, inference_BulkFuzzyProveResponse as BulkFuzzyProveResponse, inference_ClearFactsResponse as ClearFactsResponse, inference_ConstraintInputDto as ConstraintInputDto, inference_CreateGoalRequest as CreateGoalRequest, inference_CreateGoalResponse as CreateGoalResponse, inference_DeleteGoalResponse as DeleteGoalResponse, inference_DraftRulesRequest as DraftRulesRequest, inference_DraftRulesResponse as DraftRulesResponse, inference_FactConfidenceEntry as FactConfidenceEntry, inference_ForwardChainRequest as ForwardChainRequest, inference_ForwardChainResponse as ForwardChainResponse, inference_FuzzyProveRequest as FuzzyProveRequest, inference_FuzzyProveResponse as FuzzyProveResponse, inference_GetFactsResponse as GetFactsResponse, inference_GetRulesResponse as GetRulesResponse, inference_GoalDto as GoalDto, inference_GoalSummaryDto as GoalSummaryDto, inference_GuardOp as GuardOp, inference_HomoiconicSubstitutionDto as HomoiconicSubstitutionDto, inference_ListGoalsResponse as ListGoalsResponse, inference_LiteralInputDto as LiteralInputDto, inference_MetaSortsResponse as MetaSortsResponse, inference_NafProveRequest as NafProveRequest, inference_NafProveResponse as NafProveResponse, inference_ProofDto as ProofDto, inference_ProvenanceTagDto as ProvenanceTagDto, inference_ReplaceRuleResponse as ReplaceRuleResponse, inference_RuleAggregatorDto as RuleAggregatorDto, inference_RuleCertificationDelta as RuleCertificationDelta, inference_RuleDerivationsDisposition as RuleDerivationsDisposition, inference_RuleDraftClarificationQuestionDto as RuleDraftClarificationQuestionDto, inference_RuleDraftDto as RuleDraftDto, inference_RuleEntryDto as RuleEntryDto, inference_RuleNotWithdrawable as RuleNotWithdrawable, inference_RuleOrigin as RuleOrigin, inference_RuleTermDraftDto as RuleTermDraftDto, inference_RuleWithdrawalReport as RuleWithdrawalReport, inference_SolutionDto as SolutionDto, inference_TaggedDerivedFact as TaggedDerivedFact, inference_TaggedForwardChainRequest as TaggedForwardChainRequest, inference_TaggedForwardChainResponse as TaggedForwardChainResponse };
35521
36134
  }
35522
36135
 
35523
36136
  /**
@@ -35630,6 +36243,78 @@ declare class InferenceClient {
35630
36243
  * ```
35631
36244
  */
35632
36245
  getRules(): Promise<GetRulesResponse>;
36246
+ /**
36247
+ * Withdraw one rule from the knowledge base.
36248
+ *
36249
+ * @param ruleId - Term id of the rule (its conclusion), as returned by
36250
+ * {@link InferenceClient.addRule} or {@link InferenceClient.getRules}.
36251
+ * @param options - `derivations` decides what happens to the conclusions the
36252
+ * rule derived. Defaults to `'refuse'`.
36253
+ * @returns What the withdrawal removed, tier by tier.
36254
+ * @throws {ApiError} 400 if the id names a fact rather than a rule, or if the
36255
+ * rule still supports derivations under the default `'refuse'`; 403 for a
36256
+ * system, plugin-owned or bootstrap rule; 404 if no such rule exists.
36257
+ *
36258
+ * @remarks
36259
+ * A rule is not a row. Withdrawing one deletes its conclusion AND the
36260
+ * antecedent pattern, guard and variable terms it exclusively owns — a
36261
+ * conclusion-only delete would leave those patterns readable as ordinary
36262
+ * facts — while keeping every term the rest of the knowledge base still
36263
+ * holds.
36264
+ *
36265
+ * `'refuse'` (the default) refuses while the rule still proves materialized
36266
+ * conclusions and says how many; `'retract'` withdraws them with it. A delete
36267
+ * that silently drops derivations is as wrong as one that silently keeps
36268
+ * them, so neither is the unnamed default.
36269
+ *
36270
+ * @example
36271
+ * ```typescript
36272
+ * const report = await client.inference.deleteRule(ruleId, { derivations: 'retract' });
36273
+ * console.log(report.termsDeleted, report.derivationsRemoved);
36274
+ * ```
36275
+ */
36276
+ deleteRule(ruleId: string, options?: {
36277
+ derivations?: RuleDerivationsDisposition;
36278
+ }): Promise<RuleWithdrawalReport>;
36279
+ /**
36280
+ * Replace one rule with a new one.
36281
+ *
36282
+ * @param ruleId - Term id of the rule (its conclusion) to replace.
36283
+ * @param request - The replacement rule, in the same shape
36284
+ * {@link InferenceClient.addRule} takes.
36285
+ * @returns The replacement, the id it replaced, what the withdrawal removed,
36286
+ * and how the rule base's guarantees moved.
36287
+ * @throws {ApiError} 422 if the replacement is rejected by the authoring
36288
+ * guards — in which case the original rule is left live; 400/403/404 as for
36289
+ * {@link InferenceClient.deleteRule}.
36290
+ *
36291
+ * @remarks
36292
+ * A rule's id IS its conclusion term id, so an edit changes it by
36293
+ * construction. The response carries `previousRuleId` alongside the new
36294
+ * rule; a client holding the old id must adopt the new one.
36295
+ *
36296
+ * The path names ONE rule term — one disjunct. Two rules with the same
36297
+ * conclusion are OR-unioned, so "edit the rule for X" is ambiguous and this
36298
+ * addresses a single clause.
36299
+ *
36300
+ * @example
36301
+ * ```typescript
36302
+ * const result = await client.inference.replaceRule(ruleId, {
36303
+ * term: psi('retiree', { name: Var('N') }),
36304
+ * antecedents: [psi('person', { name: Var('N') })],
36305
+ * });
36306
+ * console.log(result.previousRuleId, '->', result.term.termId);
36307
+ * if (result.certification.regressed) {
36308
+ * console.warn('the edit weakened the rule base guarantees');
36309
+ * }
36310
+ * ```
36311
+ */
36312
+ replaceRule(ruleId: string, request: {
36313
+ term: TermInputArg;
36314
+ antecedents?: TermInputArg[];
36315
+ certainty?: number;
36316
+ aggregator?: RuleAggregatorDto | null;
36317
+ }): Promise<ReplaceRuleResponse>;
35633
36318
  /**
35634
36319
  * Query for matching data by searching rules and facts backwards from a goal pattern.
35635
36320
  *
@@ -50774,12 +51459,25 @@ interface StructuredIngestionStatsDto {
50774
51459
  entitiesCreated: number;
50775
51460
  /** Number of entities extracted (from pipeline). */
50776
51461
  entitiesExtracted: number;
51462
+ /**
51463
+ * Number of records the source reported as available for the ingested
51464
+ * tables, before any cap or collapse. Compared with `recordsProcessed` a cap
51465
+ * hit is visible; compared with `termsCreated`, a partial ingest is.
51466
+ */
51467
+ recordsAvailable: number;
50777
51468
  /** Number of source records processed. */
50778
51469
  recordsProcessed: number;
50779
51470
  /** Number of relations created. */
50780
51471
  relationsCreated: number;
50781
51472
  /** Number of relations discovered. */
50782
51473
  relationsDiscovered: number;
51474
+ /**
51475
+ * Number of rows that collapsed onto a key value another row already
51476
+ * produced in the same run — the bound-key upsert merged them into one term.
51477
+ * Zero when the bound key identifies rows uniquely; named in `warnings` when
51478
+ * it is not.
51479
+ */
51480
+ rowsCollapsed: number;
50783
51481
  /** Number of sorts created (from pipeline). */
50784
51482
  sortsCreated: number;
50785
51483
  /** Number of types/tables discovered. */
@@ -55657,6 +56355,19 @@ declare class PreferencesClient {
55657
56355
  declare class Functions<SecurityDataType = unknown> {
55658
56356
  http: HttpClient<SecurityDataType>;
55659
56357
  constructor(http: HttpClient<SecurityDataType>);
56358
+ /**
56359
+ * @description # The disposition is the caller's `?callers=refuse` (the default) refuses while anything calls the function and names every caller; `?callers=orphan` withdraws it anyway and reports the callers left naming something that no longer resolves. A withdrawal that silently orphans its callers is the state the missing route already produced. # Authorization Requires `X-Tenant-Id`. The function store is tenant-keyed, so another tenant's function is `404` rather than forbidden. Every request is captured by the audit middleware.
56360
+ *
56361
+ * @tags functions
56362
+ * @name DeleteFunction
56363
+ * @summary Withdraw a registered function.
56364
+ * @request DELETE:/api/v1/functions/{name}
56365
+ * @secure
56366
+ */
56367
+ deleteFunction: (name: string, query?: {
56368
+ /** What to do about the things that call this function. */
56369
+ callers?: FunctionCallersDisposition$1;
56370
+ }, params?: RequestParams) => Promise<HttpResponse<FunctionWithdrawalReport$1, void>>;
55660
56371
  /**
55661
56372
  * @description Never writes to the KB — returns a validated draft for human review.
55662
56373
  *
@@ -55697,6 +56408,16 @@ declare class Functions<SecurityDataType = unknown> {
55697
56408
  * @secure
55698
56409
  */
55699
56410
  registerFunction: (data: RegisterFunctionRequest$1, params?: RequestParams) => Promise<HttpResponse<RegisterFunctionResponse$1, void>>;
56411
+ /**
56412
+ * @description # Why this is not `POST /functions/register` Registration already replaces by name — silently, reporting nothing about what it displaced. `PUT` is the operation that says so: it refuses when nothing is registered under the name (that is registration's job), and answers with the previous signature, the new one, whether the arity moved, and everything that calls the function. # The arity is the hazard A function's identity is its NAME, so a replacement keeps every caller's reference valid — nothing dangles. That is exactly why an arity change is dangerous rather than merely breaking: every call still resolves, and one passing the old number of arguments starts failing at evaluation time. Reported, not refused: the caller may be replacing the function precisely because its signature was wrong. # Authorization Identical to `DELETE`: tenant-keyed, plugin-owned functions refused, audited.
56413
+ *
56414
+ * @tags functions
56415
+ * @name ReplaceFunction
56416
+ * @summary Replace a registered function's definition.
56417
+ * @request PUT:/api/v1/functions/{name}
56418
+ * @secure
56419
+ */
56420
+ replaceFunction: (name: string, data: ReplaceFunctionRequest, params?: RequestParams) => Promise<HttpResponse<ReplaceFunctionResponse$1, void>>;
55700
56421
  }
55701
56422
 
55702
56423
  /**
@@ -56038,6 +56759,94 @@ type DraftFunctionResponse = {
56038
56759
  /** Non-fatal issues the user should see (e.g., unknown function references). */
56039
56760
  warnings: string[];
56040
56761
  };
56762
+ /** What a withdrawal does about the things that CALL the function. */
56763
+ type FunctionCallersDisposition = 'refuse' | 'orphan';
56764
+ /** Where a reference to a function lives. */
56765
+ type FunctionCallerKind = 'function' | 'rule';
56766
+ /**
56767
+ * One thing that calls a function.
56768
+ *
56769
+ * @remarks
56770
+ * A function is reachable by name from exactly two places: another registered
56771
+ * function's clause body, and a rule's `function_call` goal. Both are scanned
56772
+ * before a withdrawal, because removing the function underneath either leaves
56773
+ * the caller naming something that no longer resolves — and the failure
56774
+ * surfaces at evaluation time.
56775
+ */
56776
+ interface FunctionCaller {
56777
+ /** Where the reference lives. */
56778
+ kind: FunctionCallerKind;
56779
+ /**
56780
+ * The calling function's name, or a label for the calling rule — so a
56781
+ * refusal names something the caller can find.
56782
+ */
56783
+ name: string;
56784
+ /**
56785
+ * Term id of the calling rule's conclusion, or of the `function_call` goal
56786
+ * when no rule holds it. Absent for a function caller, which is identified
56787
+ * by name.
56788
+ */
56789
+ termId?: string;
56790
+ }
56791
+ /**
56792
+ * What withdrawing a registered function removed.
56793
+ *
56794
+ * @remarks
56795
+ * A function is carried TWICE — the durable `meta.function` carrier Ψ-term
56796
+ * that is the source of truth, and the evaluator's own registry used for
56797
+ * dispatch — so both are reported. Forgetting either leaves it half-alive:
56798
+ * still evaluable, or back after a restart.
56799
+ */
56800
+ interface FunctionWithdrawalReport {
56801
+ /** The function that was withdrawn. */
56802
+ name: string;
56803
+ /** Its stable id, as the registration reported it. */
56804
+ functionId: string;
56805
+ /**
56806
+ * Whether the durable carrier was deleted. `false` means the function is
56807
+ * gone from this process but its carrier survives, so a restart would bring
56808
+ * it back — the cue to retry.
56809
+ */
56810
+ carrierDeleted: boolean;
56811
+ /** Whether it left the in-process registry and the evaluator. */
56812
+ deregistered: boolean;
56813
+ /**
56814
+ * Everything still naming the function, left calling what no longer
56815
+ * resolves. Empty on the ordinary withdrawal; non-empty only under
56816
+ * `callers: 'orphan'`.
56817
+ */
56818
+ callersOrphaned: FunctionCaller[];
56819
+ }
56820
+ /** Result of replacing a registered function's definition. */
56821
+ interface ReplaceFunctionResponse {
56822
+ /** The function's name — unchanged by the replacement, by construction. */
56823
+ name: string;
56824
+ /**
56825
+ * The replacement's id. A fresh registration mints a new one, so it differs
56826
+ * from the previous definition's.
56827
+ */
56828
+ functionId: string;
56829
+ /** What the replaced definition looked like. */
56830
+ previous: FunctionSummaryDto;
56831
+ /** What the replacement looks like. */
56832
+ current: FunctionSummaryDto;
56833
+ /**
56834
+ * `true` when the arity changed.
56835
+ *
56836
+ * @remarks
56837
+ * A function's identity is its NAME, so a replacement keeps every caller's
56838
+ * reference valid — nothing dangles. That is exactly what makes an arity
56839
+ * change dangerous rather than merely breaking: every call still resolves,
56840
+ * and one passing the old argument count starts failing at evaluation time.
56841
+ */
56842
+ arityChanged: boolean;
56843
+ /**
56844
+ * Everything that calls this function. Reported rather than refused: the
56845
+ * replacement keeps the name resolvable, so no caller is orphaned — but one
56846
+ * written against the old signature may no longer be correct.
56847
+ */
56848
+ callers: FunctionCaller[];
56849
+ }
56041
56850
 
56042
56851
  type functions_AuthoringClarificationQuestionDto = AuthoringClarificationQuestionDto;
56043
56852
  type functions_BinaryOperatorDto = BinaryOperatorDto;
@@ -56047,18 +56856,23 @@ type functions_EvaluateFunctionRequest = EvaluateFunctionRequest;
56047
56856
  type functions_EvaluateFunctionResponse = EvaluateFunctionResponse;
56048
56857
  type functions_ExpressionDto = ExpressionDto;
56049
56858
  type functions_FunctionBodyDto = FunctionBodyDto;
56859
+ type functions_FunctionCaller = FunctionCaller;
56860
+ type functions_FunctionCallerKind = FunctionCallerKind;
56861
+ type functions_FunctionCallersDisposition = FunctionCallersDisposition;
56050
56862
  type functions_FunctionClauseDto = FunctionClauseDto;
56051
56863
  type functions_FunctionDraftDto = FunctionDraftDto;
56052
56864
  type functions_FunctionGuardDto = FunctionGuardDto;
56053
56865
  type functions_FunctionKindDto = FunctionKindDto;
56054
56866
  type functions_FunctionSummaryDto = FunctionSummaryDto;
56055
56867
  type functions_FunctionValueDto = FunctionValueDto;
56868
+ type functions_FunctionWithdrawalReport = FunctionWithdrawalReport;
56056
56869
  type functions_ListFunctionsResponse = ListFunctionsResponse;
56057
56870
  type functions_PatternDto = PatternDto;
56058
56871
  type functions_RegisterFunctionRequest = RegisterFunctionRequest;
56059
56872
  type functions_RegisterFunctionResponse = RegisterFunctionResponse;
56873
+ type functions_ReplaceFunctionResponse = ReplaceFunctionResponse;
56060
56874
  declare namespace functions {
56061
- export type { functions_AuthoringClarificationQuestionDto as AuthoringClarificationQuestionDto, functions_BinaryOperatorDto as BinaryOperatorDto, functions_DraftFunctionRequest as DraftFunctionRequest, functions_DraftFunctionResponse as DraftFunctionResponse, functions_EvaluateFunctionRequest as EvaluateFunctionRequest, functions_EvaluateFunctionResponse as EvaluateFunctionResponse, functions_ExpressionDto as ExpressionDto, functions_FunctionBodyDto as FunctionBodyDto, functions_FunctionClauseDto as FunctionClauseDto, functions_FunctionDraftDto as FunctionDraftDto, functions_FunctionGuardDto as FunctionGuardDto, functions_FunctionKindDto as FunctionKindDto, functions_FunctionSummaryDto as FunctionSummaryDto, functions_FunctionValueDto as FunctionValueDto, functions_ListFunctionsResponse as ListFunctionsResponse, functions_PatternDto as PatternDto, functions_RegisterFunctionRequest as RegisterFunctionRequest, functions_RegisterFunctionResponse as RegisterFunctionResponse };
56875
+ export type { functions_AuthoringClarificationQuestionDto as AuthoringClarificationQuestionDto, functions_BinaryOperatorDto as BinaryOperatorDto, functions_DraftFunctionRequest as DraftFunctionRequest, functions_DraftFunctionResponse as DraftFunctionResponse, functions_EvaluateFunctionRequest as EvaluateFunctionRequest, functions_EvaluateFunctionResponse as EvaluateFunctionResponse, functions_ExpressionDto as ExpressionDto, functions_FunctionBodyDto as FunctionBodyDto, functions_FunctionCaller as FunctionCaller, functions_FunctionCallerKind as FunctionCallerKind, functions_FunctionCallersDisposition as FunctionCallersDisposition, functions_FunctionClauseDto as FunctionClauseDto, functions_FunctionDraftDto as FunctionDraftDto, functions_FunctionGuardDto as FunctionGuardDto, functions_FunctionKindDto as FunctionKindDto, functions_FunctionSummaryDto as FunctionSummaryDto, functions_FunctionValueDto as FunctionValueDto, functions_FunctionWithdrawalReport as FunctionWithdrawalReport, functions_ListFunctionsResponse as ListFunctionsResponse, functions_PatternDto as PatternDto, functions_RegisterFunctionRequest as RegisterFunctionRequest, functions_RegisterFunctionResponse as RegisterFunctionResponse, functions_ReplaceFunctionResponse as ReplaceFunctionResponse };
56062
56876
  }
56063
56877
 
56064
56878
  /**
@@ -56205,6 +57019,78 @@ declare class FunctionsClient {
56205
57019
  * ```
56206
57020
  */
56207
57021
  listFunctions(): Promise<ListFunctionsResponse>;
57022
+ /**
57023
+ * Withdraw a registered function.
57024
+ *
57025
+ * @param name - The registered function's name — its identity.
57026
+ * @param options - `callers` decides what happens to the things that call
57027
+ * it. Defaults to `'refuse'`.
57028
+ * @returns What the withdrawal removed, in each representation that held it.
57029
+ * @throws {ApiError} 400 if something still calls the function under the
57030
+ * default `'refuse'` (the body carries `code: 'function_has_callers'` and
57031
+ * the caller list); 403 for a plugin-contributed function; 404 if nothing
57032
+ * is registered under that name.
57033
+ *
57034
+ * @remarks
57035
+ * A function is carried twice — the durable `meta.function` carrier that is
57036
+ * the source of truth, and the evaluator's own registry used for dispatch
57037
+ * and recursive cross-calls — and the report names both, because forgetting
57038
+ * either leaves it half-alive: still evaluable, or back after a restart.
57039
+ *
57040
+ * `'refuse'` names every caller; `'orphan'` withdraws anyway and reports the
57041
+ * callers left naming something that no longer resolves.
57042
+ *
57043
+ * @example
57044
+ * ```typescript
57045
+ * const report = await client.functions.deleteFunction('scale', { callers: 'orphan' });
57046
+ * for (const orphan of report.callersOrphaned) {
57047
+ * console.warn(`${orphan.kind} ${orphan.name} now calls a function that is gone`);
57048
+ * }
57049
+ * ```
57050
+ */
57051
+ deleteFunction(name: string, options?: {
57052
+ callers?: FunctionCallersDisposition;
57053
+ }): Promise<FunctionWithdrawalReport>;
57054
+ /**
57055
+ * Replace a registered function's definition.
57056
+ *
57057
+ * @param name - The registered function's name. Unchanged by the
57058
+ * replacement — the name IS the identity.
57059
+ * @param request - The replacement's arity and clauses.
57060
+ * @returns Both signatures, whether the arity moved, and everything that
57061
+ * calls the function.
57062
+ * @throws {ApiError} 400 if the replacement's clauses are rejected — in
57063
+ * which case the registration is left exactly as it was; 403 for a
57064
+ * plugin-contributed function; 404 if nothing is registered under that
57065
+ * name (creating one is {@link FunctionsClient.registerFunction}'s job).
57066
+ *
57067
+ * @remarks
57068
+ * `registerFunction` already replaces by name — silently, reporting nothing
57069
+ * about what it displaced. This is the operation that says so.
57070
+ *
57071
+ * A function's identity is its NAME, so a replacement keeps every caller's
57072
+ * reference valid: nothing dangles. That is exactly why an arity change is
57073
+ * the dangerous edit — every call still resolves, and one passing the old
57074
+ * argument count starts failing at evaluation time. `arityChanged` is
57075
+ * reported rather than refused, because a caller may be replacing the
57076
+ * function precisely because its signature was wrong.
57077
+ *
57078
+ * @example
57079
+ * ```typescript
57080
+ * const result = await client.functions.replaceFunction('scale', {
57081
+ * arity: 2,
57082
+ * clauses: [multiplyClause],
57083
+ * });
57084
+ * if (result.arityChanged) {
57085
+ * console.warn(`arity ${result.previous.arity} -> ${result.current.arity};`,
57086
+ * `${result.callers.length} caller(s) were written against the old one`);
57087
+ * }
57088
+ * ```
57089
+ */
57090
+ replaceFunction(name: string, request: {
57091
+ arity: number;
57092
+ clauses: FunctionClauseDto[];
57093
+ }): Promise<ReplaceFunctionResponse>;
56208
57094
  /**
56209
57095
  * Draft a user-defined function from a natural-language description.
56210
57096
  *
@@ -58574,6 +59460,16 @@ interface ClearTenantResponse {
58574
59460
  inferenceStateCleared: boolean;
58575
59461
  /** Whether the cache was invalidated. */
58576
59462
  cacheInvalidated: boolean;
59463
+ /**
59464
+ * Number of vector-store points deleted for this tenant.
59465
+ *
59466
+ * @remarks
59467
+ * Reported separately because it is the one count an erasure request cannot
59468
+ * verify any other way: vector payloads carry the embedded text, so a wipe
59469
+ * that left them behind would report every table emptied while the tenant's
59470
+ * data stayed readable by similarity search.
59471
+ */
59472
+ vectorsDeleted: number;
58577
59473
  /**
58578
59474
  * Number of plugin-marketplace install records forgotten for this tenant.
58579
59475
  *
@@ -66857,11 +67753,49 @@ interface BulkBindSortsResponse {
66857
67753
  /**
66858
67754
  * Summary of a single active sort-table binding.
66859
67755
  */
67756
+ interface KeyProvenanceDto {
67757
+ /**
67758
+ * Which authority chose the key: `source_constraint`,
67759
+ * `synthetic_record_id`, `sequence_default`, `schema_declared_identifier`,
67760
+ * `naming_convention`, `sampled_uniqueness`, `client_supplied`, `keyless`
67761
+ * or `unrecorded`.
67762
+ */
67763
+ source: string;
67764
+ /**
67765
+ * Which side settled it: `discovery`, `client`, `nobody` (a keyless
67766
+ * binding), or `unrecorded`.
67767
+ */
67768
+ chosenBy: string;
67769
+ /** One sentence stating what this key source means, in plain words. */
67770
+ explanation: string;
67771
+ /**
67772
+ * Whether some authority guarantees the key identifies exactly one record.
67773
+ * Absent where the question has no answer — a keyless binding, or a
67774
+ * provenance that was never recorded.
67775
+ */
67776
+ guaranteedUnique?: boolean | null;
67777
+ /**
67778
+ * Whether term ids built from this key survive a rebuild of the source:
67779
+ * `survives_source_rebuild` or `lifetime_scoped`. Absent for a
67780
+ * client-supplied key, where nothing declares it.
67781
+ */
67782
+ durability?: string | null;
67783
+ }
67784
+ /**
67785
+ * One active sort↔table binding.
67786
+ */
66860
67787
  interface BindingSummaryDto {
66861
67788
  /** Number of bound features/columns. */
66862
67789
  featureCount: number;
66863
67790
  /** Primary key column names. */
66864
67791
  keyColumns: string[];
67792
+ /**
67793
+ * Where the key columns came from, and what that implies for the durability
67794
+ * of ids derived from them. The column names cannot say it: `["title"]`
67795
+ * looks identical whether a uniqueness constraint backs it or an operator
67796
+ * nominated it.
67797
+ */
67798
+ keyProvenance: KeyProvenanceDto;
66865
67799
  /** Sort ID (UUID string). */
66866
67800
  sortId: string;
66867
67801
  /** External source identifier. */
@@ -66993,11 +67927,12 @@ type ontologyBridge_ImportFoundryRequest = ImportFoundryRequest;
66993
67927
  type ontologyBridge_ImportFoundryResponse = ImportFoundryResponse;
66994
67928
  type ontologyBridge_ImportOwlRequest = ImportOwlRequest;
66995
67929
  type ontologyBridge_ImportOwlResponse = ImportOwlResponse;
67930
+ type ontologyBridge_KeyProvenanceDto = KeyProvenanceDto;
66996
67931
  type ontologyBridge_ListBindingsResponse = ListBindingsResponse;
66997
67932
  type ontologyBridge_TranspileRequest = TranspileRequest;
66998
67933
  type ontologyBridge_TranspileResponse = TranspileResponse;
66999
67934
  declare namespace ontologyBridge {
67000
- export type { ontologyBridge_BindSortRequest as BindSortRequest, ontologyBridge_BindSortResponse as BindSortResponse, ontologyBridge_BindingSummaryDto as BindingSummaryDto, ontologyBridge_BulkBindError as BulkBindError, ontologyBridge_BulkBindSortsRequest as BulkBindSortsRequest, ontologyBridge_BulkBindSortsResponse as BulkBindSortsResponse, ontologyBridge_ColumnMappingDto as ColumnMappingDto, ontologyBridge_FoundryReviewItemDto as FoundryReviewItemDto, ontologyBridge_GroundedSchemaResponse as GroundedSchemaResponse, ontologyBridge_ImportFoundryRequest as ImportFoundryRequest, ontologyBridge_ImportFoundryResponse as ImportFoundryResponse, ontologyBridge_ImportOwlRequest as ImportOwlRequest, ontologyBridge_ImportOwlResponse as ImportOwlResponse, ontologyBridge_ListBindingsResponse as ListBindingsResponse, ontologyBridge_TranspileRequest as TranspileRequest, ontologyBridge_TranspileResponse as TranspileResponse };
67935
+ export type { ontologyBridge_BindSortRequest as BindSortRequest, ontologyBridge_BindSortResponse as BindSortResponse, ontologyBridge_BindingSummaryDto as BindingSummaryDto, ontologyBridge_BulkBindError as BulkBindError, ontologyBridge_BulkBindSortsRequest as BulkBindSortsRequest, ontologyBridge_BulkBindSortsResponse as BulkBindSortsResponse, ontologyBridge_ColumnMappingDto as ColumnMappingDto, ontologyBridge_FoundryReviewItemDto as FoundryReviewItemDto, ontologyBridge_GroundedSchemaResponse as GroundedSchemaResponse, ontologyBridge_ImportFoundryRequest as ImportFoundryRequest, ontologyBridge_ImportFoundryResponse as ImportFoundryResponse, ontologyBridge_ImportOwlRequest as ImportOwlRequest, ontologyBridge_ImportOwlResponse as ImportOwlResponse, ontologyBridge_KeyProvenanceDto as KeyProvenanceDto, ontologyBridge_ListBindingsResponse as ListBindingsResponse, ontologyBridge_TranspileRequest as TranspileRequest, ontologyBridge_TranspileResponse as TranspileResponse };
67001
67936
  }
67002
67937
 
67003
67938
  /**