@kortexya/reasoninglayer 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +465 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +693 -7
- package/dist/index.d.ts +693 -7
- package/dist/index.js +464 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
112
|
+
declare const SDK_VERSION = "1.4.0";
|
|
113
113
|
/**
|
|
114
114
|
* Authentication mode for the SDK.
|
|
115
115
|
*
|
|
@@ -2058,6 +2058,55 @@ interface BulkRejectRequest$1 {
|
|
|
2058
2058
|
*/
|
|
2059
2059
|
reviewed_by: string;
|
|
2060
2060
|
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Request body for bulk-retract: list of term ids to retract.
|
|
2063
|
+
*
|
|
2064
|
+
* Phase 2 v2 entry point for retraction. The supervisor downstream
|
|
2065
|
+
* BFS-retracts every dependent derived fact through
|
|
2066
|
+
* [`DerivedFactsRepository::find_dependents`](osfkb_domain::ports::DerivedFactsRepository::find_dependents)
|
|
2067
|
+
* + [`DerivedFactsRepository::decrement_proof_count`](osfkb_domain::ports::DerivedFactsRepository::decrement_proof_count).
|
|
2068
|
+
*
|
|
2069
|
+
* # Tenant Context
|
|
2070
|
+
* The tenant is determined from the `X-Tenant-Id` header. The
|
|
2071
|
+
* `term_ids` are resolved against that tenant's working memory only.
|
|
2072
|
+
*/
|
|
2073
|
+
interface BulkRetractTermsRequest {
|
|
2074
|
+
/**
|
|
2075
|
+
* Identifiers of the terms to remove from the working memory.
|
|
2076
|
+
* Phase 2 supervisor downstream BFS-retracts every dependent
|
|
2077
|
+
* derived fact through `find_dependents` + `decrement_proof_count`.
|
|
2078
|
+
*/
|
|
2079
|
+
term_ids: string[];
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Response from bulk term retraction.
|
|
2083
|
+
*
|
|
2084
|
+
* Mirrors [`BulkAddTermsResponse`] with retraction-specific semantics.
|
|
2085
|
+
* The endpoint is idempotent: term ids that do not exist in the
|
|
2086
|
+
* working memory are silently skipped (symmetric with how
|
|
2087
|
+
* `bulk_add_terms` ignores duplicate ids when an explicit `id` is
|
|
2088
|
+
* supplied for a term that already exists).
|
|
2089
|
+
*/
|
|
2090
|
+
interface BulkRetractTermsResponse {
|
|
2091
|
+
/**
|
|
2092
|
+
* Processing time including PG removal + supervisor enqueue.
|
|
2093
|
+
* @min 0
|
|
2094
|
+
*/
|
|
2095
|
+
processing_time_ms: number;
|
|
2096
|
+
/**
|
|
2097
|
+
* The subset of `term_ids` actually removed (those that existed).
|
|
2098
|
+
* Order matches the input order, restricted to the ids that were
|
|
2099
|
+
* present in the working memory.
|
|
2100
|
+
*/
|
|
2101
|
+
removed_term_ids: string[];
|
|
2102
|
+
/**
|
|
2103
|
+
* Number of terms successfully removed (those not present in the
|
|
2104
|
+
* store are silently skipped — symmetric with `bulk_add_terms`'s
|
|
2105
|
+
* idempotency).
|
|
2106
|
+
* @min 0
|
|
2107
|
+
*/
|
|
2108
|
+
terms_removed: number;
|
|
2109
|
+
}
|
|
2061
2110
|
/** Response from bulk review actions */
|
|
2062
2111
|
interface BulkReviewResponse {
|
|
2063
2112
|
/** Review IDs that failed with reasons */
|
|
@@ -10585,6 +10634,37 @@ interface MatchedEntityDto$1 {
|
|
|
10585
10634
|
*/
|
|
10586
10635
|
term_id: string;
|
|
10587
10636
|
}
|
|
10637
|
+
/**
|
|
10638
|
+
* Snapshot of the per-tenant Phase 2 materialization sentinel for the
|
|
10639
|
+
* status endpoint.
|
|
10640
|
+
*/
|
|
10641
|
+
interface MaterializationStateSnapshot {
|
|
10642
|
+
/**
|
|
10643
|
+
* Tenant `derived_facts` count when the sentinel was written.
|
|
10644
|
+
* @format int64
|
|
10645
|
+
* @min 0
|
|
10646
|
+
*/
|
|
10647
|
+
derived_count_at_bootstrap: number;
|
|
10648
|
+
/**
|
|
10649
|
+
* Tenant `terms` count when the sentinel was written.
|
|
10650
|
+
* @format int64
|
|
10651
|
+
* @min 0
|
|
10652
|
+
*/
|
|
10653
|
+
fact_count_at_bootstrap: number;
|
|
10654
|
+
/**
|
|
10655
|
+
* Wall-clock instant of the most recent rebuild handler call,
|
|
10656
|
+
* in Unix milliseconds.
|
|
10657
|
+
* @format int64
|
|
10658
|
+
* @min 0
|
|
10659
|
+
*/
|
|
10660
|
+
last_bootstrap_at_ms: number;
|
|
10661
|
+
/**
|
|
10662
|
+
* Supervisor LSN observed at the moment the sentinel was written.
|
|
10663
|
+
* @format int64
|
|
10664
|
+
* @min 0
|
|
10665
|
+
*/
|
|
10666
|
+
last_bootstrap_lsn: number;
|
|
10667
|
+
}
|
|
10588
10668
|
/** Summary of materialization results. */
|
|
10589
10669
|
interface MaterializationSummaryDto$1 {
|
|
10590
10670
|
/**
|
|
@@ -13026,6 +13106,27 @@ interface ReExtractResponse {
|
|
|
13026
13106
|
*/
|
|
13027
13107
|
pending_review_count: number;
|
|
13028
13108
|
}
|
|
13109
|
+
/** Response payload for `POST /api/v1/admin/derived-facts/rebuild/{tenant_id}`. */
|
|
13110
|
+
interface RebuildDerivedFactsResponse {
|
|
13111
|
+
/**
|
|
13112
|
+
* Per-tenant materialization LSN at the moment the response was
|
|
13113
|
+
* produced. Read-side caches consult this value to know whether
|
|
13114
|
+
* they have observed every successfully applied event.
|
|
13115
|
+
* @format int64
|
|
13116
|
+
* @min 0
|
|
13117
|
+
*/
|
|
13118
|
+
materialization_lsn: number;
|
|
13119
|
+
/**
|
|
13120
|
+
* Number of rows truncated from `derived_facts` for this tenant.
|
|
13121
|
+
* @min 0
|
|
13122
|
+
*/
|
|
13123
|
+
removed: number;
|
|
13124
|
+
/**
|
|
13125
|
+
* Number of `BootstrapRule` events queued to the supervisor.
|
|
13126
|
+
* @min 0
|
|
13127
|
+
*/
|
|
13128
|
+
rules_queued: number;
|
|
13129
|
+
}
|
|
13029
13130
|
/** Request to recall similar episodes. */
|
|
13030
13131
|
interface RecallEpisodesRequest$1 {
|
|
13031
13132
|
/**
|
|
@@ -14744,6 +14845,43 @@ type SearchResponse = {
|
|
|
14744
14845
|
*/
|
|
14745
14846
|
variables: Record<string, VariableFeasibilityDto$1>;
|
|
14746
14847
|
};
|
|
14848
|
+
/**
|
|
14849
|
+
* PG-direct name search across the tenant's sorts. Used by the
|
|
14850
|
+
* viewer when the in-memory hierarchy returns 0 hits because the
|
|
14851
|
+
* user is exploring a million-scale tenant where most sorts aren't
|
|
14852
|
+
* hydrated. Returns `{matches: [{id, name, depth}]}` ordered by
|
|
14853
|
+
* exact-match-first, then prefix, then by name length.
|
|
14854
|
+
* One row of [`SearchSortsResponse::matches`] — a single matching sort.
|
|
14855
|
+
*/
|
|
14856
|
+
interface SearchSortsMatch {
|
|
14857
|
+
/**
|
|
14858
|
+
* Hierarchy depth — `0` is a root sort. Always populated: the
|
|
14859
|
+
* upstream port (`SortVisualizationPort::search_sorts_by_name`)
|
|
14860
|
+
* returns an `i32` directly, with no nullable code path.
|
|
14861
|
+
* @format int32
|
|
14862
|
+
*/
|
|
14863
|
+
depth: number;
|
|
14864
|
+
/**
|
|
14865
|
+
* Sort identifier (UUID).
|
|
14866
|
+
* @format uuid
|
|
14867
|
+
*/
|
|
14868
|
+
id: string;
|
|
14869
|
+
/** Sort name as stored in PG. */
|
|
14870
|
+
name: string;
|
|
14871
|
+
}
|
|
14872
|
+
/** Response body for `GET /api/v1/sorts/search`. */
|
|
14873
|
+
interface SearchSortsResponse {
|
|
14874
|
+
/**
|
|
14875
|
+
* Number of returned matches (≤ requested limit, ≤ 100).
|
|
14876
|
+
* @min 0
|
|
14877
|
+
*/
|
|
14878
|
+
count: number;
|
|
14879
|
+
/**
|
|
14880
|
+
* Matching sorts, ordered exact-match-first, then prefix, then by
|
|
14881
|
+
* shortest name.
|
|
14882
|
+
*/
|
|
14883
|
+
matches: SearchSortsMatch[];
|
|
14884
|
+
}
|
|
14747
14885
|
/**
|
|
14748
14886
|
* Search statistics collected during a search operation.
|
|
14749
14887
|
*
|
|
@@ -16209,6 +16347,117 @@ interface SummaryResponse$1 {
|
|
|
16209
16347
|
ts_first?: string | null;
|
|
16210
16348
|
ts_last?: string | null;
|
|
16211
16349
|
}
|
|
16350
|
+
/**
|
|
16351
|
+
* Snapshot of the most recent handler error observed by the
|
|
16352
|
+
* supervisor's metrics, surfaced through the status endpoint.
|
|
16353
|
+
*/
|
|
16354
|
+
interface SupervisorErrorSnapshot {
|
|
16355
|
+
/**
|
|
16356
|
+
* Unix-millisecond timestamp at which the failure was recorded.
|
|
16357
|
+
* @format int64
|
|
16358
|
+
* @min 0
|
|
16359
|
+
*/
|
|
16360
|
+
at_ms: number;
|
|
16361
|
+
/** Truncated error message (≤ 512 chars). */
|
|
16362
|
+
message: string;
|
|
16363
|
+
}
|
|
16364
|
+
/**
|
|
16365
|
+
* Response payload for
|
|
16366
|
+
* `GET /api/v1/admin/derived-facts/status/{tenant_id}`.
|
|
16367
|
+
*
|
|
16368
|
+
* Aggregates per-tenant supervisor health (event counters, last
|
|
16369
|
+
* error, materialization LSN, queue depth approximation) and
|
|
16370
|
+
* rebuild-state (sentinel snapshot, lock-held hint).
|
|
16371
|
+
*/
|
|
16372
|
+
interface SupervisorStatusResponse {
|
|
16373
|
+
/**
|
|
16374
|
+
* Total `derived_facts` rows for this tenant, queried at
|
|
16375
|
+
* response time. Operators compare this against
|
|
16376
|
+
* `materialization_state.derived_count_at_bootstrap` to estimate
|
|
16377
|
+
* derivation growth since the last rebuild.
|
|
16378
|
+
* @min 0
|
|
16379
|
+
*/
|
|
16380
|
+
derived_facts_count: number;
|
|
16381
|
+
/**
|
|
16382
|
+
* Cumulative count of events whose handler returned `Err(_)`.
|
|
16383
|
+
* @format int64
|
|
16384
|
+
* @min 0
|
|
16385
|
+
*/
|
|
16386
|
+
events_failed: number;
|
|
16387
|
+
/**
|
|
16388
|
+
* Events currently inside the handler closure.
|
|
16389
|
+
* @min 0
|
|
16390
|
+
*/
|
|
16391
|
+
events_in_flight: number;
|
|
16392
|
+
/**
|
|
16393
|
+
* Cumulative count of events whose handler returned `Ok(())`.
|
|
16394
|
+
* @format int64
|
|
16395
|
+
* @min 0
|
|
16396
|
+
*/
|
|
16397
|
+
events_processed: number;
|
|
16398
|
+
/**
|
|
16399
|
+
* Cumulative count of events accepted by `submit`.
|
|
16400
|
+
* @format int64
|
|
16401
|
+
* @min 0
|
|
16402
|
+
*/
|
|
16403
|
+
events_submitted: number;
|
|
16404
|
+
/**
|
|
16405
|
+
* Sum of `elapsed_ms` across all handler invocations.
|
|
16406
|
+
* @format int64
|
|
16407
|
+
* @min 0
|
|
16408
|
+
*/
|
|
16409
|
+
handler_millis_total: number;
|
|
16410
|
+
/**
|
|
16411
|
+
* Unix-millisecond timestamp of the most recent handler return.
|
|
16412
|
+
* @format int64
|
|
16413
|
+
* @min 0
|
|
16414
|
+
*/
|
|
16415
|
+
last_complete_ms: number;
|
|
16416
|
+
/** Most recently observed handler error, if any. */
|
|
16417
|
+
last_error?: null | SupervisorErrorSnapshot;
|
|
16418
|
+
/**
|
|
16419
|
+
* Unix-millisecond timestamp of the most recent `submit` call.
|
|
16420
|
+
* @format int64
|
|
16421
|
+
* @min 0
|
|
16422
|
+
*/
|
|
16423
|
+
last_submit_ms: number;
|
|
16424
|
+
/**
|
|
16425
|
+
* Per-tenant materialization LSN as of the response. Read-side
|
|
16426
|
+
* caches keyed on this value compare against it to detect new
|
|
16427
|
+
* derivations.
|
|
16428
|
+
* @format int64
|
|
16429
|
+
* @min 0
|
|
16430
|
+
*/
|
|
16431
|
+
materialization_lsn: number;
|
|
16432
|
+
/**
|
|
16433
|
+
* Per-tenant Phase 2 materialization sentinel, or `None` if the
|
|
16434
|
+
* tenant has never been rebuilt.
|
|
16435
|
+
*/
|
|
16436
|
+
materialization_state?: null | MaterializationStateSnapshot;
|
|
16437
|
+
/**
|
|
16438
|
+
* Approximate channel depth: `submitted − processed − failed −
|
|
16439
|
+
* in_flight`. Saturates at zero on the rare race where a handler
|
|
16440
|
+
* returned between two field reads.
|
|
16441
|
+
* @min 0
|
|
16442
|
+
*/
|
|
16443
|
+
queue_depth_approx: number;
|
|
16444
|
+
/**
|
|
16445
|
+
* **Racy hint**: `true` if the per-tenant rebuild mutex is
|
|
16446
|
+
* currently held. Computed via `try_lock()` and can briefly
|
|
16447
|
+
* disagree with the actual lock state (the lock may drop
|
|
16448
|
+
* between the probe and the read), so operators must not treat
|
|
16449
|
+
* this as authoritative. Use it as a "rebuild appears to be in
|
|
16450
|
+
* flight" signal only.
|
|
16451
|
+
*/
|
|
16452
|
+
rebuild_in_flight: boolean;
|
|
16453
|
+
/**
|
|
16454
|
+
* `true` if a [`DataflowSupervisor`] has been spawned for this
|
|
16455
|
+
* tenant. `false` indicates the tenant has never had an event
|
|
16456
|
+
* submitted on its behalf and the metrics fields are returned
|
|
16457
|
+
* at their initial zero values.
|
|
16458
|
+
*/
|
|
16459
|
+
supervisor_active: boolean;
|
|
16460
|
+
}
|
|
16212
16461
|
/** Information about a suspended (incomplete) query */
|
|
16213
16462
|
interface SuspendedQueryDto$1 {
|
|
16214
16463
|
/**
|
|
@@ -18220,6 +18469,22 @@ declare class Sorts<SecurityDataType = unknown> {
|
|
|
18220
18469
|
* @request POST:/api/v1/sorts/learned-similarities/reject
|
|
18221
18470
|
*/
|
|
18222
18471
|
rejectLearnedSimilarity: (data: RejectLearnedSimilarityRequest$1, params?: RequestParams) => Promise<HttpResponse<RejectLearnedSimilarityResponse$1, any>>;
|
|
18472
|
+
/**
|
|
18473
|
+
* No description
|
|
18474
|
+
*
|
|
18475
|
+
* @tags sorts
|
|
18476
|
+
* @name SearchSortsByName
|
|
18477
|
+
* @request GET:/api/v1/sorts/search
|
|
18478
|
+
*/
|
|
18479
|
+
searchSortsByName: (query: {
|
|
18480
|
+
/**
|
|
18481
|
+
* Max results (default 20, capped at 100)
|
|
18482
|
+
* @min 0
|
|
18483
|
+
*/
|
|
18484
|
+
limit?: number;
|
|
18485
|
+
/** Search query (sort name substring) */
|
|
18486
|
+
q: string;
|
|
18487
|
+
}, params?: RequestParams) => Promise<HttpResponse<SearchSortsResponse, any>>;
|
|
18223
18488
|
/**
|
|
18224
18489
|
* @description Similarity is symmetric: ∼(s₁, s₂) = ∼(s₂, s₁) Degree must be in [0, 1] range.
|
|
18225
18490
|
*
|
|
@@ -18372,6 +18637,17 @@ interface ReferenceValue {
|
|
|
18372
18637
|
type: 'Reference';
|
|
18373
18638
|
value: string;
|
|
18374
18639
|
}
|
|
18640
|
+
/**
|
|
18641
|
+
* A reference to a sort by UUID. Produces `{"type": "SortId", "value": "uuid"}`.
|
|
18642
|
+
*
|
|
18643
|
+
* Used by homoiconic meta-constraints (e.g. `sort_constraint`) whose feature
|
|
18644
|
+
* targets a sort as a first-class value. Maps to the backend `Value::SortId`
|
|
18645
|
+
* variant which the chainer dispatches directly.
|
|
18646
|
+
*/
|
|
18647
|
+
interface SortIdValue {
|
|
18648
|
+
type: 'SortId';
|
|
18649
|
+
value: string;
|
|
18650
|
+
}
|
|
18375
18651
|
/** A list of values. Produces `{"type": "List", "value": [...]}`. */
|
|
18376
18652
|
interface ListValue {
|
|
18377
18653
|
type: 'List';
|
|
@@ -18424,7 +18700,7 @@ interface SetValue {
|
|
|
18424
18700
|
* (BigInteger, DateTime, Geometry, etc.) to `ValueDto::String` with Rust debug format.
|
|
18425
18701
|
* You may encounter strings like `"DateTime(2024-01-15T10:30:00Z)"`.
|
|
18426
18702
|
*/
|
|
18427
|
-
type ValueDto = StringValue | IntegerValue | RealValue | BooleanValue | UninstantiatedValue | ReferenceValue | ListValue | FuzzyScalarValue | FuzzyNumberValue | SetValue;
|
|
18703
|
+
type ValueDto = StringValue | IntegerValue | RealValue | BooleanValue | UninstantiatedValue | ReferenceValue | SortIdValue | ListValue | FuzzyScalarValue | FuzzyNumberValue | SetValue;
|
|
18428
18704
|
/**
|
|
18429
18705
|
* Triangular fuzzy membership function.
|
|
18430
18706
|
*
|
|
@@ -18739,6 +19015,7 @@ type values_SetValue = SetValue;
|
|
|
18739
19015
|
type values_SigmoidDifferenceShape = SigmoidDifferenceShape;
|
|
18740
19016
|
type values_SigmoidProductShape = SigmoidProductShape;
|
|
18741
19017
|
type values_SigmoidShape = SigmoidShape;
|
|
19018
|
+
type values_SortIdValue = SortIdValue;
|
|
18742
19019
|
type values_SpikeShape = SpikeShape;
|
|
18743
19020
|
type values_StringValue = StringValue;
|
|
18744
19021
|
type values_TaggedFeatureValueDto = TaggedFeatureValueDto;
|
|
@@ -18748,7 +19025,7 @@ type values_UninstantiatedValue = UninstantiatedValue;
|
|
|
18748
19025
|
type values_ValueDto = ValueDto;
|
|
18749
19026
|
type values_ZShapeShape = ZShapeShape;
|
|
18750
19027
|
declare namespace values {
|
|
18751
|
-
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_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 };
|
|
19028
|
+
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 };
|
|
18752
19029
|
}
|
|
18753
19030
|
|
|
18754
19031
|
/**
|
|
@@ -20409,11 +20686,22 @@ interface TermInputInlineByName {
|
|
|
20409
20686
|
* Use `FeatureInput.*` builders to construct these values safely.
|
|
20410
20687
|
* Do NOT use with term CRUD endpoints — use {@link import('./values.js').ValueDto} instead.
|
|
20411
20688
|
*/
|
|
20412
|
-
type FeatureInputValueDto = FeatureInputTermRef | FeatureInputConstrainedVariable | FeatureInputVariable | FeatureInputInlineTerm | FeatureInputInlineTermByName | FeatureInputValueDto[] | string | number | boolean;
|
|
20689
|
+
type FeatureInputValueDto = FeatureInputTermRef | FeatureInputSortRef | FeatureInputConstrainedVariable | FeatureInputVariable | FeatureInputInlineTerm | FeatureInputInlineTermByName | FeatureInputValueDto[] | string | number | boolean;
|
|
20413
20690
|
/** Reference an existing term by UUID. */
|
|
20414
20691
|
interface FeatureInputTermRef {
|
|
20415
20692
|
termId: string;
|
|
20416
20693
|
}
|
|
20694
|
+
/**
|
|
20695
|
+
* Reference a sort by UUID — used by homoiconic meta-constraints (e.g.
|
|
20696
|
+
* `sort_constraint`) that name a sort as a first-class value.
|
|
20697
|
+
*
|
|
20698
|
+
* Wire format: `{ "sort_ref": "<uuid>" }` (not `sort_id`, which would
|
|
20699
|
+
* collide with {@link FeatureInputInlineTerm} under serde-untagged
|
|
20700
|
+
* deserialization on the backend).
|
|
20701
|
+
*/
|
|
20702
|
+
interface FeatureInputSortRef {
|
|
20703
|
+
sortRef: string;
|
|
20704
|
+
}
|
|
20417
20705
|
/**
|
|
20418
20706
|
* A constrained variable in a feature value position.
|
|
20419
20707
|
*
|
|
@@ -20445,6 +20733,7 @@ interface FeatureInputInlineTermByName {
|
|
|
20445
20733
|
type homoiconic_FeatureInputConstrainedVariable = FeatureInputConstrainedVariable;
|
|
20446
20734
|
type homoiconic_FeatureInputInlineTerm = FeatureInputInlineTerm;
|
|
20447
20735
|
type homoiconic_FeatureInputInlineTermByName = FeatureInputInlineTermByName;
|
|
20736
|
+
type homoiconic_FeatureInputSortRef = FeatureInputSortRef;
|
|
20448
20737
|
type homoiconic_FeatureInputTermRef = FeatureInputTermRef;
|
|
20449
20738
|
type homoiconic_FeatureInputValueDto = FeatureInputValueDto;
|
|
20450
20739
|
type homoiconic_FeatureInputVariable = FeatureInputVariable;
|
|
@@ -20454,7 +20743,7 @@ type homoiconic_TermInputInline = TermInputInline;
|
|
|
20454
20743
|
type homoiconic_TermInputInlineByName = TermInputInlineByName;
|
|
20455
20744
|
type homoiconic_TermInputRef = TermInputRef;
|
|
20456
20745
|
declare namespace homoiconic {
|
|
20457
|
-
export type { homoiconic_FeatureInputConstrainedVariable as FeatureInputConstrainedVariable, homoiconic_FeatureInputInlineTerm as FeatureInputInlineTerm, homoiconic_FeatureInputInlineTermByName as FeatureInputInlineTermByName, homoiconic_FeatureInputTermRef as FeatureInputTermRef, homoiconic_FeatureInputValueDto as FeatureInputValueDto, homoiconic_FeatureInputVariable as FeatureInputVariable, homoiconic_PsiTermDto as PsiTermDto, homoiconic_TermInputDto as TermInputDto, homoiconic_TermInputInline as TermInputInline, homoiconic_TermInputInlineByName as TermInputInlineByName, homoiconic_TermInputRef as TermInputRef };
|
|
20746
|
+
export type { homoiconic_FeatureInputConstrainedVariable as FeatureInputConstrainedVariable, homoiconic_FeatureInputInlineTerm as FeatureInputInlineTerm, homoiconic_FeatureInputInlineTermByName as FeatureInputInlineTermByName, homoiconic_FeatureInputSortRef as FeatureInputSortRef, homoiconic_FeatureInputTermRef as FeatureInputTermRef, homoiconic_FeatureInputValueDto as FeatureInputValueDto, homoiconic_FeatureInputVariable as FeatureInputVariable, homoiconic_PsiTermDto as PsiTermDto, homoiconic_TermInputDto as TermInputDto, homoiconic_TermInputInline as TermInputInline, homoiconic_TermInputInlineByName as TermInputInlineByName, homoiconic_TermInputRef as TermInputRef };
|
|
20458
20747
|
}
|
|
20459
20748
|
|
|
20460
20749
|
/**
|
|
@@ -20825,6 +21114,16 @@ declare class Inference<SecurityDataType = unknown> {
|
|
|
20825
21114
|
* @secure
|
|
20826
21115
|
*/
|
|
20827
21116
|
bulkFuzzyProve: (data: BulkFuzzyProveRequest$1, params?: RequestParams) => Promise<HttpResponse<BulkFuzzyProveResponse$1, void>>;
|
|
21117
|
+
/**
|
|
21118
|
+
* @description Phase 2 v2 entry point for retraction: 1. Removes each term from PG + in-memory stores via [`HomoiconicTermService::remove_term`](osfkb_application::services::HomoiconicTermService::remove_term). 2. When `state.use_plan_engine` is on, submits a single [`DeltaEvent::Retract`](osfkb_application::services::dataflow::DeltaEvent::Retract) to the per-tenant supervisor so the Backward/Forward backward chase decrements every dependent derived fact's `proof_count` (and deletes those whose count reaches zero). Symmetric to [`bulk_add_terms`]; idempotent (term ids absent from the working memory are silently skipped — same shape as [`delete_term`] returning 404, except in the bulk path the missing ids simply don't appear in `removed_term_ids`). Best-effort supervisor enqueue: a supervisor failure does NOT fail the 2xx response — the persist path has succeeded and a future bootstrap can recover any missed retraction. # Mid-batch error handling If `remove_term` fails for a term partway through the batch, the handler **stops accumulating successes**, runs cache invalidation for the prefix that did succeed, submits a single [`DeltaEvent::Retract`](osfkb_application::services::dataflow::DeltaEvent::Retract) covering that prefix, and **then** surfaces the error. This keeps the supervisor and the in-memory caches in sync with the actual store state — a leaked Retract event would orphan derived facts whose only antecedent is now removed, which is a critical correctness violation. # Authorization Requires `X-Tenant-Id` header. The `term_ids` are resolved against that tenant's working memory only — cross-tenant retraction is impossible by construction (the per-tenant `HomoiconicTermService` only sees its own tenant's terms).
|
|
21119
|
+
*
|
|
21120
|
+
* @tags inference
|
|
21121
|
+
* @name BulkRetractTerms
|
|
21122
|
+
* @summary Bulk-retract terms from the working memory.
|
|
21123
|
+
* @request POST:/api/v1/inference/facts/bulk-retract
|
|
21124
|
+
* @secure
|
|
21125
|
+
*/
|
|
21126
|
+
bulkRetractTerms: (data: BulkRetractTermsRequest, params?: RequestParams) => Promise<HttpResponse<BulkRetractTermsResponse, any>>;
|
|
20828
21127
|
/**
|
|
20829
21128
|
* @description # DEPRECATED This endpoint is deprecated. Use `DELETE /api/v1/terms/{term_id}` for individual terms. # TRUE HOMOICONIC API # Authorization Requires X-Tenant-Id header.
|
|
20830
21129
|
*
|
|
@@ -20877,7 +21176,7 @@ declare class Inference<SecurityDataType = unknown> {
|
|
|
20877
21176
|
* @request POST:/api/v1/inference/forward-chain
|
|
20878
21177
|
* @secure
|
|
20879
21178
|
*/
|
|
20880
|
-
forwardChain: (data: ForwardChainRequest$1, params?: RequestParams) => Promise<HttpResponse<ForwardChainResponse$1,
|
|
21179
|
+
forwardChain: (data: ForwardChainRequest$1, params?: RequestParams) => Promise<HttpResponse<ForwardChainResponse$1, void>>;
|
|
20881
21180
|
/**
|
|
20882
21181
|
* @description Runs forward chaining with probabilistic provenance tags. Each derived fact carries a confidence value computed from the provenance semiring operations (noisy-or for disjunction, product for conjunction). This extends the standard forward chain endpoint by tracking how confidence propagates through rule application, enabling probabilistic reasoning over the knowledge base.
|
|
20883
21182
|
*
|
|
@@ -39372,6 +39671,24 @@ declare class Admin<SecurityDataType = unknown> {
|
|
|
39372
39671
|
* @request GET:/api/v1/admin/tenants
|
|
39373
39672
|
*/
|
|
39374
39673
|
listTenants: (params?: RequestParams) => Promise<HttpResponse<ListTenantsResponse$1, any>>;
|
|
39674
|
+
/**
|
|
39675
|
+
* @description Truncates the derived_facts table for the given tenant and queues a BootstrapAll event covering every analyzed rule. Asynchronous: returns the queue depth and current materialization LSN, not the final state. Concurrent rebuilds for the same tenant are rejected with 409 (per-tenant mutex). Full operational runbook (prerequisites, timings, monitoring, failure recovery, known limitations) lives in .claude/SUB_MS_FORWARD_CHAINING_STATUS.md, section 'Operator runbook — derived-facts rebuild'.
|
|
39676
|
+
*
|
|
39677
|
+
* @tags admin
|
|
39678
|
+
* @name RebuildDerivedFacts
|
|
39679
|
+
* @summary Rebuild derived facts for a tenant
|
|
39680
|
+
* @request POST:/api/v1/admin/derived-facts/rebuild/{tenant_id}
|
|
39681
|
+
*/
|
|
39682
|
+
rebuildDerivedFacts: (tenantId: string, params?: RequestParams) => Promise<HttpResponse<RebuildDerivedFactsResponse, void>>;
|
|
39683
|
+
/**
|
|
39684
|
+
* @description Returns event-processing counters (submitted/processed/failed/in-flight), the materialization LSN, the last handler error (if any, truncated to 512 chars), the per-tenant materialization sentinel, the current derived-facts row count, and a racy hint about whether a rebuild is in flight. Intended for operator dashboards; the supervisor itself does not depend on this endpoint.
|
|
39685
|
+
*
|
|
39686
|
+
* @tags admin
|
|
39687
|
+
* @name SupervisorStatus
|
|
39688
|
+
* @summary Get per-tenant supervisor + materialization status
|
|
39689
|
+
* @request GET:/api/v1/admin/derived-facts/status/{tenant_id}
|
|
39690
|
+
*/
|
|
39691
|
+
supervisorStatus: (tenantId: string, params?: RequestParams) => Promise<HttpResponse<SupervisorStatusResponse, void>>;
|
|
39375
39692
|
}
|
|
39376
39693
|
|
|
39377
39694
|
/**
|
|
@@ -43688,6 +44005,24 @@ declare const Value: {
|
|
|
43688
44005
|
* ```
|
|
43689
44006
|
*/
|
|
43690
44007
|
readonly reference: (id: string) => ReferenceValue;
|
|
44008
|
+
/**
|
|
44009
|
+
* Create a reference to a sort by UUID.
|
|
44010
|
+
*
|
|
44011
|
+
* @param id - The UUID of the sort.
|
|
44012
|
+
* @returns A tagged `SortIdValue`: `{"type": "SortId", "value": "uuid"}`.
|
|
44013
|
+
*
|
|
44014
|
+
* @remarks
|
|
44015
|
+
* Used by homoiconic meta-constraints — primarily `Constraint.typeOf(...)`
|
|
44016
|
+
* — whose feature targets a sort as a first-class value. The chainer
|
|
44017
|
+
* dispatches this directly via `Value::SortId`.
|
|
44018
|
+
*
|
|
44019
|
+
* @example
|
|
44020
|
+
* ```typescript
|
|
44021
|
+
* Value.sortId("550e8400-e29b-41d4-a716-446655440000")
|
|
44022
|
+
* // { type: 'SortId', value: '550e8400-e29b-41d4-a716-446655440000' }
|
|
44023
|
+
* ```
|
|
44024
|
+
*/
|
|
44025
|
+
readonly sortId: (id: string) => SortIdValue;
|
|
43691
44026
|
/**
|
|
43692
44027
|
* Create a fuzzy scalar with a value and membership degree.
|
|
43693
44028
|
*
|
|
@@ -44078,6 +44413,127 @@ declare const FuzzyShape: {
|
|
|
44078
44413
|
readonly piecewiseLinear: (points: [number, number][]) => PiecewiseLinearShape;
|
|
44079
44414
|
};
|
|
44080
44415
|
|
|
44416
|
+
/**
|
|
44417
|
+
* Operators accepted by {@link Constraint.where} — boolean comparisons.
|
|
44418
|
+
* The chainer's `guard_constraint` reads the operator as a string; it
|
|
44419
|
+
* residuates the constraint until both sides are bound (or numerically
|
|
44420
|
+
* evaluable), then evaluates the comparison.
|
|
44421
|
+
*/
|
|
44422
|
+
type ComparisonOp = '<' | '<=' | '=' | '!=' | '>=' | '>';
|
|
44423
|
+
/**
|
|
44424
|
+
* Operators accepted by {@link Constraint.equation} — binary arithmetic.
|
|
44425
|
+
* The op selects the chainer sort: `+` → `plus_constraint`, `-` →
|
|
44426
|
+
* `minus_constraint`, `*` → `times_constraint`, `/` → `div_constraint`.
|
|
44427
|
+
* Each reads `x`, `y`, `z` as `z = x op y`.
|
|
44428
|
+
*/
|
|
44429
|
+
type ArithmeticOp = '+' | '-' | '*' | '/';
|
|
44430
|
+
/** A reference to a variable or term used as a constraint operand. */
|
|
44431
|
+
type Operand = string | TermInputArg | number | boolean;
|
|
44432
|
+
/**
|
|
44433
|
+
* Builders for the chainer's homoiconic meta-constraints. Each function
|
|
44434
|
+
* returns a single `TermInputArg` representing one constraint term — drop
|
|
44435
|
+
* the result into a clause body or rule antecedents.
|
|
44436
|
+
*
|
|
44437
|
+
* @remarks
|
|
44438
|
+
* These wrap the underlying meta-sort names (`sort_constraint`,
|
|
44439
|
+
* `feature_constraint`, `guard_constraint`, `plus_constraint`, etc.) and
|
|
44440
|
+
* use the exact feature keys the chainer reads. Hand-rolled `psi('...')`
|
|
44441
|
+
* calls with guessed keys silently fail — use these builders instead.
|
|
44442
|
+
*
|
|
44443
|
+
* @example
|
|
44444
|
+
* ```typescript
|
|
44445
|
+
* import { Constraint, psi } from '@kortexya/reasoninglayer';
|
|
44446
|
+
*
|
|
44447
|
+
* // "?E is a term of sort flow_edge_constraint, with edges leaving X"
|
|
44448
|
+
* const body = [
|
|
44449
|
+
* Constraint.typeOf('?E', flowEdgeSortUuid),
|
|
44450
|
+
* Constraint.has('?E', 'src', '?X'),
|
|
44451
|
+
* Constraint.has('?E', 'dst', '?Y'),
|
|
44452
|
+
* Constraint.has('?E', 'cap', '?C'),
|
|
44453
|
+
* Constraint.intRange('?Amount', 1, 100),
|
|
44454
|
+
* Constraint.where('?Amount', '<=', '?C'),
|
|
44455
|
+
* Constraint.solveFor('?Amount'),
|
|
44456
|
+
* ];
|
|
44457
|
+
* ```
|
|
44458
|
+
*/
|
|
44459
|
+
declare const Constraint: {
|
|
44460
|
+
/**
|
|
44461
|
+
* State that a variable is a term of a given sort. The chainer enumerates
|
|
44462
|
+
* every persisted term of that sort via backtracking.
|
|
44463
|
+
*
|
|
44464
|
+
* @param variable - Variable name (e.g. `'?E'`) or pre-built variable Ψ-term.
|
|
44465
|
+
* @param sortUuid - UUID of the target sort (resolve from
|
|
44466
|
+
* `client.inference.getMetaSorts()` or your own `createSort` response).
|
|
44467
|
+
* @returns A `sort_constraint` term.
|
|
44468
|
+
*/
|
|
44469
|
+
readonly typeOf: (variable: string, sortUuid: string) => TermInputArg;
|
|
44470
|
+
/**
|
|
44471
|
+
* State that a variable's feature equals a target. The chainer unifies
|
|
44472
|
+
* the variable's feature value with the target.
|
|
44473
|
+
*
|
|
44474
|
+
* **Important**: the chainer's `feature_constraint` only unifies
|
|
44475
|
+
* term-references with term-references. The variable's feature on the
|
|
44476
|
+
* persisted side must itself be a `Value::Reference`. Comparing against
|
|
44477
|
+
* literals (e.g. `has('?N', 'name', 'S')` where `name` is stored as a
|
|
44478
|
+
* plain string) silently returns zero solutions — that's a chainer
|
|
44479
|
+
* design constraint, not a builder bug.
|
|
44480
|
+
*
|
|
44481
|
+
* @param variable - The owning variable (e.g. `'?Edge'`).
|
|
44482
|
+
* @param feature - The feature name (e.g. `'src'`).
|
|
44483
|
+
* @param target - The target — typically another variable (`'?Src'`)
|
|
44484
|
+
* or an existing term referenced by its UUID via `'!<uuid>'`.
|
|
44485
|
+
* @returns A `feature_constraint` term.
|
|
44486
|
+
*/
|
|
44487
|
+
readonly has: (variable: string, feature: string, target: Operand) => TermInputArg;
|
|
44488
|
+
/**
|
|
44489
|
+
* State a boolean comparison between two operands. The chainer
|
|
44490
|
+
* residuates the constraint until both sides are bound; when they are,
|
|
44491
|
+
* the comparison must hold or the proof branch fails.
|
|
44492
|
+
*
|
|
44493
|
+
* @param left - Left operand — variable, literal number, or term ref.
|
|
44494
|
+
* @param op - Comparison operator.
|
|
44495
|
+
* @param right - Right operand.
|
|
44496
|
+
* @returns A `guard_constraint` term.
|
|
44497
|
+
*/
|
|
44498
|
+
readonly where: (left: Operand, op: ComparisonOp, right: Operand) => TermInputArg;
|
|
44499
|
+
/**
|
|
44500
|
+
* State that `result = left op right`. Selects the chainer sort by op:
|
|
44501
|
+
* `+` → `plus_constraint`, `-` → `minus_constraint`, `*` →
|
|
44502
|
+
* `times_constraint`, `/` → `div_constraint`. The chainer reads each
|
|
44503
|
+
* operand as either a Reference variable or a numeric literal, and can
|
|
44504
|
+
* run forward, reverse, or verify depending on which operands are
|
|
44505
|
+
* bound.
|
|
44506
|
+
*
|
|
44507
|
+
* @param result - Result variable or value (`z`).
|
|
44508
|
+
* @param op - Arithmetic operator.
|
|
44509
|
+
* @param left - Left operand (`x`).
|
|
44510
|
+
* @param right - Right operand (`y`).
|
|
44511
|
+
* @returns The appropriate arithmetic-constraint term.
|
|
44512
|
+
*/
|
|
44513
|
+
readonly equation: (result: Operand, op: ArithmeticOp, left: Operand, right: Operand) => TermInputArg;
|
|
44514
|
+
/**
|
|
44515
|
+
* Constrain a variable to be an integer in the inclusive range
|
|
44516
|
+
* `[min, max]`. Required before the chainer's labeling step can assign
|
|
44517
|
+
* a concrete value via {@link Constraint.solveFor}.
|
|
44518
|
+
*
|
|
44519
|
+
* @param variable - Variable name to constrain.
|
|
44520
|
+
* @param min - Lower bound (inclusive).
|
|
44521
|
+
* @param max - Upper bound (inclusive).
|
|
44522
|
+
* @returns An `fd_domain_constraint` term.
|
|
44523
|
+
*/
|
|
44524
|
+
readonly intRange: (variable: string, min: number, max: number) => TermInputArg;
|
|
44525
|
+
/**
|
|
44526
|
+
* Search for concrete integer assignments to the listed variables that
|
|
44527
|
+
* satisfy every other constraint mentioning them. Place this at the END
|
|
44528
|
+
* of a clause body — it's the labeling/search step that turns a
|
|
44529
|
+
* constraint network into solutions.
|
|
44530
|
+
*
|
|
44531
|
+
* @param variables - Variable names to assign.
|
|
44532
|
+
* @returns An `fd_labeling_constraint` term.
|
|
44533
|
+
*/
|
|
44534
|
+
readonly solveFor: (...variables: string[]) => TermInputArg;
|
|
44535
|
+
};
|
|
44536
|
+
|
|
44081
44537
|
/**
|
|
44082
44538
|
* Create a guard constraint as a `TermInputDto`.
|
|
44083
44539
|
*
|
|
@@ -44512,6 +44968,236 @@ declare const LP: {
|
|
|
44512
44968
|
readonly bounds: (min?: number, max?: number) => VariableBounds;
|
|
44513
44969
|
};
|
|
44514
44970
|
|
|
44971
|
+
/**
|
|
44972
|
+
* Builder namespace for network-flow constraint problems on the
|
|
44973
|
+
* `flow_constraint` family of meta-sorts.
|
|
44974
|
+
*
|
|
44975
|
+
* @remarks
|
|
44976
|
+
* Produces a list of psi-terms that encode an edge set, an objective
|
|
44977
|
+
* (max flow / min cut / min-cost-max-flow / classify edges), and a
|
|
44978
|
+
* `flow_solve_constraint` trigger. The returned `constraints` array
|
|
44979
|
+
* can be used directly as the body of a clause goal, the antecedents
|
|
44980
|
+
* of an inference rule, or spliced alongside other CLP constraints
|
|
44981
|
+
* (e.g., CLP(FD)) inside one query.
|
|
44982
|
+
*
|
|
44983
|
+
* Node identity is encoded via auto-generated psi-variables: every
|
|
44984
|
+
* unique node name maps to one variable (`?N_<sanitized_name>`) so
|
|
44985
|
+
* the backend chainer sees the same TermId every time the same name
|
|
44986
|
+
* appears.
|
|
44987
|
+
*
|
|
44988
|
+
* @example
|
|
44989
|
+
* ```typescript
|
|
44990
|
+
* import { Flow, psi } from '@kortexya/reasoninglayer';
|
|
44991
|
+
*
|
|
44992
|
+
* const { constraints, vars } = Flow.maxFlow({
|
|
44993
|
+
* source: 's',
|
|
44994
|
+
* sink: 't',
|
|
44995
|
+
* edges: [
|
|
44996
|
+
* ['s', 'a', 10],
|
|
44997
|
+
* ['s', 'b', 5],
|
|
44998
|
+
* ['a', 'b', 15],
|
|
44999
|
+
* ['a', 't', 10],
|
|
45000
|
+
* ['b', 't', 10],
|
|
45001
|
+
* ],
|
|
45002
|
+
* });
|
|
45003
|
+
*
|
|
45004
|
+
* const response = await client.inference.backwardChain({
|
|
45005
|
+
* goal: psi('clause', { antecedents: constraints }),
|
|
45006
|
+
* max_solutions: 1,
|
|
45007
|
+
* });
|
|
45008
|
+
* // Read `vars.flowValue` from response.solutions[0].substitution.
|
|
45009
|
+
* ```
|
|
45010
|
+
*/
|
|
45011
|
+
/** Logical node identifier — any string. Used to coordinate identity
|
|
45012
|
+
* across `src` / `dst` / `source` / `sink` references in one problem. */
|
|
45013
|
+
type FlowNode = string;
|
|
45014
|
+
/** A flow edge declaration. Tuple form `[from, to, cap]` or
|
|
45015
|
+
* `[from, to, cap, options]`, or an explicit object form. */
|
|
45016
|
+
type FlowEdgeInput = [FlowNode, FlowNode, number] | [FlowNode, FlowNode, number, FlowEdgeOptions] | (FlowEdgeOptions & {
|
|
45017
|
+
from: FlowNode;
|
|
45018
|
+
to: FlowNode;
|
|
45019
|
+
cap: number;
|
|
45020
|
+
});
|
|
45021
|
+
/** Optional per-edge attributes. */
|
|
45022
|
+
interface FlowEdgeOptions {
|
|
45023
|
+
/** Output variable name (e.g., `?F_sa`). If omitted, an auto-generated
|
|
45024
|
+
* name is used and returned in `vars.edgeFlows`. */
|
|
45025
|
+
flow?: string;
|
|
45026
|
+
/** Per-unit-flow cost. Defaults to 0. Only consulted by
|
|
45027
|
+
* `Flow.minCostMaxFlow`. */
|
|
45028
|
+
cost?: number;
|
|
45029
|
+
/** Optional edge label. Surfaces in min-cut / classification outputs. */
|
|
45030
|
+
label?: string;
|
|
45031
|
+
}
|
|
45032
|
+
/** Output variables surfaced by `Flow.maxFlow`. */
|
|
45033
|
+
interface MaxFlowVars {
|
|
45034
|
+
/** Variable name bound to the total flow source → sink. */
|
|
45035
|
+
flowValue: string;
|
|
45036
|
+
/** Per-edge output variables in declaration order. */
|
|
45037
|
+
edgeFlows: Array<{
|
|
45038
|
+
from: FlowNode;
|
|
45039
|
+
to: FlowNode;
|
|
45040
|
+
var: string;
|
|
45041
|
+
}>;
|
|
45042
|
+
}
|
|
45043
|
+
/** Output variables surfaced by `Flow.minCut`. */
|
|
45044
|
+
interface MinCutVars {
|
|
45045
|
+
cutValue: string;
|
|
45046
|
+
cutEdges: string;
|
|
45047
|
+
sourceSide: string;
|
|
45048
|
+
sinkSide: string;
|
|
45049
|
+
edgeFlows: Array<{
|
|
45050
|
+
from: FlowNode;
|
|
45051
|
+
to: FlowNode;
|
|
45052
|
+
var: string;
|
|
45053
|
+
}>;
|
|
45054
|
+
}
|
|
45055
|
+
/** Output variables surfaced by `Flow.minCostMaxFlow`. */
|
|
45056
|
+
interface MinCostMaxFlowVars {
|
|
45057
|
+
flowValue: string;
|
|
45058
|
+
totalCost: string;
|
|
45059
|
+
edgeFlows: Array<{
|
|
45060
|
+
from: FlowNode;
|
|
45061
|
+
to: FlowNode;
|
|
45062
|
+
var: string;
|
|
45063
|
+
}>;
|
|
45064
|
+
}
|
|
45065
|
+
/** Output variables surfaced by `Flow.classifyEdges`. */
|
|
45066
|
+
interface ClassifyEdgesVars {
|
|
45067
|
+
classifications: string;
|
|
45068
|
+
edgeFlows: Array<{
|
|
45069
|
+
from: FlowNode;
|
|
45070
|
+
to: FlowNode;
|
|
45071
|
+
var: string;
|
|
45072
|
+
}>;
|
|
45073
|
+
}
|
|
45074
|
+
/** Result returned by each `Flow.*` constructor: the constraint
|
|
45075
|
+
* psi-terms plus the output variable names needed to read results. */
|
|
45076
|
+
interface FlowProblem<V> {
|
|
45077
|
+
constraints: TermInputArg[];
|
|
45078
|
+
vars: V;
|
|
45079
|
+
}
|
|
45080
|
+
/** Common inputs accepted by every objective constructor. */
|
|
45081
|
+
interface FlowProblemInputBase {
|
|
45082
|
+
/** Source node identifier. */
|
|
45083
|
+
source: FlowNode;
|
|
45084
|
+
/** Sink node identifier. */
|
|
45085
|
+
sink: FlowNode;
|
|
45086
|
+
/** Edge declarations (tuple or object form). */
|
|
45087
|
+
edges: readonly FlowEdgeInput[];
|
|
45088
|
+
}
|
|
45089
|
+
/** Inputs for `Flow.maxFlow`. */
|
|
45090
|
+
interface MaxFlowInput extends FlowProblemInputBase {
|
|
45091
|
+
/** Optional explicit name for the `flow_value` output variable. */
|
|
45092
|
+
flowValue?: string;
|
|
45093
|
+
}
|
|
45094
|
+
/** Inputs for `Flow.minCut`. */
|
|
45095
|
+
interface MinCutInput extends FlowProblemInputBase {
|
|
45096
|
+
cutValue?: string;
|
|
45097
|
+
cutEdges?: string;
|
|
45098
|
+
sourceSide?: string;
|
|
45099
|
+
sinkSide?: string;
|
|
45100
|
+
}
|
|
45101
|
+
/** Inputs for `Flow.minCostMaxFlow`. */
|
|
45102
|
+
interface MinCostMaxFlowInput extends FlowProblemInputBase {
|
|
45103
|
+
flowValue?: string;
|
|
45104
|
+
totalCost?: string;
|
|
45105
|
+
}
|
|
45106
|
+
/** Inputs for `Flow.classifyEdges`. */
|
|
45107
|
+
interface ClassifyEdgesInput extends FlowProblemInputBase {
|
|
45108
|
+
classifications?: string;
|
|
45109
|
+
/** When true, use min-cost-max-flow as the underlying solution
|
|
45110
|
+
* space (requires edges to carry `cost`). */
|
|
45111
|
+
optimal?: boolean;
|
|
45112
|
+
}
|
|
45113
|
+
declare const Flow: {
|
|
45114
|
+
/**
|
|
45115
|
+
* Build a max-flow problem.
|
|
45116
|
+
*
|
|
45117
|
+
* Emits one `flow_edge_constraint` per edge, one
|
|
45118
|
+
* `flow_max_constraint` with the requested output binding, and a
|
|
45119
|
+
* `flow_solve_constraint` trigger. Returns the constraint terms
|
|
45120
|
+
* plus the names of every output variable.
|
|
45121
|
+
*/
|
|
45122
|
+
maxFlow(input: MaxFlowInput): FlowProblem<MaxFlowVars>;
|
|
45123
|
+
/**
|
|
45124
|
+
* Build a min-cut problem.
|
|
45125
|
+
*
|
|
45126
|
+
* Emits `flow_min_cut_constraint` and binds `cut_value`,
|
|
45127
|
+
* `cut_edges`, `source_side`, `sink_side` to the requested
|
|
45128
|
+
* variable names (auto-generated when omitted).
|
|
45129
|
+
*/
|
|
45130
|
+
minCut(input: MinCutInput): FlowProblem<MinCutVars>;
|
|
45131
|
+
/**
|
|
45132
|
+
* Build a min-cost-max-flow problem. Per-edge `cost` is required
|
|
45133
|
+
* for the optimisation to be meaningful (defaults to 0 if absent).
|
|
45134
|
+
*/
|
|
45135
|
+
minCostMaxFlow(input: MinCostMaxFlowInput): FlowProblem<MinCostMaxFlowVars>;
|
|
45136
|
+
/**
|
|
45137
|
+
* Build a Dulmage-Mendelsohn edge-classification problem.
|
|
45138
|
+
*
|
|
45139
|
+
* Each edge is classified as `"always"`, `"never"`, or
|
|
45140
|
+
* `"sometimes"` used across the space of all max flows (or all
|
|
45141
|
+
* min-cost max flows when `optimal: true`).
|
|
45142
|
+
*/
|
|
45143
|
+
classifyEdges(input: ClassifyEdgesInput): FlowProblem<ClassifyEdgesVars>;
|
|
45144
|
+
/** Low-level: build a single `flow_edge_constraint` psi-term. */
|
|
45145
|
+
edge(from: FlowNode, to: FlowNode, cap: number, options?: FlowEdgeOptions): TermInputArg;
|
|
45146
|
+
/** Low-level: build a single `flow_solve_constraint` psi-term. */
|
|
45147
|
+
solve(source: FlowNode, sink: FlowNode): TermInputArg;
|
|
45148
|
+
/**
|
|
45149
|
+
* Low-level: build a single `flow_max_constraint` psi-term.
|
|
45150
|
+
*
|
|
45151
|
+
* @example
|
|
45152
|
+
* ```typescript
|
|
45153
|
+
* const constraints = [
|
|
45154
|
+
* Flow.edge('s', 'a', 10),
|
|
45155
|
+
* Flow.edge('a', 't', 10),
|
|
45156
|
+
* Flow.maxObjective({ source: 's', sink: 't', flowValue: '?V' }),
|
|
45157
|
+
* Flow.solve('s', 't'),
|
|
45158
|
+
* ];
|
|
45159
|
+
* ```
|
|
45160
|
+
*/
|
|
45161
|
+
maxObjective(opts: {
|
|
45162
|
+
source: FlowNode;
|
|
45163
|
+
sink: FlowNode;
|
|
45164
|
+
flowValue: string;
|
|
45165
|
+
}): TermInputArg;
|
|
45166
|
+
/** Low-level: build a single `flow_min_cut_constraint` psi-term. */
|
|
45167
|
+
minCutObjective(opts: {
|
|
45168
|
+
source: FlowNode;
|
|
45169
|
+
sink: FlowNode;
|
|
45170
|
+
cutValue: string;
|
|
45171
|
+
cutEdges: string;
|
|
45172
|
+
sourceSide: string;
|
|
45173
|
+
sinkSide: string;
|
|
45174
|
+
}): TermInputArg;
|
|
45175
|
+
/** Low-level: build a single `flow_min_cost_max_flow_constraint` psi-term. */
|
|
45176
|
+
minCostMaxFlowObjective(opts: {
|
|
45177
|
+
source: FlowNode;
|
|
45178
|
+
sink: FlowNode;
|
|
45179
|
+
flowValue: string;
|
|
45180
|
+
totalCost: string;
|
|
45181
|
+
}): TermInputArg;
|
|
45182
|
+
/** Low-level: build a single `flow_classify_edges_constraint` psi-term. */
|
|
45183
|
+
classifyEdgesObjective(opts: {
|
|
45184
|
+
source: FlowNode;
|
|
45185
|
+
sink: FlowNode;
|
|
45186
|
+
classifications: string;
|
|
45187
|
+
optimal?: boolean;
|
|
45188
|
+
}): TermInputArg;
|
|
45189
|
+
/**
|
|
45190
|
+
* Low-level: get the node-variable reference used to identify a
|
|
45191
|
+
* node name in goals built by this builder. Exposed so callers
|
|
45192
|
+
* composing constraints by hand can refer to the same logical node
|
|
45193
|
+
* the high-level helpers would produce — e.g., to add a feature
|
|
45194
|
+
* test on the same node term inside the same goal.
|
|
45195
|
+
*/
|
|
45196
|
+
node(name: FlowNode): {
|
|
45197
|
+
name: string;
|
|
45198
|
+
};
|
|
45199
|
+
};
|
|
45200
|
+
|
|
44515
45201
|
/**
|
|
44516
45202
|
* Check if a string matches UUID v4 format.
|
|
44517
45203
|
*
|
|
@@ -44696,4 +45382,4 @@ declare function toUntaggedFeatures(features: PlainFeatureMap): Record<string, F
|
|
|
44696
45382
|
*/
|
|
44697
45383
|
declare function toTermInputDto(input: PsiTermInput | TermInputDto): TermInputDto;
|
|
44698
45384
|
|
|
44699
|
-
export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, type AuthConfig, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, compliance as Compliance, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, flowNetworks as FlowNetworks, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, operations as Operations, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|
|
45385
|
+
export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, type ArithmeticOp, type AuthConfig, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClassifyEdgesInput, type ClassifyEdgesVars, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ComparisonOp, compliance as Compliance, type ConstrainedPlainVar, Constraint, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, Flow, type FlowProblem as FlowBuilderProblem, type FlowEdgeInput, type FlowEdgeOptions, flowNetworks as FlowNetworks, type FlowNode, type FlowProblemInputBase, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, type MaxFlowInput, type MaxFlowVars, type MinCostMaxFlowInput, type MinCostMaxFlowVars, type MinCutInput, type MinCutVars, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, type Operand, operations as Operations, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
|