@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.cjs CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  };
8
8
 
9
9
  // src/config.ts
10
- var SDK_VERSION = "1.0.0";
10
+ var SDK_VERSION = "1.1.0";
11
11
  function resolveConfig(config) {
12
12
  if (!config.baseUrl) {
13
13
  throw new Error("ClientConfig.baseUrl is required");
@@ -1519,6 +1519,24 @@ var Inference = class {
1519
1519
  format: "json",
1520
1520
  ...params
1521
1521
  });
1522
+ /**
1523
+ * @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.
1524
+ *
1525
+ * @tags inference
1526
+ * @name ConfigureOrchestrator
1527
+ * @summary Register an OSF Neural-Predicate Orchestrator configuration for the calling tenant.
1528
+ * @request POST:/api/v1/inference/orchestrator/configure
1529
+ * @secure
1530
+ */
1531
+ configureOrchestrator = (data, params = {}) => this.http.request({
1532
+ path: `/api/v1/inference/orchestrator/configure`,
1533
+ method: "POST",
1534
+ body: data,
1535
+ secure: true,
1536
+ type: "application/json" /* Json */,
1537
+ format: "json",
1538
+ ...params
1539
+ });
1522
1540
  /**
1523
1541
  * @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.
1524
1542
  *
@@ -1690,6 +1708,42 @@ var Inference = class {
1690
1708
  format: "json",
1691
1709
  ...params
1692
1710
  });
1711
+ /**
1712
+ * @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.
1713
+ *
1714
+ * @tags inference
1715
+ * @name PredictWithOrchestrator
1716
+ * @summary Score a single Ψ-term: conclusion subsumption probability + per-axiom firing trace + noisy-OR fused confidence.
1717
+ * @request POST:/api/v1/inference/orchestrator/predict
1718
+ * @secure
1719
+ */
1720
+ predictWithOrchestrator = (data, params = {}) => this.http.request({
1721
+ path: `/api/v1/inference/orchestrator/predict`,
1722
+ method: "POST",
1723
+ body: data,
1724
+ secure: true,
1725
+ type: "application/json" /* Json */,
1726
+ format: "json",
1727
+ ...params
1728
+ });
1729
+ /**
1730
+ * @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.
1731
+ *
1732
+ * @tags inference
1733
+ * @name TrainOrchestrator
1734
+ * @summary Run one training epoch over a labelled Ψ-term batch.
1735
+ * @request POST:/api/v1/inference/orchestrator/train
1736
+ * @secure
1737
+ */
1738
+ trainOrchestrator = (data, params = {}) => this.http.request({
1739
+ path: `/api/v1/inference/orchestrator/train`,
1740
+ method: "POST",
1741
+ body: data,
1742
+ secure: true,
1743
+ type: "application/json" /* Json */,
1744
+ format: "json",
1745
+ ...params
1746
+ });
1693
1747
  };
1694
1748
 
1695
1749
  // src/api-spec/generated/Cognitive.ts
