@kortexya/reasoninglayer 1.24.0 → 1.26.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.cts 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.24.0";
112
+ declare const SDK_VERSION = "1.26.0";
113
113
  /**
114
114
  * Authentication mode for the SDK.
115
115
  *
@@ -2532,8 +2532,17 @@ interface BeliefDto$1 {
2532
2532
  */
2533
2533
  sort_id?: string | null;
2534
2534
  }
2535
- /** Binary operator for expressions */
2536
- type BinaryOperatorDto$1 = "Add" | "Subtract" | "Multiply" | "Divide";
2535
+ /**
2536
+ * Binary operator for expressions.
2537
+ *
2538
+ * The full algebra the domain's `BinaryOperator` carries, not a subset of it.
2539
+ * Four arithmetic operators were declared here while the engine had fourteen,
2540
+ * and OSFQL `DERIVE` builds function bodies with every one of them
2541
+ * (`osfql/executor.rs`, `ir_expression_to_function_expr`) — so a definition
2542
+ * created that way could not be expressed in this shape, and a read that
2543
+ * answered in this shape had to either drop it or lie about it (#235).
2544
+ */
2545
+ type BinaryOperatorDto$1 = "Add" | "Subtract" | "Multiply" | "Divide" | "Modulo" | "LessThan" | "LessThanOrEqual" | "GreaterThan" | "GreaterThanOrEqual" | "Equal" | "NotEqual" | "And" | "Or";
2537
2546
  /** Request to bind a sort to a SQL table. */
