heor-agent-mcp 0.1.0 → 0.1.2

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.
Files changed (41) hide show
  1. package/README.md +262 -91
  2. package/dist/audit/types.d.ts +9 -0
  3. package/dist/audit/types.d.ts.map +1 -1
  4. package/dist/formatters/markdown.d.ts.map +1 -1
  5. package/dist/formatters/markdown.js +8 -0
  6. package/dist/formatters/markdown.js.map +1 -1
  7. package/dist/knowledge/index.d.ts +1 -0
  8. package/dist/knowledge/index.d.ts.map +1 -1
  9. package/dist/knowledge/index.js +1 -0
  10. package/dist/knowledge/index.js.map +1 -1
  11. package/dist/knowledge/paths.d.ts +1 -0
  12. package/dist/knowledge/paths.d.ts.map +1 -1
  13. package/dist/knowledge/paths.js +10 -1
  14. package/dist/knowledge/paths.js.map +1 -1
  15. package/dist/knowledge/reportStore.d.ts +10 -0
  16. package/dist/knowledge/reportStore.d.ts.map +1 -0
  17. package/dist/knowledge/reportStore.js +27 -0
  18. package/dist/knowledge/reportStore.js.map +1 -0
  19. package/dist/providers/direct/index.d.ts.map +1 -1
  20. package/dist/providers/direct/index.js +11 -2
  21. package/dist/providers/direct/index.js.map +1 -1
  22. package/dist/providers/direct/scienceDirect.d.ts +3 -0
  23. package/dist/providers/direct/scienceDirect.d.ts.map +1 -0
  24. package/dist/providers/direct/scienceDirect.js +41 -0
  25. package/dist/providers/direct/scienceDirect.js.map +1 -0
  26. package/dist/providers/types.d.ts +1 -1
  27. package/dist/providers/types.d.ts.map +1 -1
  28. package/dist/sources/registry.d.ts +20 -0
  29. package/dist/sources/registry.d.ts.map +1 -0
  30. package/dist/sources/registry.js +311 -0
  31. package/dist/sources/registry.js.map +1 -0
  32. package/dist/tools/costEffectivenessModel.d.ts.map +1 -1
  33. package/dist/tools/costEffectivenessModel.js +5 -1
  34. package/dist/tools/costEffectivenessModel.js.map +1 -1
  35. package/dist/tools/htaDossierPrep.d.ts.map +1 -1
  36. package/dist/tools/htaDossierPrep.js +9 -2
  37. package/dist/tools/htaDossierPrep.js.map +1 -1
  38. package/dist/tools/literatureSearch.d.ts.map +1 -1
  39. package/dist/tools/literatureSearch.js +3 -1
  40. package/dist/tools/literatureSearch.js.map +1 -1
  41. package/package.json +4 -4
package/README.md CHANGED
@@ -1,10 +1,30 @@
1
1
  # HEORAgent MCP Server
2
2
 
