@kortexya/reasoninglayer 0.7.0 → 0.9.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.7.0";
4
+ var SDK_VERSION = "0.9.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
  }
@@ -13747,6 +13792,410 @@ var ConversationClient = class {
13747
13792
  }
13748
13793
  };
13749
13794
 
13795
+ // src/resources/research.ts
13796
+ var ResearchClient = class {
13797
+ /** @internal */
13798
+ http;
13799
+ /** @internal */
13800
+ constructor(http) {
13801
+ this.http = http;
13802
+ }
13803
+ /**
13804
+ * Create a new research session for a given research question.
13805
+ *
13806
+ * @param request - The research session creation request.
13807
+ * @returns The created session with its ID, status, and creation timestamp.
13808
+ * @throws {ApiError} If the request fails.
13809
+ *
13810
+ * @remarks
13811
+ * Initializes a new research pipeline session. The session starts in
13812
+ * "Created" status and must be advanced by calling {@link runCycle} or
13813
+ * {@link runToCompletion}.
13814
+ *
13815
+ * @example
13816
+ * ```typescript
13817
+ * const session = await client.research.createSession({
13818
+ * question: 'What are the mechanisms of antibiotic resistance in E. coli?',
13819
+ * maxCycles: 5,
13820
+ * maxPapers: 50,
13821
+ * paperSources: ['PubMed', 'SemanticScholar'],
13822
+ * });
13823
+ * console.log(session.sessionId); // UUID
13824
+ * console.log(session.status); // "Created"
13825
+ * ```
13826
+ */
13827
+ async createSession(request) {
13828
+ const response = await this.http.request({
13829
+ path: "/api/v1/research/sessions",
13830
+ method: "POST",
13831
+ body: request,
13832
+ secure: true,
13833
+ type: "application/json" /* Json */,
13834
+ format: "json"
13835
+ });
13836
+ return response.data;
13837
+ }
13838
+ /**
13839
+ * Get the current state of a research session.
13840
+ *
13841
+ * @param sessionId - The session ID (UUID).
13842
+ * @returns Full session state including cycles, totals, and timestamps.
13843
+ * @throws {ApiError} If the session does not exist or the request fails.
13844
+ *
13845
+ * @remarks
13846
+ * Returns the complete session state including all completed cycle results,
13847
+ * aggregate counts (papers ingested, findings, contradictions, gaps), and
13848
+ * the current session status.
13849
+ *
13850
+ * @example
13851
+ * ```typescript
13852
+ * const session = await client.research.getSession('session-uuid');
13853
+ * console.log(session.status); // "Completed"
13854
+ * console.log(session.totalPapersIngested); // 42
13855
+ * console.log(session.totalFindings); // 17
13856
+ * console.log(session.cycles.length); // 3
13857
+ * ```
13858
+ */
13859
+ async getSession(sessionId) {
13860
+ const response = await this.http.request({
13861
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}`,
13862
+ method: "GET",
13863
+ secure: true,
13864
+ format: "json"
13865
+ });
13866
+ return response.data;
13867
+ }
13868
+ /**
13869
+ * Run a single research cycle within a session.
13870
+ *
13871
+ * @param sessionId - The session ID (UUID).
13872
+ * @param request - Optional parameters for the cycle (additional queries, paper limit).
13873
+ * @returns Cycle results and whether the session has converged.
13874
+ * @throws {ApiError} If the session does not exist or the request fails.
13875
+ *
13876
+ * @remarks
13877
+ * Executes one iteration of the research pipeline: detect knowledge gaps,
13878
+ * generate search queries, retrieve papers, ingest into OSFKB, verify
13879
+ * claims, and detect contradictions. The `converged` field indicates
13880
+ * whether further cycles are needed.
13881
+ *
13882
+ * @example
13883
+ * ```typescript
13884
+ * const result = await client.research.runCycle('session-uuid', {
13885
+ * additionalQueries: ['beta-lactamase gene transfer'],
13886
+ * maxPapersThisCycle: 10,
13887
+ * });
13888
+ * console.log(result.cycle.papersIngested); // 8
13889
+ * console.log(result.cycle.contradictionsDetected); // 1
13890
+ * console.log(result.converged); // false
13891
+ * ```
13892
+ */
13893
+ async runCycle(sessionId, request) {
13894
+ const response = await this.http.request({
13895
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/run`,
13896
+ method: "POST",
13897
+ body: request,
13898
+ secure: true,
13899
+ type: "application/json" /* Json */,
13900
+ format: "json"
13901
+ });
13902
+ return response.data;
13903
+ }
13904
+ /**
13905
+ * Run the research session to completion (all remaining cycles).
13906
+ *
13907
+ * @param sessionId - The session ID (UUID).
13908
+ * @returns Final session state after all cycles have completed.
13909
+ * @throws {ApiError} If the session does not exist or the request fails.
13910
+ *
13911
+ * @remarks
13912
+ * Runs cycles until convergence (no new knowledge gaps) or the maximum
13913
+ * cycle count is reached. This may take significant time depending on
13914
+ * the research question complexity and paper availability.
13915
+ *
13916
+ * @example
13917
+ * ```typescript
13918
+ * const session = await client.research.runToCompletion('session-uuid');
13919
+ * console.log(session.status); // "Completed"
13920
+ * console.log(session.totalPapersIngested); // 47
13921
+ * console.log(session.cycles.length); // 4
13922
+ * ```
13923
+ */
13924
+ async runToCompletion(sessionId) {
13925
+ const response = await this.http.request({
13926
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/complete`,
13927
+ method: "POST",
13928
+ secure: true,
13929
+ format: "json"
13930
+ });
13931
+ return response.data;
13932
+ }
13933
+ /**
13934
+ * Delete a research session and all associated data.
13935
+ *
13936
+ * @param sessionId - The session ID (UUID) to delete.
13937
+ * @throws {ApiError} If the session does not exist or the request fails.
13938
+ *
13939
+ * @remarks
13940
+ * Permanently removes the session, its cycles, findings, gaps, and
13941
+ * contradictions. This operation cannot be undone.
13942
+ *
13943
+ * @example
13944
+ * ```typescript
13945
+ * await client.research.deleteSession('session-uuid');
13946
+ * ```
13947
+ */
13948
+ async deleteSession(sessionId) {
13949
+ await this.http.request({
13950
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}`,
13951
+ method: "DELETE",
13952
+ secure: true
13953
+ });
13954
+ }
13955
+ /**
13956
+ * Get verified findings for a research session.
13957
+ *
13958
+ * @param sessionId - The session ID (UUID).
13959
+ * @returns Findings with evidence assessments, provenance chains, and residuation status.
13960
+ * @throws {ApiError} If the session does not exist or the request fails.
13961
+ *
13962
+ * @remarks
13963
+ * Returns all claims that have been verified through evidence assessment.
13964
+ * Each finding includes supporting and contradicting evidence items,
13965
+ * a truthfulness score, and the full provenance chain from paper to claim.
13966
+ *
13967
+ * @example
13968
+ * ```typescript
13969
+ * const { findings, total } = await client.research.getFindings('session-uuid');
13970
+ * for (const finding of findings) {
13971
+ * console.log(`${finding.statement}: ${finding.label} (${finding.truthfulness})`);
13972
+ * console.log(` Supporting: ${finding.supportingEvidence.length}`);
13973
+ * console.log(` Contradicting: ${finding.contradictingEvidence.length}`);
13974
+ * }
13975
+ * ```
13976
+ */
13977
+ async getFindings(sessionId) {
13978
+ const response = await this.http.request({
13979
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/findings`,
13980
+ method: "GET",
13981
+ secure: true,
13982
+ format: "json"
13983
+ });
13984
+ return response.data;
13985
+ }
13986
+ /**
13987
+ * Get knowledge gaps for a research session.
13988
+ *
13989
+ * @param sessionId - The session ID (UUID).
13990
+ * @returns Knowledge gaps with information gain scores and suggested queries.
13991
+ * @throws {ApiError} If the session does not exist or the request fails.
13992
+ *
13993
+ * @remarks
13994
+ * Returns sorts that are needed by rule heads but have no matching facts,
13995
+ * identified via goal residuation. Each gap includes the information gain
13996
+ * score, the rules that need it, and a suggested search query to resolve it.
13997
+ *
13998
+ * @example
13999
+ * ```typescript
14000
+ * const { gaps, total } = await client.research.getGaps('session-uuid');
14001
+ * for (const gap of gaps) {
14002
+ * console.log(`Missing: ${gap.sortName} (info gain: ${gap.infoGain})`);
14003
+ * console.log(` Needed by: ${gap.neededBy.join(', ')}`);
14004
+ * if (gap.suggestedSearchQuery) {
14005
+ * console.log(` Suggested query: ${gap.suggestedSearchQuery}`);
14006
+ * }
14007
+ * }
14008
+ * ```
14009
+ */
14010
+ async getGaps(sessionId) {
14011
+ const response = await this.http.request({
14012
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/gaps`,
14013
+ method: "GET",
14014
+ secure: true,
14015
+ format: "json"
14016
+ });
14017
+ return response.data;
14018
+ }
14019
+ /**
14020
+ * Get detected contradictions for a research session.
14021
+ *
14022
+ * @param sessionId - The session ID (UUID).
14023
+ * @returns Contradictions with claim pairs, confidence scores, and explanations.
14024
+ * @throws {ApiError} If the session does not exist or the request fails.
14025
+ *
14026
+ * @remarks
14027
+ * Returns pairs of claims where disentailment has been detected. Each
14028
+ * contradiction includes both claim statements, a confidence score, and
14029
+ * an explanation of the logical conflict.
14030
+ *
14031
+ * @example
14032
+ * ```typescript
14033
+ * const { contradictions, total } = await client.research.getContradictions('session-uuid');
14034
+ * for (const c of contradictions) {
14035
+ * console.log(`Contradiction (confidence: ${c.confidence}):`);
14036
+ * console.log(` A: ${c.statementA}`);
14037
+ * console.log(` B: ${c.statementB}`);
14038
+ * console.log(` Explanation: ${c.explanation}`);
14039
+ * }
14040
+ * ```
14041
+ */
14042
+ async getContradictions(sessionId) {
14043
+ const response = await this.http.request({
14044
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/contradictions`,
14045
+ method: "GET",
14046
+ secure: true,
14047
+ format: "json"
14048
+ });
14049
+ return response.data;
14050
+ }
14051
+ /**
14052
+ * Get the full research report for a session.
14053
+ *
14054
+ * @param sessionId - The session ID (UUID).
14055
+ * @returns Complete report with findings, gaps, contradictions, statistics, and verification.
14056
+ * @throws {ApiError} If the session does not exist or the request fails.
14057
+ *
14058
+ * @remarks
14059
+ * Generates and returns a comprehensive research report including the
14060
+ * executive summary, all verified findings, unresolved knowledge gaps,
14061
+ * detected contradictions, research statistics, and an optional
14062
+ * FormalJudge verification result.
14063
+ *
14064
+ * @example
14065
+ * ```typescript
14066
+ * const report = await client.research.getReport('session-uuid');
14067
+ * console.log(report.summary);
14068
+ * console.log(`Findings: ${report.findings.length}`);
14069
+ * console.log(`Gaps: ${report.knowledgeGaps.length}`);
14070
+ * console.log(`Contradictions: ${report.contradictions.length}`);
14071
+ * if (report.verification) {
14072
+ * console.log(`Verdict: ${report.verification.verdict} (${report.verification.score})`);
14073
+ * }
14074
+ * ```
14075
+ */
14076
+ async getReport(sessionId) {
14077
+ const response = await this.http.request({
14078
+ path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/report`,
14079
+ method: "GET",
14080
+ secure: true,
14081
+ format: "json"
14082
+ });
14083
+ return response.data;
14084
+ }
14085
+ /**
14086
+ * Search for papers across external scientific databases.
14087
+ *
14088
+ * @param request - Search parameters including query, max results, and source filters.
14089
+ * @returns Search results with paper metadata and relevance scores.
14090
+ * @throws {ApiError} If the request fails.
14091
+ *
14092
+ * @remarks
14093
+ * Queries external paper databases (PubMed, Semantic Scholar, CrossRef, arXiv)
14094
+ * and returns unified results with relevance scores. Results are not
14095
+ * automatically ingested — use {@link ingestPaper} to add specific papers
14096
+ * to the knowledge base.
14097
+ *
14098
+ * @example
14099
+ * ```typescript
14100
+ * const { results, totalFound } = await client.research.searchPapers({
14101
+ * query: 'CRISPR gene editing efficiency',
14102
+ * maxResults: 20,
14103
+ * sources: ['PubMed', 'SemanticScholar'],
14104
+ * });
14105
+ * console.log(`Found ${totalFound} papers, returning ${results.length}`);
14106
+ * for (const r of results) {
14107
+ * console.log(`${r.metadata.title} (${r.metadata.year}) — score: ${r.relevanceScore}`);
14108
+ * }
14109
+ * ```
14110
+ */
14111
+ async searchPapers(request) {
14112
+ const response = await this.http.request({
14113
+ path: "/api/v1/research/papers/search",
14114
+ method: "POST",
14115
+ body: request,
14116
+ secure: true,
14117
+ type: "application/json" /* Json */,
14118
+ format: "json"
14119
+ });
14120
+ return response.data;
14121
+ }
14122
+ /**
14123
+ * Ingest a specific paper into the knowledge base.
14124
+ *
14125
+ * @param request - Paper identifier and type, with optional session association.
14126
+ * @returns Ingestion result with metadata and extraction counts.
14127
+ * @throws {ApiError} If the request fails.
14128
+ *
14129
+ * @remarks
14130
+ * Retrieves the paper by its identifier (DOI, PMID, arXiv ID, or URL),
14131
+ * extracts entities and claims, and ingests them into the OSFKB. If a
14132
+ * session ID is provided, the ingested data is associated with that
14133
+ * research session.
14134
+ *
14135
+ * @example
14136
+ * ```typescript
14137
+ * const result = await client.research.ingestPaper({
14138
+ * identifier: '10.1038/s41586-023-06004-9',
14139
+ * identifierType: 'doi',
14140
+ * sessionId: 'session-uuid',
14141
+ * });
14142
+ * if (result.success) {
14143
+ * console.log(`Extracted ${result.entitiesExtracted} entities`);
14144
+ * console.log(`Extracted ${result.claimsExtracted} claims`);
14145
+ * }
14146
+ * ```
14147
+ */
14148
+ async ingestPaper(request) {
14149
+ const response = await this.http.request({
14150
+ path: "/api/v1/research/papers/ingest",
14151
+ method: "POST",
14152
+ body: request,
14153
+ secure: true,
14154
+ type: "application/json" /* Json */,
14155
+ format: "json"
14156
+ });
14157
+ return response.data;
14158
+ }
14159
+ /**
14160
+ * Verify a specific claim against evidence in the knowledge base.
14161
+ *
14162
+ * @param request - Claim term ID and evidence sort ID.
14163
+ * @returns Verification result with truthfulness score and evidence counts.
14164
+ * @throws {ApiError} If the request fails.
14165
+ *
14166
+ * @remarks
14167
+ * Runs evidence assessment on a single claim by collecting all evidence
14168
+ * of the specified sort and computing a truthfulness score. The result
14169
+ * includes the assessment label, counts of supporting/contradicting
14170
+ * evidence, and residuation status if insufficient evidence exists.
14171
+ *
14172
+ * @example
14173
+ * ```typescript
14174
+ * const result = await client.research.verifyClaim({
14175
+ * claimTermId: 'claim-term-uuid',
14176
+ * evidenceSortId: 'evidence-sort-uuid',
14177
+ * });
14178
+ * console.log(`Truthfulness: ${result.truthfulness}`);
14179
+ * console.log(`Label: ${result.label}`);
14180
+ * console.log(`Supporting: ${result.supportingCount}, Contradicting: ${result.contradictingCount}`);
14181
+ * if (result.residuated) {
14182
+ * console.log(`Residuated: ${result.residuationReason}`);
14183
+ * }
14184
+ * ```
14185
+ */
14186
+ async verifyClaim(request) {
14187
+ const response = await this.http.request({
14188
+ path: "/api/v1/research/claims/verify",
14189
+ method: "POST",
14190
+ body: request,
14191
+ secure: true,
14192
+ type: "application/json" /* Json */,
14193
+ format: "json"
14194
+ });
14195
+ return response.data;
14196
+ }
14197
+ };
14198
+
13750
14199
  // src/client.ts
