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