@kortexya/reasoninglayer 1.14.0 → 1.15.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.14.0";
10
+ var SDK_VERSION = "1.15.0";
11
11
  function resolveConfig(config) {
12
12
  if (!config.baseUrl) {
13
13
  throw new Error("ClientConfig.baseUrl is required");
@@ -1414,9 +1414,10 @@ var Terms = class {
1414
1414
  * @request GET:/api/v1/terms
1415
1415
  * @secure
1416
1416
  */
1417
- listTerms = (params = {}) => this.http.request({
1417
+ listTerms = (query, params = {}) => this.http.request({
1418
1418
  path: `/api/v1/terms`,
1419
1419
  method: "GET",
1420
+ query,
1420
1421
  secure: true,
1421
1422
  format: "json",
1422
1423
  ...params
@@ -1496,7 +1497,7 @@ var Inference = class {
1496
1497
  ...params
1497
1498
  });
1498
1499
  /**
1499
- * @description # TRUE HOMOICONIC API Request contains a goal term and optional constraints. Response returns solutions with term-based substitutions. ## Temporal Reasoning Use constraints to filter by temporal relations: ```json { "goal": {"sort_name": "Employment", "features": {"valid_to": {"name": "?EndTime"}}}, "constraints": [{"type": "Guard", "left": "?EndTime", "op": "lt", "right": "1583020800000"}] } ``` # Authorization Requires X-Tenant-Id header.
1500
+ * @description # TRUE HOMOICONIC API Request contains a goal term and optional constraints. Response returns solutions with term-based substitutions. ## Temporal Reasoning Use constraints to filter by temporal relations: ```json { "goal": {"sort_name": "Employment", "features": {"valid_to": {"name": "?EndTime"}}}, "constraints": [{"type": "Guard", "left": "?EndTime", "op": "lt", "right": "1583020800000"}] } ``` # Authorization Requires X-Tenant-Id header. Traced: this is the path the zanzibar gateway hits for every permission check, so it is where an end-to-end trace either explains a slow request or does not. `skip_all` because the request body can be large and has no business in a span attribute.
1500
1501
  *
1501
1502
  * @tags inference
1502
1503
  * @name BackwardChain
@@ -1753,9 +1754,10 @@ var Inference = class {
1753
1754
  * @request GET:/api/v1/inference/facts/{tenant_id}
1754
1755
  * @secure
1755
1756
  */
1756
- getFacts = (tenantId, params = {}) => this.http.request({
1757
+ getFacts = (tenantId, query, params = {}) => this.http.request({
1757
1758
  path: `/api/v1/inference/facts/${tenantId}`,
1758
1759
  method: "GET",
1760
+ query,
1759
1761
  secure: true,
1760
1762
  format: "json",
1761
1763
  ...params
@@ -2645,7 +2647,7 @@ var Ingestion = class {
2645
2647
  ...params
2646
2648
  });
2647
2649
  /**
2648
- * @description POST /api/v1/ingest/document This endpoint accepts a document (as base64 or URL) and: 1. Parses it to Markdown using the document parser service (Docling) 2. Processes the Markdown through the existing ingestion pipeline 3. Returns combined statistics from both stages # Headers - `X-Tenant-Id`: Tenant ID for multi-tenancy isolation (required) # Request Body - `document`: Document source (base64 or URL) - `document_type`: Optional type hint (auto-detected if not provided) - `owner_id`: User ID who owns the ingested data - `ocr_config`: Optional OCR/parsing configuration - `ingestion_config`: Optional markdown ingestion configuration # Response - `success`: Whether ingestion completed successfully - `parse_stats`: Statistics from document parsing - `metadata`: Extracted document metadata - `ingestion_stats`: Statistics from markdown ingestion - `pending_review`: Entities that need human review
2650
+ * @description POST /api/v1/ingest/document This endpoint accepts a document (as base64 or URL) and: 1. Parses it to Markdown using the document parser service (Docling) 2. Returns the generated Markdown to the caller 3. Unless `parse_only` is true, processes the Markdown through ingestion 4. Returns combined statistics from the completed stages # Headers - `X-Tenant-Id`: Tenant ID for multi-tenancy isolation (required) # Request Body - `document`: Document source (base64 or URL) - `document_type`: Optional type hint (auto-detected if not provided) - `owner_id`: User ID who owns the ingested data - `ocr_config`: Optional OCR/parsing configuration - `ingestion_config`: Optional markdown ingestion configuration - `parse_only`: Return Markdown without creating sessions or semantic terms # Response - `success`: Whether ingestion completed successfully - `parse_stats`: Statistics from document parsing - `metadata`: Extracted document metadata - `markdown`: Markdown generated by Docling/OCR - `ingestion_stats`: Statistics from markdown ingestion - `pending_review`: Entities that need human review
2649
2651
  *
2650
2652
  * @tags ingestion
2651
2653
  * @name IngestDocument
@@ -2980,6 +2982,22 @@ var StructuredIngestion = class {
2980
2982
  format: "json",
2981
2983
  ...params
2982
2984
  });
2985
+ /**
2986
+ * @description The pre-registration half of #71's mode-discovery surface: a client rendering a "new source" picker learns, at type-selection time, which types registration would accept and which write-path modes each would serve — without constructing a source (postgres, for example, opens a connection pool eagerly). Static per build, so no tenant state is consulted; auth is still required, as for every route under `/api/v1`.
2987
+ *
2988
+ * @tags structured_ingestion
2989
+ * @name ListSourceTypesCatalog
2990
+ * @summary List the source types this build can register, with their mode capabilities.
2991
+ * @request GET:/api/v1/sources/types
2992
+ * @secure
2993
+ */
2994
+ listSourceTypesCatalog = (params = {}) => this.http.request({
2995
+ path: `/api/v1/sources/types`,
2996
+ method: "GET",
2997
+ secure: true,
2998
+ format: "json",
2999
+ ...params
3000
+ });
2983
3001
  /**
2984
3002
  * @description Creates a connector instance from the provided configuration and registers it with the structured ingestion service for subsequent schema discovery and data ingestion.
2985
3003
  *
@@ -21096,6 +21114,7 @@ function RegisterSourceResponseFromApiToFront(dto) {
21096
21114
  sourceId: dto.source_id,
21097
21115
  sourceType: dto.source_type,
21098
21116
  mode: dto.mode,
21117
+ supportedModes: dto.supported_modes,
21099
21118
  message: dto.message
21100
21119
  };
21101
21120
  }
@@ -21118,7 +21137,21 @@ function SourceDetailResponseFromApiToFront(dto) {
21118
21137
  sourceId: dto.source_id,
21119
21138
  sourceType: dto.source_type,
21120
21139
  available: dto.available,
21121
- mode: dto.mode
21140
+ mode: dto.mode,
21141
+ supportedModes: dto.supported_modes
21142
+ };
21143
+ }
21144
+ function SourceTypeDtoFromApiToFront(dto) {
21145
+ return {
21146
+ sourceType: dto.source_type,
21147
+ aliases: dto.aliases,
21148
+ available: dto.available,
21149
+ supportedModes: dto.supported_modes
21150
+ };
21151
+ }
21152
+ function ListSourceTypesResponseFromApiToFront(dto) {
21153
+ return {
21154
+ types: dto.types.map(SourceTypeDtoFromApiToFront)
21122
21155
  };
21123
21156
  }
21124
21157
  function DiscoverSchemaRequestFromFrontToApi(model) {
@@ -21235,17 +21268,21 @@ var SourcesClient = class {
21235
21268
  *
21236
21269
  * @param request - Source registration request. Set `mode` to declare the write-path
21237
21270
  * intent (`'transpile'` for live SQL views, `'ingest'` to materialize rows as
21238
- * Ψ-term facts); omit it to take the capability-grounded default (`transpile` for
21239
- * postgres, `ingest` otherwise).
21271
+ * Ψ-term facts); omit it to take the default, which is `'ingest'` for every
21272
+ * source type (#71).
21240
21273
  * @returns Registration result. `mode` always carries the **resolved** write-path
21241
- * mode, including when the default applied.
21242
- * @throws {ApiError} If registration fails, or with **422** if `mode` is not one of
21243
- * `transpile` / `ingest`.
21274
+ * mode, including when the default applied; `supportedModes` advertises which
21275
+ * modes this source's adapter can serve.
21276
+ * @throws {ApiError} If registration fails, with **422** if `mode` is not one of
21277
+ * `transpile` / `ingest`, or with **422** if `mode: 'transpile'` is requested
21278
+ * for a source whose adapter cannot execute transpiled SQL (a live view over it
21279
+ * could never be queried).
21244
21280
  *
21245
21281
  * @remarks
21246
21282
  * Registering with `mode: 'transpile'` makes {@link SourcesClient.ingest} refuse this
21247
21283
  * source with a **409** — materializing a transpiled source would create a second,
21248
- * divergent namespace over the same rows.
21284
+ * divergent namespace over the same rows. To learn which types accept `transpile`
21285
+ * before registering, call {@link SourcesClient.listSourceTypes}.
21249
21286
  *
21250
21287
  * @example
21251
21288
  * ```typescript
@@ -21257,12 +21294,44 @@ var SourcesClient = class {
21257
21294
  * mode: 'ingest',
21258
21295
  * });
21259
21296
  * console.log(result.mode); // 'ingest'
21297
+ * console.log(result.supportedModes); // ['ingest', 'transpile']
21260
21298
  * ```
21261
21299
  */
21262
21300
  async register(request) {
21263
21301
  const response = await this.api.registerSource(RegisterSourceRequestFromFrontToApi(request));
21264
21302
  return RegisterSourceResponseFromApiToFront(response.data);
21265
21303
  }
21304
+ /**
21305
+ * List the source types this build can register, with their mode capabilities.
21306
+ *
21307
+ * @returns Every registrable source type, its availability in this build, and the
21308
+ * write-path modes each would serve — before any source exists.
21309
+ * @throws {ApiError} If the request fails.
21310
+ *
21311
+ * @remarks
21312
+ * Sent to `GET /api/v1/sources/types`. The pre-registration half of #71's
21313
+ * mode-discovery surface: a client rendering a "new source" picker learns, at
21314
+ * type-selection time, which types registration would accept (`available` — a
21315
+ * type behind an uncompiled cargo feature is `false`) and which modes each
21316
+ * would serve (`supportedModes` — always `'ingest'`, plus `'transpile'` only
21317
+ * for the SQL engines). Static per build, so no tenant state is consulted.
21318
+ *
21319
+ * Drive a mode selector from `supportedModes` rather than a hard-coded list of
21320
+ * source types: the set is the adapter's declared capability, so it stays
21321
+ * correct as adapters gain the ability (MySQL and SQLite did in #70).
21322
+ *
21323
+ * @example
21324
+ * ```typescript
21325
+ * const { types } = await client.sources.listSourceTypes();
21326
+ * const postgres = types.find((t) => t.sourceType === 'postgres');
21327
+ * console.log(postgres?.supportedModes); // ['ingest', 'transpile']
21328
+ * console.log(postgres?.aliases); // ['postgresql']
21329
+ * ```
21330
+ */
21331
+ async listSourceTypes() {
21332
+ const response = await this.api.listSourceTypesCatalog();
21333
+ return ListSourceTypesResponseFromApiToFront(response.data);
21334
+ }
21266
21335
  /**
21267
21336
  * List all registered data sources.
21268
21337
  *