@thanh01.pmt/research-kit 1.2.4 → 1.4.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/academic/index.cjs +122 -0
- package/dist/academic/index.cjs.map +1 -1
- package/dist/academic/index.d.cts +27 -4
- package/dist/academic/index.d.ts +27 -4
- package/dist/academic/index.js +2 -1
- package/dist/agent/index.cjs +4277 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +10 -0
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.js +10 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/{catalogBuilder-B4eiLS_S.d.cts → catalogBuilder-BBCa9jqI.d.cts} +2 -2
- package/dist/{catalogBuilder-BNB_gaWP.d.ts → catalogBuilder-D-UiM37y.d.ts} +2 -2
- package/dist/chunk-2GBXVPOQ.js +3 -0
- package/dist/{chunk-J3VCGH7Z.js.map → chunk-2GBXVPOQ.js.map} +1 -1
- package/dist/chunk-2RMBLKP5.js +581 -0
- package/dist/chunk-2RMBLKP5.js.map +1 -0
- package/dist/{chunk-2XIEWCUE.js → chunk-32B5PVTQ.js} +2 -2
- package/dist/{chunk-2XIEWCUE.js.map → chunk-32B5PVTQ.js.map} +1 -1
- package/dist/{chunk-YICMTZS5.js → chunk-4O3FXMXO.js} +171 -3
- package/dist/chunk-4O3FXMXO.js.map +1 -0
- package/dist/chunk-LDCZ33AC.js +3 -0
- package/dist/chunk-LDCZ33AC.js.map +1 -0
- package/dist/{chunk-GK5KI5PB.js → chunk-MFRQ2VJZ.js} +63 -44
- package/dist/chunk-MFRQ2VJZ.js.map +1 -0
- package/dist/chunk-RAMDHDRJ.js +1931 -0
- package/dist/chunk-RAMDHDRJ.js.map +1 -0
- package/dist/{chunk-SAHBBO3U.js → chunk-RYLZYZRF.js} +4 -580
- package/dist/chunk-RYLZYZRF.js.map +1 -0
- package/dist/chunk-SHBDLP64.js +125 -0
- package/dist/chunk-SHBDLP64.js.map +1 -0
- package/dist/chunk-TYQEC24G.js +3 -0
- package/dist/chunk-TYQEC24G.js.map +1 -0
- package/dist/{chunk-KXJDQBSJ.js → chunk-UHKDJZNL.js} +11 -4
- package/dist/chunk-UHKDJZNL.js.map +1 -0
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/evidence/index.cjs +9 -2
- package/dist/evidence/index.cjs.map +1 -1
- package/dist/evidence/index.d.cts +2 -2
- package/dist/evidence/index.d.ts +2 -2
- package/dist/evidence/index.js +3 -2
- package/dist/harvester/index.cjs +168 -1
- package/dist/harvester/index.cjs.map +1 -1
- package/dist/harvester/index.d.cts +5 -161
- package/dist/harvester/index.d.ts +5 -161
- package/dist/harvester/index.js +4 -2
- package/dist/index-CGa7lf3L.d.ts +764 -0
- package/dist/{index-9rDiFuR4.d.cts → index-CxoD81QN.d.cts} +1 -1
- package/dist/{index-9rDiFuR4.d.ts → index-CxoD81QN.d.ts} +1 -1
- package/dist/index-DrjfrbGw.d.cts +764 -0
- package/dist/index.cjs +2411 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -174
- package/dist/index.d.ts +11 -174
- package/dist/index.js +34 -12
- package/dist/index.js.map +1 -1
- package/dist/{literatureReview-DOzgm9Q2.d.ts → literatureReview-Bn2iEGRO.d.ts} +1 -1
- package/dist/{literatureReview-BwidpYJo.d.cts → literatureReview-Bvlqk4DB.d.cts} +1 -1
- package/dist/pipeline/index.cjs +68 -43
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +5 -4
- package/dist/pipeline/index.d.ts +5 -4
- package/dist/pipeline/index.js +4 -3
- package/dist/socialPulseHarvester-CN4MwrpY.d.cts +204 -0
- package/dist/socialPulseHarvester-IbdT3zD1.d.ts +204 -0
- package/dist/{webScraper-CAQjE46m.d.cts → webScraper-BVvNW4yj.d.cts} +1 -1
- package/dist/{webScraper-CXIpvyA6.d.ts → webScraper-C9pB5Rgd.d.ts} +1 -1
- package/package.json +6 -1
- package/dist/chunk-GK5KI5PB.js.map +0 -1
- package/dist/chunk-J3VCGH7Z.js +0 -3
- package/dist/chunk-KXJDQBSJ.js.map +0 -1
- package/dist/chunk-SAHBBO3U.js.map +0 -1
- package/dist/chunk-YICMTZS5.js.map +0 -1
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a as CourseResearchContext, j as AcademicPaper, R as ResearchApiKeys, L as LlmTextFn, b as CustomSearchAdapter, c as CustomCrawlerAdapter, d as CustomAcademicSearchAdapter, g as CustomSynthesizerAdapter, E as ExtractedConceptNode } from './index-CxoD81QN.cjs';
|
|
3
|
+
import { E as ExtractedCodeBlock, S as ScrapedDocument, T as TechnicalDomain } from './webScraper-BVvNW4yj.cjs';
|
|
4
|
+
import { ClaimSweepReport, ScoredEvidence } from './evidence/index.cjs';
|
|
5
|
+
import { P as ProvenanceRecord, a as ProvenanceSidecar } from './provenanceTracker-ct4s5lJV.cjs';
|
|
6
|
+
import { S as SearchHit } from './catalogBuilder-BBCa9jqI.cjs';
|
|
7
|
+
import { o as SocialPulseItem, Y as YouTubeTranscriptResult, k as StemResearchOptions, l as StemResourceCatalog, p as SocialPulseOptions, q as SocialPulseReport, b as TermExtractionBundle, H as HealthAuditResult } from './socialPulseHarvester-CN4MwrpY.cjs';
|
|
8
|
+
import { T as TaxonomyMappingResult, L as LiteratureReviewReport } from './literatureReview-Bvlqk4DB.cjs';
|
|
9
|
+
import { ResearchPlan, HarvestPipelineOptions, HarvestPipelineResult, TechnicalFactsheet } from './pipeline/index.cjs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Primary execution mode (ADR-0019):
|
|
13
|
+
* - `'auto'`: Evaluated via Decision Model (System One) English rubric + deterministic script into `'search' | 'research' | 'deep-research'`.
|
|
14
|
+
* - `'search'`: Fast retrieval (<= 8s, 0 Generative LLM calls, returns verified EvidenceLedger items).
|
|
15
|
+
* - `'research'`: Standard multi-channel synthesis (<= 90s, up to 2 `'ok'` channels via Concurrent Refill Scheduler, 1 pass).
|
|
16
|
+
* - `'deep-research'`: Exhaustive multi-round synthesis (<= 300s, up to 5 `'ok'` channels, up to 3 gap-filling rounds + claim verification).
|
|
17
|
+
*/
|
|
18
|
+
type ResearchMode = 'auto' | 'search' | 'research' | 'deep-research';
|
|
19
|
+
/**
|
|
20
|
+
* Five independent knowledge modalities scheduled by `PriorRouter` & `ConcurrentRefillScheduler`.
|
|
21
|
+
*/
|
|
22
|
+
type SourceChannel = 'web_docs' | 'academic' | 'social_pulse' | 'stem_oer' | 'video_media';
|
|
23
|
+
/**
|
|
24
|
+
* Post-harvest channel status used by `ConcurrentRefillScheduler` to decide whether a channel counts
|
|
25
|
+
* toward `maxChannels` (`'ok'`) or triggers an immediate refill from the queue (`'weak' | 'empty' | 'error'`).
|
|
26
|
+
*/
|
|
27
|
+
type ChannelStatus = 'ok' | 'weak' | 'empty' | 'error';
|
|
28
|
+
/**
|
|
29
|
+
* Seven English question facets evaluated by the Decision Model (`choice` probabilities).
|
|
30
|
+
*/
|
|
31
|
+
type QuestionFacet = 'official_spec' | 'how_to_example' | 'pitfalls' | 'pedagogy_theory' | 'standards_policy' | 'emerging_trend' | 'learning_resources';
|
|
32
|
+
type ResearchProfile = 'auto' | 'fast_grounded' | 'deep_autonomous' | 'technical' | 'academic' | 'social_pulse' | 'curriculum_oer' | 'general';
|
|
33
|
+
interface ResearchScoreQuestion {
|
|
34
|
+
id: string;
|
|
35
|
+
type: 'score';
|
|
36
|
+
criteria: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
}
|
|
39
|
+
interface ResearchChoiceQuestion {
|
|
40
|
+
id: string;
|
|
41
|
+
type: 'choice';
|
|
42
|
+
criteria: string;
|
|
43
|
+
options: string[];
|
|
44
|
+
context?: string;
|
|
45
|
+
}
|
|
46
|
+
interface ResearchNoulQuestion {
|
|
47
|
+
id: string;
|
|
48
|
+
type: 'noul';
|
|
49
|
+
criteria: string;
|
|
50
|
+
context?: string;
|
|
51
|
+
}
|
|
52
|
+
type ResearchDecisionQuestion = ResearchScoreQuestion | ResearchChoiceQuestion | ResearchNoulQuestion;
|
|
53
|
+
interface ResearchScoreAnswer {
|
|
54
|
+
id: string;
|
|
55
|
+
type: 'score';
|
|
56
|
+
score: number;
|
|
57
|
+
probabilities?: Record<string, number>;
|
|
58
|
+
}
|
|
59
|
+
interface ResearchChoiceAnswer {
|
|
60
|
+
id: string;
|
|
61
|
+
type: 'choice';
|
|
62
|
+
choice: string;
|
|
63
|
+
probabilities?: Record<string, number>;
|
|
64
|
+
}
|
|
65
|
+
interface ResearchNoulAnswer {
|
|
66
|
+
id: string;
|
|
67
|
+
type: 'noul';
|
|
68
|
+
probability: number;
|
|
69
|
+
}
|
|
70
|
+
type ResearchDecisionAnswer = ResearchScoreAnswer | ResearchChoiceAnswer | ResearchNoulAnswer;
|
|
71
|
+
interface ResearchDecisionRequest {
|
|
72
|
+
context?: string;
|
|
73
|
+
questions: ResearchDecisionQuestion[];
|
|
74
|
+
}
|
|
75
|
+
interface ResearchDecisionResult {
|
|
76
|
+
answers: Record<string, ResearchDecisionAnswer>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Host-injected Decision Model adapter (e.g., `OpenRouterDecisionClient` in `smart-curriculum`).
|
|
80
|
+
*/
|
|
81
|
+
type ResearchDecisionFn = (request: ResearchDecisionRequest) => Promise<ResearchDecisionResult>;
|
|
82
|
+
interface ModeClassificationTrace {
|
|
83
|
+
requestedMode: ResearchMode;
|
|
84
|
+
resolvedMode: Exclude<ResearchMode, 'auto'>;
|
|
85
|
+
decisionEvaluated: boolean;
|
|
86
|
+
hardEscalated: boolean;
|
|
87
|
+
rubricBreakdown: {
|
|
88
|
+
readingDepth: number;
|
|
89
|
+
sourceDiversity: number;
|
|
90
|
+
decomposition: number;
|
|
91
|
+
verificationStakes: number;
|
|
92
|
+
contractScore: number;
|
|
93
|
+
totalScore: number;
|
|
94
|
+
};
|
|
95
|
+
facetProbabilities: Record<QuestionFacet, number>;
|
|
96
|
+
channelPriors: Array<{
|
|
97
|
+
channel: SourceChannel;
|
|
98
|
+
score: number;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
interface ChannelExecutionTrace {
|
|
102
|
+
channel: SourceChannel;
|
|
103
|
+
status: ChannelStatus;
|
|
104
|
+
priorScore: number;
|
|
105
|
+
itemsAdded: number;
|
|
106
|
+
durationMs: number;
|
|
107
|
+
errorMessage?: string;
|
|
108
|
+
}
|
|
109
|
+
interface ResearchAcceptanceCriteria {
|
|
110
|
+
/** Minimum number of distinct approved sources in EvidenceLedger (default: 2) */
|
|
111
|
+
minSources?: number;
|
|
112
|
+
/** Minimum number of peer-reviewed academic papers required */
|
|
113
|
+
minPeerReviewedSources?: number;
|
|
114
|
+
/** Minimum relevance score (1-10) for a source to count as approved (default: 6) */
|
|
115
|
+
minRelevanceScore?: number;
|
|
116
|
+
/** Require at least 1 extracted code block across ledger items */
|
|
117
|
+
requireCodeExamples?: boolean;
|
|
118
|
+
/** Require at least 1 extracted markdown specification/pinout table */
|
|
119
|
+
requireTables?: boolean;
|
|
120
|
+
/** Whether to run semantic claim verification (NLI / Decision choice) */
|
|
121
|
+
verifyClaims?: boolean;
|
|
122
|
+
/** Recency window in days for social/emerging tech queries (default: 30) */
|
|
123
|
+
recencyDays?: number;
|
|
124
|
+
/** Specific attributes, fields, or sub-questions that must be covered in the findings */
|
|
125
|
+
requiredAttributes?: string[];
|
|
126
|
+
/** Terms that must not appear in synthesized claims */
|
|
127
|
+
forbiddenTerms?: string[];
|
|
128
|
+
}
|
|
129
|
+
interface ResearchBudget {
|
|
130
|
+
/** Maximum Plan-Harvest-Evaluate rounds (0 for search, 1 for research, 3 for deep-research) */
|
|
131
|
+
maxRounds?: number;
|
|
132
|
+
/** Maximum number of 'ok' source channels to harvest per round (1 for search, 2 for research, 5 for deep-research) */
|
|
133
|
+
maxChannels?: number;
|
|
134
|
+
/** Maximum concurrent source channels executing in parallel (default: 2) */
|
|
135
|
+
channelConcurrency?: number;
|
|
136
|
+
/** Maximum search queries executed per round (default: 3) */
|
|
137
|
+
maxQueriesPerRound?: number;
|
|
138
|
+
/** Maximum URLs scraped in full per round (default: 3) */
|
|
139
|
+
maxScrapePerRound?: number;
|
|
140
|
+
/** Overall execution timeout in milliseconds (8000 for search, 90000 for research, 300000 for deep-research) */
|
|
141
|
+
timeoutMs?: number;
|
|
142
|
+
}
|
|
143
|
+
interface ResearchContract<T = Record<string, unknown>> {
|
|
144
|
+
/** Core research objective or question */
|
|
145
|
+
objective: string;
|
|
146
|
+
/** Tri-mode execution selector ('auto' | 'search' | 'research' | 'deep-research') */
|
|
147
|
+
mode?: ResearchMode;
|
|
148
|
+
/** Optional preferred source channels to prioritize in the Concurrent Refill Scheduler */
|
|
149
|
+
preferredChannels?: SourceChannel[];
|
|
150
|
+
/** Legacy/domain execution profile controlling harvesters and loop budget */
|
|
151
|
+
profile?: ResearchProfile;
|
|
152
|
+
/** Optional Zod schema for structured JSON output */
|
|
153
|
+
outputSchema?: z.ZodType<T>;
|
|
154
|
+
/** Optional human-readable JSON schema description to guide LLM synthesis */
|
|
155
|
+
outputSchemaDescription?: string;
|
|
156
|
+
/** Required Markdown heading sections in the synthesized report */
|
|
157
|
+
requiredSections?: string[];
|
|
158
|
+
/** Quality and coverage criteria that the Evaluator Gate checks after each round */
|
|
159
|
+
acceptanceCriteria?: ResearchAcceptanceCriteria;
|
|
160
|
+
/** Execution budget overrides */
|
|
161
|
+
budget?: ResearchBudget;
|
|
162
|
+
/** Optional course/domain context (hardware, software, age band, language) */
|
|
163
|
+
context?: CourseResearchContext;
|
|
164
|
+
/** Optional AbortSignal from caller */
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
}
|
|
167
|
+
interface LedgerItem {
|
|
168
|
+
/** Immutable monotonic citation ID, e.g. "RES-01", "RES-02" */
|
|
169
|
+
id: string;
|
|
170
|
+
sourceType: 'web' | 'academic' | 'social_pulse' | 'stem_oer' | 'youtube';
|
|
171
|
+
title: string;
|
|
172
|
+
url: string;
|
|
173
|
+
authorOrVenue?: string;
|
|
174
|
+
publishedDate?: string;
|
|
175
|
+
relevanceScore: number;
|
|
176
|
+
headings: string[];
|
|
177
|
+
keyExcerpts: string[];
|
|
178
|
+
codeBlocks: ExtractedCodeBlock[];
|
|
179
|
+
tables: string[];
|
|
180
|
+
rawByteSize: number;
|
|
181
|
+
accessedAt: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Compact Citation Receipt (<= 150 tokens) returned to the planning/gap-analysis loop
|
|
185
|
+
* so raw scraped documents never bloat the LLM context window.
|
|
186
|
+
*/
|
|
187
|
+
interface CitationReceipt {
|
|
188
|
+
id: string;
|
|
189
|
+
sourceType: LedgerItem['sourceType'];
|
|
190
|
+
title: string;
|
|
191
|
+
url: string;
|
|
192
|
+
relevanceScore: number;
|
|
193
|
+
headings: string[];
|
|
194
|
+
codeBlockCount: number;
|
|
195
|
+
tableCount: number;
|
|
196
|
+
briefExcerpt: string;
|
|
197
|
+
}
|
|
198
|
+
type ResearchAgentStatus = 'success' | 'partial' | 'degraded' | 'failed';
|
|
199
|
+
interface ResearchRoundTrace {
|
|
200
|
+
round: number;
|
|
201
|
+
plannedQueries: string[];
|
|
202
|
+
newReceiptsAdded: number;
|
|
203
|
+
satisfiedAttributes: string[];
|
|
204
|
+
missingGaps: string[];
|
|
205
|
+
channelTraces?: ChannelExecutionTrace[];
|
|
206
|
+
}
|
|
207
|
+
interface ResearchAgentResult<T = Record<string, unknown>> {
|
|
208
|
+
status: ResearchAgentStatus;
|
|
209
|
+
objective: string;
|
|
210
|
+
mode: Exclude<ResearchMode, 'auto'>;
|
|
211
|
+
profile: ResearchProfile;
|
|
212
|
+
roundsExecuted: number;
|
|
213
|
+
data: T | null;
|
|
214
|
+
markdownReport: string;
|
|
215
|
+
tier1Summary: string;
|
|
216
|
+
tier2TechnicalDigest: string;
|
|
217
|
+
ledgerItems: LedgerItem[];
|
|
218
|
+
receipts: CitationReceipt[];
|
|
219
|
+
validCitationIds: string[];
|
|
220
|
+
invalidCitationIds: string[];
|
|
221
|
+
missingGaps: string[];
|
|
222
|
+
roundTraces: ResearchRoundTrace[];
|
|
223
|
+
modeClassificationTrace?: ModeClassificationTrace;
|
|
224
|
+
channelTraces?: ChannelExecutionTrace[];
|
|
225
|
+
claimVerification?: ClaimSweepReport;
|
|
226
|
+
provenanceMd: string;
|
|
227
|
+
}
|
|
228
|
+
interface ModePreset {
|
|
229
|
+
mode: Exclude<ResearchMode, 'auto'>;
|
|
230
|
+
timeoutMs: number;
|
|
231
|
+
maxChannels: number;
|
|
232
|
+
channelConcurrency: number;
|
|
233
|
+
maxRounds: number;
|
|
234
|
+
maxQueriesPerRound: number;
|
|
235
|
+
maxScrapePerRound: number;
|
|
236
|
+
verifyClaims: boolean;
|
|
237
|
+
}
|
|
238
|
+
declare const RESEARCH_MODE_PRESETS: Record<Exclude<ResearchMode, 'auto'>, ModePreset>;
|
|
239
|
+
interface ProfilePreset {
|
|
240
|
+
maxRounds: number;
|
|
241
|
+
maxQueriesPerRound: number;
|
|
242
|
+
maxScrapePerRound: number;
|
|
243
|
+
timeoutMs: number;
|
|
244
|
+
enableWeb: boolean;
|
|
245
|
+
enableAcademic: boolean;
|
|
246
|
+
enableSocialPulse: boolean;
|
|
247
|
+
enableStemOer: boolean;
|
|
248
|
+
}
|
|
249
|
+
declare const RESEARCH_PROFILE_PRESETS: Record<Exclude<ResearchProfile, 'auto'>, ProfilePreset>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Out-of-Band Immutable Evidence Ledger (`[RES-01]` .. `[RES-N]`).
|
|
253
|
+
* Stores full scraped excerpts, code blocks, and specification tables in memory while
|
|
254
|
+
* emitting compact `CitationReceipt` objects (<= 150 tokens) to keep multi-round agent prompts lean.
|
|
255
|
+
*/
|
|
256
|
+
declare class EvidenceLedger {
|
|
257
|
+
private items;
|
|
258
|
+
private urlIndex;
|
|
259
|
+
private idIndex;
|
|
260
|
+
private allocateId;
|
|
261
|
+
/**
|
|
262
|
+
* Records or upgrades a ledger entry from a full `ScrapedDocument`.
|
|
263
|
+
*/
|
|
264
|
+
addScrapedDocument(doc: ScrapedDocument, relevanceScore: number, extraTakeaways?: string[]): CitationReceipt;
|
|
265
|
+
/**
|
|
266
|
+
* Records a lightweight search hit when full scraping is skipped or pending.
|
|
267
|
+
*/
|
|
268
|
+
addSearchHit(hit: SearchHit, relevanceScore?: number): CitationReceipt;
|
|
269
|
+
/**
|
|
270
|
+
* Records a peer-reviewed or preprint paper from Semantic Scholar, OpenAlex, Crossref, or arXiv.
|
|
271
|
+
*/
|
|
272
|
+
addAcademicPaper(paper: AcademicPaper): CitationReceipt;
|
|
273
|
+
/**
|
|
274
|
+
* Records a 30-day social/developer pulse signal (HackerNews, GitHub, Reddit).
|
|
275
|
+
*/
|
|
276
|
+
addSocialPulseItem(pulse: SocialPulseItem): CitationReceipt;
|
|
277
|
+
/**
|
|
278
|
+
* Records a verified STEM OER simulation/resource (PhET, OpenStax, NASA, CS Unplugged).
|
|
279
|
+
*/
|
|
280
|
+
addStemResource(resource: {
|
|
281
|
+
title: string;
|
|
282
|
+
url: string;
|
|
283
|
+
description: string;
|
|
284
|
+
provider: string;
|
|
285
|
+
license?: string;
|
|
286
|
+
}): CitationReceipt;
|
|
287
|
+
/**
|
|
288
|
+
* Projects a full `LedgerItem` into a compact receipt (<= 150 tokens) for Stage A planning & gap analysis.
|
|
289
|
+
*/
|
|
290
|
+
toCompactReceipt(item: LedgerItem): CitationReceipt;
|
|
291
|
+
getItems(): LedgerItem[];
|
|
292
|
+
getApprovedItems(minScore?: number): LedgerItem[];
|
|
293
|
+
getReceipts(): CitationReceipt[];
|
|
294
|
+
getById(id: string): LedgerItem | undefined;
|
|
295
|
+
getTotalCodeBlocks(): number;
|
|
296
|
+
getTotalTables(): number;
|
|
297
|
+
/**
|
|
298
|
+
* Formats the top verified items with `[RES-xx]` tags, substantive excerpts, code blocks,
|
|
299
|
+
* and tables for Stage B Contract Synthesis.
|
|
300
|
+
*/
|
|
301
|
+
buildSynthesisCorpus(maxItems?: number): string;
|
|
302
|
+
/**
|
|
303
|
+
* Returns concatenated plain text of all ledger items for deterministic/LLM `ClaimVerifier` checks.
|
|
304
|
+
*/
|
|
305
|
+
buildFullRawCorpus(): string;
|
|
306
|
+
/**
|
|
307
|
+
* Scans any synthesized report or JSON string for `[RES-xx]` citation markers
|
|
308
|
+
* and verifies every marker against the ledger.
|
|
309
|
+
*/
|
|
310
|
+
verifyCitationTags(synthesizedText: string): {
|
|
311
|
+
validCitationIds: string[];
|
|
312
|
+
invalidCitationIds: string[];
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Maps ledger items into `ProvenanceRecord[]` for `ProvenanceTracker`.
|
|
316
|
+
*/
|
|
317
|
+
toProvenanceRecords(defaultDomain?: string): ProvenanceRecord[];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare const QUESTION_FACETS: QuestionFacet[];
|
|
321
|
+
declare const SOURCE_CHANNELS: SourceChannel[];
|
|
322
|
+
/**
|
|
323
|
+
* Expected channel utility matrix P(channel | facet) in [0, 1].
|
|
324
|
+
* Multiplied by the Decision Model's facet probability distribution to rank the 5 channels.
|
|
325
|
+
*/
|
|
326
|
+
declare const PRIOR_MATRIX: Record<QuestionFacet, Record<SourceChannel, number>>;
|
|
327
|
+
/**
|
|
328
|
+
* Computes the deterministic structural complexity score (0..4) from `ResearchContract`.
|
|
329
|
+
*/
|
|
330
|
+
declare function computeContractComplexityScore(contract: ResearchContract<any>): number;
|
|
331
|
+
/**
|
|
332
|
+
* Fallback deterministic facet distribution when no Decision Model is configured or reachable.
|
|
333
|
+
*/
|
|
334
|
+
declare function inferFallbackFacetProbabilities(contract: ResearchContract<any>): Record<QuestionFacet, number>;
|
|
335
|
+
/**
|
|
336
|
+
* Computes expected prior scores E[Prior(c)] = sum_f P(facet=f) * PriorMatrix[f, c]
|
|
337
|
+
* plus deterministic contract modifiers, and returns channels sorted descending.
|
|
338
|
+
*/
|
|
339
|
+
declare function rankChannelsByExpectedPrior(facetProbabilities: Record<QuestionFacet, number>, contract: ResearchContract<any>): Array<{
|
|
340
|
+
channel: SourceChannel;
|
|
341
|
+
score: number;
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* Classifies `mode: 'auto'` into `'search' | 'research' | 'deep-research'` and computes
|
|
345
|
+
* expected channel priors in a single Decision Model call using an English rubric + deterministic script.
|
|
346
|
+
*/
|
|
347
|
+
declare function classifyModeAndPrior(contract: ResearchContract<any>, decision?: ResearchDecisionFn): Promise<ModeClassificationTrace>;
|
|
348
|
+
/**
|
|
349
|
+
* Evaluates whether required attributes/sections are covered by the collected Citation Receipts
|
|
350
|
+
* using English `noul` binary probability checks on the Decision Model (System One).
|
|
351
|
+
*/
|
|
352
|
+
declare function evaluateAttributeCoverageWithDecision(params: {
|
|
353
|
+
objective: string;
|
|
354
|
+
targetCheckList: string[];
|
|
355
|
+
receiptsText: string;
|
|
356
|
+
decision: ResearchDecisionFn;
|
|
357
|
+
}): Promise<{
|
|
358
|
+
satisfied: string[];
|
|
359
|
+
missing: string[];
|
|
360
|
+
} | null>;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Deterministic post-harvest channel status evaluator.
|
|
364
|
+
* - `'error'`: Channel threw an unhandled exception or network error.
|
|
365
|
+
* - `'empty'`: Zero valid items survived hard filters (`isCommercialOrNoise`, `HealthAuditor`).
|
|
366
|
+
* - `'weak'`: Only 1 thin snippet (< 450 bytes) survived when full scraping was expected — kept in `EvidenceLedger`,
|
|
367
|
+
* but does NOT count toward `okChannels` quota so the scheduler refills the next channel.
|
|
368
|
+
* - `'ok'`: At least 2 verified items OR at least 1 substantive document/paper/snippet (>= 450 bytes) survived.
|
|
369
|
+
*/
|
|
370
|
+
declare function classifyChannelStatus(itemsAdded: number, substantiveBytes: number, error?: unknown): ChannelStatus;
|
|
371
|
+
interface ConcurrentRefillSchedulerParams {
|
|
372
|
+
/** Prior-sorted queue of source channels */
|
|
373
|
+
channelQueue: Array<{
|
|
374
|
+
channel: SourceChannel;
|
|
375
|
+
score: number;
|
|
376
|
+
}>;
|
|
377
|
+
/** Target number of `'ok'` channels before stopping (e.g. 1 for search, 2 for research, 5 for deep-research) */
|
|
378
|
+
maxChannels: number;
|
|
379
|
+
/** Number of channels to execute concurrently (default: 2) */
|
|
380
|
+
concurrency?: number;
|
|
381
|
+
/** Optional stage-level AbortSignal (e.g. 75% Harvest budget deadline) */
|
|
382
|
+
signal?: AbortSignal;
|
|
383
|
+
/** Callback that harvests a single channel and returns its trace */
|
|
384
|
+
executeChannel: (channel: SourceChannel, priorScore: number, channelSignal: AbortSignal) => Promise<ChannelExecutionTrace>;
|
|
385
|
+
}
|
|
386
|
+
interface ConcurrentRefillSchedulerResult {
|
|
387
|
+
traces: ChannelExecutionTrace[];
|
|
388
|
+
okChannels: number;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Executes source channels with bounded concurrency (`concurrency = 2`) and automatic refill:
|
|
392
|
+
* - Maintains active in-flight bound: `inFlight <= Math.min(concurrency, maxChannels - okChannels)`.
|
|
393
|
+
* - If a channel returns `'error'`, `'empty'`, or `'weak'`, immediately refills from the Prior-ordered queue.
|
|
394
|
+
* - As soon as `okChannels >= maxChannels` (or `signal` aborts), cancels any remaining in-flight channels.
|
|
395
|
+
*/
|
|
396
|
+
declare function runConcurrentRefillScheduler(params: ConcurrentRefillSchedulerParams): Promise<ConcurrentRefillSchedulerResult>;
|
|
397
|
+
|
|
398
|
+
interface ResearchKitClientConfig {
|
|
399
|
+
/**
|
|
400
|
+
* API keys configured in the host application (e.g., Settings UI / DB / Vault).
|
|
401
|
+
*/
|
|
402
|
+
apiKeys?: ResearchApiKeys;
|
|
403
|
+
/**
|
|
404
|
+
* Whether to fall back to `process.env.*` if a key is not provided in `apiKeys`.
|
|
405
|
+
* Set to `false` in strict multi-tenant or desktop apps where only app-configured keys are allowed.
|
|
406
|
+
* Defaults to `true`.
|
|
407
|
+
*/
|
|
408
|
+
allowEnvFallback?: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Optional Crawl4AI self-hosted endpoint.
|
|
411
|
+
*/
|
|
412
|
+
crawl4aiHost?: string;
|
|
413
|
+
/**
|
|
414
|
+
* Optional LLM text completion callback injected from the host application
|
|
415
|
+
* (e.g., NineRouter / OpenRouter / AI SDK in smart-curriculum).
|
|
416
|
+
*/
|
|
417
|
+
llm?: LlmTextFn;
|
|
418
|
+
/**
|
|
419
|
+
* Optional Decision Model callback (System One — ADR-0001 / ADR-0016 / ADR-0019)
|
|
420
|
+
* injected from the host application for English rubric mode classification,
|
|
421
|
+
* expected channel prior routing, and `noul` attribute coverage checks.
|
|
422
|
+
*/
|
|
423
|
+
decision?: ResearchDecisionFn;
|
|
424
|
+
/**
|
|
425
|
+
* Default course context (age band, hardware/software tools, language) applied across services.
|
|
426
|
+
*/
|
|
427
|
+
defaultCourseContext?: CourseResearchContext;
|
|
428
|
+
/**
|
|
429
|
+
* Optional custom adapters.
|
|
430
|
+
*/
|
|
431
|
+
customSearchAdapter?: CustomSearchAdapter;
|
|
432
|
+
customCrawlerAdapter?: CustomCrawlerAdapter;
|
|
433
|
+
customAcademicSearchAdapter?: CustomAcademicSearchAdapter;
|
|
434
|
+
customSynthesizerAdapter?: CustomSynthesizerAdapter;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Service 1: Crawl, Search & Multimodal Knowledge Discovery
|
|
438
|
+
*/
|
|
439
|
+
declare class KnowledgeDiscoveryService {
|
|
440
|
+
private config;
|
|
441
|
+
private searchEngine;
|
|
442
|
+
private webScraper;
|
|
443
|
+
private youtubeService;
|
|
444
|
+
private stemResearcher;
|
|
445
|
+
private socialPulseHarvester;
|
|
446
|
+
constructor(config: ResearchKitClientConfig);
|
|
447
|
+
search(query: string, limit?: number): Promise<SearchHit[]>;
|
|
448
|
+
scrapeUrl(url: string): Promise<ScrapedDocument>;
|
|
449
|
+
ingestYouTube(urlOrVideoId: string, preferredLanguages?: string[]): Promise<YouTubeTranscriptResult>;
|
|
450
|
+
findStemResources(query: string, options?: StemResearchOptions): Promise<StemResourceCatalog>;
|
|
451
|
+
searchSocialPulse(topic: string, options?: SocialPulseOptions): Promise<SocialPulseReport>;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Service 2: Bilingual Term Extraction & Prerequisite Concept Graph (DAG)
|
|
455
|
+
*/
|
|
456
|
+
declare class TerminologyGraphService {
|
|
457
|
+
private config;
|
|
458
|
+
private extractor;
|
|
459
|
+
constructor(config: ResearchKitClientConfig);
|
|
460
|
+
extractConceptsDeterministic(topic: string, docs: Array<{
|
|
461
|
+
resourceId: string;
|
|
462
|
+
doc: ScrapedDocument;
|
|
463
|
+
}> | string, domain?: TechnicalDomain): TermExtractionBundle;
|
|
464
|
+
extractConcepts(topic: string, docs: Array<{
|
|
465
|
+
resourceId: string;
|
|
466
|
+
doc: ScrapedDocument;
|
|
467
|
+
}> | string, options?: {
|
|
468
|
+
domain?: TechnicalDomain;
|
|
469
|
+
context?: CourseResearchContext;
|
|
470
|
+
llm?: LlmTextFn;
|
|
471
|
+
maxTerms?: number;
|
|
472
|
+
}): Promise<TermExtractionBundle>;
|
|
473
|
+
formatConceptDagTsv(concepts: ExtractedConceptNode[]): string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Service 3: Academic Literature & Curricular Standards Alignment (ACM/IEEE CS2023 + CSTA K-12)
|
|
477
|
+
*/
|
|
478
|
+
declare class AcademicStandardsService {
|
|
479
|
+
private config;
|
|
480
|
+
private academicSearch;
|
|
481
|
+
private litSynthesizer;
|
|
482
|
+
constructor(config: ResearchKitClientConfig);
|
|
483
|
+
alignStandards(topic: string, context?: CourseResearchContext): TaxonomyMappingResult;
|
|
484
|
+
searchPapers(query: string, limit?: number): Promise<AcademicPaper[]>;
|
|
485
|
+
synthesizeLiteratureReview(topic: string, papers: AcademicPaper[], context?: CourseResearchContext): LiteratureReviewReport;
|
|
486
|
+
synthesizeLiteratureReviewWithLlm(topic: string, papers: AcademicPaper[], context?: CourseResearchContext, options?: {
|
|
487
|
+
llm?: LlmTextFn;
|
|
488
|
+
}): Promise<LiteratureReviewReport>;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Service 4: Document Health Audit, Evidence Scoring, Claim Verification & Provenance
|
|
492
|
+
*/
|
|
493
|
+
declare class EvidenceVerificationService {
|
|
494
|
+
private config;
|
|
495
|
+
private healthAuditor;
|
|
496
|
+
private evidenceScorer;
|
|
497
|
+
private claimVerifier;
|
|
498
|
+
private provenanceTracker;
|
|
499
|
+
constructor(config?: ResearchKitClientConfig);
|
|
500
|
+
auditDocument(doc: ScrapedDocument): HealthAuditResult;
|
|
501
|
+
scoreDocument(doc: ScrapedDocument, domain: TechnicalDomain, topic: string): ScoredEvidence;
|
|
502
|
+
scoreDocumentWithLlm(doc: ScrapedDocument, domain: TechnicalDomain, topic: string, options?: {
|
|
503
|
+
llm?: LlmTextFn;
|
|
504
|
+
context?: CourseResearchContext;
|
|
505
|
+
}): Promise<ScoredEvidence>;
|
|
506
|
+
verifyClaimsDeterministic(claimsToVerify: string[], sourceCorpusText: string): ClaimSweepReport;
|
|
507
|
+
verifyClaims(claimsToVerify: string[], sourceCorpusText: string, options?: {
|
|
508
|
+
llm?: LlmTextFn;
|
|
509
|
+
}): Promise<ClaimSweepReport>;
|
|
510
|
+
buildProvenance(topic: string, records: ProvenanceRecord[]): ProvenanceSidecar;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Service 5: Pedagogical Synthesis & Ground Truth Reference Pack Orchestration
|
|
514
|
+
*/
|
|
515
|
+
declare class PedagogicalSynthesisService {
|
|
516
|
+
private config;
|
|
517
|
+
private planner;
|
|
518
|
+
private pipeline;
|
|
519
|
+
constructor(config: ResearchKitClientConfig);
|
|
520
|
+
planCampaign(topic: string, options?: {
|
|
521
|
+
domain?: TechnicalDomain;
|
|
522
|
+
isDeep?: boolean;
|
|
523
|
+
maxRounds?: number;
|
|
524
|
+
context?: CourseResearchContext;
|
|
525
|
+
}): Promise<ResearchPlan>;
|
|
526
|
+
runFullHarvest(topic: string, overrides?: Partial<HarvestPipelineOptions>): Promise<HarvestPipelineResult>;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Service 6: Empirical Factsheet & Hardware/Software Technical Grounding (v1.2.0)
|
|
530
|
+
*/
|
|
531
|
+
declare class TechnicalGroundingService {
|
|
532
|
+
private config;
|
|
533
|
+
private engine;
|
|
534
|
+
constructor(config: ResearchKitClientConfig);
|
|
535
|
+
buildFactsheet(topic: string, options?: {
|
|
536
|
+
domain?: TechnicalDomain;
|
|
537
|
+
context?: CourseResearchContext;
|
|
538
|
+
}): Promise<TechnicalFactsheet>;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Unified facade exposing all 7 core services of `@thanh01.pmt/research-kit`
|
|
542
|
+
* configured with host-application API keys and LLM callbacks.
|
|
543
|
+
*/
|
|
544
|
+
declare class ResearchKitClient {
|
|
545
|
+
private readonly config;
|
|
546
|
+
/** Service 1: Multi-Engine Web Search, Scraper, YouTube Transcript & 30-Day Social Pulse */
|
|
547
|
+
readonly discovery: KnowledgeDiscoveryService;
|
|
548
|
+
/** Service 2: Bilingual Pedagogical Term Extraction & Prerequisite Concept Graph (DAG) */
|
|
549
|
+
readonly terminology: TerminologyGraphService;
|
|
550
|
+
/** Service 3: Academic Literature Search, BibTeX Citations & CS2023/CSTA K-12 Alignment */
|
|
551
|
+
readonly academic: AcademicStandardsService;
|
|
552
|
+
/** Service 4: Health Audit, Evidence Scoring, Claim Verification & Provenance Tracking */
|
|
553
|
+
readonly verification: EvidenceVerificationService;
|
|
554
|
+
/** Service 5: Campaign Planning, Semantic Synthesis & Canonical Reference Pack Orchestration */
|
|
555
|
+
readonly orchestrator: PedagogicalSynthesisService;
|
|
556
|
+
/** Service 6: Technical Grounding, Hardware/Software Compatibility & Empirical Exemplars */
|
|
557
|
+
readonly grounding: TechnicalGroundingService;
|
|
558
|
+
/** Service 7: Autonomous Contract-Driven Plan-and-Execute Research Sub-Agent (v1.4.0) */
|
|
559
|
+
readonly agent: ResearchSubAgent;
|
|
560
|
+
constructor(config?: ResearchKitClientConfig);
|
|
561
|
+
/**
|
|
562
|
+
* Unified Tri-Mode entrypoint (`'auto' | 'search' | 'research' | 'deep-research'`).
|
|
563
|
+
*/
|
|
564
|
+
execute<T = Record<string, unknown>>(mode: ResearchMode, input: ResearchContract<T> | string): Promise<ResearchAgentResult<T>>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Resolves `'auto'` profile into a concrete `ResearchProfile` based on objective & context signals.
|
|
569
|
+
*/
|
|
570
|
+
declare function resolveResearchProfile(contract: ResearchContract<any>): Exclude<ResearchProfile, 'auto'>;
|
|
571
|
+
/**
|
|
572
|
+
* Checks whether a search hit already carries semantic/neural relevance ranking
|
|
573
|
+
* (ADR-0019: Non-Redundant Evidence Gating).
|
|
574
|
+
*/
|
|
575
|
+
declare function isSemanticRankedHit(hit: {
|
|
576
|
+
engine?: string;
|
|
577
|
+
score?: number;
|
|
578
|
+
}): boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Autonomous Contract-Driven Plan-and-Execute Research Sub-Agent (v1.4.0).
|
|
581
|
+
* Implements:
|
|
582
|
+
* - Tri-Mode Execution (`'search' | 'research' | 'deep-research'`) + Decision-Model `'auto'` router.
|
|
583
|
+
* - Expected Prior Channel Routing (`Facet Probabilities x PriorMatrix`) + `ConcurrentRefillScheduler`.
|
|
584
|
+
* - Two-Stage Timeout Preemption (75% Stage A Harvest / 25% Stage B Synthesis).
|
|
585
|
+
* - Non-Redundant Evidence Gating for semantic search engines (`exa`, `tavily`, `openalex`, `semantic_scholar`).
|
|
586
|
+
*/
|
|
587
|
+
declare class ResearchSubAgent {
|
|
588
|
+
private config;
|
|
589
|
+
private searchEngine;
|
|
590
|
+
private webScraper;
|
|
591
|
+
private academicEngine;
|
|
592
|
+
private openAlexClient;
|
|
593
|
+
private socialPulseHarvester;
|
|
594
|
+
private stemResearcher;
|
|
595
|
+
private youtubeService;
|
|
596
|
+
private healthAuditor;
|
|
597
|
+
private evidenceScorer;
|
|
598
|
+
private claimVerifier;
|
|
599
|
+
private provenanceTracker;
|
|
600
|
+
constructor(config?: ResearchKitClientConfig);
|
|
601
|
+
/**
|
|
602
|
+
* Executes a complete Plan-and-Execute research campaign governed by `contract`.
|
|
603
|
+
*/
|
|
604
|
+
run<T = Record<string, unknown>>(contract: ResearchContract<T>, options?: {
|
|
605
|
+
llm?: ResearchKitClientConfig['llm'];
|
|
606
|
+
decision?: ResearchDecisionFn;
|
|
607
|
+
}): Promise<ResearchAgentResult<T>>;
|
|
608
|
+
/**
|
|
609
|
+
* Builds the Prior-sorted channel queue for a specific round.
|
|
610
|
+
*/
|
|
611
|
+
private buildRoundChannelQueue;
|
|
612
|
+
/**
|
|
613
|
+
* Executes a single source channel and classifies its outcome (`'ok' | 'weak' | 'empty' | 'error'`)
|
|
614
|
+
* using Non-Redundant Evidence Gating (ADR-0019).
|
|
615
|
+
*/
|
|
616
|
+
private executeSingleChannel;
|
|
617
|
+
/**
|
|
618
|
+
* Plans targeted search queries for Round 1 (initial coverage) or Round > 1 (surgical gap filling).
|
|
619
|
+
*/
|
|
620
|
+
private planQueriesForRound;
|
|
621
|
+
/**
|
|
622
|
+
* Evaluates whether the current `EvidenceLedger` satisfies `acceptanceCriteria`,
|
|
623
|
+
* `requiredAttributes`, and `requiredSections`.
|
|
624
|
+
* Prioritizes Decision Model (`noul`) over Generative LLM when available (ADR-0019).
|
|
625
|
+
*/
|
|
626
|
+
private evaluateRoundGaps;
|
|
627
|
+
/**
|
|
628
|
+
* Verifies claims using Decision Model `choice` (`supported | refuted | not_enough_evidence`)
|
|
629
|
+
* or Generative LLM NLI (`ClaimVerifier.verifyClaims`) when `shouldVerifyClaims` is enabled (e.g., `deep-research`).
|
|
630
|
+
*/
|
|
631
|
+
private verifyClaimsWithDecisionOrLlm;
|
|
632
|
+
/**
|
|
633
|
+
* Stage B: Synthesizes `EvidenceLedger` excerpts into `outputSchema<T>` + `markdownReport`
|
|
634
|
+
* and runs deterministic schema, citation, and claim verification gates.
|
|
635
|
+
*/
|
|
636
|
+
private synthesizeAndVerify;
|
|
637
|
+
private buildDeterministicMarkdownReport;
|
|
638
|
+
}
|
|
639
|
+
declare const ResearchAgentToolInputSchema: z.ZodObject<{
|
|
640
|
+
objective: z.ZodString;
|
|
641
|
+
mode: z.ZodOptional<z.ZodEnum<["auto", "search", "research", "deep-research"]>>;
|
|
642
|
+
preferredChannels: z.ZodOptional<z.ZodArray<z.ZodEnum<["web_docs", "academic", "social_pulse", "stem_oer", "video_media"]>, "many">>;
|
|
643
|
+
profile: z.ZodOptional<z.ZodEnum<["auto", "fast_grounded", "deep_autonomous", "technical", "academic", "social_pulse", "curriculum_oer", "general"]>>;
|
|
644
|
+
requiredAttributes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
645
|
+
requiredSections: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
646
|
+
requireCodeExamples: z.ZodOptional<z.ZodBoolean>;
|
|
647
|
+
requireTables: z.ZodOptional<z.ZodBoolean>;
|
|
648
|
+
verifyClaims: z.ZodOptional<z.ZodBoolean>;
|
|
649
|
+
minSources: z.ZodOptional<z.ZodNumber>;
|
|
650
|
+
maxChannels: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
maxRounds: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
recencyDays: z.ZodOptional<z.ZodNumber>;
|
|
653
|
+
hardwarePlatform: z.ZodOptional<z.ZodString>;
|
|
654
|
+
softwareEnv: z.ZodOptional<z.ZodString>;
|
|
655
|
+
}, "strip", z.ZodTypeAny, {
|
|
656
|
+
objective: string;
|
|
657
|
+
hardwarePlatform?: string | undefined;
|
|
658
|
+
softwareEnv?: string | undefined;
|
|
659
|
+
recencyDays?: number | undefined;
|
|
660
|
+
maxRounds?: number | undefined;
|
|
661
|
+
requireCodeExamples?: boolean | undefined;
|
|
662
|
+
requireTables?: boolean | undefined;
|
|
663
|
+
verifyClaims?: boolean | undefined;
|
|
664
|
+
requiredAttributes?: string[] | undefined;
|
|
665
|
+
maxChannels?: number | undefined;
|
|
666
|
+
mode?: "search" | "auto" | "research" | "deep-research" | undefined;
|
|
667
|
+
profile?: "academic" | "auto" | "social_pulse" | "fast_grounded" | "deep_autonomous" | "technical" | "curriculum_oer" | "general" | undefined;
|
|
668
|
+
minSources?: number | undefined;
|
|
669
|
+
preferredChannels?: ("academic" | "web_docs" | "social_pulse" | "stem_oer" | "video_media")[] | undefined;
|
|
670
|
+
requiredSections?: string[] | undefined;
|
|
671
|
+
}, {
|
|
672
|
+
objective: string;
|
|
673
|
+
hardwarePlatform?: string | undefined;
|
|
674
|
+
softwareEnv?: string | undefined;
|
|
675
|
+
recencyDays?: number | undefined;
|
|
676
|
+
maxRounds?: number | undefined;
|
|
677
|
+
requireCodeExamples?: boolean | undefined;
|
|
678
|
+
requireTables?: boolean | undefined;
|
|
679
|
+
verifyClaims?: boolean | undefined;
|
|
680
|
+
requiredAttributes?: string[] | undefined;
|
|
681
|
+
maxChannels?: number | undefined;
|
|
682
|
+
mode?: "search" | "auto" | "research" | "deep-research" | undefined;
|
|
683
|
+
profile?: "academic" | "auto" | "social_pulse" | "fast_grounded" | "deep_autonomous" | "technical" | "curriculum_oer" | "general" | undefined;
|
|
684
|
+
minSources?: number | undefined;
|
|
685
|
+
preferredChannels?: ("academic" | "web_docs" | "social_pulse" | "stem_oer" | "video_media")[] | undefined;
|
|
686
|
+
requiredSections?: string[] | undefined;
|
|
687
|
+
}>;
|
|
688
|
+
type ResearchAgentToolInput = z.infer<typeof ResearchAgentToolInputSchema>;
|
|
689
|
+
/**
|
|
690
|
+
* Standalone helper to run a `ResearchSubAgent` campaign in one call.
|
|
691
|
+
*/
|
|
692
|
+
declare function runResearchSubAgent<T = Record<string, unknown>>(contract: ResearchContract<T>, config?: ResearchKitClientConfig): Promise<ResearchAgentResult<T>>;
|
|
693
|
+
/**
|
|
694
|
+
* Helper factory that wraps `ResearchSubAgent` as an AI SDK / Copilot tool definition.
|
|
695
|
+
*/
|
|
696
|
+
declare function createResearchAgentTool(config?: ResearchKitClientConfig): {
|
|
697
|
+
name: string;
|
|
698
|
+
description: string;
|
|
699
|
+
parameters: z.ZodObject<{
|
|
700
|
+
objective: z.ZodString;
|
|
701
|
+
mode: z.ZodOptional<z.ZodEnum<["auto", "search", "research", "deep-research"]>>;
|
|
702
|
+
preferredChannels: z.ZodOptional<z.ZodArray<z.ZodEnum<["web_docs", "academic", "social_pulse", "stem_oer", "video_media"]>, "many">>;
|
|
703
|
+
profile: z.ZodOptional<z.ZodEnum<["auto", "fast_grounded", "deep_autonomous", "technical", "academic", "social_pulse", "curriculum_oer", "general"]>>;
|
|
704
|
+
requiredAttributes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
705
|
+
requiredSections: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
706
|
+
requireCodeExamples: z.ZodOptional<z.ZodBoolean>;
|
|
707
|
+
requireTables: z.ZodOptional<z.ZodBoolean>;
|
|
708
|
+
verifyClaims: z.ZodOptional<z.ZodBoolean>;
|
|
709
|
+
minSources: z.ZodOptional<z.ZodNumber>;
|
|
710
|
+
maxChannels: z.ZodOptional<z.ZodNumber>;
|
|
711
|
+
maxRounds: z.ZodOptional<z.ZodNumber>;
|
|
712
|
+
recencyDays: z.ZodOptional<z.ZodNumber>;
|
|
713
|
+
hardwarePlatform: z.ZodOptional<z.ZodString>;
|
|
714
|
+
softwareEnv: z.ZodOptional<z.ZodString>;
|
|
715
|
+
}, "strip", z.ZodTypeAny, {
|
|
716
|
+
objective: string;
|
|
717
|
+
hardwarePlatform?: string | undefined;
|
|
718
|
+
softwareEnv?: string | undefined;
|
|
719
|
+
recencyDays?: number | undefined;
|
|
720
|
+
maxRounds?: number | undefined;
|
|
721
|
+
requireCodeExamples?: boolean | undefined;
|
|
722
|
+
requireTables?: boolean | undefined;
|
|
723
|
+
verifyClaims?: boolean | undefined;
|
|
724
|
+
requiredAttributes?: string[] | undefined;
|
|
725
|
+
maxChannels?: number | undefined;
|
|
726
|
+
mode?: "search" | "auto" | "research" | "deep-research" | undefined;
|
|
727
|
+
profile?: "academic" | "auto" | "social_pulse" | "fast_grounded" | "deep_autonomous" | "technical" | "curriculum_oer" | "general" | undefined;
|
|
728
|
+
minSources?: number | undefined;
|
|
729
|
+
preferredChannels?: ("academic" | "web_docs" | "social_pulse" | "stem_oer" | "video_media")[] | undefined;
|
|
730
|
+
requiredSections?: string[] | undefined;
|
|
731
|
+
}, {
|
|
732
|
+
objective: string;
|
|
733
|
+
hardwarePlatform?: string | undefined;
|
|
734
|
+
softwareEnv?: string | undefined;
|
|
735
|
+
recencyDays?: number | undefined;
|
|
736
|
+
maxRounds?: number | undefined;
|
|
737
|
+
requireCodeExamples?: boolean | undefined;
|
|
738
|
+
requireTables?: boolean | undefined;
|
|
739
|
+
verifyClaims?: boolean | undefined;
|
|
740
|
+
requiredAttributes?: string[] | undefined;
|
|
741
|
+
maxChannels?: number | undefined;
|
|
742
|
+
mode?: "search" | "auto" | "research" | "deep-research" | undefined;
|
|
743
|
+
profile?: "academic" | "auto" | "social_pulse" | "fast_grounded" | "deep_autonomous" | "technical" | "curriculum_oer" | "general" | undefined;
|
|
744
|
+
minSources?: number | undefined;
|
|
745
|
+
preferredChannels?: ("academic" | "web_docs" | "social_pulse" | "stem_oer" | "video_media")[] | undefined;
|
|
746
|
+
requiredSections?: string[] | undefined;
|
|
747
|
+
}>;
|
|
748
|
+
execute: (input: ResearchAgentToolInput) => Promise<{
|
|
749
|
+
status: ResearchAgentStatus;
|
|
750
|
+
mode: "search" | "research" | "deep-research";
|
|
751
|
+
profile: ResearchProfile;
|
|
752
|
+
roundsExecuted: number;
|
|
753
|
+
tier1Summary: string;
|
|
754
|
+
tier2TechnicalDigest: string;
|
|
755
|
+
markdownReport: string;
|
|
756
|
+
citations: CitationReceipt[];
|
|
757
|
+
validCitationIds: string[];
|
|
758
|
+
missingGaps: string[];
|
|
759
|
+
modeClassificationTrace: ModeClassificationTrace | undefined;
|
|
760
|
+
channelTraces: ChannelExecutionTrace[] | undefined;
|
|
761
|
+
}>;
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
export { AcademicStandardsService as $, computeContractComplexityScore as A, inferFallbackFacetProbabilities as B, type ChannelStatus as C, rankChannelsByExpectedPrior as D, EvidenceLedger as E, classifyModeAndPrior as F, evaluateAttributeCoverageWithDecision as G, classifyChannelStatus as H, type ConcurrentRefillSchedulerParams as I, type ConcurrentRefillSchedulerResult as J, runConcurrentRefillScheduler as K, type LedgerItem as L, type ModeClassificationTrace as M, resolveResearchProfile as N, isSemanticRankedHit as O, type ProfilePreset as P, type QuestionFacet as Q, type ResearchMode as R, type SourceChannel as S, ResearchSubAgent as T, ResearchAgentToolInputSchema as U, type ResearchAgentToolInput as V, runResearchSubAgent as W, createResearchAgentTool as X, type ResearchKitClientConfig as Y, KnowledgeDiscoveryService as Z, TerminologyGraphService as _, type ResearchProfile as a, EvidenceVerificationService as a0, PedagogicalSynthesisService as a1, TechnicalGroundingService as a2, ResearchKitClient as a3, type ResearchScoreQuestion as b, type ResearchChoiceQuestion as c, type ResearchNoulQuestion as d, type ResearchDecisionQuestion as e, type ResearchScoreAnswer as f, type ResearchChoiceAnswer as g, type ResearchNoulAnswer as h, type ResearchDecisionAnswer as i, type ResearchDecisionRequest as j, type ResearchDecisionResult as k, type ResearchDecisionFn as l, type ChannelExecutionTrace as m, type ResearchAcceptanceCriteria as n, type ResearchBudget as o, type ResearchContract as p, type CitationReceipt as q, type ResearchAgentStatus as r, type ResearchRoundTrace as s, type ResearchAgentResult as t, type ModePreset as u, RESEARCH_MODE_PRESETS as v, RESEARCH_PROFILE_PRESETS as w, QUESTION_FACETS as x, SOURCE_CHANNELS as y, PRIOR_MATRIX as z };
|