@kortexya/reasoninglayer 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/config.ts
8
- var SDK_VERSION = "1.0.0";
8
+ var SDK_VERSION = "1.1.0";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -1517,6 +1517,24 @@ var Inference = class {
1517
1517
  format: "json",
1518
1518
  ...params
1519
1519
  });
1520
+ /**
1521
+ * @description In OSF/LIFE terms, an orchestrator wires neural sort-subsumption gates (`τ(x ⊑ S) ∈ [0, 1]`) for a conclusion sort and a set of antecedent sorts. Knowledge axioms reference homoiconic rule Ψ-terms registered in the tenant's KB. The first call lazily instantiates the underlying Candle-backed gates; subsequent calls within the same tenant share gate state. # Authorization Requires `X-Tenant-Id` header.
1522
+ *
1523
+ * @tags inference
1524
+ * @name ConfigureOrchestrator
1525
+ * @summary Register an OSF Neural-Predicate Orchestrator configuration for the calling tenant.
1526
+ * @request POST:/api/v1/inference/orchestrator/configure
1527
+ * @secure
1528
+ */
1529
+ configureOrchestrator = (data, params = {}) => this.http.request({
1530
+ path: `/api/v1/inference/orchestrator/configure`,
1531
+ method: "POST",
1532
+ body: data,
1533
+ secure: true,
1534
+ type: "application/json" /* Json */,
1535
+ format: "json",
1536
+ ...params
1537
+ });
1520
1538
  /**
1521
1539
  * @description # TRUE HOMOICONICITY Goals are first-class Ψ-terms that can be created, persisted, and reused. This endpoint creates a goal from clauses and optional constraints, persists it to PostgreSQL, and returns the goal ID for later use. # Authorization Requires X-Tenant-Id header.
1522
1540
  *
@@ -1688,6 +1706,42 @@ var Inference = class {
1688
1706
  format: "json",
1689
1707
  ...params
1690
1708
  });
1709
+ /**
1710
+ * @description In OSF/LIFE terms, the orchestrator forwards the Ψ-term through the conclusion gate to read `τ(x ⊑ conclusion_sort)`, then for each knowledge axiom evaluates its antecedent gates and combines them with the conclusion truth via Reichenbach (`1 − a + a · c`). The fused confidence aggregates per-axiom modus-ponens witness strength via noisy-OR. # Authorization Requires `X-Tenant-Id` header.
1711
+ *
1712
+ * @tags inference
1713
+ * @name PredictWithOrchestrator
1714
+ * @summary Score a single Ψ-term: conclusion subsumption probability + per-axiom firing trace + noisy-OR fused confidence.
1715
+ * @request POST:/api/v1/inference/orchestrator/predict
1716
+ * @secure
1717
+ */
1718
+ predictWithOrchestrator = (data, params = {}) => this.http.request({
1719
+ path: `/api/v1/inference/orchestrator/predict`,
1720
+ method: "POST",
1721
+ body: data,
1722
+ secure: true,
1723
+ type: "application/json" /* Json */,
1724
+ format: "json",
1725
+ ...params
1726
+ });
1727
+ /**
1728
+ * @description In OSF/LIFE terms, the orchestrator pushes the conclusion gate and each antecedent gate toward the dual-weighted satisfaction objective `1 − ( w_D · K_D + w_K · K_K )` (paper eq. 4). Each call performs exactly one epoch over the supplied batch — the response carries the per-epoch metrics for that single epoch (multi-epoch aggregation is the caller's responsibility). # Authorization Requires `X-Tenant-Id` header.
1729
+ *
1730
+ * @tags inference
1731
+ * @name TrainOrchestrator
1732
+ * @summary Run one training epoch over a labelled Ψ-term batch.
1733
+ * @request POST:/api/v1/inference/orchestrator/train
1734
+ * @secure
1735
+ */
1736
+ trainOrchestrator = (data, params = {}) => this.http.request({
1737
+ path: `/api/v1/inference/orchestrator/train`,
1738
+ method: "POST",
1739
+ body: data,
1740
+ secure: true,
1741
+ type: "application/json" /* Json */,
1742
+ format: "json",
1743
+ ...params
1744
+ });
1691
1745
  };
1692
1746
 
1693
1747
  // src/api-spec/generated/Cognitive.ts