13751
14200
  var ReasoningLayerClient = class {
13752
14201
  /** Sort (type hierarchy) operations. */
@@ -13839,6 +14288,8 @@ var ReasoningLayerClient = class {
13839
14288
  osfql;
13840
14289
  /** Conversational AI operations (NL → OSFQL with self-correction). */
13841
14290
  conversation;
14291
+ /** Verified scientific research pipeline operations. */
14292
+ research;
13842
14293
  // ─── Group Caches ─────────────────────────────────────────────────
13843
14294
  _core;
13844
14295
  _ai;
@@ -14060,6 +14511,7 @@ var ReasoningLayerClient = class {
14060
14511
  this.optimize = new OptimizeClient(generatedInference, generatedSorts, generatedQuery, generatedTerms, resolved.tenantId);
14061
14512
  this.osfql = new OsfqlClient(generatedOsfql);
14062
14513
  this.conversation = new ConversationClient(generatedHttp);
14514
+ this.research = new ResearchClient(generatedHttp);
14063
14515
  }
14064
14516
  };
14065
14517
 
@@ -14207,6 +14659,9 @@ var osfql_exports = {};
14207
14659
  // src/types/conversation.ts
14208
14660
  var conversation_exports = {};
14209
14661
 
14662
+ // src/types/research.ts
14663
+ var research_exports = {};
14664
+
14210
14665
  // src/builders/value.ts
14211
14666
  var Value = {
14212
14667
  /**
@@ -14369,6 +14824,277 @@ var FuzzyShape = {
14369
14824
  */
14370
14825
  cyclicGaussian(mean, stdDev, period) {
14371
14826
  return { kind: "CyclicGaussian", mean, stdDev, period };
14827
+ },
14828
+ /**
14829
+ * Create a sigmoid (logistic) fuzzy membership function.
14830
+ *
14831
+ * Monotonic S-curve transition: `μ(x) = 1 / (1 + exp(-steepness * (x - midpoint)))`.
14832
+ * Positive steepness = increasing, negative = decreasing.
14833
+ *
14834
+ * @param midpoint - The x-value where membership = 0.5 (inflection point).
14835
+ * @param steepness - Controls transition sharpness. Positive = left-to-right rise.
14836
+ * @returns A `SigmoidShape`.
14837
+ *
14838
+ * @remarks
14839
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14840
+ *
14841
+ * @example
14842
+ * ```typescript
14843
+ * // DNA match confidence: sharp transition around 95%
14844
+ * FuzzyShape.sigmoid(0.95, 20)
14845
+ * // {"kind": "Sigmoid", "midpoint": 0.95, "steepness": 20}
14846
+ * ```
14847
+ */
14848
+ sigmoid(midpoint, steepness) {
14849
+ return { kind: "Sigmoid", midpoint, steepness };
14850
+ },
14851
+ /**
14852
+ * Create a generalized bell fuzzy membership function.
14853
+ *
14854
+ * Tunable flat-top bell: `μ(x) = 1 / (1 + |((x - center) / width)|^(2*slope))`.
14855
+ * Unlike Gaussian, the slope controls how sharply the curve drops off.
14856
+ *
14857
+ * @param center - Center of the bell (membership = 1).
14858
+ * @param width - Half-width of the bell at the crossover point.
14859
+ * @param slope - Controls steepness of the sides. Higher = sharper edges.
14860
+ * @returns A `BellShape`.
14861
+ *
14862
+ * @remarks
14863
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14864
+ *
14865
+ * @example
14866
+ * ```typescript
14867
+ * FuzzyShape.bell(100, 15, 3)
14868
+ * // {"kind": "Bell", "center": 100, "width": 15, "slope": 3}
14869
+ * ```
14870
+ */
14871
+ bell(center, width, slope) {
14872
+ return { kind: "Bell", center, width, slope };
14873
+ },
14874
+ /**
14875
+ * Create a sigmoid difference fuzzy membership function.
14876
+ *
14877
+ * Difference of two sigmoids: creates a smooth bounded region (like a smooth trapezoidal).
14878
+ * `μ(x) = sigmoid(x, midpoint1, steepness1) - sigmoid(x, midpoint2, steepness2)`.
14879
+ *
14880
+ * @param midpoint1 - Left transition inflection point.
14881
+ * @param steepness1 - Left transition sharpness (positive = rising).
14882
+ * @param midpoint2 - Right transition inflection point.
14883
+ * @param steepness2 - Right transition sharpness (positive = falling).
14884
+ * @returns A `SigmoidDifferenceShape`.
14885
+ *
14886
+ * @remarks
14887
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14888
+ *
14889
+ * @example
14890
+ * ```typescript
14891
+ * // Smooth region between pH 6.5 and 7.5
14892
+ * FuzzyShape.sigmoidDifference(6.5, 10, 7.5, 10)
14893
+ * // {"kind": "SigmoidDifference", "midpoint1": 6.5, "steepness1": 10, "midpoint2": 7.5, "steepness2": 10}
14894
+ * ```
14895
+ */
14896
+ sigmoidDifference(midpoint1, steepness1, midpoint2, steepness2) {
14897
+ return { kind: "SigmoidDifference", midpoint1, steepness1, midpoint2, steepness2 };
14898
+ },
14899
+ /**
14900
+ * Create a Gaussian product (gauss2mf) fuzzy membership function.
14901
+ *
14902
+ * Asymmetric flat-top bell: left Gaussian up to mean1, flat 1.0 in [mean1, mean2],
14903
+ * right Gaussian after mean2.
14904
+ *
14905
+ * @param mean1 - Left Gaussian center.
14906
+ * @param stdDev1 - Left Gaussian standard deviation.
14907
+ * @param mean2 - Right Gaussian center.
14908
+ * @param stdDev2 - Right Gaussian standard deviation.
14909
+ * @returns A `GaussianProductShape`.
14910
+ *
14911
+ * @remarks
14912
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14913
+ *
14914
+ * @example
14915
+ * ```typescript
14916
+ * FuzzyShape.gaussianProduct(36.5, 0.3, 37.5, 0.2)
14917
+ * // {"kind": "GaussianProduct", "mean1": 36.5, "stdDev1": 0.3, "mean2": 37.5, "stdDev2": 0.2}
14918
+ * ```
14919
+ */
14920
+ gaussianProduct(mean1, stdDev1, mean2, stdDev2) {
14921
+ return { kind: "GaussianProduct", mean1, stdDev1, mean2, stdDev2 };
14922
+ },
14923
+ /**
14924
+ * Create a sigmoid product fuzzy membership function.
14925
+ *
14926
+ * Product of two sigmoids: `μ(x) = sigmoid(x, midpoint1, steepness1) * sigmoid(x, midpoint2, steepness2)`.
14927
+ * Always non-negative (unlike {@link sigmoidDifference}).
14928
+ *
14929
+ * @param midpoint1 - First sigmoid inflection point.
14930
+ * @param steepness1 - First sigmoid sharpness.
14931
+ * @param midpoint2 - Second sigmoid inflection point.
14932
+ * @param steepness2 - Second sigmoid sharpness.
14933
+ * @returns A `SigmoidProductShape`.
14934
+ *
14935
+ * @remarks
14936
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14937
+ *
14938
+ * @example
14939
+ * ```typescript
14940
+ * FuzzyShape.sigmoidProduct(6.5, 10, 7.5, -10)
14941
+ * // {"kind": "SigmoidProduct", "midpoint1": 6.5, "steepness1": 10, "midpoint2": 7.5, "steepness2": -10}
14942
+ * ```
14943
+ */
14944
+ sigmoidProduct(midpoint1, steepness1, midpoint2, steepness2) {
14945
+ return { kind: "SigmoidProduct", midpoint1, steepness1, midpoint2, steepness2 };
14946
+ },
14947
+ /**
14948
+ * Create a cosine fuzzy membership function with compact support.
14949
+ *
14950
+ * `μ(x) = 0.5 * (1 + cos(2π/width * (x - center)))` for `|x - center| <= width/2`,
14951
+ * `μ(x) = 0` otherwise.
14952
+ *
14953
+ * @param center - Center of the cosine curve (membership = 1).
14954
+ * @param width - Full width of the support region.
14955
+ * @returns A `CosineShape`.
14956
+ *
14957
+ * @remarks
14958
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14959
+ *
14960
+ * @example
14961
+ * ```typescript
14962
+ * FuzzyShape.cosine(50, 10)
14963
+ * // {"kind": "Cosine", "center": 50, "width": 10}
14964
+ * ```
14965
+ */
14966
+ cosine(center, width) {
14967
+ return { kind: "Cosine", center, width };
14968
+ },
14969
+ /**
14970
+ * Create a spike (Laplacian/double-exponential) fuzzy membership function.
14971
+ *
14972
+ * `μ(x) = exp(-|x - center| / width)`. Sharp cusp at center with exponential tails.
14973
+ *
14974
+ * @param center - Peak of the spike (membership = 1).
14975
+ * @param width - Controls the rate of exponential decay.
14976
+ * @returns A `SpikeShape`.
14977
+ *
14978
+ * @remarks
14979
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
14980
+ *
14981
+ * @example
14982
+ * ```typescript
14983
+ * FuzzyShape.spike(100, 5)
14984
+ * // {"kind": "Spike", "center": 100, "width": 5}
14985
+ * ```
14986
+ */
14987
+ spike(center, width) {
14988
+ return { kind: "Spike", center, width };
14989
+ },
14990
+ /**
14991
+ * Create a Cauchy (Lorentzian) fuzzy membership function.
14992
+ *
14993
+ * `μ(x) = 1 / (1 + ((x - center) / gamma)^2)`. Heavy-tailed bell whose tails never reach zero.
14994
+ *
14995
+ * @param center - Center of the Cauchy curve (membership = 1).
14996
+ * @param gamma - Half-width at half-maximum, controlling the spread.
14997
+ * @returns A `CauchyShape`.
14998
+ *
14999
+ * @remarks
15000
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
15001
+ *
15002
+ * @example
15003
+ * ```typescript
15004
+ * FuzzyShape.cauchy(0, 1)
15005
+ * // {"kind": "Cauchy", "center": 0, "gamma": 1}
15006
+ * ```
15007
+ */
15008
+ cauchy(center, gamma) {
15009
+ return { kind: "Cauchy", center, gamma };
15010
+ },
15011
+ /**
15012
+ * Create an S-shaped (smf) fuzzy membership function.
15013
+ *
15014
+ * Smooth monotonic spline from 0 to 1 using piecewise quadratic.
15015
+ * Reaches exact 0 and 1 (unlike {@link sigmoid}).
15016
+ *
15017
+ * @param a - Foot: x-value where membership starts rising from 0.
15018
+ * @param b - Shoulder: x-value where membership reaches 1.
15019
+ * @returns An `SShapeShape`.
15020
+ *
15021
+ * @remarks
15022
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
15023
+ *
15024
+ * @example
15025
+ * ```typescript
15026
+ * FuzzyShape.sShape(20, 80)
15027
+ * // {"kind": "SShape", "a": 20, "b": 80}
15028
+ * ```
15029
+ */
15030
+ sShape(a, b) {
15031
+ return { kind: "SShape", a, b };
15032
+ },
15033
+ /**
15034
+ * Create a Z-shaped (zmf) fuzzy membership function.
15035
+ *
15036
+ * Mirror of {@link sShape}. Smooth monotonic spline from 1 to 0
15037
+ * using piecewise quadratic.
15038
+ *
15039
+ * @param a - Shoulder: x-value where membership starts falling from 1.
15040
+ * @param b - Foot: x-value where membership reaches 0.
15041
+ * @returns A `ZShapeShape`.
15042
+ *
15043
+ * @remarks
15044
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
15045
+ *
15046
+ * @example
15047
+ * ```typescript
15048
+ * FuzzyShape.zShape(20, 80)
15049
+ * // {"kind": "ZShape", "a": 20, "b": 80}
15050
+ * ```
15051
+ */
15052
+ zShape(a, b) {
15053
+ return { kind: "ZShape", a, b };
15054
+ },
15055
+ /**
15056
+ * Create a Pi-shaped (pimf) fuzzy membership function.
15057
+ *
15058
+ * Smooth flat-top bump: `μ(x) = SShape(x, a, b) * ZShape(x, c, d)`.
15059
+ * Like a smooth trapezoidal.
15060
+ *
15061
+ * @param a - Left foot (SShape start).
15062
+ * @param b - Left shoulder (SShape end).
15063
+ * @param c - Right shoulder (ZShape start).
15064
+ * @param d - Right foot (ZShape end).
15065
+ * @returns A `PiShapeShape`.
15066
+ *
15067
+ * @remarks
15068
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
15069
+ *
15070
+ * @example
15071
+ * ```typescript
15072
+ * FuzzyShape.piShape(10, 20, 60, 80)
15073
+ * // {"kind": "PiShape", "a": 10, "b": 20, "c": 60, "d": 80}
15074
+ * ```
15075
+ */
15076
+ piShape(a, b, c, d) {
15077
+ return { kind: "PiShape", a, b, c, d };
15078
+ },
15079
+ /**
15080
+ * Create a piecewise linear fuzzy membership function.
15081
+ *
15082
+ * Membership is linearly interpolated between the provided (x, mu) data points.
15083
+ *
15084
+ * @param points - Array of `[x, mu]` tuples defining the membership function.
15085
+ * @returns A `PiecewiseLinearShape`.
15086
+ *
15087
+ * @remarks
15088
+ * Serialization format: Tagged by `"kind"` (FuzzyShapeDto).
15089
+ *
15090
+ * @example
15091
+ * ```typescript
15092
+ * FuzzyShape.piecewiseLinear([[0, 0], [0.5, 1], [1, 0]])
15093
+ * // {"kind": "PiecewiseLinear", "points": [[0, 0], [0.5, 1], [1, 0]]}
15094
+ * ```
15095
+ */
15096
+ piecewiseLinear(points) {
15097
+ return { kind: "PiecewiseLinear", points };
14372
15098
  }
14373
15099
  };
14374
15100
 
@@ -14648,6 +15374,7 @@ exports.RateLimitError = RateLimitError;
14648
15374
  exports.Reasoning = reasoning_exports;
14649
15375
  exports.ReasoningLayerClient = ReasoningLayerClient;
14650
15376
  exports.ReasoningLayerError = ReasoningLayerError;
15377
+ exports.Research = research_exports;
14651
15378
  exports.Reviews = reviews_exports;
14652
15379
  exports.Row = row_exports;
14653
15380
  exports.SDK_VERSION = SDK_VERSION;