2538
2547
  interface BindSortRequest$1 {
2539
2548
  /** Column mappings: feature name to column spec. */
@@ -2646,7 +2655,7 @@ interface BindingSummaryDto$1 {
2646
2655
  * uniqueness constraint backs it or an operator ticked it, and those two
2647
2656
  * have opposite durability.
2648
2657
  */
2649
- key_provenance: KeyProvenanceDto;
2658
+ key_provenance: KeyProvenanceDto$1;
2650
2659
  /** Sort ID (UUID string). */
2651
2660
  sort_id: string;
2652
2661
  /**
@@ -5574,6 +5583,22 @@ interface CondResponse$1 {
5574
5583
  condition_succeeded: boolean;
5575
5584
  success: boolean;
5576
5585
  }
5586
+ /**
5587
+ * One `WHEN cond THEN value` branch of a conditional expression.
5588
+ *
5589
+ * The domain carries these as an unnamed `(Expression, Expression)` pair.
5590
+ * A two-element JSON array would round-trip just as well and read as nothing
5591
+ * at all, so the wire shape names both halves.
5592
+ */
5593
+ interface ConditionalBranchDto$1 {
5594
+ /**
5595
+ * The value of the whole conditional when this is the first branch whose
5596
+ * condition is `true`.
5597
+ */
5598
+ then: ExpressionDto$1;
5599
+ /** The condition, evaluated in source order against the clause's bindings. */
5600
+ when: ExpressionDto$1;
5601
+ }
5577
5602
  interface ConditionalIndependenceRequest$1 {
5578
5603
  /** Conditioning set */
5579
5604
  conditioning_set: string[];
@@ -8053,7 +8078,7 @@ interface DiscoveredFeatureDto$1 {
8053
8078
  * rebuild of the source: a uniqueness constraint does, a graph's internal
8054
8079
  * record id does not.
8055
8080
  */
8056
- identifier_provenance?: null | KeyProvenanceDto;
8081
+ identifier_provenance?: null | KeyProvenanceDto$1;
8057
8082
  /** Whether the field is a primary key/identifier */
8058
8083
  is_identifier: boolean;
8059
8084
  /** Whether the field is a relation */
@@ -10694,7 +10719,16 @@ type ExpressionDto$1 = {
10694
10719
  } | {
10695
10720
  /** Arithmetic/logical expression */
10696
10721
  left: ExpressionDto$1;
10697
- /** Binary operator for expressions */
10722
+ /**
10723
+ * Binary operator for expressions.
10724
+ *
10725
+ * The full algebra the domain's `BinaryOperator` carries, not a subset of it.
10726
+ * Four arithmetic operators were declared here while the engine had fourteen,
10727
+ * and OSFQL `DERIVE` builds function bodies with every one of them
10728
+ * (`osfql/executor.rs`, `ir_expression_to_function_expr`) — so a definition
10729
+ * created that way could not be expressed in this shape, and a read that
10730
+ * answered in this shape had to either drop it or lie about it (#235).
10731
+ */
10698
10732
  op: BinaryOperatorDto$1;
10699
10733
  /** Arithmetic/logical expression */
10700
10734
  right: ExpressionDto$1;
@@ -10703,6 +10737,16 @@ type ExpressionDto$1 = {
10703
10737
  arguments: ExpressionDto$1[];
10704
10738
  function_name: string;
10705
10739
  type: "FunctionCall";
10740
+ } | {
10741
+ /** Unary operator for expressions. */
10742
+ op: UnaryOperatorDto$1;
10743
+ /** Arithmetic/logical expression */
10744
+ operand: ExpressionDto$1;
10745
+ type: "UnaryOp";
10746
+ } | {
10747
+ branches: ConditionalBranchDto$1[];
10748
+ default?: null | ExpressionDto$1;
10749
+ type: "Conditional";
10706
10750
  };
10707
10751
  /** Extended agent state DTO with full cognitive state. */
10708
10752
  interface ExtendedAgentStateDto$1 {
@@ -11417,7 +11461,23 @@ type FeatureTypeDto$1 = "string" | "integer" | "real" | "boolean" | "reference"
11417
11461
  * - null
11418
11462
  * - array of FeatureValueDto
11419
11463
  */
11420
- type FeatureValueDto$1 = string | number | boolean | null | FeatureValueDto$1[];
11464
+ type FeatureValueDto$1 = {
11465
+ term_id: string;
11466
+ var_name: string;
11467
+ } | {
11468
+ /**
11469
+ * Feature value in a Ψ-term (untagged union). Can be:
11470
+ * - UUID string (term reference)
11471
+ * - string value
11472
+ * - integer (i64)
11473
+ * - number (f64)
11474
+ * - boolean
11475
+ * - null
11476
+ * - array of FeatureValueDto
11477
+ */
11478
+ literal: FeatureValueDto$1;
11479
+ term_id: string;
11480
+ } | string | number | boolean | null | FeatureValueDto$1[];
11421
11481
  /** Request to finalize a live oversight session. */
11422
11482
  interface FinalizeSessionRequest {
11423
11483
  /** Optional execution log (for full provenance) */
@@ -12099,10 +12159,49 @@ type FunctionBodyDto$1 = {
12099
12159
  program: string;
12100
12160
  type: "Neural";
12101
12161
  };
12162
+ /** One thing that calls a function. */
12163
+ interface FunctionCallerDto {
12164
+ /** Where the reference lives. */
12165
+ kind: FunctionCallerKind$1;
12166
+ /**
12167
+ * The calling function's name, or the rule conclusion's display, so a
12168
+ * refusal names something the caller can find.
12169
+ */
12170
+ name: string;
12171
+ /**
12172
+ * Term id of the calling rule's conclusion, or of the `function_call`
12173
+ * goal term when no rule holds it. Absent for a function caller, which is
12174
+ * identified by name.
12175
+ * @format uuid
12176
+ */
12177
+ term_id?: string | null;
12178
+ }
12179
+ /** What names a function — where the reference lives. */
12180
+ type FunctionCallerKind$1 = "function" | "rule";
12181
+ /**
12182
+ * What `DELETE /api/v1/functions/{name}` does about the things that CALL the
12183
+ * function.
12184
+ *
12185
+ * A function is reachable by name from two places: another registered
12186
+ * function's clause body (`FunctionCall`), and a rule's `function_call` goal.
12187
+ * Removing it underneath either leaves the caller naming something that no
12188
+ * longer resolves, and the failure surfaces at evaluation time — which is
12189
+ * exactly what "no route at all, recover with a tenant wipe" already produced
12190
+ * and what this route exists to stop being the default.
12191
+ */
12192
+ type FunctionCallersDisposition$1 = "refuse" | "orphan";
12102
12193
  /** A single clause in a function definition */
12103
12194
  interface FunctionClauseDto$1 {
12104
12195
  /** Function body - what to compute */
12105
12196
  body: FunctionBodyDto$1;
12197
+ /**
12198
+ * The clause's guard, if it has one.
12199
+ *
12200
+ * Omitted rather than serialized as `null` when absent, so what
12201
+ * `GET /api/v1/functions/{name}` emits is byte-for-byte a body
12202
+ * `register` and `PUT` accept (#235). An explicit `"guard": null` is
12203
+ * still accepted on the way in.
12204
+ */
12106
12205
  guard?: null | GuardDto;
12107
12206
  parameters: PatternDto$1[];
12108
12207
  }
@@ -12118,6 +12217,26 @@ interface FunctionDraftDto$1 {
12118
12217
  }
12119
12218
  /** Execution kind for a registered function. */
12120
12219
  type FunctionKindDto$1 = "Classic" | "Neural";
12220
+ /**
12221
+ * Why a registered function cannot be replaced, in the same terms the
12222
+ * mutation route would answer with.
12223
+ *
12224
+ * Mirrors `RuleNotWithdrawableDto`: the read tells a client what the write
12225
+ * would say, so a UI can present the function without offering an edit that
12226
+ * is going to be refused.
12227
+ */
12228
+ interface FunctionNotReplaceableDto$1 {
12229
+ /**
12230
+ * The stable machine-readable discriminator `PUT` and `DELETE` carry —
12231
+ * currently `function_plugin_owned`.
12232
+ */
12233
+ code: string;
12234
+ /**
12235
+ * The refusal in words, naming the lifecycle operation that DOES remove
12236
+ * the function.
12237
+ */
12238
+ reason: string;
12239
+ }
12121
12240
  /**
12122
12241
  * Typed signature summary for a single registered function.
12123
12242
  *
@@ -12189,6 +12308,36 @@ type FunctionValueDto$1 = {
12189
12308
  } | {
12190
12309
  type: "Uninstantiated";
12191
12310
  };
12311
+ /**
12312
+ * What withdrawing a registered function removed.
12313
+ *
12314
+ * A function is carried twice — the durable `meta.function` carrier Ψ-term
12315
+ * that is the source of truth, and the evaluator's own registry used for
12316
+ * dispatch — so both are reported. Forgetting either leaves it half-alive.
12317
+ */
12318
+ interface FunctionWithdrawalReport$1 {
12319
+ /**
12320
+ * Everything that still names the function, left calling something that
12321
+ * no longer resolves. Empty on the ordinary withdrawal; non-empty only
12322
+ * under `?callers=orphan`, which is the disposition that permits it.
12323
+ */
12324
+ callers_orphaned?: FunctionCallerDto[];
12325
+ /**
12326
+ * Whether the durable `meta.function` carrier Ψ-term was deleted. `false`
12327
+ * means the function is gone from this process but its carrier survives,
12328
+ * so a restart would bring it back — the operator's cue to retry.
12329
+ */
12330
+ carrier_deleted: boolean;
12331
+ /** Whether it left the in-process registry and the evaluator. */
12332
+ deregistered: boolean;
12333
+ /**
12334
+ * Its stable id, as the registration reported it.
12335
+ * @format uuid
12336
+ */
12337
+ function_id: string;
12338
+ /** The function that was withdrawn. */
12339
+ name: string;
12340
+ }
12192
12341
  /**
12193
12342
  * Request: render the LIFE-function definitions in the tenant's
12194
12343
  * term store.
@@ -13099,6 +13248,87 @@ interface GetFactsResponse$1 {
13099
13248
  /** List of facts */
13100
13249
  facts: PsiTermDto$1[];
13101
13250
  }
13251
+ /**
13252
+ * Response of `GET /api/v1/functions/{name}` — the registered definition.
13253
+ *
13254
+ * # Why the clauses come back in the register shape
13255
+ *
13256
+ * `PUT /api/v1/functions/{name}` reports what it displaced — `previous`,
13257
+ * `current`, `arity_changed`, every caller — and all of that describes the
13258
+ * change AFTER it happened. Nothing let a caller see what they were about to
13259
+ * overwrite, so a client editing one clause of a three-clause function had to
13260
+ * re-author the other two from memory (#235).
13261
+ *
13262
+ * [`Self::clauses`] is therefore the exact payload
13263
+ * `PUT /api/v1/functions/{name}` and `POST /api/v1/functions/register` accept:
13264
+ * a read-modify-write is an edit, not a re-authoring, and needs no
13265
+ * translation layer that could drop a body variant on the way through.
13266
+ *
13267
+ * # And why `clauses` is optional
13268
+ *
13269
+ * The clause shape is total over every construct the engine can currently
13270
+ * build — that is what widening `BinaryOperatorDto` and `ExpressionDto` was
13271
+ * for. It is NOT total over the domain's `Value`, which carries Ψ-terms,
13272
+ * lists, geometries and more that no function producer emits.
13273
+ *
13274
+ * If one ever appears, the read declines to describe it rather than
13275
+ * degrading it to `Uninstantiated`: `clauses` is absent,
13276
+ * [`Self::unrepresentable`] names what stopped it, and the signature fields
13277
+ * still answer. A wrong definition presented as a right one is the failure
13278
+ * this route exists to prevent, and a `PUT` of it would destroy the real one.
13279
+ */
13280
+ interface GetFunctionResponse$1 {
13281
+ /**
13282
+ * The number of named arguments it accepts.
13283
+ * @min 0
13284
+ */
13285
+ arity: number;
13286
+ /**
13287
+ * Everything that calls this function, by the same scan `DELETE` refuses
13288
+ * on and `PUT` reports.
13289
+ *
13290
+ * Read before offering an edit: a replacement that changes the arity
13291
+ * keeps every one of these resolvable and makes every one of them wrong.
13292
+ */
13293
+ callers?: FunctionCallerDto[];
13294
+ /**
13295
+ * The pattern-matched clauses, tried in order — in the shape
13296
+ * `register` and `PUT` accept.
13297
+ *
13298
+ * Absent only when the definition holds a construct this shape cannot
13299
+ * express, in which case [`Self::unrepresentable`] says which.
13300
+ */
13301
+ clauses?: FunctionClauseDto$1[] | null;
13302
+ /**
13303
+ * Its stable id, as the registration reported it.
13304
+ * @format uuid
13305
+ */
13306
+ function_id: string;
13307
+ /** Whether it is classical or neural/fuzzy. */
13308
+ kind: FunctionKindDto$1;
13309
+ /** The function's name — the key `POST /functions/evaluate` takes. */
13310
+ name: string;
13311
+ /**
13312
+ * When [`Self::replaceable`] is false, the refusal a `PUT` would produce
13313
+ * — the same `code` and the same prose. Absent otherwise.
13314
+ */
13315
+ not_replaceable?: null | FunctionNotReplaceableDto$1;
13316
+ /**
13317
+ * Whether `PUT`/`DELETE` on this function will act rather than refuse.
13318
+ *
13319
+ * Read through the same admission the mutation routes run, so the read
13320
+ * and the refusal cannot disagree. The engine stays the authority: a
13321
+ * state change between this read and the write can still refuse.
13322
+ */
13323
+ replaceable: boolean;
13324
+ /**
13325
+ * What stopped the definition being expressed in the register shape.
13326
+ *
13327
+ * Absent — not empty — on the ordinary read. Present with `clauses`
13328
+ * absent, never both.
13329
+ */
13330
+ unrepresentable?: string | null;
13331
+ }
13102
13332
  /** Request to read the fuzzy subsumption degree `sub ⊑· sup` */
13103
13333
  interface GetFuzzySubsumptionRequest {
13104
13334
  /**
@@ -16231,7 +16461,7 @@ type KbChangeDto$1 = {
16231
16461
  * *do the term ids survive a rebuild of the source?* — are readable without
16232
16462
  * inferring anything from a column's name.
16233
16463
  */
16234
- interface KeyProvenanceDto {
16464
+ interface KeyProvenanceDto$1 {
16235
16465
  /**
16236
16466
  * Which side settled the key: `discovery`, `client`, `nobody` (a keyless
16237
16467
  * binding), or `unrecorded`.
@@ -23193,6 +23423,92 @@ interface RepairHintDto {
23193
23423
  /** The feature or predicate the hint applies to. */
23194
23424
  target: string;
23195
23425
  }
23426
+ /**
23427
+ * Request body of `PUT /api/v1/functions/{name}` — the definition that
23428
+ * replaces the one registered under the path name.
23429
+ *
23430
+ * # Why it accepts the register payload verbatim
23431
+ *
23432
+ * `POST /functions/register` takes `{tenant_id, name, arity, clauses}`, and
23433
+ * that is the payload a client already has in hand when it decides to replace
23434
+ * something. Sending it to `PUT` is the obvious move, and under
23435
+ * `deny_unknown_fields` it would answer `422 unknown field 'tenant_id'` —
23436
+ * technically correct and unhelpful, since the caller's actual question is
23437
+ * about the two `name`s (#234).
23438
+ *
23439
+ * So both are declared, and each is handled explicitly rather than dropped:
23440
+ *
23441
+ * * `tenant_id` is **accepted and ignored**, exactly as `register_function`
23442
+ * ignores it — the tenant comes from the authenticated principal, and
23443
+ * trusting a body field would let a caller write into another tenant.
23444
+ * * `name`, when present, **must equal the path's**. A mismatch is refused
23445
+ * with both names rather than silently applying the clauses to whichever
23446
+ * one the route happened to read.
23447
+ *
23448
+ * A *declared* field that is deliberately ignored is a different thing from
23449
+ * an *undeclared* key that is silently dropped. The first is a documented
23450
+ * contract; the second is the defect this issue is about.
23451
+ */
23452
+ interface ReplaceFunctionRequest {
23453
+ /**
23454
+ * The number of named arguments the replacement accepts.
23455
+ * @min 0
23456
+ */
23457
+ arity: number;
23458
+ /** The replacement's pattern-matched clauses, tried in order. */
23459
+ clauses: FunctionClauseDto$1[];
23460
+ /**
23461
+ * The function's name. Optional, and when present it must equal the
23462
+ * path's — this route replaces a definition, it does not rename one.
23463
+ *
23464
+ * A rename would keep every caller's reference pointing at the OLD name,
23465
+ * which no longer resolves; that is a withdrawal plus a registration, and
23466
+ * the caller should say so.
23467
+ */
23468
+ name?: string | null;
23469
+ /**
23470
+ * Accepted so the `register` payload works verbatim, and **ignored**: the
23471
+ * tenant is the authenticated principal's, never a body field.
23472
+ * @format uuid
23473
+ */
23474
+ tenant_id?: string | null;
23475
+ }
23476
+ /**
23477
+ * Response of `PUT /api/v1/functions/{name}`.
23478
+ *
23479
+ * # Why the previous signature is reported
23480
+ *
23481
+ * A function's identity is its NAME, so a replacement keeps every caller's
23482
+ * reference valid — which is what makes an arity change dangerous rather than
23483
+ * merely breaking: a caller passing the old number of arguments keeps
23484
+ * resolving and starts failing at evaluation time with an arity error. The
23485
+ * response names the change so a client can say so.
23486
+ */
23487
+ interface ReplaceFunctionResponse$1 {
23488
+ /**
23489
+ * `true` when the arity changed. Every caller's reference stays valid and
23490
+ * every call passing the old count now fails at evaluation time.
23491
+ */
23492
+ arity_changed: boolean;
23493
+ /**
23494
+ * Everything that calls this function. Reported rather than refused: the
23495
+ * replacement keeps the name resolvable, so a caller is not orphaned —
23496
+ * but one written against the old signature may no longer be correct.
23497
+ */
23498
+ callers?: FunctionCallerDto[];
23499
+ /** What the replacement looks like. */
23500
+ current: FunctionSummaryDto$1;
23501
+ /**
23502
+ * The replacement's id. A fresh registration mints a new one, so this
23503
+ * differs from the previous definition's.
23504
+ * @format uuid
23505
+ */
23506
+ function_id: string;
23507
+ /** The function's name — unchanged by the replacement, by construction. */
23508
+ name: string;
23509
+ /** What the replaced definition looked like. */
23510
+ previous: FunctionSummaryDto$1;
23511
+ }
23196
23512
  /**
23197
23513
  * Response of `PUT /api/v1/inference/rules/{id}`.
23198
23514
  *
@@ -24909,12 +25225,63 @@ interface RuleEntryDto$1 {
24909
25225
  certainty?: number | null;
24910
25226
  /** The head (consequent) of the rule. */
24911
25227
  head: PsiTermDto$1;
25228
+ /**
25229
+ * When [`Self::withdrawable`] is false, the refusal a withdrawal attempt
25230
+ * would produce — the same prose, and the same `code`, the mutation route
25231
+ * answers with.
25232
+ *
25233
+ * Absent for a withdrawable rule.
25234
+ */
25235
+ not_withdrawable?: null | RuleNotWithdrawableDto;
25236
+ /**
25237
+ * Where this rule came from, from the reading tenant's point of view.
25238
+ *
25239
+ * The listing deliberately returns the PLUGIN-MERGED rule set and admits
25240
+ * the reserved system tenant's rules, because they fire in every tenant's
25241
+ * proof — so three of the withdrawal route's five refusal classes describe
25242
+ * rules that appear here (#232 §1).
25243
+ */
25244
+ origin: RuleOriginDto;
24912
25245
  /**
24913
25246
  * Rule term ID.
24914
25247
  * @format uuid
24915
25248
  */
24916
25249
  rule_id: string;
25250
+ /**
25251
+ * Whether `DELETE`/`PUT` on this rule will act rather than refuse.
25252
+ *
25253
+ * Derived from the same walk the mutation routes run, so the listing and
25254
+ * the refusal cannot disagree. The engine stays the authority: a caller
25255
+ * may still be refused by a state change between this read and the write.
25256
+ */
25257
+ withdrawable: boolean;
25258
+ }
25259
+ /**
25260
+ * Why a listed rule cannot be withdrawn, in the same terms the mutation route
25261
+ * would answer with.
25262
+ */
25263
+ interface RuleNotWithdrawableDto {
25264
+ /**
25265
+ * The stable machine-readable discriminator the `DELETE` would carry —
25266
+ * `rule_system_owned`, `rule_plugin_owned` or `rule_bootstrap`.
25267
+ */
25268
+ code: string;
25269
+ /**
25270
+ * The refusal in words, naming the lifecycle operation that DOES withdraw
25271
+ * this rule.
25272
+ */
25273
+ reason: string;
24917
25274
  }
25275
+ /**
25276
+ * Where a listed rule came from.
25277
+ *
25278
+ * The client-facing projection of the engine's provenance walk. A UI keys the
25279
+ * row's actions on this rather than on `_plugin_id` — the underscore-prefixed
25280
+ * provenance meta-feature the marketplace stamps on a plugin's clauses, which
25281
+ * is documented as invisible to domain queries and cannot tell a system-wide
25282
+ * plugin from a tenant-scoped one, nor see a bootstrap rule at all.
25283
+ */
25284
+ type RuleOriginDto = "tenant" | "system_plugin" | "tenant_plugin" | "bootstrap";
24918
25285
  /** Response with rule store info */
24919
25286
  interface RuleStoreResponse$1 {
24920
25287
  /** @min 0 */
@@ -30065,6 +30432,8 @@ interface UiAffinityDoc {
30065
30432
  }
30066
30433
  /** Complete hierarchy of UI component sorts */
30067
30434
  type UiSort$1 = "app" | "page" | "dashboard" | "grid" | "flex" | "stack" | "box" | "card" | "divider" | "spacer" | "navbar" | "sidebar" | "tabs" | "tab_panel" | "breadcrumbs" | "menu" | "menu_item" | "link" | "router" | "route" | "data_table" | "column" | "list" | "list_item" | "tree" | "tree_node" | "chart" | "stat" | "badge" | "avatar" | "icon" | "image" | "video" | "text" | "heading" | "paragraph" | "code" | "markdown" | "label" | "form" | "form_field" | "input" | "textarea" | "select" | "option" | "checkbox" | "radio" | "radio_group" | "toggle" | "slider" | "date_picker" | "time_picker" | "date_range_picker" | "file_upload" | "color_picker" | "autocomplete" | "search_input" | "button" | "button_group" | "icon_button" | "fab" | "dropdown_button" | "modal" | "dialog" | "drawer" | "popover" | "tooltip" | "toast" | "alert" | "progress" | "spinner" | "skeleton" | "accordion" | "accordion_item" | "collapsible" | "carousel" | "drag_drop_zone" | "draggable" | "drop_target" | "resizable" | "sortable_list" | "command_palette" | "wizard" | "wizard_step" | "timeline" | "timeline_item" | "kanban_board" | "kanban_column" | "kanban_card" | "calendar" | "rich_text_editor" | "conditional" | "for_each" | "show" | "suspense" | "error_boundary" | "portal" | "data_source" | "computed" | "state" | "effect" | "on_event" | "on_click" | "on_submit" | "on_change" | "sequence" | "navigate" | "api_call" | "set_state" | "show_toast" | "open_modal" | "close_modal" | "animate" | "transition" | "keyframes" | "auth_provider" | "protected_route" | "login_form" | "logout_button" | "user_profile" | "permission_gate" | "session_timeout" | "i18n_provider" | "trans" | "language_switcher" | "locale_date" | "locale_number" | "locale_currency" | "bidi" | "responsive" | "show_on_breakpoint" | "hide_on_breakpoint" | "container_query" | "aspect_ratio" | "theme_provider" | "theme_toggle" | "css_var" | "styled" | "color_scheme" | "screen_reader_only" | "skip_link" | "focus_trap" | "live_region" | "keyboard_nav" | "accessible_label" | "focus_ring" | "virtual_list" | "virtual_grid" | "virtual_table" | "infinite_scroll" | "lazy_load" | "code_split" | "prefetch" | "offline_indicator" | "sync_status" | "cache_control" | "background_sync" | "install_prompt" | "update_available" | "undo_provider" | "undo_button" | "redo_button" | "history_browser" | "snapshot" | "restore_point" | "hotkey" | "shortcut_hint" | "key_combo" | "shortcut_scope" | "global_search" | "search_results" | "search_highlight" | "search_filters" | "recent_searches" | "copy_button" | "paste_handler" | "share_button" | "qr_code" | "export_button" | "print_button" | "print_only" | "screen_only" | "pdf_preview" | "presence_indicator" | "cursor_overlay" | "typing_indicator" | "conflict_resolver" | "realtime_diff" | "notification_center" | "push_notification" | "inbox" | "unread_badge" | "notification_settings" | "debug_panel" | "state_inspector" | "perf_monitor" | "network_inspector" | "error_reporter" | "position" | "layer" | "overlay" | "fixed" | "sticky" | "form_state_provider" | "field_error" | "validation_schema" | "async_validator" | "cross_field_validation" | "pagination" | "cursor_pagination" | "load_more" | "page_size_selector" | "search_params" | "route_params" | "deep_link" | "url_state" | "query_binding" | "scroll_container" | "scroll_snap" | "scroll_lock" | "scroll_restore" | "scroll_to" | "scroll_spy" | "selection_provider" | "selectable" | "selection_actions" | "range_selection" | "gesture_handler" | "swipe_action" | "pinch_zoom" | "long_press" | "pan_gesture" | "multi_touch" | "file_download" | "file_preview" | "file_progress" | "file_browser" | "drop_zone" | "image_cropper" | "animation_controller" | "animation_timeline" | "spring" | "motion_value" | "animate_presence" | "stagger" | "focus_scope" | "focus_manager" | "auto_focus" | "restore_focus" | "merge_conflict" | "conflict_resolution" | "version_indicator" | "tenant_provider" | "tenant_switcher" | "tenant_branding" | "audit_log" | "activity_feed" | "change_history" | "feature_gate" | "feature_provider" | "beta_badge" | "experiment" | "variant" | "experiment_provider" | "analytics" | "page_view" | "click_tracker" | "event_tracker" | "rate_limit_indicator" | "maintenance_mode" | "system_status" | "scheduled_downtime" | "document_head" | "meta_tag" | "document_title" | "open_graph" | "structured_data" | "video_call" | "audio_call" | "screen_share" | "media_stream" | "camera_capture" | "audio_recorder" | "canvas2_d" | "web_g_l" | "drawing_canvas" | "signature_pad" | "geolocation" | "device_orientation" | "camera" | "barcode_scanner" | "local_storage_binding" | "session_storage_binding" | "indexed_db_binding";
30435
+ /** Unary operator for expressions. */
30436
+ type UnaryOperatorDto$1 = "Not" | "Negate";
30068
30437
  interface UncertainEdgeDto$1 {
30069
30438
  /** Possible directions */
30070
30439
  possible_directions: [string, string][];
@@ -32224,20 +32593,71 @@ type FeatureTargetDto = TaggedFeatureValueDto | string;
32224
32593
  * Do NOT use with term CRUD or query endpoints — use {@link ValueDto} instead.
32225
32594
  *
32226
32595
  * The backend Rust type is `FeatureValueDto` in `dto/homoiconic.rs` with
32227
- * `#[serde(untagged)]`. Variant ordering:
32228
- * 1. TermRef (UUID string)
32229
- * 2. TermRefs/List (array of FeatureValueDto)
32230
- * 3. String
32231
- * 4. Integer (i64)
32232
- * 5. Real (f64)
32233
- * 6. Boolean
32234
- * 7. Null (uninstantiated)
32596
+ * `#[serde(untagged)]`. Variant ordering — **load-bearing**, because an
32597
+ * untagged union tries its variants in declaration order and an object with
32598
+ * extra keys still matches an earlier variant that ignores them:
32599
+ * 1. Variable (`{term_id, var_name}`)
32600
+ * 2. Literal (`{term_id, literal}`)
32601
+ * 3. TermRef (`{term_id}`)
32602
+ * 4. TermRefs/List (array of FeatureValueDto)
32603
+ * 5. String
32604
+ * 6. Integer (i64)
32605
+ * 7. Real (f64)
32606
+ * 8. Boolean
32607
+ * 9. Null (uninstantiated)
32235
32608
  *
32236
32609
  * **Ambiguity note**: UUID strings and regular strings are both `string` in TypeScript.
32237
32610
  * The backend distinguishes them by UUID format. The SDK provides
32238
32611
  * `discriminateFeatureValue()` in `utils/discrimination.ts` for response parsing.
32239
32612
  */
32240
- type FeatureValueDto = string | number | boolean | null | FeatureValueDto[];
32613
+ type FeatureValueDto = VariableFeatureValue | LiteralFeatureValue | TermRefFeatureValue | string | number | boolean | null | FeatureValueDto[];
32614
+ /**
32615
+ * A feature bound to a LOGIC VARIABLE, carrying the name the rule author wrote.
32616
+ *
32617
+ * @remarks
32618
+ * A variable and a reference to a stored term are both `Value::Reference` in
32619
+ * the engine, so both used to arrive as a bare {@link TermRefFeatureValue} —
32620
+ * nothing in a rule's features said that `name` was bound to `?N` rather than
32621
+ * to a term, and the name existed only inside the `display` prose (#232 §2).
32622
+ *
32623
+ * `termId` is the variable term's, so **two features bound to the same variable
32624
+ * carry the same id**. That is how a client reads the coreference which makes
32625
+ * `senior(name: ?N) WHEN person(name: ?N)` a join rather than two independent
32626
+ * patterns.
32627
+ */
32628
+ interface VariableFeatureValue {
32629
+ /** The variable term's UUID. Shared by every feature bound to it. */
32630
+ term_id: string;
32631
+ /** The variable's name as authored, e.g. `?N`. */
32632
+ var_name: string;
32633
+ }
32634
+ /**
32635
+ * A feature bound to an INTERNED LITERAL WRAPPER, carrying the scalar it holds.
32636
+ *
32637
+ * @remarks
32638
+ * The engine interns a guard's bound as a term — `65` becomes an
32639
+ * `integer_type` Ψ-term — so reading it used to cost one `GET /terms/{id}` per
32640
+ * guard, and the summary that exists to save that round trip named the
32641
+ * wrapper's SORT rather than its value (#232 §4).
32642
+ */
32643
+ interface LiteralFeatureValue {
32644
+ /** The wrapper term's UUID. */
32645
+ term_id: string;
32646
+ /** The scalar the wrapper holds. */
32647
+ literal: FeatureValueDto;
32648
+ }
32649
+ /**
32650
+ * A reference to another term, with nothing said about what it is.
32651
+ *
32652
+ * @remarks
32653
+ * What a reference falls back to when it is neither a named variable nor an
32654
+ * interned literal — an ordinary stored term, or an anonymous variable, which
32655
+ * carries no name to report.
32656
+ */
32657
+ interface TermRefFeatureValue {
32658
+ /** The referenced term's UUID. */
32659
+ term_id: string;
32660
+ }
32241
32661
 
32242
32662
  type values_BellShape = BellShape;
32243
32663
  type values_BooleanValue = BooleanValue;
@@ -32253,6 +32673,7 @@ type values_GaussianProductShape = GaussianProductShape;
32253
32673
  type values_GaussianShape = GaussianShape;
32254
32674
  type values_IntegerValue = IntegerValue;
32255
32675
  type values_ListValue = ListValue;
32676
+ type values_LiteralFeatureValue = LiteralFeatureValue;
32256
32677
  type values_PiShapeShape = PiShapeShape;
32257
32678
  type values_PiecewiseLinearShape = PiecewiseLinearShape;
32258
32679
  type values_RealValue = RealValue;
@@ -32266,13 +32687,15 @@ type values_SortIdValue = SortIdValue;
32266
32687
  type values_SpikeShape = SpikeShape;
32267
32688
  type values_StringValue = StringValue;
32268
32689
  type values_TaggedFeatureValueDto = TaggedFeatureValueDto;
32690
+ type values_TermRefFeatureValue = TermRefFeatureValue;
32269
32691
  type values_TrapezoidalShape = TrapezoidalShape;
32270
32692
  type values_TriangularShape = TriangularShape;
32271
32693
  type values_UninstantiatedValue = UninstantiatedValue;
32272
32694
  type values_ValueDto = ValueDto;
32695
+ type values_VariableFeatureValue = VariableFeatureValue;
32273
32696
  type values_ZShapeShape = ZShapeShape;
32274
32697
  declare namespace values {
32275
- 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 };
32698
+ 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 };
32276
32699
  }
32277
32700
 
32278
32701
  /**
@@ -33871,6 +34294,11 @@ interface FindBySortRequest {
33871
34294
  sortName?: string | null;
33872
34295
  /** Optional filter for feature-based filtering. */
33873
34296
  filter?: Record<string, string> | null;
34297
+ /**
34298
+ * Cap on the number of terms returned, applied after the filter. Omit (or
34299
+ * pass 0) for no cap.
34300
+ */
34301
+ limit?: number | null;
33874
34302
  }
33875
34303
  /**
33876
34304
  * Request to validate a term against its sort's type witnesses.
@@ -35367,6 +35795,58 @@ interface RuleEntryDto {
35367
35795
  body: PsiTermDto[];
35368
35796
  /** Optional certainty/confidence for the rule. */
35369
35797
  certainty?: number | null;
35798
+ /**
35799
+ * Where this rule came from, from the reading tenant's point of view.
35800
+ *
35801
+ * @remarks
35802
+ * The listing deliberately returns the PLUGIN-MERGED rule set and admits the
35803
+ * reserved system tenant's rules, because they fire in every tenant's proof
35804
+ * — so three of the withdrawal route's five refusal classes describe rules
35805
+ * that appear here.
35806
+ */
35807
+ origin: RuleOrigin;
35808
+ /**
35809
+ * Whether `deleteRule` / `replaceRule` will act on this rule rather than
35810
+ * refuse.
35811
+ *
35812
+ * @remarks
35813
+ * Derived from the same walk the mutation routes run, so the listing and the
35814
+ * refusal cannot disagree. The engine stays the authority: a caller may
35815
+ * still be refused by a state change between this read and the write.
35816
+ */
35817
+ withdrawable: boolean;
35818
+ /**
35819
+ * When {@link RuleEntryDto.withdrawable} is false, the refusal a withdrawal
35820
+ * would produce — the same `code` and prose the mutation route answers with.
35821
+ * Absent for a withdrawable rule.
35822
+ */
35823
+ notWithdrawable?: RuleNotWithdrawable;
35824
+ }
35825
+ /**
35826
+ * Where a listed rule came from.
35827
+ *
35828
+ * @remarks
35829
+ * A UI keys a row's actions on this rather than on `_plugin_id` — the
35830
+ * underscore-prefixed provenance meta-feature the marketplace stamps on a
35831
+ * plugin's clauses, which is documented as invisible to domain queries, cannot
35832
+ * tell a system-wide plugin from a tenant-scoped one, and sees nothing at all
35833
+ * for a bootstrap rule.
35834
+ *
35835
+ * - `tenant` — authored in this tenant. The only withdrawable origin.
35836
+ * - `system_plugin` — a system-wide plugin's rule, firing in every tenant's proof.
35837
+ * - `tenant_plugin` — contributed by a plugin installed in this tenant.
35838
+ * - `bootstrap` — engine machinery (an Allen relation, a handler mapping).
35839
+ */
35840
+ type RuleOrigin = 'tenant' | 'system_plugin' | 'tenant_plugin' | 'bootstrap';
35841
+ /** Why a listed rule cannot be withdrawn, in the mutation route's own terms. */
35842
+ interface RuleNotWithdrawable {
35843
+ /**
35844
+ * The stable discriminator the `DELETE` would carry — `rule_system_owned`,
35845
+ * `rule_plugin_owned` or `rule_bootstrap`.
35846
+ */
35847
+ code: string;
35848
+ /** The refusal in words, naming the lifecycle operation that DOES withdraw it. */
35849
+ reason: string;
35370
35850
  }
35371
35851
  /** Response listing all rules for a tenant. */
35372
35852
  interface GetRulesResponse {
@@ -35796,6 +36276,8 @@ type inference_RuleDerivationsDisposition = RuleDerivationsDisposition;
35796
36276
  type inference_RuleDraftClarificationQuestionDto = RuleDraftClarificationQuestionDto;
35797
36277
  type inference_RuleDraftDto = RuleDraftDto;
35798
36278
  type inference_RuleEntryDto = RuleEntryDto;
36279
+ type inference_RuleNotWithdrawable = RuleNotWithdrawable;
36280
+ type inference_RuleOrigin = RuleOrigin;
35799
36281
  type inference_RuleTermDraftDto = RuleTermDraftDto;
35800
36282
  type inference_RuleWithdrawalReport = RuleWithdrawalReport;
35801
36283
  type inference_SolutionDto = SolutionDto;
@@ -35803,7 +36285,7 @@ type inference_TaggedDerivedFact = TaggedDerivedFact;
35803
36285
  type inference_TaggedForwardChainRequest = TaggedForwardChainRequest;
35804
36286
  type inference_TaggedForwardChainResponse = TaggedForwardChainResponse;
35805
36287
  declare namespace inference {
35806
- 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_RuleTermDraftDto as RuleTermDraftDto, inference_RuleWithdrawalReport as RuleWithdrawalReport, inference_SolutionDto as SolutionDto, inference_TaggedDerivedFact as TaggedDerivedFact, inference_TaggedForwardChainRequest as TaggedForwardChainRequest, inference_TaggedForwardChainResponse as TaggedForwardChainResponse };
36288
+ 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 };
35807
36289
  }
35808
36290
 
35809
36291
  /**
@@ -51132,12 +51614,25 @@ interface StructuredIngestionStatsDto {
51132
51614
  entitiesCreated: number;
51133
51615
  /** Number of entities extracted (from pipeline). */
51134
51616
  entitiesExtracted: number;
51617
+ /**
51618
+ * Number of records the source reported as available for the ingested
51619
+ * tables, before any cap or collapse. Compared with `recordsProcessed` a cap
51620
+ * hit is visible; compared with `termsCreated`, a partial ingest is.
51621
+ */
51622
+ recordsAvailable: number;
51135
51623
  /** Number of source records processed. */
51136
51624
  recordsProcessed: number;
51137
51625
  /** Number of relations created. */
51138
51626
  relationsCreated: number;
51139
51627
  /** Number of relations discovered. */
51140
51628
  relationsDiscovered: number;
51629
+ /**
51630
+ * Number of rows that collapsed onto a key value another row already
51631
+ * produced in the same run — the bound-key upsert merged them into one term.
51632
+ * Zero when the bound key identifies rows uniquely; named in `warnings` when
51633
+ * it is not.
51634
+ */
51635
+ rowsCollapsed: number;
51141
51636
  /** Number of sorts created (from pipeline). */
51142
51637
  sortsCreated: number;
51143
51638
  /** Number of types/tables discovered. */
@@ -56015,6 +56510,19 @@ declare class PreferencesClient {
56015
56510
  declare class Functions<SecurityDataType = unknown> {
56016
56511
  http: HttpClient<SecurityDataType>;
56017
56512
  constructor(http: HttpClient<SecurityDataType>);
56513
+ /**
56514
+ * @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.
56515
+ *
56516
+ * @tags functions
56517
+ * @name DeleteFunction
56518
+ * @summary Withdraw a registered function.
56519
+ * @request DELETE:/api/v1/functions/{name}
56520
+ * @secure
56521
+ */
56522
+ deleteFunction: (name: string, query?: {
56523
+ /** What to do about the things that call this function. */
56524
+ callers?: FunctionCallersDisposition$1;
56525
+ }, params?: RequestParams) => Promise<HttpResponse<FunctionWithdrawalReport$1, void>>;
56018
56526
  /**
56019
56527
  * @description Never writes to the KB — returns a validated draft for human review.
56020
56528
  *
@@ -56035,6 +56543,16 @@ declare class Functions<SecurityDataType = unknown> {
56035
56543
  * @secure
56036
56544
  */
56037
56545
  evaluateFunction: (data: EvaluateFunctionRequest$1, params?: RequestParams) => Promise<HttpResponse<EvaluateFunctionResponse$1, void>>;
56546
+ /**
56547
+ * @description # Why this route had to exist `/api/v1/functions` had five routes and none of them returned a definition: the listing answers summaries (`name`, `arity`, `clauses_count`, `kind`), and `GET /api/v1/functions/{name}` was a `405`. So `PUT` replaced a definition its caller could not see — a client fixing one clause of a three-clause function had to remember the other two or lose them, and the route made a partial edit look like a whole one (#235). # The clauses come back in the shape `PUT` takes [`GetFunctionResponse::clauses`] is the exact `clauses` payload `POST /functions/register` and `PUT /functions/{name}` accept, so a read-modify-write needs no translation layer that could drop a body variant on the way through. Making that true meant widening the request shape: `BinaryOperatorDto` carried four of the domain's thirteen operators and `ExpressionDto` was missing `UnaryOp` and `Conditional`, while OSFQL `DERIVE` builds function bodies with every one of them. A read in the old shape would have had to drop a `CASE WHEN` or lie about a `%`. # Reading is not changing A plugin-contributed function is refused by `DELETE` and `PUT` and **returned** by this route, with `replaceable: false` and the refusal the mutation would answer with. The listing already admits it exists; refusing to describe it would leave a client unable to show what the plugin contributed while still showing its name. The refusal is read from the same walk the mutation routes run, so the two cannot disagree. # Authorization Requires `X-Tenant-Id`. The function store is tenant-keyed, so another tenant's function is `404` rather than forbidden — saying anything else would confirm the name exists somewhere.
56548
+ *
56549
+ * @tags functions
56550
+ * @name GetFunction
56551
+ * @summary Read one registered function's definition.
56552
+ * @request GET:/api/v1/functions/{name}
56553
+ * @secure
56554
+ */
56555
+ getFunction: (name: string, params?: RequestParams) => Promise<HttpResponse<GetFunctionResponse$1, void>>;
56038
56556
  /**
56039
56557
  * @description This is the discovery counterpart to `register_function`/`evaluate_function`: it projects the tenant's slice of the function sub-lattice into a list of typed signatures (name + arity + clause count) without evaluating anything. The tenant is taken from the authenticated principal (never a body field), honouring the tenancy-scoping invariant.
56040
56558
  *
@@ -56055,12 +56573,47 @@ declare class Functions<SecurityDataType = unknown> {
56055
56573
  * @secure
56056
56574
  */
56057
56575
  registerFunction: (data: RegisterFunctionRequest$1, params?: RequestParams) => Promise<HttpResponse<RegisterFunctionResponse$1, void>>;
56576
+ /**
56577
+ * @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.
56578
+ *
56579
+ * @tags functions
56580
+ * @name ReplaceFunction
56581
+ * @summary Replace a registered function's definition.
56582
+ * @request PUT:/api/v1/functions/{name}
56583
+ * @secure
56584
+ */
56585
+ replaceFunction: (name: string, data: ReplaceFunctionRequest, params?: RequestParams) => Promise<HttpResponse<ReplaceFunctionResponse$1, void>>;
56058
56586
  }
56059
56587
 
56060
56588
  /**
56061
56589
  * Binary operator for expressions within function bodies.
56590
+ *
56591
+ * @remarks
56592
+ * The whole algebra the engine carries, not the arithmetic corner of it. Four
56593
+ * operators were declared here while the engine had thirteen, and OSFQL
56594
+ * `DERIVE` builds function bodies with every one of them — so a definition
56595
+ * created that way could not be expressed in this shape, and a read that
56596
+ * answered in this shape had to drop it or lie about it (backend #235).
56062
56597
  */
56063
- type BinaryOperatorDto = 'Add' | 'Subtract' | 'Multiply' | 'Divide';
56598
+ type BinaryOperatorDto = 'Add' | 'Subtract' | 'Multiply' | 'Divide' | 'Modulo' | 'LessThan' | 'LessThanOrEqual' | 'GreaterThan' | 'GreaterThanOrEqual' | 'Equal' | 'NotEqual' | 'And' | 'Or';
56599
+ /** Unary operator for expressions within function bodies. */
56600
+ type UnaryOperatorDto = 'Not' | 'Negate';
56601
+ /**
56602
+ * One `WHEN cond THEN value` branch of a {@link ExpressionDto} `Conditional`.
56603
+ *
56604
+ * @remarks
56605
+ * The engine carries these as an unnamed pair; the wire names both halves,
56606
+ * because a two-element array round-trips as well and reads as nothing.
56607
+ */
56608
+ interface ConditionalBranchDto {
56609
+ /** The condition, evaluated in source order against the clause's bindings. */
56610
+ when: ExpressionDto;
56611
+ /**
56612
+ * The value of the whole conditional when this is the first branch whose
56613
+ * condition holds.
56614
+ */
56615
+ then: ExpressionDto;
56616
+ }
56064
56617
  /**
56065
56618
  * Value type for LIFE-style function literals.
56066
56619
  *
@@ -56104,6 +56657,16 @@ type ExpressionDto = {
56104
56657
  type: 'FunctionCall';
56105
56658
  functionName: string;
56106
56659
  arguments: ExpressionDto[];
56660
+ } | {
56661
+ type: 'UnaryOp';
56662
+ op: UnaryOperatorDto;
56663
+ operand: ExpressionDto;
56664
+ } | {
56665
+ type: 'Conditional';
56666
+ /** Branches, tried in order; the first whose `when` holds supplies the value. */
56667
+ branches: ConditionalBranchDto[];
56668
+ /** The value when no branch holds. `null` when the conditional has none. */
56669
+ default?: ExpressionDto | null;
56107
56670
  };
56108
56671
  /**
56109
56672
  * Function body — what a clause computes.
@@ -56396,27 +56959,231 @@ type DraftFunctionResponse = {
56396
56959
  /** Non-fatal issues the user should see (e.g., unknown function references). */
56397
56960
  warnings: string[];
56398
56961
  };
56962
+ /** What a withdrawal does about the things that CALL the function. */
56963
+ type FunctionCallersDisposition = 'refuse' | 'orphan';
56964
+ /** Where a reference to a function lives. */
56965
+ type FunctionCallerKind = 'function' | 'rule';
56966
+ /**
56967
+ * One thing that calls a function.
56968
+ *
56969
+ * @remarks
56970
+ * A function is reachable by name from exactly two places: another registered
56971
+ * function's clause body, and a rule's `function_call` goal. Both are scanned
56972
+ * before a withdrawal, because removing the function underneath either leaves
56973
+ * the caller naming something that no longer resolves — and the failure
56974
+ * surfaces at evaluation time.
56975
+ */
56976
+ interface FunctionCaller {
56977
+ /** Where the reference lives. */
56978
+ kind: FunctionCallerKind;
56979
+ /**
56980
+ * The calling function's name, or a label for the calling rule — so a
56981
+ * refusal names something the caller can find.
56982
+ */
56983
+ name: string;
56984
+ /**
56985
+ * Term id of the calling rule's conclusion, or of the `function_call` goal
56986
+ * when no rule holds it. Absent for a function caller, which is identified
56987
+ * by name.
56988
+ */
56989
+ termId?: string;
56990
+ }
56991
+ /**
56992
+ * What withdrawing a registered function removed.
56993
+ *
56994
+ * @remarks
56995
+ * A function is carried TWICE — the durable `meta.function` carrier Ψ-term
56996
+ * that is the source of truth, and the evaluator's own registry used for
56997
+ * dispatch — so both are reported. Forgetting either leaves it half-alive:
56998
+ * still evaluable, or back after a restart.
56999
+ */
57000
+ interface FunctionWithdrawalReport {
57001
+ /** The function that was withdrawn. */
57002
+ name: string;
57003
+ /** Its stable id, as the registration reported it. */
57004
+ functionId: string;
57005
+ /**
57006
+ * Whether the durable carrier was deleted. `false` means the function is
57007
+ * gone from this process but its carrier survives, so a restart would bring
57008
+ * it back — the cue to retry.
57009
+ */
57010
+ carrierDeleted: boolean;
57011
+ /** Whether it left the in-process registry and the evaluator. */
57012
+ deregistered: boolean;
57013
+ /**
57014
+ * Everything still naming the function, left calling what no longer
57015
+ * resolves. Empty on the ordinary withdrawal; non-empty only under
57016
+ * `callers: 'orphan'`.
57017
+ */
57018
+ callersOrphaned: FunctionCaller[];
57019
+ }
57020
+ /**
57021
+ * Why a registered function cannot be replaced, in the terms the mutation
57022
+ * route would answer with.
57023
+ *
57024
+ * @remarks
57025
+ * The read tells a client what the write would say, so a surface can present
57026
+ * the function without offering an edit that is going to be refused.
57027
+ */
57028
+ interface FunctionNotReplaceableDto {
57029
+ /**
57030
+ * The stable machine-readable discriminator `PUT` and `DELETE` carry —
57031
+ * currently `'function_plugin_owned'`.
57032
+ */
57033
+ code: string;
57034
+ /** The refusal in words, naming the lifecycle operation that DOES remove it. */
57035
+ reason: string;
57036
+ }
57037
+ /**
57038
+ * The signature half of a read definition — everything that answers whether or
57039
+ * not the clauses could be expressed.
57040
+ */
57041
+ interface FunctionDefinitionSignature {
57042
+ /** The function's name — the key `POST /functions/evaluate` takes. */
57043
+ name: string;
57044
+ /** Its stable id, as the registration reported it. */
57045
+ functionId: string;
57046
+ /** The number of named arguments it accepts. */
57047
+ arity: number;
57048
+ /** Whether it is classical or neural/fuzzy. */
57049
+ kind: FunctionKindDto;
57050
+ /**
57051
+ * Whether `PUT`/`DELETE` on this function will act rather than refuse.
57052
+ *
57053
+ * Read through the same admission the mutation routes run, so the read and
57054
+ * the refusal cannot disagree. The engine stays the authority: a state
57055
+ * change between this read and the write can still refuse.
57056
+ */
57057
+ replaceable: boolean;
57058
+ /** The refusal a `PUT` would produce. Absent while `replaceable` is true. */
57059
+ notReplaceable?: FunctionNotReplaceableDto;
57060
+ /**
57061
+ * Everything that calls this function, by the same scan `DELETE` refuses on
57062
+ * and `PUT` reports.
57063
+ *
57064
+ * Read before offering an edit: a replacement that changes the arity keeps
57065
+ * every one of these resolvable and makes every one of them wrong. Empty
57066
+ * when nothing calls it.
57067
+ */
57068
+ callers: FunctionCaller[];
57069
+ }
57070
+ /**
57071
+ * One registered function's definition, as `GET /functions/{name}` answers it.
57072
+ *
57073
+ * @remarks
57074
+ * ## The clauses come back in the shape `PUT` takes
57075
+ *
57076
+ * The `clauses` of a readable definition are the exact payload
57077
+ * {@link FunctionsClient.registerFunction} and
57078
+ * {@link FunctionsClient.replaceFunction} accept, so a read-modify-write is an
57079
+ * edit rather than a re-authoring. That is the point of the route: `PUT`
57080
+ * replaces the WHOLE definition, so before it a client fixing one clause of a
57081
+ * three-clause function had to remember the other two or lose them.
57082
+ *
57083
+ * ## Withheld is not empty, and the type says so
57084
+ *
57085
+ * `clauses: []` is a function with no clauses. A definition holding a
57086
+ * construct the register shape cannot express comes back with no `clauses` at
57087
+ * all and an `unrepresentable` reason — the engine declines to describe it
57088
+ * rather than degrading it, because a `PUT` of a degraded read would destroy
57089
+ * the real definition.
57090
+ *
57091
+ * The two are modelled as a union rather than two optional fields, so a client
57092
+ * cannot read `clauses` without first ruling the withheld case out:
57093
+ *
57094
+ * ```typescript
57095
+ * const definition = await client.functions.getFunction('scale');
57096
+ * if (definition.clauses === undefined) {
57097
+ * console.warn(`cannot edit scale: ${definition.unrepresentable}`);
57098
+ * } else {
57099
+ * await client.functions.replaceFunction('scale', {
57100
+ * arity: definition.arity,
57101
+ * clauses: [...definition.clauses, extraClause],
57102
+ * });
57103
+ * }
57104
+ * ```
57105
+ *
57106
+ * ## Reading is not changing
57107
+ *
57108
+ * A plugin-contributed function is refused by `DELETE`/`PUT` and RETURNED
57109
+ * here, with `replaceable: false` and the refusal the mutation would give.
57110
+ */
57111
+ type GetFunctionResponse = FunctionDefinitionSignature & ({
57112
+ /**
57113
+ * The pattern-matched clauses, tried in order — in the shape
57114
+ * `register` and `PUT` accept.
57115
+ */
57116
+ clauses: FunctionClauseDto[];
57117
+ unrepresentable?: undefined;
57118
+ } | {
57119
+ clauses?: undefined;
57120
+ /**
57121
+ * What stopped the definition being expressed in the register shape.
57122
+ * Present only with the clauses absent, never alongside them.
57123
+ */
57124
+ unrepresentable: string;
57125
+ });
57126
+ /** Result of replacing a registered function's definition. */
57127
+ interface ReplaceFunctionResponse {
57128
+ /** The function's name — unchanged by the replacement, by construction. */
57129
+ name: string;
57130
+ /**
57131
+ * The replacement's id. A fresh registration mints a new one, so it differs
57132
+ * from the previous definition's.
57133
+ */
57134
+ functionId: string;
57135
+ /** What the replaced definition looked like. */
57136
+ previous: FunctionSummaryDto;
57137
+ /** What the replacement looks like. */
57138
+ current: FunctionSummaryDto;
57139
+ /**
57140
+ * `true` when the arity changed.
57141
+ *
57142
+ * @remarks
57143
+ * A function's identity is its NAME, so a replacement keeps every caller's
57144
+ * reference valid — nothing dangles. That is exactly what makes an arity
57145
+ * change dangerous rather than merely breaking: every call still resolves,
57146
+ * and one passing the old argument count starts failing at evaluation time.
57147
+ */
57148
+ arityChanged: boolean;
57149
+ /**
57150
+ * Everything that calls this function. Reported rather than refused: the
57151
+ * replacement keeps the name resolvable, so no caller is orphaned — but one
57152
+ * written against the old signature may no longer be correct.
57153
+ */
57154
+ callers: FunctionCaller[];
57155
+ }
56399
57156
 
56400
57157
  type functions_AuthoringClarificationQuestionDto = AuthoringClarificationQuestionDto;
56401
57158
  type functions_BinaryOperatorDto = BinaryOperatorDto;
57159
+ type functions_ConditionalBranchDto = ConditionalBranchDto;
56402
57160
  type functions_DraftFunctionRequest = DraftFunctionRequest;
56403
57161
  type functions_DraftFunctionResponse = DraftFunctionResponse;
56404
57162
  type functions_EvaluateFunctionRequest = EvaluateFunctionRequest;
56405
57163
  type functions_EvaluateFunctionResponse = EvaluateFunctionResponse;
56406
57164
  type functions_ExpressionDto = ExpressionDto;
56407
57165
  type functions_FunctionBodyDto = FunctionBodyDto;
57166
+ type functions_FunctionCaller = FunctionCaller;
57167
+ type functions_FunctionCallerKind = FunctionCallerKind;
57168
+ type functions_FunctionCallersDisposition = FunctionCallersDisposition;
56408
57169
  type functions_FunctionClauseDto = FunctionClauseDto;
57170
+ type functions_FunctionDefinitionSignature = FunctionDefinitionSignature;
56409
57171
  type functions_FunctionDraftDto = FunctionDraftDto;
56410
57172
  type functions_FunctionGuardDto = FunctionGuardDto;
56411
57173
  type functions_FunctionKindDto = FunctionKindDto;
57174
+ type functions_FunctionNotReplaceableDto = FunctionNotReplaceableDto;
56412
57175
  type functions_FunctionSummaryDto = FunctionSummaryDto;
56413
57176
  type functions_FunctionValueDto = FunctionValueDto;
57177
+ type functions_FunctionWithdrawalReport = FunctionWithdrawalReport;
57178
+ type functions_GetFunctionResponse = GetFunctionResponse;
56414
57179
  type functions_ListFunctionsResponse = ListFunctionsResponse;
56415
57180
  type functions_PatternDto = PatternDto;
56416
57181
  type functions_RegisterFunctionRequest = RegisterFunctionRequest;
56417
57182
  type functions_RegisterFunctionResponse = RegisterFunctionResponse;
57183
+ type functions_ReplaceFunctionResponse = ReplaceFunctionResponse;
57184
+ type functions_UnaryOperatorDto = UnaryOperatorDto;
56418
57185
  declare namespace functions {
56419
- 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 };
57186
+ export type { functions_AuthoringClarificationQuestionDto as AuthoringClarificationQuestionDto, functions_BinaryOperatorDto as BinaryOperatorDto, functions_ConditionalBranchDto as ConditionalBranchDto, 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_FunctionDefinitionSignature as FunctionDefinitionSignature, functions_FunctionDraftDto as FunctionDraftDto, functions_FunctionGuardDto as FunctionGuardDto, functions_FunctionKindDto as FunctionKindDto, functions_FunctionNotReplaceableDto as FunctionNotReplaceableDto, functions_FunctionSummaryDto as FunctionSummaryDto, functions_FunctionValueDto as FunctionValueDto, functions_FunctionWithdrawalReport as FunctionWithdrawalReport, functions_GetFunctionResponse as GetFunctionResponse, functions_ListFunctionsResponse as ListFunctionsResponse, functions_PatternDto as PatternDto, functions_RegisterFunctionRequest as RegisterFunctionRequest, functions_RegisterFunctionResponse as RegisterFunctionResponse, functions_ReplaceFunctionResponse as ReplaceFunctionResponse, functions_UnaryOperatorDto as UnaryOperatorDto };
56420
57187
  }
56421
57188
 
56422
57189
  /**
@@ -56563,6 +57330,118 @@ declare class FunctionsClient {
56563
57330
  * ```
56564
57331
  */
56565
57332
  listFunctions(): Promise<ListFunctionsResponse>;
57333
+ /**
57334
+ * Read one registered function's definition.
57335
+ *
57336
+ * @param name - The registered function's name — its identity.
57337
+ * @returns The signature, everything that calls it, whether a `PUT` would
57338
+ * act or refuse, and the clauses in the shape a replacement takes.
57339
+ * @throws {ApiError} 404 if nothing is registered under that name for the
57340
+ * authenticated tenant. Another tenant's function is 404 too — saying
57341
+ * anything else would confirm the name exists somewhere.
57342
+ *
57343
+ * @remarks
57344
+ * This is what makes {@link FunctionsClient.replaceFunction} an edit. `PUT`
57345
+ * replaces the WHOLE definition, so without a read a client fixing one
57346
+ * clause of a three-clause function had to re-author the other two from
57347
+ * memory, and any it forgot were deleted.
57348
+ *
57349
+ * `clauses` and `unrepresentable` are exclusive: a definition holding a
57350
+ * construct the register shape cannot express comes back with no clauses and
57351
+ * a reason, because a degraded read written back would destroy the real
57352
+ * definition. Narrow on `clauses === undefined` before using them.
57353
+ *
57354
+ * A plugin-contributed function is refused by `DELETE`/`PUT` and returned
57355
+ * here, with `replaceable: false` and the refusal the mutation would give.
57356
+ *
57357
+ * @example
57358
+ * ```typescript
57359
+ * const definition = await client.functions.getFunction('scale');
57360
+ * if (definition.clauses === undefined) {
57361
+ * throw new Error(`scale cannot be edited: ${definition.unrepresentable}`);
57362
+ * }
57363
+ * if (!definition.replaceable) {
57364
+ * throw new Error(definition.notReplaceable?.reason);
57365
+ * }
57366
+ * await client.functions.replaceFunction('scale', {
57367
+ * arity: definition.arity,
57368
+ * clauses: definition.clauses.map(tweak),
57369
+ * });
57370
+ * ```
57371
+ */
57372
+ getFunction(name: string): Promise<GetFunctionResponse>;
57373
+ /**
57374
+ * Withdraw a registered function.
57375
+ *
57376
+ * @param name - The registered function's name — its identity.
57377
+ * @param options - `callers` decides what happens to the things that call
57378
+ * it. Defaults to `'refuse'`.
57379
+ * @returns What the withdrawal removed, in each representation that held it.
57380
+ * @throws {ApiError} 400 if something still calls the function under the
57381
+ * default `'refuse'` (the body carries `code: 'function_has_callers'` and
57382
+ * the caller list); 403 for a plugin-contributed function; 404 if nothing
57383
+ * is registered under that name.
57384
+ *
57385
+ * @remarks
57386
+ * A function is carried twice — the durable `meta.function` carrier that is
57387
+ * the source of truth, and the evaluator's own registry used for dispatch
57388
+ * and recursive cross-calls — and the report names both, because forgetting
57389
+ * either leaves it half-alive: still evaluable, or back after a restart.
57390
+ *
57391
+ * `'refuse'` names every caller; `'orphan'` withdraws anyway and reports the
57392
+ * callers left naming something that no longer resolves.
57393
+ *
57394
+ * @example
57395
+ * ```typescript
57396
+ * const report = await client.functions.deleteFunction('scale', { callers: 'orphan' });
57397
+ * for (const orphan of report.callersOrphaned) {
57398
+ * console.warn(`${orphan.kind} ${orphan.name} now calls a function that is gone`);
57399
+ * }
57400
+ * ```
57401
+ */
57402
+ deleteFunction(name: string, options?: {
57403
+ callers?: FunctionCallersDisposition;
57404
+ }): Promise<FunctionWithdrawalReport>;
57405
+ /**
57406
+ * Replace a registered function's definition.
57407
+ *
57408
+ * @param name - The registered function's name. Unchanged by the
57409
+ * replacement — the name IS the identity.
57410
+ * @param request - The replacement's arity and clauses.
57411
+ * @returns Both signatures, whether the arity moved, and everything that
57412
+ * calls the function.
57413
+ * @throws {ApiError} 400 if the replacement's clauses are rejected — in
57414
+ * which case the registration is left exactly as it was; 403 for a
57415
+ * plugin-contributed function; 404 if nothing is registered under that
57416
+ * name (creating one is {@link FunctionsClient.registerFunction}'s job).
57417
+ *
57418
+ * @remarks
57419
+ * `registerFunction` already replaces by name — silently, reporting nothing
57420
+ * about what it displaced. This is the operation that says so.
57421
+ *
57422
+ * A function's identity is its NAME, so a replacement keeps every caller's
57423
+ * reference valid: nothing dangles. That is exactly why an arity change is
57424
+ * the dangerous edit — every call still resolves, and one passing the old
57425
+ * argument count starts failing at evaluation time. `arityChanged` is
57426
+ * reported rather than refused, because a caller may be replacing the
57427
+ * function precisely because its signature was wrong.
57428
+ *
57429
+ * @example
57430
+ * ```typescript
57431
+ * const result = await client.functions.replaceFunction('scale', {
57432
+ * arity: 2,
57433
+ * clauses: [multiplyClause],
57434
+ * });
57435
+ * if (result.arityChanged) {
57436
+ * console.warn(`arity ${result.previous.arity} -> ${result.current.arity};`,
57437
+ * `${result.callers.length} caller(s) were written against the old one`);
57438
+ * }
57439
+ * ```
57440
+ */
57441
+ replaceFunction(name: string, request: {
57442
+ arity: number;
57443
+ clauses: FunctionClauseDto[];
57444
+ }): Promise<ReplaceFunctionResponse>;
56566
57445
  /**
56567
57446
  * Draft a user-defined function from a natural-language description.
56568
57447
  *
@@ -58932,6 +59811,16 @@ interface ClearTenantResponse {
58932
59811
  inferenceStateCleared: boolean;
58933
59812
  /** Whether the cache was invalidated. */
58934
59813
  cacheInvalidated: boolean;
59814
+ /**
59815
+ * Number of vector-store points deleted for this tenant.
59816
+ *
59817
+ * @remarks
59818
+ * Reported separately because it is the one count an erasure request cannot
59819
+ * verify any other way: vector payloads carry the embedded text, so a wipe
59820
+ * that left them behind would report every table emptied while the tenant's
59821
+ * data stayed readable by similarity search.
59822
+ */
59823
+ vectorsDeleted: number;
58935
59824
  /**
58936
59825
  * Number of plugin-marketplace install records forgotten for this tenant.
58937
59826
  *
@@ -67215,11 +68104,49 @@ interface BulkBindSortsResponse {
67215
68104
  /**
67216
68105
  * Summary of a single active sort-table binding.
67217
68106
  */
68107
+ interface KeyProvenanceDto {
68108
+ /**
68109
+ * Which authority chose the key: `source_constraint`,
68110
+ * `synthetic_record_id`, `sequence_default`, `schema_declared_identifier`,
68111
+ * `naming_convention`, `sampled_uniqueness`, `client_supplied`, `keyless`
68112
+ * or `unrecorded`.
68113
+ */
68114
+ source: string;
68115
+ /**
68116
+ * Which side settled it: `discovery`, `client`, `nobody` (a keyless
68117
+ * binding), or `unrecorded`.
68118
+ */
68119
+ chosenBy: string;
68120
+ /** One sentence stating what this key source means, in plain words. */
68121
+ explanation: string;
68122
+ /**
68123
+ * Whether some authority guarantees the key identifies exactly one record.
68124
+ * Absent where the question has no answer — a keyless binding, or a
68125
+ * provenance that was never recorded.
68126
+ */
68127
+ guaranteedUnique?: boolean | null;
68128
+ /**
68129
+ * Whether term ids built from this key survive a rebuild of the source:
68130
+ * `survives_source_rebuild` or `lifetime_scoped`. Absent for a
68131
+ * client-supplied key, where nothing declares it.
68132
+ */
68133
+ durability?: string | null;
68134
+ }
68135
+ /**
68136
+ * One active sort↔table binding.
68137
+ */
67218
68138
  interface BindingSummaryDto {
67219
68139
  /** Number of bound features/columns. */
67220
68140
  featureCount: number;
67221
68141
  /** Primary key column names. */
67222
68142
  keyColumns: string[];
68143
+ /**
68144
+ * Where the key columns came from, and what that implies for the durability
68145
+ * of ids derived from them. The column names cannot say it: `["title"]`
68146
+ * looks identical whether a uniqueness constraint backs it or an operator
68147
+ * nominated it.
68148
+ */
68149
+ keyProvenance: KeyProvenanceDto;
67223
68150
  /** Sort ID (UUID string). */
67224
68151
  sortId: string;
67225
68152
  /** External source identifier. */
@@ -67351,11 +68278,12 @@ type ontologyBridge_ImportFoundryRequest = ImportFoundryRequest;
67351
68278
  type ontologyBridge_ImportFoundryResponse = ImportFoundryResponse;
67352
68279
  type ontologyBridge_ImportOwlRequest = ImportOwlRequest;
67353
68280
  type ontologyBridge_ImportOwlResponse = ImportOwlResponse;
68281
+ type ontologyBridge_KeyProvenanceDto = KeyProvenanceDto;
67354
68282
  type ontologyBridge_ListBindingsResponse = ListBindingsResponse;
67355
68283
  type ontologyBridge_TranspileRequest = TranspileRequest;
67356
68284
  type ontologyBridge_TranspileResponse = TranspileResponse;
67357
68285
  declare namespace ontologyBridge {
67358
- 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 };
68286
+ 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 };
67359
68287
  }
67360
68288
 
67361
68289
  /**