3
- An AI-powered Health Economics and Outcomes Research (HEOR) agent for Claude.ai — automates literature review, cost-effectiveness modelling, and HTA dossier preparation.
3
+ [![npm version](https://img.shields.io/npm/v/heor-agent-mcp.svg)](https://www.npmjs.com/package/heor-agent-mcp)
4
+ [![license](https://img.shields.io/npm/l/heor-agent-mcp.svg)](./LICENSE)
5
+ [![node](https://img.shields.io/node/v/heor-agent-mcp.svg)](https://nodejs.org)
6
+
7
+ **AI-powered Health Economics and Outcomes Research (HEOR) agent as a Model Context Protocol server.**
8
+
9
+ Automates literature review across 41 data sources, state-of-the-art cost-effectiveness modelling, HTA dossier preparation for NICE / EMA / FDA / IQWiG / HAS / EU JCA, and a persistent project knowledge base — all callable as MCP tools from Claude.ai, Claude Code, and any MCP-compatible host.
10
+
11
+ Built for pharmaceutical, biotech, CRO, and medical affairs teams who need rigorous, auditable HEOR workflows without building infrastructure from scratch.
12
+
13
+ ---
4
14
 
5
15
  ## Quick Start
6
16
 
7
- Add to your Claude.ai MCP configuration:
17
+ ### Claude Code
18
+
19
+ ```bash
20
+ claude mcp add heor-agent -- npx heor-agent-mcp
21
+ ```
22
+
23
+ Then restart Claude Code.
24
+
25
+ ### Claude Desktop / claude.ai
26
+
27
+ Add to your MCP configuration:
8
28
 
9
29
  ```json
10
30
  {
@@ -17,136 +37,287 @@ Add to your Claude.ai MCP configuration:
17
37
  }
18
38
  ```
19
39
 
20
- Or run locally:
40
+ ### Verify
21
41
 
22
- ```bash
23
- npm install heor-agent-mcp
24
- npx heor-agent-mcp
42
+ ```
43
+ > Run a literature search for semaglutide cost-effectiveness in T2D using PubMed and NICE TAs
25
44
  ```
26
45
 
27
- ## Tools
46
+ ---
28
47
 
29
- ### literature_search
48
+ ## Tools
30
49
 
31
- Search PubMed, ClinicalTrials.gov, bioRxiv/medRxiv, and ChEMBL simultaneously.
32
- Returns structured results with a full PRISMA-style audit trail.
50
+ | Tool | Purpose |
51
+ |------|---------|
52
+ | `literature_search` | Search 41 data sources with a full PRISMA-style audit trail |
53
+ | `cost_effectiveness_model` | Markov / PartSA / decision-tree CEA with PSA, OWSA, CEAC, EVPI |
54
+ | `hta_dossier_prep` | Draft submissions for NICE, EMA, FDA, IQWiG, HAS, and EU JCA |
55
+ | `project_create` | Initialize a persistent project workspace |
56
+ | `knowledge_search` | Full-text search across a project's raw/ and wiki/ trees |
57
+ | `knowledge_read` | Read any file from a project's knowledge base |
58
+ | `knowledge_write` | Write compiled evidence to the project wiki (Obsidian-compatible) |
33
59
 
34
- **Required**: `query` (string)
35
- **Optional**: `sources` (array), `max_results` (1–100), `date_from` (YYYY-MM-DD), `output_format` (text|json|docx)
60
+ ### `literature_search`
36
61
 
37
- **Example prompt**: "Find RCT evidence on semaglutide for type 2 diabetes from the last 3 years"
62
+ Searches across 41 sources in parallel. Every call returns a **source selection table** showing which of the 41 sources were used and why — essential for HTA audit trails.
38
63
 
39
- ### cost_effectiveness_model
64
+ **Example call:**
65
+ ```json
66
+ {
67
+ "query": "semaglutide cardiovascular outcomes type 2 diabetes",
68
+ "sources": ["pubmed", "clinicaltrials", "nice_ta", "cadth_reviews", "icer_reports"],
69
+ "max_results": 20,
70
+ "output_format": "text"
71
+ }
72
+ ```
40
73
 
41
- State-of-the-art cost-utility analysis: multi-state Markov model, probabilistic sensitivity
42
- analysis (PSA, Monte Carlo), one-way sensitivity analysis (tornado diagram), cost-effectiveness
43
- acceptability curve (CEAC), and Expected Value of Perfect Information (EVPI).
74
+ ### `cost_effectiveness_model`
44
75
 
45
- Follows ISPOR good practice guidelines and NICE reference case (3.5% discount rate).
76
+ Multi-state Markov model (default) or Partitioned Survival Analysis (oncology), following ISPOR good practice and NICE reference case (3.5% discount rate, half-cycle correction). Includes:
46
77
 
47
- **Required**: `intervention`, `comparator`, `indication`, `time_horizon`, `perspective`, `clinical_inputs`, `cost_inputs`
48
- **Optional**: `model_type` (markov|partsa|decision_tree), `utility_inputs`, `run_psa`, `psa_iterations`, `run_owsa`
78
+ - **PSA** 1,000–10,000 Monte Carlo iterations, probability cost-effective at WTP thresholds
79
+ - **OWSA** one-way sensitivity analysis with tornado summary
80
+ - **CEAC** — cost-effectiveness acceptability curve
81
+ - **EVPI** — expected value of perfect information
82
+ - **WTP assessment** — verdict against NHS (£20–30K), US payer ($100–150K), societal thresholds
49
83
 
50
- **Supported HTA perspectives**:
51
- - `nhs` — NICE threshold £20–30K/QALY
52
- - `us_payer` — ICER threshold $100–150K/QALY
53
- - `societal` Societal perspective $50–100K/QALY
84
+ **Example call:**
85
+ ```json
86
+ {
87
+ "intervention": "Semaglutide 1mg SC weekly",
88
+ "comparator": "Sitagliptin 100mg daily",
89
+ "indication": "Type 2 Diabetes Mellitus",
90
+ "time_horizon": "lifetime",
91
+ "perspective": "nhs",
92
+ "model_type": "markov",
93
+ "clinical_inputs": { "efficacy_delta": 0.5, "mortality_reduction": 0.15 },
94
+ "cost_inputs": { "drug_cost_annual": 3200, "comparator_cost_annual": 480 },
95
+ "utility_inputs": { "qaly_on_treatment": 0.82, "qaly_comparator": 0.76 },
96
+ "run_psa": true,
97
+ "output_format": "docx"
98
+ }
99
+ ```
54
100
 
55
- For oncology: set `model_type="partsa"` to use Partitioned Survival Analysis (NICE TSD 14).
101
+ ### `hta_dossier_prep`
56
102
 
57
- **Example prompt**: "Model cost-effectiveness of semaglutide vs sitagliptin for T2D, NHS perspective, lifetime horizon"
103
+ Drafts submission-ready sections for six HTA frameworks with gap analysis:
58
104
 
59
- ### hta_dossier_prep
105
+ | Body | Country | Submission types |
106
+ |------|---------|------------------|
107
+ | NICE | UK | STA, MTA, early_access |
108
+ | EMA | EU | STA, MTA |
109
+ | FDA | US | STA, MTA |
110
+ | IQWiG | Germany | STA, MTA |
111
+ | HAS | France | STA, MTA |
112
+ | JCA | EU (Reg. 2021/2282) | initial, renewal, variation (with PICOs) |
60
113
 
61
- Structure evidence into submission-ready HTA dossier sections with gap analysis.
62
- Accepts output from `literature_search` and `cost_effectiveness_model` directly.
114
+ Accepts piped output from `literature_search` and `cost_effectiveness_model`.
63
115
 
64
- **Required**: `hta_body` (nice|ema|fda|iqwig|has), `submission_type` (sta|mta|early_access), `drug_name`, `indication`
65
- **Optional**: `evidence_summary` (text or JSON from literature_search), `model_results` (from cost_effectiveness_model)
116
+ ### Knowledge base tools
66
117
 
67
- **Supported bodies**: NICE (UK), EMA (EU), FDA (US), IQWiG (Germany), HAS (France)
118
+ Projects live at `~/.heor-agent/projects/{project-id}/` with:
119
+ - `raw/literature/` — auto-populated literature search results
120
+ - `raw/models/` — auto-populated model runs
121
+ - `raw/dossiers/` — auto-populated dossier drafts
122
+ - `reports/` — generated DOCX files
123
+ - `wiki/` — manually curated, Obsidian-compatible markdown with `[[wikilinks]]`
68
124
 
69
- **Example prompt**: "Prepare a NICE STA outline for semaglutide in type 2 diabetes using [literature search output]"
125
+ Pass `project: "project-id"` to any tool and results are saved automatically.
70
126
 
71
- ## Audit Trail
127
+ ---
72
128
 
73
- Every tool call returns a full audit record:
74
- - Sources queried, queries sent, response counts
75
- - Inclusion/exclusion counts with reasons
76
- - Methodology notes and assumptions
77
- - Warnings and data quality flags
129
+ ## Data Sources
78
130
 
79
- Suitable for inclusion in HTA submission appendices.
131
+ **41 sources across 9 categories.** Every `literature_search` call includes a source selection table showing used/not-used status and reason for each.
80
132
 
81
- ## Data Sources (Phase 1 — DirectProvider)
133
+ <details>
134
+ <summary><b>Biomedical & Clinical Trials (4)</b></summary>
82
135
 
83
- Currently integrated (free, direct API access):
84
136
  - **PubMed** — 35M+ biomedical citations (NCBI E-utilities)
85
- - **ClinicalTrials.gov** — FDA-regulated clinical studies (CT.gov v2 API)
137
+ - **ClinicalTrials.gov** — NIH/NLM trial registry (CT.gov v2 API)
86
138
  - **bioRxiv / medRxiv** — Life sciences and medical preprints
87
139
  - **ChEMBL** — Drug bioactivity, mechanisms, ADMET (EMBL-EBI)
140
+ </details>
141
+
142
+ <details>
143
+ <summary><b>Epidemiology & Demographics (5)</b></summary>
144
+
145
+ - **WHO GHO** — WHO Global Health Observatory
146
+ - **World Bank** — Demographics, macroeconomics, health expenditure
147
+ - **OECD Health** — OECD health statistics (expenditure, workforce, outcomes)
148
+ - **IHME GBD** — Global Burden of Disease (DALYs, prevalence across 204 countries)
149
+ - **All of Us** — NIH precision medicine cohort
150
+ </details>
151
+
152
+ <details>
153
+ <summary><b>FDA (2)</b></summary>
154
+
155
+ - **FDA Orange Book** — Drug approvals and therapeutic equivalence
156
+ - **FDA Purple Book** — Licensed biologics and biosimilars
157
+ </details>
158
+
159
+ <details>
160
+ <summary><b>HTA Appraisals (10) — HTA precedent decisions</b></summary>
161
+
162
+ - **NICE TAs** (UK) · **CADTH** (Canada) · **ICER** (US) · **PBAC** (Australia)
163
+ - **G-BA AMNOG** (Germany) · **IQWiG** (Germany) · **HAS** (France)
164
+ - **AIFA** (Italy) · **TLV** (Sweden) · **INESSS** (Quebec, Canada)
165
+ </details>
166
+
167
+ <details>
168
+ <summary><b>HTA Cost References (5)</b></summary>
169
+
170
+ - **CMS NADAC** (US drug acquisition costs)
171
+ - **PSSRU** (UK unit costs) · **NHS National Cost Collection** · **BNF** (UK drug pricing)
172
+ - **PBS Schedule** (Australia)
173
+ </details>
174
+
175
+ <details>
176
+ <summary><b>LATAM (6)</b></summary>
88
177
 
89
- ## Data Sources (Roadmap)
90
-
91
- ### Phase 2 — Open/Free APIs
92
- - WHO Global Health Observatory — Global epidemiology and health indicators
93
- - World Bank Data — Demographics, macroeconomics
94
- - OECD Health Data — Costs, utilization, health statistics (OECD)
95
- - IHME / Global Burden of Disease — Global disease burden estimates
96
- - ISPOR Presentations Database — HEOR studies and conference posters
97
-
98
- ### Phase 2 — HTA Guidance & Pricing (Open)
99
- - NICE (UK): Methods Guide, Technology Appraisals, PSSRU Unit Costs, NHS Reference Costs, BNF
100
- - ICER (US): Value Assessment Framework, CMS Data
101
- - CADTH (Canada): Guidelines and Reviews, INESSS
102
- - PBAC (Australia): Guidelines, PSD, PBS/MBS Schedule
103
- - HAS (France): Guidelines, Transparency Committee, CEPS
104
- - IQWiG/G-BA (Germany): Methods Guide, Appraisal Decisions
105
- - AIFA (Italy), AEMPS/IPT (Spain), TLV (Sweden), MHLW (Japan)
106
- - CONITEC/ANVISA (Brazil), IETS (Colombia), FONASA (Chile), HITAP (Thailand)
107
- - HIRA/NHIS (South Korea), WHO GHO, OECD Health, World Bank
108
-
109
- ### Phase 2 Restricted (with credentials)
110
- - CPRD (UK primary care), NHS HES (UK hospital episodes), SNDS (France national claims)
111
- - German SHI/AOK/WIdO, Nordic Registries, Japan NDB, NHIRD (Taiwan)
112
- - NHSO (Thailand), PhilHealth (Philippines)
113
-
114
- ### Phase 3 — Commercial (enterprise tier)
115
- - IQVIA MIDAS/RWD, Optum Clinformatics, Flatiron Health (oncology EHR)
116
- - Premier Healthcare Database, Komodo Health, Oracle Health RWD
117
- - IBM Micromedex Red Book (drug pricing), SSR Health (net pricing/rebates)
118
-
119
- ## Local RWE Datasets (Phase 2)
120
-
121
- Point to local files in `/Users/mnaumov/Projects/Health_Statistics`:
122
- - NAMCS — National Ambulatory Medical Care Survey (US)
123
- - NHAMCS National Hospital Ambulatory Medical Care Survey (US)
124
- - MEPS — Medical Expenditure Panel Survey (US)
125
- - DATASUSBrazilian health system data (hospital + epidemiology)
126
-
127
- ## Tiers
128
-
129
- - **DirectProvider** (default) Free. Uses your Anthropic API key. All tools, text + JSON output.
130
- - **HostedProvider** — Set `HEOR_API_KEY` env var. Phase 2: DOCX/PDF reports, Redis caching.
178
+ - **DATASUS** · **CONITEC** · **ANVISA** (Brazil)
179
+ - **PAHO** (Pan American regional) · **IETS** (Colombia) · **FONASA** (Chile)
180
+ </details>
181
+
182
+ <details>
183
+ <summary><b>APAC (1)</b></summary>
184
+
185
+ - **HITAP** (Thailand)
186
+ </details>
187
+
188
+ <details>
189
+ <summary><b>Enterprise (6) require API key</b></summary>
190
+
191
+ | Source | Env variable |
192
+ |--------|--------------|
193
+ | Embase | `ELSEVIER_API_KEY` |
194
+ | ScienceDirect | `ELSEVIER_API_KEY` |
195
+ | Cochrane Library | `COCHRANE_API_KEY` |
196
+ | Citeline | `CITELINE_API_KEY` |
197
+ | Pharmapendium | `PHARMAPENDIUM_API_KEY` |
198
+ | Cortellis | `CORTELLIS_API_KEY` |
199
+ | Google Scholar | `SERPAPI_KEY` |
200
+ </details>
201
+
202
+ <details>
203
+ <summary><b>Other (1)</b></summary>
204
+
205
+ - **ISPOR** HEOR methodology and conference abstracts
206
+ </details>
207
+
208
+ ---
209
+
210
+ ## Output Formats
211
+
212
+ All tools support `output_format`:
213
+
214
+ - **`text`** (default) Markdown with formatted tables and headings
215
+ - **`json`** — Structured objects for downstream tools
216
+ - **`docx`** — Microsoft Word document, saved to disk, path returned in response
217
+
218
+ DOCX files are saved to `~/.heor-agent/projects/{project}/reports/` (when a project is set) or `~/.heor-agent/reports/` (global). The tool response contains the absolute path ready to attach to submissions or share with stakeholders.
219
+
220
+ ---
221
+
222
+ ## Audit Trail
223
+
224
+ Every tool call returns a full audit record:
225
+
226
+ - **Source selection table** — all 41 sources with used/not-used and reason
227
+ - **Sources queried** — queries sent, response counts, status, latency
228
+ - **Inclusions / exclusions** — counts with reasons
229
+ - **Methodology** — PRISMA-style for literature, ISPOR/NICE for economics
230
+ - **Assumptions** — every assumption logged with justification
231
+ - **Warnings** — data quality flags, missing API keys, failed sources
232
+
233
+ Suitable for inclusion in HTA submission appendices.
234
+
235
+ ---
131
236
 
132
237
  ## Configuration
133
238
 
134
239
  ```bash
135
- HEOR_API_KEY # Set to enable HostedProvider (Phase 2). Omit for DirectProvider (Phase 1).
240
+ # Optional enterprise data sources
241
+ ELSEVIER_API_KEY=... # Embase + ScienceDirect
242
+ COCHRANE_API_KEY=... # Cochrane Library
243
+ CITELINE_API_KEY=... # Citeline
244
+ PHARMAPENDIUM_API_KEY=... # Pharmapendium
245
+ CORTELLIS_API_KEY=... # Cortellis
246
+ SERPAPI_KEY=... # Google Scholar
247
+
248
+ # Optional — knowledge base location
249
+ HEOR_KB_ROOT=~/.heor-agent # Default
250
+
251
+ # Optional — localhost proxy for enterprise APIs behind corporate VPN
252
+ HEOR_PROXY_URL=http://localhost:8787
253
+
254
+ # Optional — hosted tier (future)
255
+ HEOR_API_KEY=...
136
256
  ```
137
257
 
258
+ ---
259
+
138
260
  ## Development
139
261
 
140
262
  ```bash
263
+ git clone https://github.com/neptun2000/HEORAgent
264
+ cd HEORAgent/heor-agent-mcp
141
265
  npm install
142
- npm test # 74 tests
143
- npm run build # Compiles to dist/
266
+ npm test # 244 tests across 66 suites
267
+ npm run build # Compile TypeScript to dist/
144
268
  npm run dev # Run with tsx (no build step)
145
269
  ```
146
270
 
147
- Node.js >= 20 required.
271
+ **Requires:** Node.js 20.
272
+
273
+ ---
274
+
275
+ ## Architecture
276
+
277
+ ```
278
+ ┌────────────────────────────────────────────┐
279
+ │ MCP Host (Claude.ai / Claude Code / etc.) │
280
+ └────────────────┬───────────────────────────┘
281
+ │ stdio
282
+ ┌────────────────▼──────────────────────────┐
283
+ │ heor-agent-mcp server │
284
+ │ ┌──────────────────────────────────────┐ │
285
+ │ │ 7 MCP tools (Zod-validated) │ │
286
+ │ ├──────────────────────────────────────┤ │
287
+ │ │ DirectProvider (default) │ │
288
+ │ │ ├─ 41 source fetchers │ │
289
+ │ │ ├─ Audit builder + PRISMA trail │ │
290
+ │ │ ├─ Markov / PartSA economic models │ │
291
+ │ │ ├─ Markdown + DOCX formatters │ │
292
+ │ │ └─ Knowledge base (YAML + MD) │ │
293
+ │ └──────────────────────────────────────┘ │
294
+ └───────────────────────────────────────────┘
295
+
296
+ ┌────────────┴─────────────┐
297
+ ▼ ▼
298
+ ┌────────────┐ ┌──────────────────┐
299
+ │ ~/.heor- │ │ External APIs │
300
+ │ agent/ │ │ (PubMed, NICE, │
301
+ │ projects/ │ │ ICER, CADTH, …) │
302
+ └────────────┘ └──────────────────┘
303
+ ```
304
+
305
+ ---
306
+
307
+ ## License
308
+
309
+ MIT — see [LICENSE](./LICENSE).
310
+
311
+ ---
148
312
 
149
313
  ## Disclaimer
150
314
 
151
- All outputs are preliminary and for research orientation only. Results require validation by a
152
- qualified health economist before use in any HTA submission, payer negotiation, or clinical decision.
315
+ **All outputs are preliminary and for research orientation only.** Results require validation by a qualified health economist before use in any HTA submission, payer negotiation, regulatory filing, or clinical decision. This tool does not replace professional HEOR expertise.
316
+
317
+ ---
318
+
319
+ ## Links
320
+
321
+ - **npm:** https://www.npmjs.com/package/heor-agent-mcp
322
+ - **GitHub:** https://github.com/neptun2000/HEORAgent
323
+ - **Issues:** https://github.com/neptun2000/HEORAgent/issues
@@ -12,12 +12,21 @@ export interface ExclusionRecord {
12
12
  title: string;
13
13
  reason: string;
14
14
  }
15
+ export interface SourceSelectionRow {
16
+ source: string;
17
+ name: string;
18
+ category: string;
19
+ used: boolean;
20
+ reason: string;
21
+ }
15
22
  export interface AuditRecord {
16
23
  tool: string;
17
24
  /** ISO 8601 timestamp when the tool invocation began (query start time, not completion time) */
18
25
  timestamp: string;
19
26
  query: Record<string, unknown>;
20
27
  sources_queried: SourceAudit[];
28
+ /** Full source selection table showing all available sources with used/not-used and reason */
29
+ source_selection?: SourceSelectionRow[];
21
30
  methodology: string;
22
31
  /** Running total of results included across all sources — incremented by addSource() */
23
32
  inclusions: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/audit/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,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AC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,eAAe,EAAE,WAAW,EAAE,CAAC;IAC/B,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;IACnB,0LAA0L;IAC1L,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/formatters/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,KAAK,EAAE,WAAW,GACjB,MAAM,CA4BR;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAoC1D"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/formatters/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,KAAK,EAAE,WAAW,GACjB,MAAM,CA4BR;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAiD1D"}
@@ -25,6 +25,14 @@ export function auditToMarkdown(audit) {
25
25
  lines.push(`## Audit Report`);
26
26
  lines.push(`**Tool:** ${audit.tool} | **Time:** ${audit.timestamp} | **Methodology:** ${audit.methodology || "N/A"}`);
27
27
  lines.push(`**Total included:** ${audit.inclusions}`);
28
+ if (audit.source_selection && audit.source_selection.length > 0) {
29
+ lines.push(`\n### Source Selection (${audit.source_selection.filter((s) => s.used).length}/${audit.source_selection.length} sources used)`);
30
+ lines.push(`| Source | Category | Used | Reason |`);
31
+ lines.push(`|--------|----------|------|--------|`);
32
+ audit.source_selection.forEach((s) => {
33
+ lines.push(`| ${s.name} | ${s.category} | ${s.used ? "YES" : "NO"} | ${s.reason} |`);
34
+ });
35
+ }
28
36
  if (audit.sources_queried.length > 0) {
29
37
  lines.push(`\n### Sources Queried`);
30
38
  lines.push(`| Source | Query | Returned | Included | Status |`);
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/formatters/markdown.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,iBAAiB,CAC/B,OAA2B,EAC3B,KAAkB;IAElB,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC3C,KAAK,CAAC,IAAI,CACR,IAAI,OAAO,CAAC,MAAM,4BAA4B,KAAK,CAAC,eAAe,CAAC,MAAM,aAAa,CACxF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACvB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KA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;IAED,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -4,5 +4,6 @@ export * from "./rawStore.js";
4
4
  export * from "./search.js";
5
5
  export * from "./wikiStore.js";
6
6
  export * from "./projectStore.js";
7
+ export * from "./reportStore.js";
7
8
  export * from "./types.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
@@ -4,5 +4,6 @@ export * from "./rawStore.js";
4
4
  export * from "./search.js";
5
5
  export * from "./wikiStore.js";
6
6
  export * from "./projectStore.js";
7
+ export * from "./reportStore.js";
7
8
  export * from "./types.js";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
@@ -4,6 +4,7 @@ export declare function getRawLiteratureDir(projectId: string): string;
4
4
  export declare function getRawModelsDir(projectId: string): string;
5
5
  export declare function getRawDossiersDir(projectId: string): string;
6
6
  export declare function getWikiDir(projectId: string): string;
7
+ export declare function getReportsDir(projectId?: string): string;
7
8
  export declare function sanitizeProjectId(id: string): string;
8
9
  export declare function sanitizeFilename(name: string): string;
9
10
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/knowledge/paths.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAGD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAMpD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/knowledge/paths.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAKxD;AAGD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAUpD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -18,10 +18,19 @@ export function getRawDossiersDir(projectId) {
18
18
  export function getWikiDir(projectId) {
19
19
  return join(getProjectRoot(projectId), "wiki");
20
20
  }
21
+ export function getReportsDir(projectId) {
22
+ if (projectId) {
23
+ return join(getProjectRoot(projectId), "reports");
24
+ }
25
+ return join(getKbRoot(), "reports");
26
+ }
21
27
  // Sanitize project ID to prevent path traversal and filesystem issues
22
28
  export function sanitizeProjectId(id) {
23
29
  // Allow alphanumeric, hyphens, underscores. Replace all else with hyphen.
24
- const clean = id.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
30
+ const clean = id
31
+ .replace(/[^a-zA-Z0-9_-]/g, "-")
32
+ .replace(/-+/g, "-")
33
+ .replace(/^-|-$/g, "");
25
34
  if (clean.length === 0)
26
35
  throw new Error("Invalid project ID: must contain alphanumeric characters");
27
36
  if (clean.length > 64)
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/knowledge/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC1C,0EAA0E;IAC1E,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,OAAO,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DOCX report to disk.
3
+ *
4
+ * If `projectId` is provided, saves to `~/.heor-agent/projects/{id}/reports/`.
5
+ * Otherwise saves to `~/.heor-agent/reports/`.
6
+ *
7
+ * @returns Absolute path to the saved file
8
+ */
9
+ export declare function saveReport(base64: string, filenameStem: string, projectId?: string, extension?: string): Promise<string>;
10
+ //# sourceMappingURL=reportStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportStore.d.ts","sourceRoot":"","sources":["../../src/knowledge/reportStore.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,GAAE,MAAe,GACzB,OAAO,CAAC,MAAM,CAAC,CAkBjB"}
@@ -0,0 +1,27 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { getReportsDir, sanitizeFilename } from "./paths.js";
4
+ /**
5
+ * Save a base64-encoded DOCX report to disk.
6
+ *
7
+ * If `projectId` is provided, saves to `~/.heor-agent/projects/{id}/reports/`.
8
+ * Otherwise saves to `~/.heor-agent/reports/`.
9
+ *
10
+ * @returns Absolute path to the saved file
11
+ */
12
+ export async function saveReport(base64, filenameStem, projectId, extension = "docx") {
13
+ const dir = getReportsDir(projectId);
14
+ await mkdir(dir, { recursive: true });
15
+ const timestamp = new Date()
16
+ .toISOString()
17
+ .replace(/[:.]/g, "-")
18
+ .replace(/T/, "_")
19
+ .slice(0, 19);
20
+ const safeName = sanitizeFilename(filenameStem);
21
+ const filename = `${safeName}_${timestamp}.${extension}`;
22
+ const fullPath = join(dir, filename);
23
+ const buffer = Buffer.from(base64, "base64");
24
+ await writeFile(fullPath, buffer);
25
+ return fullPath;
26
+ }
27
+ //# sourceMappingURL=reportStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportStore.js","sourceRoot":"","sources":["../../src/knowledge/reportStore.ts"],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BAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAuGrE,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAMzD,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;CAK/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/direct/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,UAAU,EAGX,MAAM,aAAa,CAAC;AAgHrB,qBAAa,cAAe,YAAW,SAAS;IACxC,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IA8GrE,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAMzD,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;CAK/D"}