@@ -4271,6 +4325,24 @@ var Visualization = class {
4271
4325
  constructor(http) {
4272
4326
  this.http = http;
4273
4327
  }
4328
+ /**
4329
+ * @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.
4330
+ *
4331
+ * @tags visualization
4332
+ * @name GetBranchDiffVisualization
4333
+ * @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.
4334
+ * @request POST:/api/v1/visualization/branch-diff
4335
+ * @secure
4336
+ */
4337
+ getBranchDiffVisualization = (data, params = {}) => this.http.request({
4338
+ path: `/api/v1/visualization/branch-diff`,
4339
+ method: "POST",
4340
+ body: data,
4341
+ secure: true,
4342
+ type: "application/json" /* Json */,
4343
+ format: "json",
4344
+ ...params
4345
+ });
4274
4346
  /**
4275
4347
  * No description
4276
4348
  *
@@ -4289,6 +4361,75 @@ var Visualization = class {
4289
4361
  format: "json",
4290
4362
  ...params
4291
4363
  });
4364
+ /**
4365
+ * @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.
4366
+ *
4367
+ * @tags visualization
4368
+ * @name GetDerivationStream
4369
+ * @summary SSE channel that streams the forward-chainer's derivation steps as they fire, instead of blocking until the full trace is assembled.
4370
+ * @request GET:/api/v1/visualization/derivation/stream
4371
+ * @secure
4372
+ */
4373
+ getDerivationStream = (params = {}) => this.http.request({
4374
+ path: `/api/v1/visualization/derivation/stream`,
4375
+ method: "GET",
4376
+ secure: true,
4377
+ ...params
4378
+ });
4379
+ /**
4380
+ * @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.
4381
+ *
4382
+ * @tags visualization
4383
+ * @name GetDerivationVisualization
4384
+ * @summary Get the forward-chain derivation lattice as a meta-hypergraph.
4385
+ * @request POST:/api/v1/visualization/derivation
4386
+ * @secure
4387
+ */
4388
+ getDerivationVisualization = (data, params = {}) => this.http.request({
4389
+ path: `/api/v1/visualization/derivation`,
4390
+ method: "POST",
4391
+ body: data,
4392
+ secure: true,
4393
+ type: "application/json" /* Json */,
4394
+ format: "json",
4395
+ ...params
4396
+ });
4397
+ /**
4398
+ * No description
4399
+ *
4400
+ * @tags visualization
4401
+ * @name GetFunctionsVisualization
4402
+ * @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.
4403
+ * @request POST:/api/v1/visualization/functions
4404
+ * @secure
4405
+ */
4406
+ getFunctionsVisualization = (data, params = {}) => this.http.request({
4407
+ path: `/api/v1/visualization/functions`,
4408
+ method: "POST",
4409
+ body: data,
4410
+ secure: true,
4411
+ type: "application/json" /* Json */,
4412
+ format: "json",
4413
+ ...params
4414
+ });
4415
+ /**
4416
+ * No description
4417
+ *
4418
+ * @tags visualization
4419
+ * @name GetGradedPosetVisualization
4420
+ * @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
4421
+ * @request POST:/api/v1/visualization/graded-poset
4422
+ * @secure
4423
+ */
4424
+ getGradedPosetVisualization = (data, params = {}) => this.http.request({
4425
+ path: `/api/v1/visualization/graded-poset`,
4426
+ method: "POST",
4427
+ body: data,
4428
+ secure: true,
4429
+ type: "application/json" /* Json */,
4430
+ format: "json",
4431
+ ...params
4432
+ });
4292
4433
  /**
4293
4434
  * No description
4294
4435
  *
@@ -4322,6 +4463,24 @@ var Visualization = class {
4322
4463
  secure: true,
4323
4464
  ...params
4324
4465
  });
4466
+ /**
4467
+ * @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.
4468
+ *
4469
+ * @tags visualization
4470
+ * @name GetLatticeTile
4471
+ * @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).
4472
+ * @request POST:/api/v1/visualization/lattice-tile
4473
+ * @secure
4474
+ */
4475
+ getLatticeTile = (data, params = {}) => this.http.request({
4476
+ path: `/api/v1/visualization/lattice-tile`,
4477
+ method: "POST",
4478
+ body: data,
4479
+ secure: true,
4480
+ type: "application/json" /* Json */,
4481
+ format: "json",
4482
+ ...params
4483
+ });
4325
4484
  /**
4326
4485
  * @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.
4327
4486
  *
@@ -4358,6 +4517,42 @@ var Visualization = class {
4358
4517
  format: "json",
4359
4518
  ...params
4360
4519
  });
4520
+ /**
4521
+ * @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.
4522
+ *
4523
+ * @tags visualization
4524
+ * @name GetSortNeighborhood
4525
+ * @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.
4526
+ * @request POST:/api/v1/visualization/sort-neighborhood
4527
+ * @secure
4528
+ */
4529
+ getSortNeighborhood = (data, params = {}) => this.http.request({
4530
+ path: `/api/v1/visualization/sort-neighborhood`,
4531
+ method: "POST",
4532
+ body: data,
4533
+ secure: true,
4534
+ type: "application/json" /* Json */,
4535
+ format: "json",
4536
+ ...params
4537
+ });
4538
+ /**
4539
+ * No description
4540
+ *
4541
+ * @tags visualization
4542
+ * @name GetTermListVisualization
4543
+ * @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.
4544
+ * @request POST:/api/v1/visualization/term-list
4545
+ * @secure
4546
+ */
4547
+ getTermListVisualization = (data, params = {}) => this.http.request({
4548
+ path: `/api/v1/visualization/term-list`,
4549
+ method: "POST",
4550
+ body: data,
4551
+ secure: true,
4552
+ type: "application/json" /* Json */,
4553
+ format: "json",
4554
+ ...params
4555
+ });
4361
4556
  /**
4362
4557
  * No description
4363
4558
  *
@@ -4392,6 +4587,24 @@ var Visualization = class {
4392
4587
  format: "json",
4393
4588
  ...params
4394
4589
  });
4590
+ /**
4591
+ * @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.
4592
+ *
4593
+ * @tags visualization
4594
+ * @name GetUnifyTermsVisualization
4595
+ * @summary Render the unification (or anti-unification) of two Ψ-terms.
4596
+ * @request POST:/api/v1/visualization/unify-terms
4597
+ * @secure
4598
+ */
4599
+ getUnifyTermsVisualization = (data, params = {}) => this.http.request({
4600
+ path: `/api/v1/visualization/unify-terms`,
4601
+ method: "POST",
4602
+ body: data,
4603
+ secure: true,
4604
+ type: "application/json" /* Json */,
4605
+ format: "json",
4606
+ ...params
4607
+ });
4395
4608
  /**
4396
4609
  * No description
4397
4610
  *
@@ -7745,6 +7958,155 @@ var Ui = class {
7745
7958
  });
7746
7959
  };
7747
7960
 
7961
+ // src/api-spec/generated/Compliance.ts
7962
+ var Compliance = class {
7963
+ http;
7964
+ constructor(http) {
7965
+ this.http = http;
7966
+ }
7967
+ /**
7968
+ * No description
7969
+ *
7970
+ * @tags compliance
7971
+ * @name Append
7972
+ * @summary `POST /api/v1/compliance/audit/append`
7973
+ * @request POST:/api/v1/compliance/audit/append
7974
+ * @secure
7975
+ */
7976
+ append = (data, params = {}) => this.http.request({
7977
+ path: `/api/v1/compliance/audit/append`,
7978
+ method: "POST",
7979
+ body: data,
7980
+ secure: true,
7981
+ type: "application/json" /* Json */,
7982
+ format: "json",
7983
+ ...params
7984
+ });
7985
+ /**
7986
+ * No description
7987
+ *
7988
+ * @tags compliance
7989
+ * @name CaptureSnapshot
7990
+ * @summary `POST /api/v1/predictions/snapshot`
7991
+ * @request POST:/api/v1/predictions/snapshot
7992
+ * @secure
7993
+ */
7994
+ captureSnapshot = (data, params = {}) => this.http.request({
7995
+ path: `/api/v1/predictions/snapshot`,
7996
+ method: "POST",
7997
+ body: data,
7998
+ secure: true,
7999
+ type: "application/json" /* Json */,
8000
+ format: "json",
8001
+ ...params
8002
+ });
8003
+ /**
8004
+ * No description
8005
+ *
8006
+ * @tags compliance
8007
+ * @name GetSnapshot
8008
+ * @summary `GET /api/v1/predictions/snapshot/{id}`
8009
+ * @request GET:/api/v1/predictions/snapshot/{id}
8010
+ * @secure
8011
+ */
8012
+ getSnapshot = (id, params = {}) => this.http.request({
8013
+ path: `/api/v1/predictions/snapshot/${id}`,
8014
+ method: "GET",
8015
+ secure: true,
8016
+ format: "json",
8017
+ ...params
8018
+ });
8019
+ /**
8020
+ * No description
8021
+ *
8022
+ * @tags compliance
8023
+ * @name List
8024
+ * @summary `GET /api/v1/compliance/audit/list`
8025
+ * @request GET:/api/v1/compliance/audit/list
8026
+ * @secure
8027
+ */
8028
+ list = (query, params = {}) => this.http.request({
8029
+ path: `/api/v1/compliance/audit/list`,
8030
+ method: "GET",
8031
+ query,
8032
+ secure: true,
8033
+ format: "json",
8034
+ ...params
8035
+ });
8036
+ /**
8037
+ * No description
8038
+ *
8039
+ * @tags compliance
8040
+ * @name Summary
8041
+ * @summary `GET /api/v1/compliance/audit/summary`
8042
+ * @request GET:/api/v1/compliance/audit/summary
8043
+ * @secure
8044
+ */
8045
+ summary = (params = {}) => this.http.request({
8046
+ path: `/api/v1/compliance/audit/summary`,
8047
+ method: "GET",
8048
+ secure: true,
8049
+ format: "json",
8050
+ ...params
8051
+ });
8052
+ /**
8053
+ * @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.
8054
+ *
8055
+ * @tags compliance
8056
+ * @name ValidateStub
8057
+ * @summary `POST /api/v1/predictions/snapshot/{id}/validate-stub`
8058
+ * @request POST:/api/v1/predictions/snapshot/{id}/validate-stub
8059
+ * @secure
8060
+ */
8061
+ validateStub = (id, params = {}) => this.http.request({
8062
+ path: `/api/v1/predictions/snapshot/${id}/validate-stub`,
8063
+ method: "POST",
8064
+ secure: true,
8065
+ format: "json",
8066
+ ...params
8067
+ });
8068
+ /**
8069
+ * No description
8070
+ *
8071
+ * @tags compliance
8072
+ * @name Verify
8073
+ * @summary `GET /api/v1/compliance/audit/verify`
8074
+ * @request GET:/api/v1/compliance/audit/verify
8075
+ * @secure
8076
+ */
8077
+ verify = (params = {}) => this.http.request({
8078
+ path: `/api/v1/compliance/audit/verify`,
8079
+ method: "GET",
8080
+ secure: true,
8081
+ format: "json",
8082
+ ...params
8083
+ });
8084
+ };
8085
+
8086
+ // src/api-spec/generated/Operations.ts
8087
+ var Operations = class {
8088
+ http;
8089
+ constructor(http) {
8090
+ this.http = http;
8091
+ }
8092
+ /**
8093
+ * @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).
8094
+ *
8095
+ * @tags operations
8096
+ * @name AntiUnify
8097
+ * @summary Anti-unify two Ψ-terms (Least General Generalisation).
8098
+ * @request POST:/api/v1/operations/anti-unify
8099
+ */
8100
+ antiUnify = (data, params = {}) => this.http.request({
8101
+ path: `/api/v1/operations/anti-unify`,
8102
+ method: "POST",
8103
+ body: data,
8104
+ type: "application/json" /* Json */,
8105
+ format: "json",
8106
+ ...params
8107
+ });
8108
+ };
8109
+
7748
8110
  // src/normalizers/sorts.ts
