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