@kortexya/reasoninglayer 1.9.0 → 1.10.1
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 +257 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +257 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
|
|
|
109
109
|
* This is the single source of truth for the version constant.
|
|
110
110
|
* The `scripts/release.sh` script updates this value alongside `package.json`.
|
|
111
111
|
*/
|
|
112
|
-
declare const SDK_VERSION = "1.
|
|
112
|
+
declare const SDK_VERSION = "1.10.1";
|
|
113
113
|
/**
|
|
114
114
|
* Authentication mode for the SDK.
|
|
115
115
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
|
|
|
109
109
|
* This is the single source of truth for the version constant.
|
|
110
110
|
* The `scripts/release.sh` script updates this value alongside `package.json`.
|
|
111
111
|
*/
|
|
112
|
-
declare const SDK_VERSION = "1.
|
|
112
|
+
declare const SDK_VERSION = "1.10.1";
|
|
113
113
|
/**
|
|
114
114
|
* Authentication mode for the SDK.
|
|
115
115
|
*
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/config.ts
|
|
8
|
-
var SDK_VERSION = "1.
|
|
8
|
+
var SDK_VERSION = "1.10.1";
|
|
9
9
|
function resolveConfig(config) {
|
|
10
10
|
if (!config.baseUrl) {
|
|
11
11
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -22873,6 +22873,246 @@ var VerificationClient = class {
|
|
|
22873
22873
|
}
|
|
22874
22874
|
};
|
|
22875
22875
|
|
|
22876
|
+
// src/normalizers/research.ts
|
|
22877
|
+
function PaperMetadataFromApiToFront(dto) {
|
|
22878
|
+
return {
|
|
22879
|
+
title: dto.title,
|
|
22880
|
+
authors: dto.authors,
|
|
22881
|
+
doi: dto.doi ?? null,
|
|
22882
|
+
pmid: dto.pmid ?? null,
|
|
22883
|
+
arxivId: dto.arxiv_id ?? null,
|
|
22884
|
+
journal: dto.journal ?? null,
|
|
22885
|
+
year: dto.year ?? null,
|
|
22886
|
+
abstractText: dto.abstract_text ?? null,
|
|
22887
|
+
citationCount: dto.citation_count ?? null,
|
|
22888
|
+
source: dto.source,
|
|
22889
|
+
fullTextUrl: dto.full_text_url ?? null
|
|
22890
|
+
};
|
|
22891
|
+
}
|
|
22892
|
+
function PaperSearchResultFromApiToFront(dto) {
|
|
22893
|
+
return {
|
|
22894
|
+
metadata: PaperMetadataFromApiToFront(dto.metadata),
|
|
22895
|
+
relevanceScore: dto.relevance_score ?? null
|
|
22896
|
+
};
|
|
22897
|
+
}
|
|
22898
|
+
function SearchPapersResponseFromApiToFront(raw) {
|
|
22899
|
+
const dto = raw;
|
|
22900
|
+
return {
|
|
22901
|
+
results: (dto.results ?? []).map(PaperSearchResultFromApiToFront),
|
|
22902
|
+
totalFound: dto.total_found
|
|
22903
|
+
};
|
|
22904
|
+
}
|
|
22905
|
+
function CreateResearchSessionResponseFromApiToFront(raw) {
|
|
22906
|
+
const dto = raw;
|
|
22907
|
+
return {
|
|
22908
|
+
sessionId: dto.session_id,
|
|
22909
|
+
status: dto.status,
|
|
22910
|
+
question: dto.question,
|
|
22911
|
+
createdAt: dto.created_at
|
|
22912
|
+
};
|
|
22913
|
+
}
|
|
22914
|
+
function ResearchCycleResultFromApiToFront(dto) {
|
|
22915
|
+
return {
|
|
22916
|
+
cycleNumber: dto.cycle_number,
|
|
22917
|
+
gapsDetected: dto.gaps_detected,
|
|
22918
|
+
gapsResolved: dto.gaps_resolved,
|
|
22919
|
+
papersRetrieved: dto.papers_retrieved,
|
|
22920
|
+
papersIngested: dto.papers_ingested,
|
|
22921
|
+
claimsVerified: dto.claims_verified,
|
|
22922
|
+
contradictionsDetected: dto.contradictions_detected,
|
|
22923
|
+
processingTimeMs: dto.processing_time_ms,
|
|
22924
|
+
searchQueries: dto.search_queries ?? []
|
|
22925
|
+
};
|
|
22926
|
+
}
|
|
22927
|
+
function ResearchSessionResponseFromApiToFront(raw) {
|
|
22928
|
+
const dto = raw;
|
|
22929
|
+
return {
|
|
22930
|
+
sessionId: dto.session_id,
|
|
22931
|
+
question: dto.question,
|
|
22932
|
+
status: dto.status,
|
|
22933
|
+
error: dto.error ?? null,
|
|
22934
|
+
cycles: (dto.cycles ?? []).map(ResearchCycleResultFromApiToFront),
|
|
22935
|
+
totalPapersIngested: dto.total_papers_ingested,
|
|
22936
|
+
totalFindings: dto.total_findings,
|
|
22937
|
+
totalContradictions: dto.total_contradictions,
|
|
22938
|
+
totalGaps: dto.total_gaps,
|
|
22939
|
+
createdAt: dto.created_at,
|
|
22940
|
+
updatedAt: dto.updated_at
|
|
22941
|
+
};
|
|
22942
|
+
}
|
|
22943
|
+
function ResearchCycleResponseFromApiToFront(raw) {
|
|
22944
|
+
const dto = raw;
|
|
22945
|
+
return {
|
|
22946
|
+
sessionId: dto.session_id,
|
|
22947
|
+
status: dto.status,
|
|
22948
|
+
cycle: ResearchCycleResultFromApiToFront(dto.cycle),
|
|
22949
|
+
converged: dto.converged
|
|
22950
|
+
};
|
|
22951
|
+
}
|
|
22952
|
+
function EvidenceItemSummaryFromApiToFront(dto) {
|
|
22953
|
+
return {
|
|
22954
|
+
termId: dto.term_id,
|
|
22955
|
+
description: dto.description,
|
|
22956
|
+
qualityWeight: dto.quality_weight,
|
|
22957
|
+
supports: dto.supports,
|
|
22958
|
+
contribution: dto.contribution,
|
|
22959
|
+
paperDoi: dto.paper_doi ?? null
|
|
22960
|
+
};
|
|
22961
|
+
}
|
|
22962
|
+
function ProvenanceStepFromApiToFront(dto) {
|
|
22963
|
+
return {
|
|
22964
|
+
stepType: dto.step_type,
|
|
22965
|
+
description: dto.description,
|
|
22966
|
+
entityId: dto.entity_id ?? null,
|
|
22967
|
+
timestamp: dto.timestamp ?? null
|
|
22968
|
+
};
|
|
22969
|
+
}
|
|
22970
|
+
function ResearchFindingFromApiToFront(dto) {
|
|
22971
|
+
return {
|
|
22972
|
+
claimId: dto.claim_id,
|
|
22973
|
+
statement: dto.statement,
|
|
22974
|
+
truthfulness: dto.truthfulness,
|
|
22975
|
+
label: dto.label,
|
|
22976
|
+
supportingEvidence: (dto.supporting_evidence ?? []).map(EvidenceItemSummaryFromApiToFront),
|
|
22977
|
+
contradictingEvidence: (dto.contradicting_evidence ?? []).map(EvidenceItemSummaryFromApiToFront),
|
|
22978
|
+
provenanceChain: (dto.provenance_chain ?? []).map(ProvenanceStepFromApiToFront),
|
|
22979
|
+
residuated: dto.residuated,
|
|
22980
|
+
residuationReason: dto.residuation_reason ?? null
|
|
22981
|
+
};
|
|
22982
|
+
}
|
|
22983
|
+
function ResearchFindingsResponseFromApiToFront(raw) {
|
|
22984
|
+
const dto = raw;
|
|
22985
|
+
return {
|
|
22986
|
+
sessionId: dto.session_id,
|
|
22987
|
+
findings: (dto.findings ?? []).map(ResearchFindingFromApiToFront),
|
|
22988
|
+
total: dto.total
|
|
22989
|
+
};
|
|
22990
|
+
}
|
|
22991
|
+
function KnowledgeGapFromApiToFront(dto) {
|
|
22992
|
+
return {
|
|
22993
|
+
sortName: dto.sort_name,
|
|
22994
|
+
infoGain: dto.info_gain,
|
|
22995
|
+
neededBy: dto.needed_by ?? [],
|
|
22996
|
+
wakeTrigger: dto.wake_trigger,
|
|
22997
|
+
suggestedSearchQuery: dto.suggested_search_query ?? null
|
|
22998
|
+
};
|
|
22999
|
+
}
|
|
23000
|
+
function ResearchGapsResponseFromApiToFront(raw) {
|
|
23001
|
+
const dto = raw;
|
|
23002
|
+
return {
|
|
23003
|
+
sessionId: dto.session_id,
|
|
23004
|
+
gaps: (dto.gaps ?? []).map(KnowledgeGapFromApiToFront),
|
|
23005
|
+
total: dto.total
|
|
23006
|
+
};
|
|
23007
|
+
}
|
|
23008
|
+
function ContradictionFromApiToFront(dto) {
|
|
23009
|
+
return {
|
|
23010
|
+
claimAId: dto.claim_a_id,
|
|
23011
|
+
claimBId: dto.claim_b_id,
|
|
23012
|
+
statementA: dto.statement_a,
|
|
23013
|
+
statementB: dto.statement_b,
|
|
23014
|
+
confidence: dto.confidence,
|
|
23015
|
+
explanation: dto.explanation
|
|
23016
|
+
};
|
|
23017
|
+
}
|
|
23018
|
+
function ResearchContradictionsResponseFromApiToFront(raw) {
|
|
23019
|
+
const dto = raw;
|
|
23020
|
+
return {
|
|
23021
|
+
sessionId: dto.session_id,
|
|
23022
|
+
contradictions: (dto.contradictions ?? []).map(ContradictionFromApiToFront),
|
|
23023
|
+
total: dto.total
|
|
23024
|
+
};
|
|
23025
|
+
}
|
|
23026
|
+
function ResearchStatisticsFromApiToFront(dto) {
|
|
23027
|
+
return {
|
|
23028
|
+
totalCycles: dto.total_cycles,
|
|
23029
|
+
totalPapersRetrieved: dto.total_papers_retrieved,
|
|
23030
|
+
totalPapersIngested: dto.total_papers_ingested,
|
|
23031
|
+
totalClaimsExtracted: dto.total_claims_extracted,
|
|
23032
|
+
totalClaimsVerified: dto.total_claims_verified,
|
|
23033
|
+
totalContradictions: dto.total_contradictions,
|
|
23034
|
+
totalProcessingTimeMs: dto.total_processing_time_ms,
|
|
23035
|
+
gapsResolved: dto.gaps_resolved,
|
|
23036
|
+
gapsRemaining: dto.gaps_remaining
|
|
23037
|
+
};
|
|
23038
|
+
}
|
|
23039
|
+
function ReportVerificationFromApiToFront(dto) {
|
|
23040
|
+
return {
|
|
23041
|
+
verdict: dto.verdict,
|
|
23042
|
+
score: dto.score,
|
|
23043
|
+
computationTimeMs: dto.computation_time_ms
|
|
23044
|
+
};
|
|
23045
|
+
}
|
|
23046
|
+
function ResearchReportResponseFromApiToFront(raw) {
|
|
23047
|
+
const dto = raw;
|
|
23048
|
+
return {
|
|
23049
|
+
sessionId: dto.session_id,
|
|
23050
|
+
question: dto.question,
|
|
23051
|
+
summary: dto.summary,
|
|
23052
|
+
findings: (dto.findings ?? []).map(ResearchFindingFromApiToFront),
|
|
23053
|
+
knowledgeGaps: (dto.knowledge_gaps ?? []).map(KnowledgeGapFromApiToFront),
|
|
23054
|
+
contradictions: (dto.contradictions ?? []).map(ContradictionFromApiToFront),
|
|
23055
|
+
statistics: ResearchStatisticsFromApiToFront(dto.statistics),
|
|
23056
|
+
generatedContent: dto.generated_content ?? null,
|
|
23057
|
+
verification: dto.verification ? ReportVerificationFromApiToFront(dto.verification) : null
|
|
23058
|
+
};
|
|
23059
|
+
}
|
|
23060
|
+
function IngestPaperResponseFromApiToFront(raw) {
|
|
23061
|
+
const dto = raw;
|
|
23062
|
+
return {
|
|
23063
|
+
success: dto.success,
|
|
23064
|
+
metadata: dto.metadata ? PaperMetadataFromApiToFront(dto.metadata) : null,
|
|
23065
|
+
entitiesExtracted: dto.entities_extracted,
|
|
23066
|
+
claimsExtracted: dto.claims_extracted,
|
|
23067
|
+
error: dto.error ?? null
|
|
23068
|
+
};
|
|
23069
|
+
}
|
|
23070
|
+
function VerifyClaimResponseFromApiToFront(raw) {
|
|
23071
|
+
const dto = raw;
|
|
23072
|
+
return {
|
|
23073
|
+
truthfulness: dto.truthfulness,
|
|
23074
|
+
label: dto.label,
|
|
23075
|
+
supportingCount: dto.supporting_count,
|
|
23076
|
+
contradictingCount: dto.contradicting_count,
|
|
23077
|
+
residuated: dto.residuated,
|
|
23078
|
+
residuationReason: dto.residuation_reason ?? null
|
|
23079
|
+
};
|
|
23080
|
+
}
|
|
23081
|
+
function CreateResearchSessionRequestFromFrontToApi(model) {
|
|
23082
|
+
return {
|
|
23083
|
+
question: model.question,
|
|
23084
|
+
max_cycles: model.maxCycles,
|
|
23085
|
+
max_papers: model.maxPapers,
|
|
23086
|
+
paper_sources: model.paperSources
|
|
23087
|
+
};
|
|
23088
|
+
}
|
|
23089
|
+
function RunResearchCycleRequestFromFrontToApi(model) {
|
|
23090
|
+
return {
|
|
23091
|
+
additional_queries: model.additionalQueries,
|
|
23092
|
+
max_papers_this_cycle: model.maxPapersThisCycle
|
|
23093
|
+
};
|
|
23094
|
+
}
|
|
23095
|
+
function SearchPapersRequestFromFrontToApi(model) {
|
|
23096
|
+
return {
|
|
23097
|
+
query: model.query,
|
|
23098
|
+
max_results: model.maxResults,
|
|
23099
|
+
sources: model.sources
|
|
23100
|
+
};
|
|
23101
|
+
}
|
|
23102
|
+
function IngestPaperRequestFromFrontToApi(model) {
|
|
23103
|
+
return {
|
|
23104
|
+
identifier: model.identifier,
|
|
23105
|
+
identifier_type: model.identifierType,
|
|
23106
|
+
session_id: model.sessionId
|
|
23107
|
+
};
|
|
23108
|
+
}
|
|
23109
|
+
function VerifyClaimRequestFromFrontToApi(model) {
|
|
23110
|
+
return {
|
|
23111
|
+
claim_term_id: model.claimTermId,
|
|
23112
|
+
evidence_sort_id: model.evidenceSortId
|
|
23113
|
+
};
|
|
23114
|
+
}
|
|
23115
|
+
|
|
22876
23116
|
// src/resources/research.ts
|
|
22877
23117
|
var ResearchClient = class {
|
|
22878
23118
|
/** @internal */
|
|
@@ -22909,12 +23149,12 @@ var ResearchClient = class {
|
|
|
22909
23149
|
const response = await this.http.request({
|
|
22910
23150
|
path: "/api/v1/research/sessions",
|
|
22911
23151
|
method: "POST",
|
|
22912
|
-
body: request,
|
|
23152
|
+
body: CreateResearchSessionRequestFromFrontToApi(request),
|
|
22913
23153
|
secure: true,
|
|
22914
23154
|
type: "application/json" /* Json */,
|
|
22915
23155
|
format: "json"
|
|
22916
23156
|
});
|
|
22917
|
-
return response.data;
|
|
23157
|
+
return CreateResearchSessionResponseFromApiToFront(response.data);
|
|
22918
23158
|
}
|
|
22919
23159
|
/**
|
|
22920
23160
|
* Get the current state of a research session.
|
|
@@ -22944,7 +23184,7 @@ var ResearchClient = class {
|
|
|
22944
23184
|
secure: true,
|
|
22945
23185
|
format: "json"
|
|
22946
23186
|
});
|
|
22947
|
-
return response.data;
|
|
23187
|
+
return ResearchSessionResponseFromApiToFront(response.data);
|
|
22948
23188
|
}
|
|
22949
23189
|
/**
|
|
22950
23190
|
* Run a single research cycle within a session.
|
|
@@ -22975,12 +23215,12 @@ var ResearchClient = class {
|
|
|
22975
23215
|
const response = await this.http.request({
|
|
22976
23216
|
path: `/api/v1/research/sessions/${encodeURIComponent(sessionId)}/run`,
|
|
22977
23217
|
method: "POST",
|
|
22978
|
-
body: request,
|
|
23218
|
+
body: request ? RunResearchCycleRequestFromFrontToApi(request) : void 0,
|
|
22979
23219
|
secure: true,
|
|
22980
23220
|
type: "application/json" /* Json */,
|
|
22981
23221
|
format: "json"
|
|
22982
23222
|
});
|
|
22983
|
-
return response.data;
|
|
23223
|
+
return ResearchCycleResponseFromApiToFront(response.data);
|
|
22984
23224
|
}
|
|
22985
23225
|
/**
|
|
22986
23226
|
* Run the research session to completion (all remaining cycles).
|
|
@@ -23009,7 +23249,7 @@ var ResearchClient = class {
|
|
|
23009
23249
|
secure: true,
|
|
23010
23250
|
format: "json"
|
|
23011
23251
|
});
|
|
23012
|
-
return response.data;
|
|
23252
|
+
return ResearchSessionResponseFromApiToFront(response.data);
|
|
23013
23253
|
}
|
|
23014
23254
|
/**
|
|
23015
23255
|
* Delete a research session and all associated data.
|
|
@@ -23062,7 +23302,7 @@ var ResearchClient = class {
|
|
|
23062
23302
|
secure: true,
|
|
23063
23303
|
format: "json"
|
|
23064
23304
|
});
|
|
23065
|
-
return response.data;
|
|
23305
|
+
return ResearchFindingsResponseFromApiToFront(response.data);
|
|
23066
23306
|
}
|
|
23067
23307
|
/**
|
|
23068
23308
|
* Get knowledge gaps for a research session.
|
|
@@ -23095,7 +23335,7 @@ var ResearchClient = class {
|
|
|
23095
23335
|
secure: true,
|
|
23096
23336
|
format: "json"
|
|
23097
23337
|
});
|
|
23098
|
-
return response.data;
|
|
23338
|
+
return ResearchGapsResponseFromApiToFront(response.data);
|
|
23099
23339
|
}
|
|
23100
23340
|
/**
|
|
23101
23341
|
* Get detected contradictions for a research session.
|
|
@@ -23127,7 +23367,7 @@ var ResearchClient = class {
|
|
|
23127
23367
|
secure: true,
|
|
23128
23368
|
format: "json"
|
|
23129
23369
|
});
|
|
23130
|
-
return response.data;
|
|
23370
|
+
return ResearchContradictionsResponseFromApiToFront(response.data);
|
|
23131
23371
|
}
|
|
23132
23372
|
/**
|
|
23133
23373
|
* Get the full research report for a session.
|
|
@@ -23161,7 +23401,7 @@ var ResearchClient = class {
|
|
|
23161
23401
|
secure: true,
|
|
23162
23402
|
format: "json"
|
|
23163
23403
|
});
|
|
23164
|
-
return response.data;
|
|
23404
|
+
return ResearchReportResponseFromApiToFront(response.data);
|
|
23165
23405
|
}
|
|
23166
23406
|
/**
|
|
23167
23407
|
* Search for papers across external scientific databases.
|
|
@@ -23193,12 +23433,12 @@ var ResearchClient = class {
|
|
|
23193
23433
|
const response = await this.http.request({
|
|
23194
23434
|
path: "/api/v1/research/papers/search",
|
|
23195
23435
|
method: "POST",
|
|
23196
|
-
body: request,
|
|
23436
|
+
body: SearchPapersRequestFromFrontToApi(request),
|
|
23197
23437
|
secure: true,
|
|
23198
23438
|
type: "application/json" /* Json */,
|
|
23199
23439
|
format: "json"
|
|
23200
23440
|
});
|
|
23201
|
-
return response.data;
|
|
23441
|
+
return SearchPapersResponseFromApiToFront(response.data);
|
|
23202
23442
|
}
|
|
23203
23443
|
/**
|
|
23204
23444
|
* Ingest a specific paper into the knowledge base.
|
|
@@ -23230,12 +23470,12 @@ var ResearchClient = class {
|
|
|
23230
23470
|
const response = await this.http.request({
|
|
23231
23471
|
path: "/api/v1/research/papers/ingest",
|
|
23232
23472
|
method: "POST",
|
|
23233
|
-
body: request,
|
|
23473
|
+
body: IngestPaperRequestFromFrontToApi(request),
|
|
23234
23474
|
secure: true,
|
|
23235
23475
|
type: "application/json" /* Json */,
|
|
23236
23476
|
format: "json"
|
|
23237
23477
|
});
|
|
23238
|
-
return response.data;
|
|
23478
|
+
return IngestPaperResponseFromApiToFront(response.data);
|
|
23239
23479
|
}
|
|
23240
23480
|
/**
|
|
23241
23481
|
* Verify a specific claim against evidence in the knowledge base.
|
|
@@ -23268,12 +23508,12 @@ var ResearchClient = class {
|
|
|
23268
23508
|
const response = await this.http.request({
|
|
23269
23509
|
path: "/api/v1/research/claims/verify",
|
|
23270
23510
|
method: "POST",
|
|
23271
|
-
body: request,
|
|
23511
|
+
body: VerifyClaimRequestFromFrontToApi(request),
|
|
23272
23512
|
secure: true,
|
|
23273
23513
|
type: "application/json" /* Json */,
|
|
23274
23514
|
format: "json"
|
|
23275
23515
|
});
|
|
23276
|
-
return response.data;
|
|
23516
|
+
return VerifyClaimResponseFromApiToFront(response.data);
|
|
23277
23517
|
}
|
|
23278
23518
|
};
|
|
23279
23519
|
|