7749
8111
  function ConstraintDtoFromApiToFront(dto) {
7750
8112
  if (dto.type === "FuzzyPathSimilarity") {
@@ -9152,10 +9514,19 @@ function ConstraintInputDtoFromFrontToApi(model) {
9152
9514
  }
9153
9515
  }
9154
9516
  function BackwardChainResponseFromApiToFront(dto) {
9517
+ const wireRefs = dto.referenced_terms;
9518
+ let referencedTerms;
9519
+ if (wireRefs) {
9520
+ referencedTerms = {};
9521
+ for (const [uuid, term] of Object.entries(wireRefs)) {
9522
+ referencedTerms[uuid] = TermDtoFromApiToFront(term);
9523
+ }
9524
+ }
9155
9525
  return {
9156
9526
  solutions: dto.solutions.map(SolutionDtoFromApiToFront),
9157
9527
  queryTimeMs: dto.query_time_ms,
9158
- goalId: dto.goal_id ?? void 0
9528
+ goalId: dto.goal_id ?? void 0,
9529
+ referencedTerms
9159
9530
  };
9160
9531
  }
9161
9532
  function ForwardChainResponseFromApiToFront(dto) {
@@ -9527,7 +9898,8 @@ function BackwardChainRequestFromFrontToApi(model) {
9527
9898
  max_solutions: model.maxSolutions,
9528
9899
  min_certainty: model.minCertainty,
9529
9900
  timeout_ms: model.timeoutMs ?? void 0,
9530
- constraints: model.constraints?.map(ConstraintInputDtoFromFrontToApi)
9901
+ constraints: model.constraints?.map(ConstraintInputDtoFromFrontToApi),
9902
+ expand_bindings: model.expandBindings
9531
9903
  };
9532
9904
  }
9533
9905
  function ForwardChainRequestFromFrontToApi(model) {
@@ -9680,6 +10052,12 @@ var InferenceClient = class {
9680
10052
  *
9681
10053
  * The `timeout_ms` field on the request is a wall-clock timeout for the search.
9682
10054
  * When it fires, the backend returns whatever solutions have been found so far.
10055
+ *
10056
+ * Pass `expandBindings: true` to receive the full {@link TermDto} of every
10057
+ * Ψ-term transitively referenced by a solution's bindings in the
10058
+ * `referencedTerms` sidecar map of the response. Lets the caller read complex
10059
+ * bound values (lists of nested Ψ-terms etc.) without follow-up
10060
+ * `terms.get(uuid)` calls.
9683
10061
  */
9684
10062
  async backwardChain(request) {
9685
10063
  const wireRequest = {
@@ -21759,6 +22137,243 @@ var UiClient = class {
21759
22137
  }
21760
22138
  };
21761
22139
 
22140
+ // src/normalizers/compliance.ts
22141
+ function AppendRequestFromFrontToApi(model) {
22142
+ const dto = {
22143
+ request_path: model.requestPath,
22144
+ request_hash: model.requestHash,
22145
+ response_hash: model.responseHash
22146
+ };
22147
+ if (model.dataVersions !== void 0) dto.data_versions = model.dataVersions;
22148
+ if (model.extra !== void 0) dto.extra = model.extra;
22149
+ return dto;
22150
+ }
22151
+ function AuditRecordFromApiToFront(dto) {
22152
+ return {
22153
+ id: dto.id,
22154
+ tenantId: dto.tenant_id,
22155
+ actor: dto.actor ?? null,
22156
+ timestamp: dto.timestamp,
22157
+ requestPath: dto.request_path,
22158
+ requestHash: dto.request_hash,
22159
+ responseHash: dto.response_hash,
22160
+ prevHash: dto.prev_hash,
22161
+ recordHash: dto.record_hash,
22162
+ gitRevision: dto.git_revision,
22163
+ dataVersions: dto.data_versions,
22164
+ extra: dto.extra
22165
+ };
22166
+ }
22167
+ function SummaryResponseFromApiToFront(dto) {
22168
+ const out = {
22169
+ nRecords: dto.n_records,
22170
+ perActor: dto.per_actor,
22171
+ perRequestPath: dto.per_request_path,
22172
+ tenantId: dto.tenant_id
22173
+ };
22174
+ if (dto.ts_first) out.tsFirst = dto.ts_first;
22175
+ if (dto.ts_last) out.tsLast = dto.ts_last;
22176
+ return out;
22177
+ }
22178
+ function VerifyResponseFromApiToFront(dto) {
22179
+ return {
22180
+ ok: dto.ok,
22181
+ nViolations: dto.n_violations,
22182
+ violations: dto.violations
22183
+ };
22184
+ }
22185
+ function CaptureSnapshotRequestFromFrontToApi(model) {
22186
+ const dto = {
22187
+ request_path_pattern: model.requestPathPattern
22188
+ };
22189
+ if (model.capturedAfter !== void 0) dto.captured_after = model.capturedAfter;
22190
+ if (model.maxEntries !== void 0) dto.max_entries = model.maxEntries;
22191
+ return dto;
22192
+ }
22193
+ function snapshotFilterFromApi(dto) {
22194
+ return {
22195
+ requestPathPattern: dto.request_path_pattern,
22196
+ capturedAfter: dto.captured_after ?? null,
22197
+ maxEntries: dto.max_entries ?? null
22198
+ };
22199
+ }
22200
+ function predictionEntryFromApi(dto) {
22201
+ return {
22202
+ id: dto.id,
22203
+ requestHash: dto.request_hash,
22204
+ responseSummary: dto.response_summary,
22205
+ sourceRecordId: dto.source_record_id,
22206
+ capturedStatus: dto.captured_status,
22207
+ validatedStatus: dto.validated_status ?? null,
22208
+ validatedAt: dto.validated_at ?? null
22209
+ };
22210
+ }
22211
+ function PredictionSnapshotFromApiToFront(dto) {
22212
+ return {
22213
+ id: dto.id,
22214
+ tenantId: dto.tenant_id,
22215
+ capturedAt: dto.captured_at,
22216
+ filter: snapshotFilterFromApi(dto.filter),
22217
+ entries: dto.entries.map(predictionEntryFromApi)
22218
+ };
22219
+ }
22220
+ function ValidationReportDtoFromApiToFront(dto) {
22221
+ return {
22222
+ snapshotId: dto.snapshot_id,
22223
+ completedAt: dto.completed_at,
22224
+ nTotal: dto.n_total,
22225
+ nPending: dto.n_pending,
22226
+ nValidated: dto.n_validated,
22227
+ nRefuted: dto.n_refuted,
22228
+ nUnknown: dto.n_unknown,
22229
+ validationRate: dto.validation_rate ?? null
22230
+ };
22231
+ }
22232
+
22233
+ // src/resources/compliance.ts
22234
+ var ComplianceClient = class {
22235
+ /** @internal */
22236
+ api;
22237
+ /** @internal */
22238
+ constructor(api) {
22239
+ this.api = api;
22240
+ }
22241
+ // ---------------------------------------------------------------
22242
+ // Audit ledger
22243
+ // ---------------------------------------------------------------
22244
+ /**
22245
+ * Append one record to the tenant's audit ledger.
22246
+ *
22247
+ * @param request - Hashes + path + optional metadata.
22248
+ * @returns The freshly appended record (with `recordHash` /
22249
+ * `prevHash` populated by the engine).
22250
+ */
22251
+ async append(request) {
22252
+ const response = await this.api.append(AppendRequestFromFrontToApi(request));
22253
+ return AuditRecordFromApiToFront(response.data);
22254
+ }
22255
+ /**
22256
+ * List audit records for this tenant, optionally filtered.
22257
+ *
22258
+ * @param options - Limit / glob filter on `requestPath`.
22259
+ */
22260
+ async list(options = {}) {
22261
+ const query = {};
22262
+ if (options.limit !== void 0) query.limit = options.limit;
22263
+ if (options.requestPathPattern !== void 0) {
22264
+ query.request_path_pattern = options.requestPathPattern;
22265
+ }
22266
+ const response = await this.api.list(query);
22267
+ return response.data.map(AuditRecordFromApiToFront);
22268
+ }
22269
+ /**
22270
+ * Top-line counts over the tenant's full ledger — useful for
22271
+ * dashboards and quick health checks.
22272
+ */
22273
+ async summary() {
22274
+ const response = await this.api.summary();
22275
+ return SummaryResponseFromApiToFront(response.data);
22276
+ }
22277
+ /**
22278
+ * Re-walk the hash chain end-to-end and report any breaks.
22279
+ *
22280
+ * @returns `ok: true` when the chain is intact. `violations` is
22281
+ * an engine-defined opaque list when it isn't.
22282
+ */
22283
+ async verify() {
22284
+ const response = await this.api.verify();
22285
+ return VerifyResponseFromApiToFront(response.data);
22286
+ }
22287
+ // ---------------------------------------------------------------
22288
+ // Prediction snapshots
22289
+ // ---------------------------------------------------------------
22290
+ /**
22291
+ * Capture a frozen slice of the audit ledger for later validation.
22292
+ *
22293
+ * @param request - Glob-style path filter + optional time / count
22294
+ * bounds.
22295
+ * @returns The freshly persisted snapshot, including every
22296
+ * captured `PredictionEntry`.
22297
+ *
22298
+ * @remarks
22299
+ * The `requestPathPattern` is mandatory. Without it the snapshot
22300
+ * would freeze the entire ledger, which is rarely useful.
22301
+ */
22302
+ async captureSnapshot(request) {
22303
+ const response = await this.api.captureSnapshot(
22304
+ CaptureSnapshotRequestFromFrontToApi(request)
22305
+ );
22306
+ return PredictionSnapshotFromApiToFront(response.data);
22307
+ }
22308
+ /**
22309
+ * Fetch a previously-captured snapshot by id.
22310
+ */
22311
+ async getSnapshot(id) {
22312
+ const response = await this.api.getSnapshot(id);
22313
+ return PredictionSnapshotFromApiToFront(response.data);
22314
+ }
22315
+ /**
22316
+ * Run the stub validator over a snapshot and return a
22317
+ * pending/validated/refuted/unknown report.
22318
+ *
22319
+ * @param id - Snapshot id.
22320
+ *
22321
+ * @remarks
22322
+ * "Stub" is the in-engine validator that defers the actual
22323
+ * ground-truth resolution to a `GroundTruthProviderPort` registered
22324
+ * on the backend. Without a registered provider every entry stays
22325
+ * `Pending`.
22326
+ */
22327
+ async validateStub(id) {
22328
+ const response = await this.api.validateStub(id);
22329
+ return ValidationReportDtoFromApiToFront(response.data);
22330
+ }
22331
+ };
22332
+
22333
+ // src/normalizers/operations.ts
22334
+ function AntiUnifyRequestFromFrontToApi(model) {
22335
+ return {
22336
+ term1_id: model.term1Id,
22337
+ term2_id: model.term2Id
22338
+ };
22339
+ }
22340
+ function AntiUnifyResponseFromApiToFront(dto) {
22341
+ return {
22342
+ lggTermId: dto.lgg_term_id,
22343
+ lgg: TermDtoFromApiToFront(dto.lgg),
22344
+ computationTimeMs: dto.computation_time_ms
22345
+ };
22346
+ }
22347
+
22348
+ // src/resources/operations.ts
22349
+ var OperationsClient = class {
22350
+ /** @internal */
22351
+ api;
22352
+ /** @internal */
22353
+ constructor(api) {
22354
+ this.api = api;
22355
+ }
22356
+ /**
22357
+ * Compute the anti-unification (Least General Generalisation) of
22358
+ * two Ψ-terms.
22359
+ *
22360
+ * @param request - The two term ids to generalise.
22361
+ * @returns The newly-created LGG term + enriched view + timing.
22362
+ *
22363
+ * @remarks
22364
+ * Both ids must already be registered in the tenant's term store.
22365
+ * The LGG is persisted; subsequent calls with the same operands
22366
+ * still produce a fresh LGG term (idempotency is not guaranteed at
22367
+ * this layer — wrap in your own cache if you need it).
22368
+ */
22369
+ async antiUnify(request) {
22370
+ const response = await this.api.antiUnify(
22371
+ AntiUnifyRequestFromFrontToApi(request)
22372
+ );
22373
+ return AntiUnifyResponseFromApiToFront(response.data);
22374
+ }
22375
+ };
22376
+
21762
22377
  // src/client.ts
21763
22378
  var ReasoningLayerClient = class {
21764
22379
  /** Sort (type hierarchy) operations. */
@@ -21861,6 +22476,10 @@ var ReasoningLayerClient = class {
21861
22476
  rlTraining;
21862
22477
  /** Sort-driven UI descriptor operations (describe, action, catalog). */
21863
22478
  ui;
22479
+ /** Hash-chained audit ledger and prediction-snapshot validation. */
22480
+ compliance;
22481
+ /** Low-level term-graph operations (anti-unification / LGG). */
22482
+ operations;
21864
22483
  // ─── Group Caches ─────────────────────────────────────────────────
21865
22484
  _core;
21866
22485
  _ai;
@@ -22093,6 +22712,8 @@ var ReasoningLayerClient = class {
22093
22712
  this.context = new ContextClient(generatedContext);
22094
22713
  this.rlTraining = new RlTrainingClient(generatedRlTraining);
22095
22714
  this.ui = new UiClient(generatedUi);
22715
+ this.compliance = new ComplianceClient(new Compliance(generatedHttp));
22716
+ this.operations = new OperationsClient(new Operations(generatedHttp));
22096
22717
  }
22097
22718
  };
22098
22719
 
@@ -22247,6 +22868,12 @@ var osfql_exports = {};
22247
22868
  // src/types/conversation.ts
22248
22869
  var conversation_exports = {};
22249
22870
 
22871
+ // src/types/compliance.ts
22872
+ var compliance_exports = {};
22873
+
22874
+ // src/types/operations.ts
22875
+ var operations_exports = {};
22876
+
22250
22877
  // src/types/research.ts
22251
22878
  var research_exports = {};
22252
22879
 
@@ -22936,6 +23563,7 @@ exports.Causal = causal_exports;
22936
23563
  exports.Cognitive = cognitive_exports;
22937
23564
  exports.Collections = collections_exports;
22938
23565
  exports.Communities = communities_exports;
23566
+ exports.Compliance = compliance_exports;
22939
23567
  exports.ConstraintViolationError = ConstraintViolationError;
22940
23568
  exports.Constraints = constraints_exports;
22941
23569
  exports.Control = control_exports;
@@ -22963,6 +23591,7 @@ exports.NetworkError = NetworkError;
22963
23591
  exports.NeuroSymbolic = neuro_symbolic_exports;
22964
23592
  exports.NotFoundError = NotFoundError;
22965
23593
  exports.Ontology = ontology_exports;
23594
+ exports.Operations = operations_exports;
22966
23595
  exports.Optimize = optimize_exports;
22967
23596
  exports.Osfql = osfql_exports;
22968
23597
  exports.Oversight = oversight_exports;