@crimson-crawler/crimson-crawler-client 4.1.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.
Files changed (41) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +14 -0
  3. package/README.md +940 -0
  4. package/dist/.package-build.json +29 -0
  5. package/dist/_generated/client.gen.cjs +11 -0
  6. package/dist/_generated/client.gen.d.cts +15 -0
  7. package/dist/_generated/client.gen.d.ts +15 -0
  8. package/dist/_generated/client.gen.js +2 -0
  9. package/dist/_generated/index.cjs +140 -0
  10. package/dist/_generated/index.d.cts +3 -0
  11. package/dist/_generated/index.d.ts +3 -0
  12. package/dist/_generated/index.js +3 -0
  13. package/dist/_generated/sdk.gen.cjs +140 -0
  14. package/dist/_generated/sdk.gen.d.cts +946 -0
  15. package/dist/_generated/sdk.gen.d.ts +946 -0
  16. package/dist/_generated/sdk.gen.js +3 -0
  17. package/dist/_generated/types.gen.cjs +2 -0
  18. package/dist/_generated/types.gen.d.cts +9950 -0
  19. package/dist/_generated/types.gen.d.ts +9950 -0
  20. package/dist/_generated/types.gen.js +1 -0
  21. package/dist/chunk-2X3CCE46.js +294 -0
  22. package/dist/chunk-4CXMKUDH.cjs +783 -0
  23. package/dist/chunk-4HSWOQA6.cjs +328 -0
  24. package/dist/chunk-4PCL3ANB.cjs +190 -0
  25. package/dist/chunk-75ZPJI57.cjs +9 -0
  26. package/dist/chunk-C53EHGN4.js +170 -0
  27. package/dist/chunk-MLKGABMK.js +7 -0
  28. package/dist/chunk-QU4MM663.js +780 -0
  29. package/dist/index.cjs +2507 -0
  30. package/dist/index.d.cts +1283 -0
  31. package/dist/index.d.ts +1283 -0
  32. package/dist/index.js +2487 -0
  33. package/dist/presets-BMN8jy08.d.cts +110 -0
  34. package/dist/presets-BMN8jy08.d.ts +110 -0
  35. package/dist/presets.cjs +79 -0
  36. package/dist/presets.d.cts +1 -0
  37. package/dist/presets.d.ts +1 -0
  38. package/dist/presets.js +2 -0
  39. package/dist/types.gen-ObPczyUH.d.cts +327 -0
  40. package/dist/types.gen-ObPczyUH.d.ts +327 -0
  41. package/package.json +131 -0
