@kortexya/reasoninglayer 0.6.0 → 0.8.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
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // src/config.ts
4
- var SDK_VERSION = "0.6.0";
4
+ var SDK_VERSION = "0.8.0";
5
5
  function resolveConfig(config) {
6
6
  if (!config.baseUrl) {
7
7
  throw new Error("ClientConfig.baseUrl is required");
@@ -530,6 +530,28 @@ var HttpClient = class {
530
530
  };
531
531
 
532
532
  // src/serialization.ts
533
+ var USER_DATA_FIELDS = /* @__PURE__ */ new Set([
534
+ // features — term/query feature maps (Record<string, ValueDto>)
535
+ "features",
536
+ // bindings — variable binding maps
537
+ "bindings",
538
+ // evidence — causal evidence maps
539
+ "evidence",
540
+ // exogenous values — causal intervention values
541
+ "exogenous_values",
542
+ "exogenousValues",
543
+ // modified/suggested params — action review params
544
+ "modified_params",
545
+ "modifiedParams",
546
+ "suggested_params",
547
+ "suggestedParams",
548
+ // match key — row matching keys
549
+ "match_key",
550
+ "matchKey",
551
+ // concept values — RAG concept values
552
+ "concept_values",
553
+ "conceptValues"
554
+ ]);
533
555
  function camelToSnake(str) {
534
556
  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
535
557
  }
@@ -541,6 +563,19 @@ function isPlainObject(value) {
541
563
  const proto = Object.getPrototypeOf(value);
542
564
  return proto === Object.prototype || proto === null;
543
565
  }
566
+ function transformUserDataRecord(input, transformFn) {
567
+ if (Array.isArray(input)) {
568
+ return input.map((item) => transformFn(item));
569
+ }
570
+ if (!isPlainObject(input)) {
571
+ return input;
572
+ }
573
+ const result = {};
574
+ for (const key of Object.keys(input)) {
575
+ result[key] = transformFn(input[key]);
576
+ }
577
+ return result;
578
+ }
544
579
  function toSnakeCase(input) {
545
580
  if (Array.isArray(input)) {
546
581
  return input.map((item) => toSnakeCase(item));
@@ -550,7 +585,12 @@ function toSnakeCase(input) {
550
585
  }
551
586
  const result = {};
552
587
  for (const key of Object.keys(input)) {
553
- result[camelToSnake(key)] = toSnakeCase(input[key]);
588
+ const snakeKey = camelToSnake(key);
589
+ if (USER_DATA_FIELDS.has(key)) {
590
+ result[snakeKey] = transformUserDataRecord(input[key], toSnakeCase);
591
+ } else {
592
+ result[snakeKey] = toSnakeCase(input[key]);
593
+ }
554
594
  }
555
595
  return result;
556
596
  }
@@ -563,7 +603,12 @@ function toCamelCase(input) {
563
603
  }
564
604
  const result = {};
565
605
  for (const key of Object.keys(input)) {
566
- result[snakeToCamel(key)] = toCamelCase(input[key]);
606
+ const camelKey = snakeToCamel(key);
607
+ if (USER_DATA_FIELDS.has(key)) {
608
+ result[camelKey] = transformUserDataRecord(input[key], toCamelCase);
609
+ } else {
610
+ result[camelKey] = toCamelCase(input[key]);
611
+ }
567
612
  }
568
613
  return result;
569
614
  }
@@ -8484,7 +8529,7 @@ var QueryClient = class {
8484
8529
  /**
8485
8530
  * Execute an Order-Sorted Feature search.
8486
8531
  *
8487
- * @param request - OSF search request with pattern. Features can be plain JS values.
8532
+ * @param request - Structured search request with pattern. Features can be plain JS values.
8488
8533
  * @returns Structured search results including entities, relations, and suspended query information.
8489
8534
  *
8490
8535
  * @remarks
@@ -8560,7 +8605,7 @@ var QueryClient = class {
8560
8605
  * Search for records matching a pattern with type-aware matching.
8561
8606
  * Alias for {@link osfSearch} using friendlier naming.
8562
8607
  *
8563
- * @param request - OSF search request with pattern.
8608
+ * @param request - Structured search request with pattern.
8564
8609
  * @returns Structured search results including entities, relations, and suspended query information.
8565
8610
  *
8566
8611
  * @see osfSearch
@@ -10230,7 +10275,7 @@ var VisualizationClient = class {
10230
10275
  return response.data;
10231
10276
  }
10232
10277
  /**
10233
- * Generate a hypergraph visualization of OSF terms.
10278
+ * Generate a hypergraph visualization of Psi-terms.
10234
10279
  *
10235
10280
  * @param request - Hypergraph request with root term and traversal options.
10236
10281
  * @returns Hypergraph with graph, stats, components, and degree distribution.
@@ -12239,7 +12284,7 @@ var SyntheticClient = class {
12239
12284
  * @throws {ApiError} If the request fails.
12240
12285
  *
12241
12286
  * @remarks
12242
- * Uses OSF-aware verification with Wu-Palmer sort similarity, feature-level comparison
12287
+ * Uses ontology-aware verification with Wu-Palmer sort similarity, feature-level comparison
12243
12288
  * with type-aware value similarity, and Hungarian algorithm for optimal entity matching.
12244
12289
  *
12245
12290
  * Requires X-Tenant-Id header (set via client configuration).
@@ -12908,7 +12953,7 @@ var OntologyClient = class {
12908
12953
  this.api = api;
12909
12954
  }
12910
12955
  /**
12911
- * Generate an OSFKB scenario from a natural language task description.
12956
+ * Generate a scenario from a natural language task description.
12912
12957
  *
12913
12958
  * @param request - Generation parameters including the prompt and optional clarification answers.
12914
12959
  * @returns Either clarification questions (status `"needs_clarification"`) or the generated scenario (status `"complete"`).
@@ -13755,7 +13800,7 @@ var ReasoningLayerClient = class {
13755
13800
  terms;
13756
13801
  /** Inference engine operations (backward/forward chaining, fuzzy, Bayesian, NAF). */
13757
13802
  inference;
13758
- /** Query operations (unification, OSF search, validation). */
13803
+ /** Query operations (unification, structured search, validation). */
13759
13804
  query;
13760
13805
  /** Cognitive agent operations (BDI cycle, beliefs, goals, messaging). */
13761
13806
  cognitive;
@@ -13835,7 +13880,7 @@ var ReasoningLayerClient = class {
13835
13880
  rag;
13836
13881
  /** Linear program optimization (CLP(Q) simplex solver via backward chaining). */
13837
13882
  optimize;
13838
- /** OSFQL (OSF Query Language) execution operations. */
13883
+ /** OSFQL execution operations. */
13839
13884
  osfql;
13840
13885
  /** Conversational AI operations (NL → OSFQL with self-correction). */
13841
13886
  conversation;