@@ -4269,6 +4323,24 @@ var Visualization = class {
4269
4323
  constructor(http) {
4270
4324
  this.http = http;
4271
4325
  }
4326
+ /**
4327
+ * @description Note: when MVCC branching isn't materialized as named branches in the user's store, this endpoint surfaces an empty diff. The shape is preserved so clients can rely on it without conditional code.
4328
+ *
4329
+ * @tags visualization
4330
+ * @name GetBranchDiffVisualization
4331
+ * @summary Render the diff between two MVCC branches of the tenant's term store. Each visible Ψ-term carries `properties.diff` ∈ `{added, removed, changed}` so the renderer can color-distinguish.
4332
+ * @request POST:/api/v1/visualization/branch-diff
4333
+ * @secure
4334
+ */
4335
+ getBranchDiffVisualization = (data, params = {}) => this.http.request({
4336
+ path: `/api/v1/visualization/branch-diff`,
4337
+ method: "POST",
4338
+ body: data,
4339
+ secure: true,
4340
+ type: "application/json" /* Json */,
4341
+ format: "json",
4342
+ ...params
4343
+ });
4272
4344
  /**
4273
4345
  * No description
4274
4346
  *
@@ -4287,6 +4359,75 @@ var Visualization = class {
4287
4359
  format: "json",
4288
4360
  ...params
4289
4361
  });
4362
+ /**
4363
+ * @description Each event is a JSON-encoded `DerivationStepEvent` with shape: ```json { "iteration": 3, "rule_id": "uuid", "antecedents": ["uuid",...], "derived_fact": "uuid" } ``` Sent once per record produced during the chainer pass. The client can animate each polygon emerging as its premise edges arrive.
4364
+ *
4365
+ * @tags visualization
4366
+ * @name GetDerivationStream
4367
+ * @summary SSE channel that streams the forward-chainer's derivation steps as they fire, instead of blocking until the full trace is assembled.
4368
+ * @request GET:/api/v1/visualization/derivation/stream
4369
+ * @secure
4370
+ */
4371
+ getDerivationStream = (params = {}) => this.http.request({
4372
+ path: `/api/v1/visualization/derivation/stream`,
4373
+ method: "GET",
4374
+ secure: true,
4375
+ ...params
4376
+ });
4377
+ /**
4378
+ * @description Runs the homoiconic forward chainer with provenance enabled and emits a [`VisualizationGraph`] in which: - **Nodes** are Ψ-terms (each one is either an asserted fact, a rule, or a derived fact). Rules surface as `NodeType::Rule`. - **Edges** are `EdgeType::Derivation`, oriented antecedent → rule-application → produced-fact, mirroring the proof DAG. - **Hyperedges** are `HyperedgeType::DerivationStep` — one per rule application, grouping the rule with all its antecedents plus the produced fact. Rendering each step as a polygon makes "this fact came from these premises via this rule" visually atomic — exactly the idea behind Aït-Kaci & Sasaki's proof-tree diagrams in OSF/LIFE papers.
4379
+ *
4380
+ * @tags visualization
4381
+ * @name GetDerivationVisualization
4382
+ * @summary Get the forward-chain derivation lattice as a meta-hypergraph.
4383
+ * @request POST:/api/v1/visualization/derivation
4384
+ * @secure
4385
+ */
4386
+ getDerivationVisualization = (data, params = {}) => this.http.request({
4387
+ path: `/api/v1/visualization/derivation`,
4388
+ method: "POST",
4389
+ body: data,
4390
+ secure: true,
4391
+ type: "application/json" /* Json */,
4392
+ format: "json",
4393
+ ...params
4394
+ });
4395
+ /**
4396
+ * No description
4397
+ *
4398
+ * @tags visualization
4399
+ * @name GetFunctionsVisualization
4400
+ * @summary Render the LIFE-style function definitions in the tenant's term store. A LIFE function is itself a Ψ-term (homoiconic) — typically a term whose sort is `function` (or a subtype) carrying features `head`, `body`, optional `equations`. This handler scans the store for terms matching that signature and emits one TermFeatures-style hyperedge per function so each is visually atomic.
4401
+ * @request POST:/api/v1/visualization/functions
4402
+ * @secure
4403
+ */
4404
+ getFunctionsVisualization = (data, params = {}) => this.http.request({
4405
+ path: `/api/v1/visualization/functions`,
4406
+ method: "POST",
4407
+ body: data,
4408
+ secure: true,
4409
+ type: "application/json" /* Json */,
4410
+ format: "json",
4411
+ ...params
4412
+ });
4413
+ /**
4414
+ * No description
4415
+ *
4416
+ * @tags visualization
4417
+ * @name GetGradedPosetVisualization
4418
+ * @summary Render the graded-poset projection of the tenant's sort hierarchy per "Weisfeiler & Lehman Go Categorical" (Choi, Kim, Yun 2026): - elements = sorts - dimension(σ) = topological depth from the lattice top - coverings = parent → child (subtype) - 4-adjacency edges when requested
4419
+ * @request POST:/api/v1/visualization/graded-poset
4420
+ * @secure
4421
+ */
4422
+ getGradedPosetVisualization = (data, params = {}) => this.http.request({
4423
+ path: `/api/v1/visualization/graded-poset`,
4424
+ method: "POST",
4425
+ body: data,
4426
+ secure: true,
4427
+ type: "application/json" /* Json */,
4428
+ format: "json",
4429
+ ...params
4430
+ });
4290
4431
  /**
4291
4432
  * No description
4292
4433
  *
@@ -4320,6 +4461,24 @@ var Visualization = class {
4320
4461
  secure: true,
4321
4462
  ...params
4322
4463
  });
4464
+ /**
4465
+ * @description The layout is computed once per tenant (per hierarchy snapshot) and cached. Coordinates are stable across requests, so the client can pan/zoom by submitting different bboxes and the same node always lands at the same screen position.
4466
+ *
4467
+ * @tags visualization
4468
+ * @name GetLatticeTile
4469
+ * @summary Render only the lattice nodes that fall inside the client's viewport, using a stable pre-computed deterministic layout. This scales to millions of sorts because the per-request work is O(K) where K is the number of nodes inside the viewport, not O(N).
4470
+ * @request POST:/api/v1/visualization/lattice-tile
4471
+ * @secure
4472
+ */
4473
+ getLatticeTile = (data, params = {}) => this.http.request({
4474
+ path: `/api/v1/visualization/lattice-tile`,
4475
+ method: "POST",
4476
+ body: data,
4477
+ secure: true,
4478
+ type: "application/json" /* Json */,
4479
+ format: "json",
4480
+ ...params
4481
+ });
4323
4482
  /**
4324
4483
  * @description Returns a graph representation of the sort hierarchy with nodes for each sort and edges for subtype relationships. Supports filtering by root sort and depth.
4325
4484
  *
@@ -4356,6 +4515,42 @@ var Visualization = class {
4356
4515
  format: "json",
4357
4516
  ...params
4358
4517
  });
4518
+ /**
4519
+ * @description BFS expands ancestors and/or descendants from the focus, emitting each visited sort with its signed hop distance as `level`. When the visit count would exceed `max_nodes`, the BFS halts and the `truncated` flag is set; the closest sorts are kept.
4520
+ *
4521
+ * @tags visualization
4522
+ * @name GetSortNeighborhood
4523
+ * @summary Render an N-hop neighborhood around a focus sort, capped at `max_nodes`. Designed for tenants with millions of sorts — the client never sees the full lattice; it browses by picking a focus and walking outward.
4524
+ * @request POST:/api/v1/visualization/sort-neighborhood
4525
+ * @secure
4526
+ */
4527
+ getSortNeighborhood = (data, params = {}) => this.http.request({
4528
+ path: `/api/v1/visualization/sort-neighborhood`,
4529
+ method: "POST",
4530
+ body: data,
4531
+ secure: true,
4532
+ type: "application/json" /* Json */,
4533
+ format: "json",
4534
+ ...params
4535
+ });
4536
+ /**
4537
+ * No description
4538
+ *
4539
+ * @tags visualization
4540
+ * @name GetTermListVisualization
4541
+ * @summary Paginated raw list of Ψ-terms for visualization. Mirrors the `lattice` endpoint but for terms — at 9M terms in the drug-discovery tenant the first page returns sub-second without loading the in-memory term store.
4542
+ * @request POST:/api/v1/visualization/term-list
4543
+ * @secure
4544
+ */
4545
+ getTermListVisualization = (data, params = {}) => this.http.request({
4546
+ path: `/api/v1/visualization/term-list`,
4547
+ method: "POST",
4548
+ body: data,
4549
+ secure: true,
4550
+ type: "application/json" /* Json */,
4551
+ format: "json",
4552
+ ...params
4553
+ });
4359
4554
  /**
4360
4555
  * No description
4361
4556
  *
@@ -4390,6 +4585,24 @@ var Visualization = class {
4390
4585
  format: "json",
4391
4586
  ...params
4392
4587
  });
4588
+ /**
4589
+ * @description **Unify (`⊔`)**: computes the meet on the Ψ-term lattice — the most-specific term that subsumes both operands. Variables in either operand bind to the corresponding sub-term in the other. **Anti-unify (`⊓`)**: computes the join — the least-general generalization (LGG) that subsumes both operands, introducing fresh variables where they disagree. This is the operation Aït-Kaci & Sasaki used for ILP rule synthesis. The handler runs the operation in a sandbox (trail-undone after snapshot) so the tenant's term store is not mutated by a visualization request. Returns operand1, operand2, and the result as polygons in one `VisualizationGraph`, with `properties.role` distinguishing each.
4590
+ *
4591
+ * @tags visualization
4592
+ * @name GetUnifyTermsVisualization
4593
+ * @summary Render the unification (or anti-unification) of two Ψ-terms.
4594
+ * @request POST:/api/v1/visualization/unify-terms
4595
+ * @secure
4596
+ */
4597
+ getUnifyTermsVisualization = (data, params = {}) => this.http.request({
4598
+ path: `/api/v1/visualization/unify-terms`,
4599
+ method: "POST",
4600
+ body: data,
4601
+ secure: true,
4602
+ type: "application/json" /* Json */,
4603
+ format: "json",
4604
+ ...params
4605
+ });
4393
4606
  /**
4394
4607
  * No description
4395
4608
  *
@@ -7743,6 +7956,155 @@ var Ui = class {
7743
7956
  });
7744
7957
  };
7745
7958
 
7959
+ // src/api-spec/generated/Compliance.ts
7960
+ var Compliance = class {
7961
+ http;
7962
+ constructor(http) {
7963
+ this.http = http;
7964
+ }
7965
+ /**
7966
+ * No description
7967
+ *
7968
+ * @tags compliance
7969
+ * @name Append
7970
+ * @summary `POST /api/v1/compliance/audit/append`
7971
+ * @request POST:/api/v1/compliance/audit/append
7972
+ * @secure
7973
+ */
7974
+ append = (data, params = {}) => this.http.request({
7975
+ path: `/api/v1/compliance/audit/append`,
7976
+ method: "POST",
7977
+ body: data,
7978
+ secure: true,
7979
+ type: "application/json" /* Json */,
7980
+ format: "json",
7981
+ ...params
7982
+ });
7983
+ /**
7984
+ * No description
7985
+ *
7986
+ * @tags compliance
7987
+ * @name CaptureSnapshot
7988
+ * @summary `POST /api/v1/predictions/snapshot`
7989
+ * @request POST:/api/v1/predictions/snapshot
7990
+ * @secure
7991
+ */
7992
+ captureSnapshot = (data, params = {}) => this.http.request({
7993
+ path: `/api/v1/predictions/snapshot`,
7994
+ method: "POST",
7995
+ body: data,
7996
+ secure: true,
7997
+ type: "application/json" /* Json */,
7998
+ format: "json",
7999
+ ...params
8000
+ });
8001
+ /**
8002
+ * No description
8003
+ *
8004
+ * @tags compliance
8005
+ * @name GetSnapshot
8006
+ * @summary `GET /api/v1/predictions/snapshot/{id}`
8007
+ * @request GET:/api/v1/predictions/snapshot/{id}
8008
+ * @secure
8009
+ */
8010
+ getSnapshot = (id, params = {}) => this.http.request({
8011
+ path: `/api/v1/predictions/snapshot/${id}`,
8012
+ method: "GET",
8013
+ secure: true,
8014
+ format: "json",
8015
+ ...params
8016
+ });
8017
+ /**
8018
+ * No description
8019
+ *
8020
+ * @tags compliance
8021
+ * @name List
8022
+ * @summary `GET /api/v1/compliance/audit/list`
8023
+ * @request GET:/api/v1/compliance/audit/list
8024
+ * @secure
8025
+ */
8026
+ list = (query, params = {}) => this.http.request({
8027
+ path: `/api/v1/compliance/audit/list`,
8028
+ method: "GET",
8029
+ query,
8030
+ secure: true,
8031
+ format: "json",
8032
+ ...params
8033
+ });
8034
+ /**
8035
+ * No description
8036
+ *
8037
+ * @tags compliance
8038
+ * @name Summary
8039
+ * @summary `GET /api/v1/compliance/audit/summary`
8040
+ * @request GET:/api/v1/compliance/audit/summary
8041
+ * @secure
8042
+ */
8043
+ summary = (params = {}) => this.http.request({
8044
+ path: `/api/v1/compliance/audit/summary`,
8045
+ method: "GET",
8046
+ secure: true,
8047
+ format: "json",
8048
+ ...params
8049
+ });
8050
+ /**
8051
+ * @description Runs validation with a built-in stub provider that returns `Pending` for every entry. Real consumers wire their own `GroundTruthProviderPort` implementation and call `PredictionLedgerPort::validate` from a service.
8052
+ *
8053
+ * @tags compliance
8054
+ * @name ValidateStub
8055
+ * @summary `POST /api/v1/predictions/snapshot/{id}/validate-stub`
8056
+ * @request POST:/api/v1/predictions/snapshot/{id}/validate-stub
8057
+ * @secure
8058
+ */
8059
+ validateStub = (id, params = {}) => this.http.request({
8060
+ path: `/api/v1/predictions/snapshot/${id}/validate-stub`,
8061
+ method: "POST",
8062
+ secure: true,
8063
+ format: "json",
8064
+ ...params
8065
+ });
8066
+ /**
8067
+ * No description
8068
+ *
8069
+ * @tags compliance
8070
+ * @name Verify
8071
+ * @summary `GET /api/v1/compliance/audit/verify`
8072
+ * @request GET:/api/v1/compliance/audit/verify
8073
+ * @secure
8074
+ */
8075
+ verify = (params = {}) => this.http.request({
8076
+ path: `/api/v1/compliance/audit/verify`,
8077
+ method: "GET",
8078
+ secure: true,
8079
+ format: "json",
8080
+ ...params
8081
+ });
8082
+ };
8083
+
8084
+ // src/api-spec/generated/Operations.ts
8085
+ var Operations = class {
8086
+ http;
8087
+ constructor(http) {
8088
+ this.http = http;
8089
+ }
8090
+ /**
8091
+ * @description `POST /api/v1/operations/anti-unify` Accepts two Ψ-term ids and returns the LGG term computed by the engine's [`AntiUnificationEngine`](osfkb_domain::operations::ilp::AntiUnificationEngine). The LGG is persisted in the tenant's term store; the response carries both its id and an enriched view (sort name + display name + referenced-term summaries).
8092
+ *
8093
+ * @tags operations
8094
+ * @name AntiUnify
8095
+ * @summary Anti-unify two Ψ-terms (Least General Generalisation).
8096
+ * @request POST:/api/v1/operations/anti-unify
8097
+ */
8098
+ antiUnify = (data, params = {}) => this.http.request({
8099
+ path: `/api/v1/operations/anti-unify`,
8100
+ method: "POST",
8101
+ body: data,
8102
+ type: "application/json" /* Json */,
8103
+ format: "json",
8104
+ ...params
8105
+ });
8106
+ };
8107
+
7746
8108
  // src/normalizers/sorts.ts