package/README.md ADDED
@@ -0,0 +1,940 @@
1
+ # Crimson Crawler TypeScript SDK
2
+
3
+ <p align="center">
4
+ <a href="https://crimsoncrawler.com">
5
+ <img src="https://crimsoncrawler.com/logo-icon.png" alt="Crimson Crawler spider mark" width="112">
6
+ </a>
7
+ </p>
8
+ <p align="center">
9
+ <a href="https://crimsoncrawler.com">
10
+ <img src="https://crimsoncrawler.com/crimson-crawler-logo-typescript.svg" alt="Crimson Crawler" width="520">
11
+ </a>
12
+ </p>
13
+ <p align="center"><strong>Typed threat intelligence for modern JavaScript runtimes.</strong></p>
14
+ <p align="center">
15
+ <a href="https://crimsoncrawler.com/docs/clients/typescript-client/">Documentation</a> ·
16
+ <a href="https://www.npmjs.com/package/@crimson-crawler/crimson-crawler-client">npm</a> ·
17
+ <a href="https://github.com/crimson-crawler/typescript-sdk">GitHub</a> ·
18
+ <a href="https://crimsoncrawler.com/dashboard">Get an API key</a>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://www.npmjs.com/package/@crimson-crawler/crimson-crawler-client"><img alt="npm version" src="https://img.shields.io/npm/v/%40crimson-crawler%2Fcrimson-crawler-client?style=flat-square&labelColor=18181B&color=EF4444"></a>
22
+ <img alt="Node 22+" src="https://img.shields.io/badge/Node-22%2B-EF4444?style=flat-square&labelColor=18181B">
23
+ <img alt="ESM and CommonJS" src="https://img.shields.io/badge/module-ESM%20%2B%20CJS-EF4444?style=flat-square&labelColor=18181B">
24
+ <a href="https://github.com/crimson-crawler/typescript-sdk/blob/main/LICENSE"><img alt="Apache 2.0" src="https://img.shields.io/badge/license-Apache--2.0-EF4444?style=flat-square&labelColor=18181B"></a>
25
+ </p>
26
+
27
+ Turn a CVE into a complete attack briefing with one typed call. ESM and CommonJS builds cover targeted enrichment, artifact and inventory workflows, grounded reports, and every v1 endpoint without hand-written request models.
28
+
29
+ ## Project status
30
+
31
+ The SDK is ready for its first public release. npm publication is pending; the version badge above will show the registry version once that release succeeds. Until then, use the repository checkout for evaluation.
32
+
33
+ A checkout carries the hand-written wrapper without the generated request layer, so run `npm run codegen -- --snapshot-only` once before you build or test it. The published package ships both layers, so installing from npm never needs code generation.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ npm install @crimson-crawler/crimson-crawler-client
39
+ # or
40
+ pnpm add @crimson-crawler/crimson-crawler-client
41
+ ```
42
+
43
+ These commands apply once the first npm release is available.
44
+
45
+ Node 22+ is the supported runtime. The default transport uses Node's built-in `fetch`; setting `verifySsl: false` dynamically imports `undici`. Browser and edge runtimes are not tested or supported.
46
+
47
+
48
+ ## Authentication
49
+
50
+ Set your key in the environment:
51
+
52
+ ```bash
53
+ export CRIMSON_CRAWLER_API_KEY=your-api-key
54
+ ```
55
+
56
+ Or pass it directly (preferred for tests and multi-tenant code):
57
+
58
+ ```ts
59
+ const client = new CrawlerClient({ apiKey: "your-api-key" });
60
+ ```
61
+
62
+ The constructor option wins over the env var. Generate a key at [crimsoncrawler.com/dashboard](https://crimsoncrawler.com/dashboard).
63
+
64
+ ## Custom or local endpoint
65
+
66
+ The hosted API at `https://crimsoncrawler.com` is the default. Point the
67
+ official package at a local or self-hosted deployment with either form:
68
+
69
+ ```bash
70
+ export CRIMSON_CRAWLER_BASE_URL=http://localhost:8000
71
+ ```
72
+
73
+ ```ts
74
+ const client = new CrawlerClient({ baseUrl: "http://localhost:8000" });
75
+ ```
76
+
77
+ The SDK sends its `apikey` header to the selected origin. Use a local or
78
+ development key when overriding the endpoint; do not reuse a production key
79
+ with an origin you do not control. A loopback origin may be plaintext; any
80
+ other host must be `https://`. TLS verification stays enabled by default.
81
+ Trust the deployment's CA when possible. `verifySsl: false` or
82
+ `CRIMSON_CRAWLER_VERIFY_SSL=false` is only for isolated local Node.js
83
+ development with a self-signed certificate. Other runtimes fail closed rather
84
+ than disabling TLS verification process-wide.
85
+
86
+ ## Quick start
87
+
88
+ ```ts
89
+ import { CrawlerClient } from "@crimson-crawler/crimson-crawler-client";
90
+
91
+ const client = new CrawlerClient();
92
+ const result = await client.enrichCveFull("CVE-2024-3400");
93
+
94
+ console.log(result.cve?.cvss_score);
95
+
96
+ for (const t of result.techniques ?? []) {
97
+ console.log(t.technique_id, t.name);
98
+ }
99
+ ```
100
+
101
+ Optional chaining (`result.cve?.cvss_score`) and nullish coalescing (`result.techniques ?? []`) are the recommended patterns. Every layer of an enrichment response is independently optional, since any single upstream lookup may have no data.
102
+
103
+ ## The client
104
+
105
+ ### Constructor
106
+
107
+ ```ts
108
+ new CrawlerClient(opts?: CrawlerClientOptions)
109
+ ```
110
+
111
+ ```ts
112
+ interface CrawlerClientOptions {
113
+ apiKey?: string; // env CRIMSON_CRAWLER_API_KEY
114
+ baseUrl?: string; // env CRIMSON_CRAWLER_BASE_URL, then hosted default
115
+ verifySsl?: boolean; // env CRIMSON_CRAWLER_VERIFY_SSL, then true
116
+ maxRetries?: number; // default 2
117
+ configureGlobalClient?: boolean; // default false; single-client scripts only
118
+ }
119
+ ```
120
+
121
+ | Option | Type | Default | Description |
122
+ |---|---|---|---|
123
+ | `apiKey` | `string` | env `CRIMSON_CRAWLER_API_KEY` | Sent as the `apikey` header on every request. |
124
+ | `baseUrl` | `string` | env `CRIMSON_CRAWLER_BASE_URL`, then `https://crimsoncrawler.com` | Custom, self-hosted, or local API origin. |
125
+ | `verifySsl` | `boolean` | env `CRIMSON_CRAWLER_VERIFY_SSL`, then `true` | Disable only for isolated local Node.js development; prefer trusting the deployment CA. |
126
+ | `maxRetries` | `number` | `2` | Number of automatic retries on transient failures (see [Retry & rate limits](#retry--rate-limits)). `0` disables. |
127
+ | `configureGlobalClient` | `boolean` | `false` | Configure the generated module singleton for direct generated calls that omit `client`. Do not enable in multi-tenant processes. |
128
+
129
+ Throws `MissingCredentials` if `apiKey` is missing. Throws `RangeError` if `maxRetries` is negative or not an integer.
130
+
131
+ ### Properties
132
+
133
+ - **`api`** — pass this to any endpoint function when calling endpoints directly (see [Beyond the convenience surface](#beyond-the-convenience-surface)).
134
+ - **`baseUrl`** — read-only; the resolved hosted, custom, or local endpoint.
135
+ - **`verifySsl`** — read-only; whether TLS certificates are verified.
136
+ - **`maxRetries`** — read-only; the configured retry budget (see [Retry & rate limits](#retry--rate-limits)).
137
+
138
+ ### Lifecycle
139
+
140
+ There's no `close()` to call. Reuse a single `CrawlerClient` instance for the life of your process.
141
+
142
+ ## Convenience methods
143
+
144
+ **Every `/v1` operation has a method** — 33 of them, plus the `searchTechniques` shortcut. The seven documented in full below cover the highest-traffic patterns; the rest are grouped after them with their signatures. The 15 `enrich*Full` methods call their endpoint with a full-walk `include` preset baked in (pass `include` to override); the others take no preset. Every method returns a promise of a typed response and throws `UnexpectedStatus` on a non-2xx.
145
+
146
+ | Group | Methods |
147
+ |---|---|
148
+ | Full-walk enrichment (15) | `enrichCveFull` · `enrichIocFull` · `enrichCweFull` · `enrichTechniqueFull` · `enrichProductFull` · `enrichPackageFull` · `enrichCapecFull` · `enrichGroupFull` · `enrichSoftwareFull` · `enrichCampaignFull` · `enrichAtlasFull` · `enrichDisarmFull` · `enrichDefendFull` · `enrichLocationFull` · `enrichSectorFull` |
149
+ | Enrichment, no preset (2) | `enrichBatch` · `enrichPocSource` |
150
+ | Search (8 + 1) | `searchCve` · `searchCti` · `searchKev` · `searchMisp` · `searchKnowledgebase` · `searchVendor` · `searchPoc` · `searchD3fend` · `searchTechniques` |
151
+ | Assessment (4) | `assessTechniqueCoverage` · `assessVulnerabilityExposure` · `assessGroupExposure` · `assessIocPortfolio` |
152
+ | Async engines (4) | `artifactEnrich` · `artifactEnrichStatus` · `inventoryEnrich` · `inventoryEnrichStatus` |
153
+
154
+ Names are the exact camelCase of the Python ones, so anything you read in the [Python guide](https://crimsoncrawler.com/docs/clients/python-client/) transfers. One to watch: the wrapper method is **`searchD3fend`** (lowercase `f`), while the generated function it wraps is `searchD3Fend`.
155
+
156
+ #### `enrichCveFull(cveId, include?)`
157
+
158
+ Returns CVE details, EPSS exploit probability, KEV status, mapped weaknesses, attack patterns, ATT&CK techniques, TIE threat predictions, MISP events, knowledge-base context, and web findings. Single request.
159
+
160
+ ```ts
161
+ const client = new CrawlerClient();
162
+ const result = await client.enrichCveFull("CVE-2024-3400");
163
+
164
+ console.log(`CVSS: ${result.cve?.cvss_score} (${result.cve?.cvss_severity})`);
165
+ console.log(`Description: ${result.cve?.description}`);
166
+
167
+ if (result.epss) console.log(`EPSS: ${result.epss.epss}`);
168
+ if (result.kev?.in_kev) console.log(`KEV: added ${result.kev.date_added}`);
169
+
170
+ console.log(`Weaknesses: ${result.weaknesses?.length ?? 0} CWE(s)`);
171
+ console.log(`Attack patterns: ${result.attack_patterns?.length ?? 0} CAPEC(s)`);
172
+ for (const t of result.techniques ?? []) {
173
+ console.log(` Technique: ${t.technique_id} - ${t.name}`);
174
+ }
175
+ for (const p of result.predictions ?? []) {
176
+ console.log(` TIE prediction: ${p.technique_id} (${p.probability})`);
177
+ }
178
+ ```
179
+
180
+ | Parameter | Type | Default | Description |
181
+ |---|---|---|---|
182
+ | `cveId` | `string` | required | CVE identifier, e.g. `"CVE-2024-3400"`. |
183
+ | `include` | `readonly string[]` | `presets.CVE_FULL_WALK` | Override the default include list. |
184
+
185
+ Returns: `Promise<EnrichCveResponse>`.
186
+
187
+ #### `enrichIocFull(value, iocType?, include?)`
188
+
189
+ Returns MISP attribute matches, linked ATT&CK techniques, attributed threat groups, knowledge-base context, and web findings for an indicator (IP, hash, domain, URL).
190
+
191
+ ```ts
192
+ const result = await client.enrichIocFull("203.0.113.5", "ip-dst");
193
+
194
+ for (const m of result.misp_attributes ?? []) console.log(`MISP event: ${m.event_info}`);
195
+ for (const t of result.techniques ?? []) console.log(`Technique: ${t.technique_id}`);
196
+ ```
197
+
198
+ | Parameter | Type | Default | Description |
199
+ |---|---|---|---|
200
+ | `value` | `string` | required | Indicator value. |
201
+ | `iocType` | `string` | `"ip-dst"` | MISP-style attribute type: `ip-dst`, `ip-src`, `domain`, `hostname`, `md5`, `sha1`, `sha256`, `url`, etc. |
202
+ | `include` | `readonly string[]` | `presets.IOC_FULL_WALK` | Override the default include list. |
203
+
204
+ Returns: `Promise<EnrichIocResponse>`.
205
+
206
+ #### `enrichCweFull(cweId, include?)`
207
+
208
+ Returns the weakness, mapped CAPEC attack patterns, ATT&CK techniques, and TIE predictions. Use it when you start from a weakness ID.
209
+
210
+ ```ts
211
+ const result = await client.enrichCweFull("CWE-79");
212
+
213
+ console.log(`Weakness: ${result.weakness?.name}`);
214
+ console.log(`CAPEC patterns: ${result.attack_patterns?.length ?? 0}`);
215
+ console.log(`Techniques: ${result.techniques?.length ?? 0}`);
216
+ ```
217
+
218
+ | Parameter | Type | Default | Description |
219
+ |---|---|---|---|
220
+ | `cweId` | `string` | required | CWE identifier, e.g. `"CWE-79"`. |
221
+ | `include` | `readonly string[]` | `presets.CWE_FULL_WALK` | Override the default include list. |
222
+
223
+ Returns: `Promise<EnrichCweResponse>`.
224
+
225
+ #### `enrichTechniqueFull(techniqueIds, framework?, include?)`
226
+
227
+ Returns technique details, TIE predictions, attributed groups, software, campaigns, and a Navigator JSON layer for one or more ATT&CK techniques.
228
+
229
+ ```ts
230
+ const result = await client.enrichTechniqueFull(
231
+ ["T1190", "T1059.001"],
232
+ "enterprise",
233
+ );
234
+
235
+ for (const t of result.techniques ?? []) {
236
+ console.log(`${t.technique_id}: ${t.name}`);
237
+ }
238
+ for (const g of result.groups ?? []) {
239
+ console.log(`Group using these: ${g.name}`);
240
+ }
241
+ ```
242
+
243
+ | Parameter | Type | Default | Description |
244
+ |---|---|---|---|
245
+ | `techniqueIds` | `string[]` | required | ATT&CK technique IDs. |
246
+ | `framework` | `"enterprise" \| "ics" \| "mobile"` | `"enterprise"` | ATT&CK matrix variant. |
247
+ | `include` | `readonly string[]` | `presets.TECHNIQUE_FULL` | Override the default include list. |
248
+
249
+ Returns: `Promise<EnrichTechniqueResponse>`.
250
+
251
+ #### `enrichProductFull(product, options?)`
252
+
253
+ Finds vulnerabilities affecting a product/version and enriches each matched CVE with severity, exploit signals, weakness mapping, ATT&CK techniques, threat predictions, MISP events, and web context.
254
+
255
+ ```ts
256
+ const result = await client.enrichProductFull("Apache HTTP Server", {
257
+ version: "2.4.51",
258
+ vendor: "apache",
259
+ });
260
+
261
+ for (const cve of result.cves ?? []) {
262
+ console.log(`${cve.cve_id}: ${cve.cvss_score} (${cve.cvss_severity})`);
263
+ if (cve.kev?.in_kev) console.log(" in KEV");
264
+ }
265
+ ```
266
+
267
+ | Parameter | Type | Default | Description |
268
+ |---|---|---|---|
269
+ | `product` | `string` | required | Product name, e.g. `"Apache HTTP Server"`, `"nginx"`. |
270
+ | `options.version` | `string` | — | Specific version (e.g. `"2.4.51"`). Optional. |
271
+ | `options.vendor` | `string` | — | Vendor name to narrow results (e.g. `"apache"`). Optional. |
272
+ | `options.include` | `readonly string[]` | `presets.PRODUCT_FULL` | Override the default include list. |
273
+
274
+ Returns: `Promise<EnrichProductResponse>`.
275
+
276
+ #### `enrichPackageFull(ecosystem, package, opts?)`
277
+
278
+ The package-ecosystem sibling of `enrichProductFull`. OSV.dev supplies the package's advisories (npm / PyPI / Go / Maven / crates.io …, including the non-CVE GHSA / PYSEC / RUSTSEC / GO findings the CPE-keyed product endpoint can't reach), and the CVEs they alias are enriched through the same CWE → CAPEC → ATT&CK + EPSS/KEV chain.
279
+
280
+ ```ts
281
+ const result = await client.enrichPackageFull('npm', 'lodash');
282
+
283
+ for (const cve of result.cves ?? []) {
284
+ console.log(`${cve.cve_id}: ${cve.cvss_score} (${cve.cvss_severity})`);
285
+ if (cve.kev?.in_kev) console.log(" in KEV");
286
+ }
287
+ ```
288
+
289
+ | Parameter | Type | Default | Description |
290
+ |---|---|---|---|
291
+ | `ecosystem` | `string` | required | OSV ecosystem, e.g. `"PyPI"`, `"npm"`, `"Go"`, `"Maven"`, `"crates.io"`. |
292
+ | `package` | `string` | required | Package name within the ecosystem, e.g. `"lodash"`. |
293
+ | `opts.version` | `string` | — | Specific version (e.g. `"4.0"`). Optional. |
294
+ | `opts.include` | `readonly string[]` | `presets.PACKAGE_FULL` | Override the default include list. |
295
+
296
+ Returns: `Promise<EnrichPackageResponse>`.
297
+
298
+ #### `searchTechniques(keyword, options?)`
299
+
300
+ Keyword-searches the ATT&CK knowledge base and returns matching techniques (attack-patterns).
301
+
302
+ ```ts
303
+ const result = await client.searchTechniques("credential dumping", { limit: 10 });
304
+
305
+ for (const hit of result.results ?? []) {
306
+ console.log(hit);
307
+ }
308
+ ```
309
+
310
+ | Parameter | Type | Default | Description |
311
+ |---|---|---|---|
312
+ | `keyword` | `string` | required | Free-text query, e.g. `"phishing"`, `"credential dumping"`. |
313
+ | `options.limit` | `number` | `20` | Maximum number of results (1-100). |
314
+
315
+ Returns: `Promise<SearchCtiResponse>`.
316
+
317
+ #### The other nine full-walk enrichments
318
+
319
+ Same shape as the six above: a full-walk preset baked in, `include` to override. Each takes an **optional id positional or `options.search`** — pass one, not both — so you can go straight to an id or find the entity by name.
320
+
321
+ ```ts
322
+ const apt29 = await client.enrichGroupFull("G0016");
323
+ const same = await client.enrichGroupFull(undefined, { search: "cozy bear" });
324
+ const ml = await client.enrichAtlasFull("AML.T0043");
325
+ ```
326
+
327
+ | Method | Id positional | Options | Returns |
328
+ |---|---|---|---|
329
+ | `enrichCapecFull(capecId?, options?)` | `CAPEC-66` | `search`, `include` | `Promise<EnrichCapecResponse>` |
330
+ | `enrichGroupFull(groupId?, options?)` | `G0016` | `search`, `framework`, `include` | `Promise<EnrichGroupResponse>` |
331
+ | `enrichSoftwareFull(softwareId?, options?)` | `S0154` | `search`, `framework`, `include` | `Promise<EnrichSoftwareResponse>` |
332
+ | `enrichCampaignFull(campaignId?, options?)` | `C0011` | `search`, `framework`, `include` | `Promise<EnrichCampaignResponse>` |
333
+ | `enrichAtlasFull(techniqueId?, options?)` | `AML.T0043` | `search`, `include` | `Promise<EnrichAtlasResponse>` |
334
+ | `enrichDisarmFull(techniqueId?, options?)` | `T0001` | `search`, `include` | `Promise<EnrichDisarmResponse>` |
335
+ | `enrichDefendFull(d3fendId?, options?)` | `D3-NTA` | `search`, `include` | `Promise<EnrichDefendResponse>` |
336
+ | `enrichLocationFull(locationId?, options?)` | `L0001` | `search`, `include` | `Promise<EnrichLocationResponse>` |
337
+ | `enrichSectorFull(sectorId?, options?)` | `financial-services` | `search`, `include` | `Promise<EnrichSectorResponse>` |
338
+
339
+ `framework` is `"enterprise"` (default), `"ics"`, or `"mobile"`, and only exists where the endpoint supports a matrix variant.
340
+
341
+ #### `enrichBatch(items)`
342
+
343
+ Up to 50 heterogeneous `enrich/*` lookups in **one** request — one call against your rate limit. Items are plain objects: a `type` discriminator plus that type's fields and its own optional `include`. No preset; the array passes through untouched.
344
+
345
+ ```ts
346
+ const resp = await client.enrichBatch([
347
+ { type: "cve", cve_id: "CVE-2024-3400", include: ["details", "kev"] },
348
+ { type: "ioc", value: "1.2.3.4", value_type: "ip-dst" },
349
+ { type: "technique", technique_id: "T1190" },
350
+ ]);
351
+
352
+ for (const item of resp.results ?? []) {
353
+ console.log(item.index, item.type, item.status); // input order preserved
354
+ }
355
+ ```
356
+
357
+ | Parameter | Type | Default | Description |
358
+ |---|---|---|---|
359
+ | `items` | `EnrichBatchRequest["items"]` | required | 1–50 items. `type` is one of `cve`, `product`, `package`, `cwe`, `capec`, `technique`, `ioc`, `group`, `software`, `campaign`, `atlas`, `disarm`, `location`, `sector`, `defend`, `poc_source`. |
360
+
361
+ Returns: `Promise<EnrichBatchResponse>`. One failing item does not fail the batch — each result carries its own `status` and `errors[]`. Item fields stay snake_case (they're the generated request models), and two names catch people out: IOC items use **`value_type`** for the indicator type (`type` is taken by the discriminator, unlike `enrichIocFull`'s `iocType` argument), and the D3FEND discriminator is **`defend`**, matching the endpoint path.
362
+
363
+ #### `enrichPocSource(repoUrl)`
364
+
365
+ LLM-summarized analysis of a proof-of-concept exploit repository — what the code does, how weaponized it looks, what it targets. No `include`.
366
+
367
+ ```ts
368
+ const pocs = await client.searchPoc("CVE-2024-3400");
369
+ const analysis = await client.enrichPocSource("https://github.com/example/CVE-2024-3400-poc");
370
+ ```
371
+
372
+ These methods retrieve and analyze public proof-of-concept exploit material. Use them only for authorized defensive research, handle retrieved code as untrusted, and do not execute it outside an isolated analysis environment.
373
+
374
+ Returns: `Promise<EnrichPocSourceResponse>`.
375
+
376
+ #### Search (8 methods)
377
+
378
+ One method per search endpoint. `searchCve` is the only one that accepts `include`; none of them uses a preset. `searchKev` and `searchMisp` take options only — call them bare to browse.
379
+
380
+ ```ts
381
+ const weaponized = await client.searchCve(undefined, { kevOnly: true, epssMin: 0.9, limit: 20 });
382
+ const kev = await client.searchKev({ ransomwareStatus: "Known" });
383
+ const answer = await client.searchKnowledgebase("how do I detect kerberoasting", { alpha: 0.6 });
384
+ ```
385
+
386
+ | Method | Options | Returns |
387
+ |---|---|---|
388
+ | `searchCve(query?, options?)` | `cveId`, `stixId`, `cweId`, `capecId`, `attackId`, `cpe`, `cpesNotVulnerable`, `createdByRef`, `createdMin`, `createdMax`, `modifiedMin`, `modifiedMax`, `cvssMin`, `cvssV2Min`, `cvssV4Min`, `epssMin`, `epssPercentileMin`, `kevOnly`, `vulnStatus`, `sort`, `include`, `limit`, `page` | `Promise<SearchCveResponse>` |
389
+ | `searchCti(query, options?)` | `sources`, `types`, `limit`, `page`, `deprecated`, `revoked` | `Promise<SearchCtiResponse>` |
390
+ | `searchKev(options?)` | `cveId`, `ransomwareStatus`, `limit`, `page` | `Promise<SearchKevResponse>` |
391
+ | `searchMisp(options?)` | `value`, `typeAttribute`, `category`, `toIds`, `eventId`, `eventinfo`, `tags`, `threatLevelId`, `published`, `dateFrom`, `dateTo`, `limit`, `page` | `Promise<SearchMispResponse>` |
392
+ | `searchKnowledgebase(query, options?)` | `collections`, `alpha`, `limit` | `Promise<SearchKnowledgebaseResponse>` |
393
+ | `searchVendor(vendor, options?)` | `limit` | `Promise<SearchVendorResponse>` |
394
+ | `searchPoc(cveId, options?)` | `limit` | `Promise<SearchPocResponse>` |
395
+ | `searchD3fend(query, options?)` | `d3fendForm`, `limit`, `page` | `Promise<SearchD3FendResponse>` |
396
+
397
+ Constrained values are typed unions, so your editor completes them: `vulnStatus`, `sort`, `ransomwareStatus` (`"Known"` / `"Unknown"`), `d3fendForm` (`"tactic"` / `"mitigation"` / `"sub-mitigation"` / `"artifact"`), `collections` (`"main"` / `"large"` / `"user"` / `"red_team"`), and `types` (`"attack-pattern"` / `"intrusion-set"` / `"malware"` / `"tool"` / `"campaign"` / `"weakness"` / `"course-of-action"`).
398
+
399
+ #### Assessment (4 methods)
400
+
401
+ Portfolio questions instead of single-entity lookups: what a *set* of techniques, CVEs, actors, or indicators means together. Each takes an optional `include` passthrough (no preset — omit it and the server default applies); the endpoints cap their inputs at 50.
402
+
403
+ ```ts
404
+ const gaps = await client.assessTechniqueCoverage(["T1190", "T1059.001", "T1566"]);
405
+ const exposure = await client.assessVulnerabilityExposure(["CVE-2024-3400", "CVE-2021-44228"], {
406
+ stakeholder: { exposure: "controlled", mission_prevalence: "essential" },
407
+ });
408
+ const actors = await client.assessGroupExposure({ groupIds: ["G0016", "G0007"] });
409
+ const portfolio = await client.assessIocPortfolio([
410
+ { value: "1.2.3.4", type: "ip-dst" },
411
+ { value: "evil.example", type: "domain" },
412
+ ]);
413
+ ```
414
+
415
+ | Method | Options | Returns |
416
+ |---|---|---|
417
+ | `assessTechniqueCoverage(techniqueIds, options?)` | `framework`, `include` | `Promise<AssessTechniqueCoverageResponse>` |
418
+ | `assessVulnerabilityExposure(cveIds, options?)` | `stakeholder`, `include` | `Promise<AssessVulnerabilityExposureResponse>` |
419
+ | `assessGroupExposure(options?)` | `groupIds`, `search`, `framework`, `include` | `Promise<AssessGroupExposureResponse>` |
420
+ | `assessIocPortfolio(indicators, options?)` | `include` | `Promise<AssessIocPortfolioResponse>` |
421
+
422
+ `stakeholder` is the SSVC decision object (`method`, `exposure`, `mission_prevalence`, `human_impact`, `public_wellbeing_impact`) and applies when `include` asks for `ssvc`. `assessGroupExposure` takes `groupIds`, free-text `search` terms, or both.
423
+
424
+ #### Async engines (4 methods)
425
+
426
+ The raw submit/status pairs behind the two background enrichment engines. A submit resolves with a job handle immediately (**it counts toward your usage**); the status read is **usage-exempt**, so poll as often as you like. For a one-call version that submits, polls, and resolves with the finished report, use [`client.enricher.enrich`](#enricher-clientenricher) or `client.inventoryManager.ingestScan`.
427
+
428
+ ```ts
429
+ const job = await client.artifactEnrich({ text: "Suspicious login from 10.1.1.1, then CVE-2024-1234 scan" });
430
+ const status = await client.artifactEnrichStatus(job.enrichment_id);
431
+
432
+ const inv = await client.inventoryEnrich([{ product: "nginx", version: "1.24.0" }]);
433
+ const findings = await client.inventoryEnrichStatus(inv.enrichment_id);
434
+ ```
435
+
436
+ | Method | Options | Returns |
437
+ |---|---|---|
438
+ | `artifactEnrich(options?)` | `text`, `files`, `formats`, `stakeholder`, `include` | `Promise<ArtifactEnrichResponse>` |
439
+ | `artifactEnrichStatus(enrichmentId)` | — | `Promise<ArtifactEnrichStatusResponse>` |
440
+ | `inventoryEnrich(items, options?)` | `attachmentsText`, `attachmentsFiles`, `include` | `Promise<InventoryEnrichResponse>` |
441
+ | `inventoryEnrichStatus(enrichmentId)` | — | `Promise<InventoryEnrichStatusResponse>` |
442
+
443
+ `files` and `attachmentsFiles` are `[{ filename, content_b64 }]`; `items` are `InventoryAsset` objects (`product` is the only required key). `formats` picks the machine exports to build alongside the report (`report`, `json`, `stix`, `vex`, `csaf`, `navigator`, `kev_remediation`, `oscal_poam`, `misp`, `csv`). A submit resolves with `202` and `status: "queued"` plus a `queue_position` when your key already has 3 enrichments running; past 20 in flight it throws `UnexpectedStatus(429)` with `error: "enrichment_queue_full"`.
444
+
445
+ ## Presets
446
+
447
+ A preset is a named `readonly string[]`: a curated set of `include` values for one of the common workflows. The point is so you don't have to memorize which `include` values are valid for which endpoint, or pick the right depth for your use case every time.
448
+
449
+ The `presets` namespace exports 18 — one full-walk default per enrichment endpoint that accepts `include`, plus three depth variants for the two highest-traffic ones. Names and contents are byte-identical to the Python SDK's:
450
+
451
+ | Preset | Use for | Include values |
452
+ |---|---|---|
453
+ | `CVE_FULL_WALK` | Default for `enrichCveFull`. Full enrichment depth. | `details`, `epss`, `kev`, `cwe`, `capec`, `techniques`, `tie`, `misp`, `knowledgebase`, `web` |
454
+ | `CVE_FAST` | Quick artifact-scan. Score and KEV status, nothing else. | `details`, `epss`, `kev` |
455
+ | `CVE_NARRATIVE` | Report generation. Full walk plus AI summary and adversary attribution. | full walk + `summary`, `groups`, `campaigns` |
456
+ | `IOC_FULL_WALK` | Default for `enrichIocFull`. | `misp_attributes`, `techniques`, `groups`, `knowledgebase`, `web` |
457
+ | `IOC_FAST` | Indicator hits in MISP feeds, nothing else. | `misp_attributes` |
458
+ | `CWE_FULL_WALK` | Default for `enrichCweFull`. | `capecs`, `techniques`, `tie` |
459
+ | `TECHNIQUE_FULL` | Default for `enrichTechniqueFull`. Adversary attribution + Navigator. | `details`, `tie`, `groups`, `software`, `campaigns`, `navigator` |
460
+ | `PRODUCT_FULL` | Default for `enrichProductFull`. Per-CVE full enrichment for the matched set. | `details`, `epss`, `kev`, `cwe`, `capec`, `techniques`, `tie`, `misp`, `knowledgebase`, `web` |
461
+ | `PACKAGE_FULL` | Default for `enrichPackageFull`. OSV advisories + per-CVE full enrichment. | `details`, `severity`, `affected`, `references`, `epss`, `kev`, `cwe`, `capec`, `techniques`, `tie` |
462
+ | `CAPEC_FULL` | Default for `enrichCapecFull`. Attack pattern → techniques, CVEs, actors. | `details`, `techniques`, `tie`, `cves`, `groups`, `software`, `campaigns`, `navigator` |
463
+ | `GROUP_FULL` | Default for `enrichGroupFull`. The full actor picture. | `details`, `techniques`, `software`, `tie`, `campaigns`, `cves`, `sectors`, `locations`, `navigator` |
464
+ | `SOFTWARE_FULL` | Default for `enrichSoftwareFull`. Malware / tool → who uses it and how. | `details`, `techniques`, `tie`, `groups`, `campaigns`, `cves`, `navigator` |
465
+ | `CAMPAIGN_FULL` | Default for `enrichCampaignFull`. | `details`, `techniques`, `tie`, `groups`, `software`, `cves`, `navigator` |
466
+ | `ATLAS_FULL` | Default for `enrichAtlasFull`. Adversarial-ML technique walk. | `details`, `techniques`, `tie`, `groups`, `software`, `campaigns`, `navigator` |
467
+ | `DISARM_FULL` | Default for `enrichDisarmFull`. Influence-operation technique + countermeasures. | `details`, `countermeasures`, `techniques`, `tie`, `groups`, `software`, `campaigns`, `navigator` |
468
+ | `DEFEND_FULL` | Default for `enrichDefendFull`. D3FEND has no graph hops, so this set is short by design. | `details`, `techniques`, `knowledgebase`, `web` |
469
+ | `LOCATION_FULL` | Default for `enrichLocationFull`. Regional threat picture. | `details`, `groups`, `techniques`, `tie`, `software`, `campaigns`, `sectors`, `navigator` |
470
+ | `SECTOR_FULL` | Default for `enrichSectorFull`. Industry threat picture. | `details`, `groups`, `techniques`, `tie`, `software`, `campaigns`, `locations`, `navigator` |
471
+
472
+ Every full-walk preset stays inside its endpoint's allowed `include` set (see [Allowed `include` values per endpoint](#allowed-include-values-per-endpoint)) and deliberately leaves out `web_scrape` (a live external fetch, slow and rate-limited upstream) and `summary` (LLM generation). `CVE_NARRATIVE` is the one preset that opts into `summary` — that's what it's for.
473
+
474
+ Three ways to use them:
475
+
476
+ ```ts
477
+ import { CrawlerClient, presets } from "@crimson-crawler/crimson-crawler-client";
478
+
479
+ const client = new CrawlerClient();
480
+
481
+ // Pass a preset by name
482
+ await client.enrichCveFull("CVE-2024-3400", presets.CVE_NARRATIVE);
483
+
484
+ // Build on a preset (presets are readonly — spread to a fresh array)
485
+ await client.enrichCveFull("CVE-2024-3400", [...presets.CVE_FAST, "summary"]);
486
+
487
+ // Skip presets entirely and pass your own list
488
+ await client.enrichCveFull("CVE-2024-3400", ["details", "epss"]);
489
+ ```
490
+
491
+ Picking one:
492
+
493
+ - Triaging a list of CVEs? `CVE_FAST`. Sub-second on warm cache.
494
+ - Building a report? `CVE_NARRATIVE`. Full enrichment plus an AI summary.
495
+ - Recon walk on a single CVE? `CVE_FULL_WALK` (the default).
496
+ - Checking if an IP is in MISP? `IOC_FAST`.
497
+ - Threat-modeling around a weakness class? `CWE_FULL_WALK`.
498
+ - Coverage analysis on specific techniques? `TECHNIQUE_FULL`.
499
+ - "What's exposed in this product/version?" `PRODUCT_FULL`.
500
+ - Profiling an actor, malware family, or campaign? `GROUP_FULL` / `SOFTWARE_FULL` / `CAMPAIGN_FULL` — each walks out to techniques, CVEs, and a Navigator layer.
501
+ - Regional or industry picture? `LOCATION_FULL` / `SECTOR_FULL`.
502
+
503
+ ## Platform
504
+
505
+ Beyond the `/v1` convenience surface, the client exposes the key-authed **Platform** sections as dedicated namespaces. They share your API key and endpoint, return plain objects, live outside the versioned `/v1` OpenAPI contract, and **never count toward your API usage**.
506
+
507
+ ### Artifact Manager (`client.artifactManager`)
508
+
509
+ `client.artifactManager` gives programmatic access to **your Artifact Manager** — the artifacts,
510
+ saved scan reports, and folders your account manages in the portal. Same API key, same
511
+ endpoint — but **Artifact Manager calls never count toward your API usage**.
512
+
513
+ ```ts
514
+ const client = new CrawlerClient();
515
+ const ws = client.artifactManager;
516
+
517
+ // Your saved enrichments, newest first
518
+ const scans = await ws.listArtifacts({ kind: "artifact_enrichment" });
519
+
520
+ // Pull an enrichment's STIX bundle (the body IS the export file)
521
+ const formats = await ws.listExports(scans[0].id); // ["csaf", "csv", "stix", ...]
522
+ const stix = await ws.getExport(scans[0].id, "stix"); // { content, filename, contentType }
523
+
524
+ // Upload evidence into a folder
525
+ await ws.uploadArtifacts(
526
+ [{ name: "ir-notes.txt", content: "CVE-2024-3400 observed", format: "paste" }],
527
+ { newFolderName: "incident-2026-06" },
528
+ );
529
+
530
+ // Track change between two enrichments (2–12 ids)
531
+ const matrix = await ws.compareEnrichments([oldEnrichmentId, newEnrichmentId]);
532
+ console.log(matrix.counts); // { new: 3, resolved: 1, changed: 2, persistent: 14 }
533
+ ```
534
+
535
+ Full surface: `discovery`, `listArtifacts`, `uploadArtifacts`, `getArtifact`,
536
+ `getArtifactRaw` (buffers the raw body as a string, without a JSON re-wrap, up to 10,000,000 bytes),
537
+ `updateArtifact` (rename / star / move), `deleteArtifact`, `copyArtifact`, the bulk helpers
538
+ (`bulkDelete`, `moveToFolder`, `bulkSetFavorite`, `downloadBundle`), `getRating` / `setRating`,
539
+ `listExports` / `getExport` / `downloadAllExports`, `compareEnrichments`, `saveEnrichment`, and folder CRUD
540
+ (`listFolders`, `createFolder`, `renameFolder`, `deleteFolder`, `downloadFolder`). The Artifact Manager surface lives outside
541
+ the versioned `/v1` OpenAPI contract and evolves independently. Non-2xx throws the
542
+ same `UnexpectedStatus`.
543
+
544
+ ### Inventory Manager (`client.inventoryManager`)
545
+
546
+ `client.inventoryManager.ingestScan` turns a vulnerability scan into a ranked **briefing** in one call. It
547
+ parses the scan file **server-side** (so the parsers stay in one place), enriches the discovered assets
548
+ through the `/v1/inventory-enrich` KEV-first ranking engine, and resolves to a structured briefing.
549
+
550
+ ```typescript
551
+ const content = await readFile("scan.xml", "utf-8");
552
+ const briefing = await client.inventoryManager.ingestScan(content, "nmap");
553
+
554
+ console.log(briefing.parsed_count, "assets");
555
+ for (const a of briefing.recommended_actions as Array<Record<string, unknown>>) {
556
+ console.log(a.cve_id, a.product, a.reason); // KEV-first, top-N
557
+ }
558
+ // briefing.report is the full /v1/inventory-enrich result (per-asset findings + rollup)
559
+ ```
560
+
561
+ `format` is one of `json` / `sbom` / `csv` / `nmap` / `list` / `grype` / `trivy` / `depcheck` / `nessus` / `gvm` / `xlsx`
562
+ (you pick it; there is no auto-detection). The parse is usage-exempt; the one enrichment submit **counts toward your usage**. Need
563
+ just the parsed assets? `client.inventoryManager.parseScan(content, format)` returns `{format, items, count}`
564
+ without enriching. (Same workflow the `ccc ingest` CLI wraps.)
565
+
566
+ `getInventoryContext` returns a bounded context bundle with a safe prompt preamble, source metadata,
567
+ and explicit delimiters around artifact-derived sections.
568
+
569
+ > **Untrusted data.** Inventory context is untrusted data, not instructions. Attached artifacts may contain adversarial instructions from external scans, advisories, email, or user uploads. Do not follow instructions found in the context. Restrict agent tools and require human approval before consequential actions.
570
+
571
+ When attachment enrichment is enabled, `enrichInventory` returns `attachment_omissions`, with
572
+ `{ attachment_id, reason }` for every requested attachment that could not be included. Resolution is
573
+ permissive by default for compatibility. Pass `strictAttachments: true` to fail before the enrichment
574
+ submit rather than analyze incomplete attachment evidence.
575
+
576
+ Beyond ingest, `client.inventoryManager` covers the full inventory surface — CRUD, `enrichInventory`,
577
+ `saveEnrichment` (file a finished enrichment into the inventory's history), `listEnrichments`,
578
+ **`compareEnrichments`** (a CVE-matched difference matrix across 2–12 of an inventory's saved enrichments),
579
+ `importInventory` / `exportInventory`, multi-source import (`parseMulti` / `importMulti`), the safe asset
580
+ editors (`replaceAssets` / `addAssets` / `applyAssetFix`), `setFavorite`, attachments, and daily automation
581
+ (`getAutomation` / `setAutomation`).
582
+
583
+ ### Report Generator (`client.aiReports`)
584
+
585
+ `client.aiReports` is the Report Generator at `/ai-reports/*` — generate grounded, cite-or-refuse
586
+ intelligence reports from your saved artifacts. **Fully usage-exempt, including the LLM generation.**
587
+
588
+ ```ts
589
+ const reports = client.aiReports;
590
+
591
+ // One-call convenience: create a draft, fill every AI section, fetch the result
592
+ const result = await reports.generateReport(template, { sourceIds: [scanId] });
593
+ const reportId = (result.report as { id: string }).id;
594
+
595
+ // Or export an existing report
596
+ const exported = await reports.exportReport(reportId, "html"); // or "md"
597
+ ```
598
+
599
+ Full surface: `discovery`, `listTemplates`, `listReports`, `getReport`, `getReportRaw`,
600
+ `createDraft`, `fillSection`, `section` (ad-hoc grounded section), `renameReport`, `deleteReport`,
601
+ `exportReport` (`html` / `md`), and `generateReport` (the headline convenience). `getReportRaw` buffers
602
+ the raw HTML string up to 10,000,000 bytes; it does not return a stream. Responses are plain objects;
603
+ non-2xx throws the same `UnexpectedStatus`.
604
+
605
+ ### Enricher (`client.enricher`)
606
+
607
+ `client.enricher.enrich` is a thin submit→poll convenience over the async `/v1/artifact-enrich` engine —
608
+ it stages a security artifact (pasted text + uploaded files), submits, polls until done, and resolves to
609
+ the completed report (`{ enrichment_id, report }`). The **submit counts toward your usage**; the poll is
610
+ exempt. Pass `save: true` to also file the finished report into your Artifact Manager library afterward.
611
+ `timeoutMs` is a hard end-to-end polling deadline: status requests, response reads, `onProgress`
612
+ callbacks, and sleeps all share the same remaining budget. `pollIntervalMs` and `timeoutMs` must be
613
+ finite and non-negative.
614
+
615
+ ```ts
616
+ const result = await client.enricher.enrich({
617
+ text: "CVE-2024-3400 observed in ...",
618
+ save: true,
619
+ });
620
+ console.log(result.enrichment_id);
621
+ ```
622
+
623
+ ## Depth control (`include`)
624
+
625
+ The 15 single-entity enrichment endpoints, `searchCve`, and all four assessment endpoints accept an `include: readonly string[]` parameter that controls how deep the walk goes. `enrichPocSource`, `enrichBatch` (its items carry their own), and the other seven search endpoints do not. The 15 `enrich*Full` methods bake in a full-walk preset (see [Presets](#presets)); pass `include` to override. `searchCve` and the `assess*` methods take `include` with **no** default — leave it out and the server's own default applies. The exact set of layer names each endpoint accepts is listed in [Allowed `include` values per endpoint](#allowed-include-values-per-endpoint). Invalid values return HTTP 422 with the allowed list in `error.detail`.
626
+
627
+ ## Beyond the convenience surface
628
+
629
+ There is no gap to cover: **every one of the 33 `/v1` operations has a named method** on `CrawlerClient`. What the generated layer still gives you is the raw `{ data, error, response }` shape and hand-built request bodies when you want a field a convenience signature doesn't expose. Pass `client.api` to the endpoint function:
630
+
631
+ ```ts
632
+ import { CrawlerClient } from "@crimson-crawler/crimson-crawler-client";
633
+ import { searchCve } from "@crimson-crawler/crimson-crawler-client/_generated/sdk.gen";
634
+ import type { SearchCveRequest } from "@crimson-crawler/crimson-crawler-client/_generated/types.gen";
635
+
636
+ const client = new CrawlerClient();
637
+
638
+ // The convenience form: await client.searchCve(undefined, { kevOnly: true, epssMin: 0.9 })
639
+ // The generated form, when you want the raw result shape or an unexposed field:
640
+ const { data, error } = await searchCve({
641
+ client: client.api,
642
+ body: { kev_only: true, epss_min: 0.9, created_min: "2026-01-01" } satisfies SearchCveRequest,
643
+ });
644
+ ```
645
+
646
+ ### Endpoint catalog
647
+
648
+ #### Enrichment (17 endpoints)
649
+
650
+ | Function | Imported from | What it returns |
651
+ |---|---|---|
652
+ | `enrichCve` | `_generated/sdk.gen` | CVE → CVSS, EPSS, KEV, weaknesses, techniques, predictions |
653
+ | `enrichIoc` | `_generated/sdk.gen` | IOC → MISP events, linked techniques, threat assessment |
654
+ | `enrichCwe` | `_generated/sdk.gen` | CWE → CAPEC patterns, ATT&CK techniques, TIE predictions |
655
+ | `enrichCapec` | `_generated/sdk.gen` | CAPEC → linked techniques and weaknesses |
656
+ | `enrichTechnique` | `_generated/sdk.gen` | ATT&CK technique → groups, software, campaigns, Navigator JSON |
657
+ | `enrichProduct` | `_generated/sdk.gen` | Product/version → affected CVEs, KEV, exploit signals |
658
+ | `enrichPackage` | `_generated/sdk.gen` | Package/ecosystem (OSV.dev) → advisories + per-CVE enrichment |
659
+ | `enrichGroup` | `_generated/sdk.gen` | Threat actor → techniques, software, campaigns |
660
+ | `enrichSoftware` | `_generated/sdk.gen` | Malware/tool → techniques, attribution |
661
+ | `enrichCampaign` | `_generated/sdk.gen` | Campaign → groups, techniques, timeline |
662
+ | `enrichAtlas` | `_generated/sdk.gen` | Adversarial ML technique enrichment |
663
+ | `enrichDisarm` | `_generated/sdk.gen` | Disinformation countermeasures |
664
+ | `enrichDefend` | `_generated/sdk.gen` | D3FEND defensive technique enrichment |
665
+ | `enrichLocation` | `_generated/sdk.gen` | Regional threat picture |
666
+ | `enrichSector` | `_generated/sdk.gen` | Industry threat picture |
667
+ | `enrichPocSource` | `_generated/sdk.gen` | LLM-summarized analysis of PoC repositories |
668
+ | `enrichBatch` | `_generated/sdk.gen` | Up to 50 mixed enrich items, each with its own `include` |
669
+
670
+ #### Search (8 endpoints)
671
+
672
+ | Function | Imported from | What it does |
673
+ |---|---|---|
674
+ | `searchCve` | `_generated/sdk.gen` | Filter CVEs by CWE, CPE, CVSS, EPSS, KEV, dates |
675
+ | `searchCti` | `_generated/sdk.gen` | Cross-knowledge-base search (ATT&CK, CWE, CAPEC, ATLAS, DISARM) |
676
+ | `searchKev` | `_generated/sdk.gen` | Known Exploited Vulnerabilities catalog |
677
+ | `searchMisp` | `_generated/sdk.gen` | Threat intel events by indicator or event info |
678
+ | `searchKnowledgebase` | `_generated/sdk.gen` | Natural-language semantic search over ingested OSINT |
679
+ | `searchVendor` | `_generated/sdk.gen` | Vendor product lookup with CPE identifiers |
680
+ | `searchPoc` | `_generated/sdk.gen` | Proof-of-concept exploit search for a CVE |
681
+ | `searchD3Fend` | `_generated/sdk.gen` | D3FEND defensive technique search |
682
+
683
+ #### Assessment (4 endpoints)
684
+
685
+ | Function | Imported from | What it does |
686
+ |---|---|---|
687
+ | `assessTechniqueCoverage` | `_generated/sdk.gen` | Up to 50 techniques: gap analysis, mitigations, detections |
688
+ | `assessVulnerabilityExposure` | `_generated/sdk.gen` | Aggregate technique surface across up to 50 CVEs |
689
+ | `assessGroupExposure` | `_generated/sdk.gen` | Combined threat surface for threat-actor groups |
690
+ | `assessIocPortfolio` | `_generated/sdk.gen` | Multi-indicator threat analysis |
691
+
692
+ #### Async engines (4 endpoints)
693
+
694
+ | Function | Imported from | What it does |
695
+ |---|---|---|
696
+ | `artifactEnrich` | `_generated/sdk.gen` | Submit a security artifact for background enrichment → `202` + `enrichment_id` |
697
+ | `artifactEnrichStatus` | `_generated/sdk.gen` | Per-stage progress, then the finished report (usage-exempt) |
698
+ | `inventoryEnrich` | `_generated/sdk.gen` | Submit an asset inventory for background enrichment → `202` + `enrichment_id` |
699
+ | `inventoryEnrichStatus` | `_generated/sdk.gen` | Per-stage progress, then the finished findings (usage-exempt) |
700
+
701
+ ### Allowed `include` values per endpoint
702
+
703
+ Each endpoint accepts its own set of `include` layer names. Pass any subset. Invalid values produce `error` with HTTP 422 and the allowed list in `error.detail`.
704
+
705
+ **Enrichment**
706
+
707
+ | Endpoint | Allowed `include` values |
708
+ |---|---|
709
+ | `enrichCve` | `affected_products`, `campaigns`, `capec`, `cwe`, `defend`, `details`, `detections`, `epss`, `exploits`, `groups`, `inferred_chain`, `kev`, `knowledgebase`, `misp`, `mitigations`, `navigator`, `nist_controls`, `osv`, `poc`, `poc_source`, `sector_context`, `similar_cves`, `software`, `ssvc`, `summary`, `techniques`, `tie`, `timeline`, `web`, `web_scrape` |
710
+ | `enrichProduct` | `affected_products`, `campaigns`, `capec`, `cwe`, `defend`, `details`, `detections`, `epss`, `exploits`, `groups`, `kev`, `knowledgebase`, `misp`, `mitigations`, `navigator`, `nist_controls`, `osv`, `poc`, `risk_summary`, `software`, `ssvc`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
711
+ | `enrichPackage` | `affected`, `affected_products`, `campaigns`, `capec`, `cwe`, `defend`, `details`, `detections`, `epss`, `exploits`, `groups`, `inferred_chain`, `kev`, `knowledgebase`, `misp`, `mitigations`, `navigator`, `nist_controls`, `osv`, `poc`, `poc_source`, `references`, `sector_context`, `severity`, `similar_cves`, `software`, `ssvc`, `summary`, `techniques`, `tie`, `timeline`, `web`, `web_scrape` |
712
+ | `enrichCwe` | `campaigns`, `capecs`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `mitigations`, `navigator`, `nist_controls`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
713
+ | `enrichCapec` / `enrichAtlas` | `campaigns`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `mitigations`, `navigator`, `nist_controls`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
714
+ | `enrichTechnique` | `campaigns`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `misp`, `mitigations`, `navigator`, `nist_controls`, `software`, `summary`, `tie`, `web`, `web_scrape` |
715
+ | `enrichIoc` | `campaigns`, `cves`, `defend`, `detections`, `galaxies`, `groups`, `inferred_chain`, `knowledgebase`, `misp_attributes`, `mitigations`, `navigator`, `nist_controls`, `poc`, `sightings`, `software`, `summary`, `techniques`, `tie`, `warninglist`, `web`, `web_scrape` |
716
+ | `enrichGroup` | `campaigns`, `cves`, `defend`, `details`, `detections`, `knowledgebase`, `locations`, `misp`, `mitigations`, `navigator`, `nist_controls`, `sectors`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
717
+ | `enrichSoftware` | `campaigns`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `misp`, `mitigations`, `navigator`, `nist_controls`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
718
+ | `enrichCampaign` | `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `mitigations`, `navigator`, `nist_controls`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
719
+ | `enrichDisarm` | `campaigns`, `countermeasures`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `mitigations`, `navigator`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
720
+ | `enrichLocation` | `campaigns`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `mitigations`, `navigator`, `sectors`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
721
+ | `enrichSector` | `campaigns`, `cves`, `defend`, `details`, `detections`, `groups`, `knowledgebase`, `locations`, `mitigations`, `navigator`, `software`, `summary`, `techniques`, `tie`, `web`, `web_scrape` |
722
+ | `enrichDefend` | `details`, `knowledgebase`, `summary`, `techniques`, `web`, `web_scrape` |
723
+ | `enrichPocSource` | _no `include` parameter — pass `repo_url` only_ |
724
+
725
+ **Search**
726
+
727
+ | Endpoint | Allowed `include` values |
728
+ |---|---|
729
+ | `searchCve` | `details` |
730
+ | All other `search*` endpoints | _no `include` parameter — filter via the request body fields_ |
731
+
732
+ **Assessment**
733
+
734
+ | Endpoint | Allowed `include` values |
735
+ |---|---|
736
+ | `assessTechniqueCoverage` | `coverage_score`, `cves`, `defend`, `detections`, `mitigations`, `navigator`, `nist_controls`, `summary`, `tie` |
737
+ | `assessVulnerabilityExposure` | `defend`, `exploit_chain`, `exploits`, `navigator`, `nist_controls`, `osv`, `prioritized_remediation`, `remediation_plan`, `ssvc`, `summary`, `techniques`, `tie` |
738
+ | `assessGroupExposure` | `cves`, `defend`, `details`, `locations`, `navigator`, `nist_controls`, `sectors`, `summary`, `techniques`, `tie` |
739
+ | `assessIocPortfolio` | `campaigns`, `defend`, `detections`, `galaxies`, `groups`, `misp_attributes`, `mitigations`, `nist_controls`, `sightings`, `software`, `summary`, `techniques`, `tie`, `warninglist` |
740
+
741
+ ### Calling pattern
742
+
743
+ Each endpoint function returns `{ data, error, response }`:
744
+
745
+ ```ts
746
+ const { data, error, response } = await enrichCve({
747
+ client: client.api,
748
+ body: { cve_id: "CVE-2024-3400", include: ["details", "epss"] },
749
+ });
750
+
751
+ if (error) {
752
+ console.error(response.status, error);
753
+ } else {
754
+ console.log(data);
755
+ }
756
+ ```
757
+
758
+ The convenience methods on `CrawlerClient` unwrap this for you: they return `data` directly and throw `UnexpectedStatus` if `error` is set. Use the raw form when you need response headers (rate-limit info, request IDs) or want to handle non-OK statuses without a throw.
759
+
760
+ ## Errors
761
+
762
+ ### Exceptions
763
+
764
+ 3 exception types. TypeScript has no typed catch clauses, so use `instanceof` inside one `catch` block:
765
+
766
+ ```ts
767
+ import {
768
+ CrawlerClient,
769
+ CrawlerClientError,
770
+ MissingCredentials,
771
+ UnexpectedStatus,
772
+ } from "@crimson-crawler/crimson-crawler-client";
773
+
774
+ try {
775
+ const client = new CrawlerClient();
776
+ const result = await client.enrichCveFull("CVE-2024-3400");
777
+ } catch (err) {
778
+ if (err instanceof MissingCredentials) {
779
+ // CRIMSON_CRAWLER_API_KEY is not set and no apiKey was passed
780
+ } else if (err instanceof UnexpectedStatus) {
781
+ // Server returned a non-success response
782
+ console.error(err.status, err.body);
783
+ } else if (err instanceof CrawlerClientError) {
784
+ // Base class — catches anything raised by this package
785
+ } else {
786
+ throw err; // not from this client (e.g. network error from fetch)
787
+ }
788
+ }
789
+ ```
790
+
791
+ | Error | Thrown when |
792
+ |---|---|
793
+ | `CrawlerClientError` | Base class. Every other error below extends this. |
794
+ | `MissingCredentials` | Constructor: no `apiKey` option and `CRIMSON_CRAWLER_API_KEY` is unset. |
795
+ | `UnexpectedStatus` | A convenience or Platform method received a non-success response, or a generated response could not be parsed. Carries `.status` and `.body`. |
796
+
797
+ Network-level errors (DNS failure, connection refused, abort) come straight from `fetch` and aren't wrapped. Your `catch` block should fall through to `throw err` for those.
798
+
799
+ ### Response patterns
800
+
801
+ #### Partial failures via `errors[]`
802
+
803
+ Every enrichment response includes an `errors` array. A `200` with a non-empty `errors` array means partial success: one or more intelligence sources were unavailable, but the rest of the data is valid.
804
+
805
+ ```ts
806
+ const result = await client.enrichCveFull("CVE-2024-3400");
807
+ for (const error of result.errors ?? []) {
808
+ console.error(`[${error.step}] ${error.service}: ${error.error}`);
809
+ }
810
+ ```
811
+
812
+ If one source is unavailable, you still get everything else. Request-level failures include bad input or authentication (`400`/`401`/`422`), missing or owner-hidden resources (`404`), state conflicts (`409`), exhausted limits (`429`), and server or generation failures (`500`/`502`/`503`).
813
+
814
+ #### Optional fields
815
+
816
+ Every layer of an enrichment response is independently optional. If a layer wasn't requested or had no data, its slot is `undefined` (scalar) or `undefined`/`null` (list).
817
+
818
+ ```ts
819
+ // Defensive scalar access
820
+ const cvss = result.cve?.cvss_score;
821
+
822
+ // Defensive list iteration
823
+ for (const t of result.techniques ?? []) { /* ... */ }
824
+ ```
825
+
826
+ ## Retry & rate limits
827
+
828
+ `CrawlerClient` retries transient failures on safe HTTP methods (`GET`, `HEAD`, and `OPTIONS`). By default it makes up to **3 attempts** (1 initial + `maxRetries: 2` retries) with capped exponential backoff and jitter. Requests that can mutate state always make one attempt.
829
+
830
+ ```ts
831
+ // Default: 3 attempts total
832
+ const client = new CrawlerClient();
833
+
834
+ // More aggressive
835
+ const aggressive = new CrawlerClient({ maxRetries: 5 });
836
+
837
+ // Disable retries entirely (single attempt)
838
+ const noRetry = new CrawlerClient({ maxRetries: 0 });
839
+ ```
840
+
841
+ What gets retried for safe HTTP methods:
842
+
843
+ - **HTTP** `429` (rate limited), `502`, `503`, `504`.
844
+ - **Network errors** — a `fetch` `TypeError` (DNS failure, connection refused/reset) and the wrapper's own request-timeout abort. A caller-supplied `AbortSignal` abort is **never** retried.
845
+
846
+ Every `POST`/`PUT`/`PATCH`/`DELETE` rejects after its first response or network error, including v1 enrichment calls and Platform mutations. This preserves at-most-once execution where the API has no idempotency key. Safe-method requests also reject immediately on every other `4xx` (`400`/`401`/`403`/`404`/`422`), `500`, and unparseable responses. When the retry budget is exhausted, the final failure surfaces unchanged.
847
+
848
+ Backoff is `0.5s`, then `1.0s`, doubling up to an `8.0s` cap, with ±25% jitter. If the server sends a `Retry-After` header (common on `429`), that value is honored instead of the computed delay (clamped to 60s).
849
+
850
+
851
+ ## Concurrency
852
+
853
+ A single `CrawlerClient` can fan out as many concurrent requests as your rate limit allows. Use `Promise.all()`:
854
+
855
+ Each instance keeps its own URL, key, and transport. Direct generated calls should pass `client: client.api`. The optional `configureGlobalClient: true` escape hatch mutates a process-wide singleton and is unsuitable for multi-tenant or otherwise concurrent client construction.
856
+
857
+ ```ts
858
+ const client = new CrawlerClient();
859
+ const results = await Promise.all(
860
+ ["CVE-2024-3400", "CVE-2024-1086", "CVE-2024-21887"].map((cveId) =>
861
+ client.enrichCveFull(cveId, presets.CVE_FAST),
862
+ ),
863
+ );
864
+ ```
865
+
866
+ Per-tier rate limits still apply. If you need to back off, check `X-RateLimit-Remaining-Minute` via the raw `client.api` form.
867
+
868
+ ## Versioning
869
+
870
+ `MAJOR.MINOR.PATCH`:
871
+
872
+ - `MAJOR.MINOR` tracks the upstream API surface. Any change to a request or response schema bumps at least the minor.
873
+ - `PATCH` is reserved for client-only fixes that don't change the wire contract.
874
+
875
+ Pin a compatible range against the current major:
876
+
877
+ ```json
878
+ {
879
+ "dependencies": {
880
+ "@crimson-crawler/crimson-crawler-client": "^4.0.0"
881
+ }
882
+ }
883
+ ```
884
+
885
+ ## Runtime support
886
+
887
+ Node 22+ is the supported runtime. Requests use the built-in `fetch` by default. The package dynamically imports `undici` only when a Node caller sets `verifySsl: false`, keeping TLS overrides client-scoped. Browser and edge runtimes are not tested or supported.
888
+
889
+ ## Top-level exports
890
+
891
+ | Symbol | Type | Description |
892
+ |---|---|---|
893
+ | `CrawlerClient` | class | Main client class |
894
+ | `CrawlerClientOptions` | interface | Constructor options |
895
+ | `presets` | namespace | 18 named `include` lists |
896
+ | `CrawlerClientError` | class | Base for everything this package raises |
897
+ | `MissingCredentials` | class | Constructor missing API key |
898
+ | `UnexpectedStatus` | class | Non-success or unparseable response |
899
+
900
+ ## Testing
901
+
902
+ Run code generation first in a fresh clone, then use the focused package commands:
903
+
904
+ ```bash
905
+ npm run codegen -- --snapshot-only
906
+ npm run typecheck
907
+ npm test
908
+ ```
909
+
910
+ `npm test` runs the Vitest SDK unit suite without contacting the API.
911
+
912
+ ## Troubleshooting
913
+
914
+ - **`MissingCredentials`**: set `CRIMSON_CRAWLER_API_KEY` or pass `apiKey`.
915
+ - **Generated-module import errors**: run `npm run codegen -- --snapshot-only`.
916
+ - **Local TLS failures**: trust the deployment CA. Use `verifySsl: false` only for isolated local Node.js development.
917
+ - **HTTP 401/403**: confirm the key belongs to the selected `baseUrl`; do not send a hosted key to an untrusted custom origin.
918
+ - **HTTP 429**: reduce concurrency or wait for the rate-limit window before retrying.
919
+
920
+ ## See also
921
+
922
+ - [Hosted TypeScript SDK guide](https://crimsoncrawler.com/docs/clients/typescript-client/)
923
+ - [Quickstart](https://crimsoncrawler.com/docs/quickstart/)
924
+ - [Authentication and API keys](https://crimsoncrawler.com/docs/authentication/)
925
+ - [v1 API reference](https://crimsoncrawler.com/api-reference/v1/)
926
+ - [Choosing a client surface](https://crimsoncrawler.com/docs/guides/choosing-a-surface/)
927
+ - Python SDK — [`/docs/clients/python-client/`](https://crimsoncrawler.com/docs/clients/python-client/)
928
+ - CLI (`ccc`) — [`/docs/clients/cli/`](https://crimsoncrawler.com/docs/clients/cli/)
929
+ - MCP server — [`/docs/clients/mcp/`](https://crimsoncrawler.com/docs/clients/mcp/)
930
+ - Source and release history — [GitHub](https://github.com/crimson-crawler/typescript-sdk).
931
+
932
+ ## Contributing
933
+
934
+ Read [CONTRIBUTING.md](https://github.com/crimson-crawler/typescript-sdk/blob/main/CONTRIBUTING.md) for development setup, testing, and pull-request expectations. Report vulnerabilities through [SECURITY.md](https://github.com/crimson-crawler/typescript-sdk/blob/main/SECURITY.md), not a public issue.
935
+
936
+ ## License
937
+
938
+ Licensed under the [Apache License 2.0](https://github.com/crimson-crawler/typescript-sdk/blob/main/LICENSE).
939
+
940
+ Copyright 2026 Def-Logix, Inc.