7747
8109
  function ConstraintDtoFromApiToFront(dto) {
7748
8110
  if (dto.type === "FuzzyPathSimilarity") {
@@ -9150,10 +9512,19 @@ function ConstraintInputDtoFromFrontToApi(model) {
9150
9512
  }
9151
9513
  }
9152
9514
  function BackwardChainResponseFromApiToFront(dto) {
9515
+ const wireRefs = dto.referenced_terms;
9516
+ let referencedTerms;
9517
+ if (wireRefs) {
9518
+ referencedTerms = {};
9519
+ for (const [uuid, term] of Object.entries(wireRefs)) {
9520
+ referencedTerms[uuid] = TermDtoFromApiToFront(term);
9521
+ }
9522
+ }
9153
9523
  return {
9154
9524
  solutions: dto.solutions.map(SolutionDtoFromApiToFront),
9155
9525
  queryTimeMs: dto.query_time_ms,
9156
- goalId: dto.goal_id ?? void 0
9526
+ goalId: dto.goal_id ?? void 0,
9527
+ referencedTerms
9157
9528
  };
9158
9529
  }
9159
9530
  function ForwardChainResponseFromApiToFront(dto) {
@@ -9525,7 +9896,8 @@ function BackwardChainRequestFromFrontToApi(model) {
9525
9896
  max_solutions: model.maxSolutions,
9526
9897
  min_certainty: model.minCertainty,
9527
9898
  timeout_ms: model.timeoutMs ?? void 0,
9528
- constraints: model.constraints?.map(ConstraintInputDtoFromFrontToApi)
9899
+ constraints: model.constraints?.map(ConstraintInputDtoFromFrontToApi),
9900
+ expand_bindings: model.expandBindings
9529
9901
  };
9530
9902
  }
9531
9903
  function ForwardChainRequestFromFrontToApi(model) {
@@ -9678,6 +10050,12 @@ var InferenceClient = class {
9678
10050
  *
9679
10051
  * The `timeout_ms` field on the request is a wall-clock timeout for the search.
9680
10052
  * When it fires, the backend returns whatever solutions have been found so far.
10053
+ *
10054
+ * Pass `expandBindings: true` to receive the full {@link TermDto} of every
10055
+ * Ψ-term transitively referenced by a solution's bindings in the
10056
+ * `referencedTerms` sidecar map of the response. Lets the caller read complex
10057
+ * bound values (lists of nested Ψ-terms etc.) without follow-up
10058
+ * `terms.get(uuid)` calls.
9681
10059
  */
9682
10060
  async backwardChain(request) {
9683
10061
  const wireRequest = {
@@ -21757,6 +22135,243 @@ var UiClient = class {
21757
22135
  }
21758
22136
  };
21759
22137
 
22138
+ // src/normalizers/compliance.ts
22139
+ function AppendRequestFromFrontToApi(model) {
22140
+ const dto = {
22141
+ request_path: model.requestPath,
22142
+ request_hash: model.requestHash,
22143
+ response_hash: model.responseHash
22144
+ };
22145
+ if (model.dataVersions !== void 0) dto.data_versions = model.dataVersions;
22146
+ if (model.extra !== void 0) dto.extra = model.extra;
22147
+ return dto;
22148
+ }
22149
+ function AuditRecordFromApiToFront(dto) {
22150
+ return {
22151
+ id: dto.id,
22152
+ tenantId: dto.tenant_id,
22153
+ actor: dto.actor ?? null,
22154
+ timestamp: dto.timestamp,
22155
+ requestPath: dto.request_path,
22156
+ requestHash: dto.request_hash,
22157
+ responseHash: dto.response_hash,
22158
+ prevHash: dto.prev_hash,
22159
+ recordHash: dto.record_hash,
22160
+ gitRevision: dto.git_revision,
22161
+ dataVersions: dto.data_versions,
22162
+ extra: dto.extra
22163
+ };
22164
+ }
22165
+ function SummaryResponseFromApiToFront(dto) {
22166
+ const out = {
22167
+ nRecords: dto.n_records,
22168
+ perActor: dto.per_actor,
22169
+ perRequestPath: dto.per_request_path,
22170
+ tenantId: dto.tenant_id
22171
+ };
22172
+ if (dto.ts_first) out.tsFirst = dto.ts_first;
22173
+ if (dto.ts_last) out.tsLast = dto.ts_last;
22174
+ return out;
22175
+ }
22176
+ function VerifyResponseFromApiToFront(dto) {
22177
+ return {
22178
+ ok: dto.ok,
22179
+ nViolations: dto.n_violations,
22180
+ violations: dto.violations
22181
+ };
22182
+ }
22183
+ function CaptureSnapshotRequestFromFrontToApi(model) {
22184
+ const dto = {
22185
+ request_path_pattern: model.requestPathPattern
22186
+ };
22187
+ if (model.capturedAfter !== void 0) dto.captured_after = model.capturedAfter;
22188
+ if (model.maxEntries !== void 0) dto.max_entries = model.maxEntries;
22189
+ return dto;
22190
+ }
22191
+ function snapshotFilterFromApi(dto) {
22192
+ return {
22193
+ requestPathPattern: dto.request_path_pattern,
22194
+ capturedAfter: dto.captured_after ?? null,
22195
+ maxEntries: dto.max_entries ?? null
22196
+ };
22197
+ }
22198
+ function predictionEntryFromApi(dto) {
22199
+ return {
22200
+ id: dto.id,
22201
+ requestHash: dto.request_hash,
22202
+ responseSummary: dto.response_summary,
22203
+ sourceRecordId: dto.source_record_id,
22204
+ capturedStatus: dto.captured_status,
22205
+ validatedStatus: dto.validated_status ?? null,
22206
+ validatedAt: dto.validated_at ?? null
22207
+ };
22208
+ }
22209
+ function PredictionSnapshotFromApiToFront(dto) {
22210
+ return {
22211
+ id: dto.id,
22212
+ tenantId: dto.tenant_id,
22213
+ capturedAt: dto.captured_at,
22214
+ filter: snapshotFilterFromApi(dto.filter),
22215
+ entries: dto.entries.map(predictionEntryFromApi)
22216
+ };
22217
+ }
22218
+ function ValidationReportDtoFromApiToFront(dto) {
22219
+ return {
22220
+ snapshotId: dto.snapshot_id,
22221
+ completedAt: dto.completed_at,
22222
+ nTotal: dto.n_total,
22223
+ nPending: dto.n_pending,
22224
+ nValidated: dto.n_validated,
22225
+ nRefuted: dto.n_refuted,
22226
+ nUnknown: dto.n_unknown,
22227
+ validationRate: dto.validation_rate ?? null
22228
+ };
22229
+ }
22230
+
22231
+ // src/resources/compliance.ts
22232
+ var ComplianceClient = class {
22233
+ /** @internal */
22234
+ api;
22235
+ /** @internal */
22236
+ constructor(api) {
22237
+ this.api = api;
22238
+ }
22239
+ // ---------------------------------------------------------------
22240
+ // Audit ledger
22241
+ // ---------------------------------------------------------------
22242
+ /**
22243
+ * Append one record to the tenant's audit ledger.
22244
+ *
22245
+ * @param request - Hashes + path + optional metadata.
22246
+ * @returns The freshly appended record (with `recordHash` /
22247
+ * `prevHash` populated by the engine).
22248
+ */
22249
+ async append(request) {
22250
+ const response = await this.api.append(AppendRequestFromFrontToApi(request));
22251
+ return AuditRecordFromApiToFront(response.data);
22252
+ }
22253
+ /**
22254
+ * List audit records for this tenant, optionally filtered.
22255
+ *
22256
+ * @param options - Limit / glob filter on `requestPath`.
22257
+ */
22258
+ async list(options = {}) {
22259
+ const query = {};
22260
+ if (options.limit !== void 0) query.limit = options.limit;
22261
+ if (options.requestPathPattern !== void 0) {
22262
+ query.request_path_pattern = options.requestPathPattern;
22263
+ }
22264
+ const response = await this.api.list(query);
22265
+ return response.data.map(AuditRecordFromApiToFront);
22266
+ }
22267
+ /**
22268
+ * Top-line counts over the tenant's full ledger — useful for
22269
+ * dashboards and quick health checks.
22270
+ */
22271
+ async summary() {
22272
+ const response = await this.api.summary();
22273
+ return SummaryResponseFromApiToFront(response.data);
22274
+ }
22275
+ /**
22276
+ * Re-walk the hash chain end-to-end and report any breaks.
22277
+ *
22278
+ * @returns `ok: true` when the chain is intact. `violations` is
22279
+ * an engine-defined opaque list when it isn't.
22280
+ */
22281
+ async verify() {
22282
+ const response = await this.api.verify();
22283
+ return VerifyResponseFromApiToFront(response.data);
22284
+ }
22285
+ // ---------------------------------------------------------------
22286
+ // Prediction snapshots
22287
+ // ---------------------------------------------------------------
22288
+ /**
22289
+ * Capture a frozen slice of the audit ledger for later validation.
22290
+ *
22291
+ * @param request - Glob-style path filter + optional time / count
22292
+ * bounds.
22293
+ * @returns The freshly persisted snapshot, including every
22294
+ * captured `PredictionEntry`.
22295
+ *
22296
+ * @remarks
22297
+ * The `requestPathPattern` is mandatory. Without it the snapshot
22298
+ * would freeze the entire ledger, which is rarely useful.
22299
+ */
22300
+ async captureSnapshot(request) {
22301
+ const response = await this.api.captureSnapshot(
22302
+ CaptureSnapshotRequestFromFrontToApi(request)
22303
+ );
22304
+ return PredictionSnapshotFromApiToFront(response.data);
22305
+ }
22306
+ /**
22307
+ * Fetch a previously-captured snapshot by id.
22308
+ */
22309
+ async getSnapshot(id) {
22310
+ const response = await this.api.getSnapshot(id);
22311
+ return PredictionSnapshotFromApiToFront(response.data);
22312
+ }
22313
+ /**
22314
+ * Run the stub validator over a snapshot and return a
22315
+ * pending/validated/refuted/unknown report.
22316
+ *
22317
+ * @param id - Snapshot id.
22318
+ *
22319
+ * @remarks
22320
+ * "Stub" is the in-engine validator that defers the actual
22321
+ * ground-truth resolution to a `GroundTruthProviderPort` registered
22322
+ * on the backend. Without a registered provider every entry stays
22323
+ * `Pending`.
22324
+ */
22325
+ async validateStub(id) {
22326
+ const response = await this.api.validateStub(id);
22327
+ return ValidationReportDtoFromApiToFront(response.data);
22328
+ }
22329
+ };
22330
+
22331
+ // src/normalizers/operations.ts
22332
+ function AntiUnifyRequestFromFrontToApi(model) {
22333
+ return {
22334
+ term1_id: model.term1Id,
22335
+ term2_id: model.term2Id
22336
+ };
22337
+ }
22338
+ function AntiUnifyResponseFromApiToFront(dto) {
22339
+ return {
22340
+ lggTermId: dto.lgg_term_id,
22341
+ lgg: TermDtoFromApiToFront(dto.lgg),
22342
+ computationTimeMs: dto.computation_time_ms
22343
+ };
22344
+ }
22345
+
22346
+ // src/resources/operations.ts
22347
+ var OperationsClient = class {
22348
+ /** @internal */
22349
+ api;
22350
+ /** @internal */
22351
+ constructor(api) {
22352
+ this.api = api;
22353
+ }
22354
+ /**
22355
+ * Compute the anti-unification (Least General Generalisation) of
22356
+ * two Ψ-terms.
22357
+ *
22358
+ * @param request - The two term ids to generalise.
22359
+ * @returns The newly-created LGG term + enriched view + timing.
22360
+ *
22361
+ * @remarks
22362
+ * Both ids must already be registered in the tenant's term store.
22363
+ * The LGG is persisted; subsequent calls with the same operands
22364
+ * still produce a fresh LGG term (idempotency is not guaranteed at
22365
+ * this layer — wrap in your own cache if you need it).
22366
+ */
22367
+ async antiUnify(request) {
22368
+ const response = await this.api.antiUnify(
22369
+ AntiUnifyRequestFromFrontToApi(request)
22370
+ );
22371
+ return AntiUnifyResponseFromApiToFront(response.data);
22372
+ }
22373
+ };
22374
+
21760
22375
  // src/client.ts
21761
22376
  var ReasoningLayerClient = class {
21762
22377
  /** Sort (type hierarchy) operations. */
@@ -21859,6 +22474,10 @@ var ReasoningLayerClient = class {
21859
22474
  rlTraining;
21860
22475
  /** Sort-driven UI descriptor operations (describe, action, catalog). */
21861
22476
  ui;
22477
+ /** Hash-chained audit ledger and prediction-snapshot validation. */
22478
+ compliance;
22479
+ /** Low-level term-graph operations (anti-unification / LGG). */
22480
+ operations;
21862
22481
  // ─── Group Caches ─────────────────────────────────────────────────
21863
22482
  _core;
21864
22483
  _ai;
@@ -22091,6 +22710,8 @@ var ReasoningLayerClient = class {
22091
22710
  this.context = new ContextClient(generatedContext);
22092
22711
  this.rlTraining = new RlTrainingClient(generatedRlTraining);
22093
22712
  this.ui = new UiClient(generatedUi);
22713
+ this.compliance = new ComplianceClient(new Compliance(generatedHttp));
22714
+ this.operations = new OperationsClient(new Operations(generatedHttp));
22094
22715
  }
22095
22716
  };
22096
22717
 
@@ -22245,6 +22866,12 @@ var osfql_exports = {};
22245
22866
  // src/types/conversation.ts
22246
22867
  var conversation_exports = {};
22247
22868
 
22869
+ // src/types/compliance.ts
22870
+ var compliance_exports = {};
22871
+
22872
+ // src/types/operations.ts
22873
+ var operations_exports = {};
22874
+
22248
22875
  // src/types/research.ts
22249
22876
  var research_exports = {};
22250
22877
 
@@ -22922,6 +23549,6 @@ function discriminateFeatureValue(value) {
22922
23549
  );
22923
23550
  }
22924
23551
 
22925
- export { ANY_ROLE, action_reviews_exports as ActionReviews, admin_exports as Admin, analysis_exports as Analysis, ApiError, AuthenticationError, BadRequestError, cdl_exports as CDL, causal_exports as Causal, cognitive_exports as Cognitive, collections_exports as Collections, communities_exports as Communities, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, discovery_exports as Discovery, execution_exports as Execution, extract_exports as Extract, ForbiddenError, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inference_exports as Inference, ingestion_exports as Ingestion, IngestionFailedError, IngestionSession, InternalServerError, LP, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, optimize_exports as Optimize, osfql_exports as Osfql, oversight_exports as Oversight, plain_values_exports as PlainValues, preferences_exports as Preferences, proof_engine_exports as ProofEngine, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, row_exports as Row, SDK_VERSION, scenarios_exports as Scenarios, scheduling_exports as Scheduling, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, statistical_exports as Statistical, synthetic_exports as Synthetic, terms_exports as Terms, TimeoutError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
23552
+ export { ANY_ROLE, action_reviews_exports as ActionReviews, admin_exports as Admin, analysis_exports as Analysis, ApiError, AuthenticationError, BadRequestError, cdl_exports as CDL, causal_exports as Causal, cognitive_exports as Cognitive, collections_exports as Collections, communities_exports as Communities, compliance_exports as Compliance, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, discovery_exports as Discovery, execution_exports as Execution, extract_exports as Extract, ForbiddenError, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, generation_exports as Generation, health_exports as Health, homoiconic_exports as Homoiconic, ilp_exports as ILP, image_extraction_exports as ImageExtraction, inference_exports as Inference, ingestion_exports as Ingestion, IngestionFailedError, IngestionSession, InternalServerError, LP, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, operations_exports as Operations, optimize_exports as Optimize, osfql_exports as Osfql, oversight_exports as Oversight, plain_values_exports as PlainValues, preferences_exports as Preferences, proof_engine_exports as ProofEngine, query_exports as Query, rag_exports as RAG, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, reviews_exports as Reviews, row_exports as Row, SDK_VERSION, scenarios_exports as Scenarios, scheduling_exports as Scheduling, SortBuilder, sorts_exports as Sorts, sources_exports as Sources, spaces_exports as Spaces, statistical_exports as Statistical, synthetic_exports as Synthetic, terms_exports as Terms, TimeoutError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, visualization_exports as Visualization, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
22926
23553
  //# sourceMappingURL=index.js.map
22927
23554
  //# sourceMappingURL=index.js.map