@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.
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +940 -0
- package/dist/.package-build.json +29 -0
- package/dist/_generated/client.gen.cjs +11 -0
- package/dist/_generated/client.gen.d.cts +15 -0
- package/dist/_generated/client.gen.d.ts +15 -0
- package/dist/_generated/client.gen.js +2 -0
- package/dist/_generated/index.cjs +140 -0
- package/dist/_generated/index.d.cts +3 -0
- package/dist/_generated/index.d.ts +3 -0
- package/dist/_generated/index.js +3 -0
- package/dist/_generated/sdk.gen.cjs +140 -0
- package/dist/_generated/sdk.gen.d.cts +946 -0
- package/dist/_generated/sdk.gen.d.ts +946 -0
- package/dist/_generated/sdk.gen.js +3 -0
- package/dist/_generated/types.gen.cjs +2 -0
- package/dist/_generated/types.gen.d.cts +9950 -0
- package/dist/_generated/types.gen.d.ts +9950 -0
- package/dist/_generated/types.gen.js +1 -0
- package/dist/chunk-2X3CCE46.js +294 -0
- package/dist/chunk-4CXMKUDH.cjs +783 -0
- package/dist/chunk-4HSWOQA6.cjs +328 -0
- package/dist/chunk-4PCL3ANB.cjs +190 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/chunk-C53EHGN4.js +170 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-QU4MM663.js +780 -0
- package/dist/index.cjs +2507 -0
- package/dist/index.d.cts +1283 -0
- package/dist/index.d.ts +1283 -0
- package/dist/index.js +2487 -0
- package/dist/presets-BMN8jy08.d.cts +110 -0
- package/dist/presets-BMN8jy08.d.ts +110 -0
- package/dist/presets.cjs +79 -0
- package/dist/presets.d.cts +1 -0
- package/dist/presets.d.ts +1 -0
- package/dist/presets.js +2 -0
- package/dist/types.gen-ObPczyUH.d.cts +327 -0
- package/dist/types.gen-ObPczyUH.d.ts +327 -0
- package/package.json +131 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1283 @@
|
|
|
1
|
+
import { b as Client } from './types.gen-ObPczyUH.js';
|
|
2
|
+
import { EnrichCveResponse, EnrichIocResponse, EnrichCweResponse, EnrichTechniqueResponse, EnrichProductResponse, EnrichPackageResponse, SearchCtiResponse, EnrichAtlasResponse, EnrichCampaignResponse, EnrichCapecResponse, EnrichDefendResponse, EnrichDisarmResponse, EnrichGroupResponse, EnrichLocationResponse, EnrichSectorResponse, EnrichSoftwareResponse, EnrichBatchRequest, EnrichBatchResponse, EnrichPocSourceResponse, AssessGroupExposureResponse, AssessIocPortfolioRequest, AssessIocPortfolioResponse, AssessTechniqueCoverageResponse, ArtifactEnrichmentStakeholder, AssessVulnerabilityExposureResponse, SearchCtiRequest, SearchCveRequest, SearchCveResponse, SearchD3FendRequest, SearchD3FendResponse, SearchKevRequest, SearchKevResponse, SearchKnowledgebaseRequest, SearchKnowledgebaseResponse, SearchMispResponse, SearchPocResponse, SearchVendorResponse, ArtifactEnrichmentDocRequest, ArtifactEnrichResponse, ArtifactEnrichStatusResponse, InventoryAsset, InventoryEnrichResponse, InventoryEnrichStatusResponse } from './_generated/types.gen.js';
|
|
3
|
+
export { p as presets } from './presets-BMN8jy08.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Report Generator API — key-authed access to the Report Generator.
|
|
7
|
+
*
|
|
8
|
+
* Its own section at `/ai-reports/*` generates and manages grounded,
|
|
9
|
+
* cite-or-refuse intelligence reports from saved enrichments, inputs, and prior reports.
|
|
10
|
+
* A report is built by picking a TEMPLATE + source artifacts, creating a DRAFT (the scaffold + a
|
|
11
|
+
* list of AI sections to fill), then filling each AI section (a grounded LLM call). The
|
|
12
|
+
* `generateReport` convenience runs the whole create → fill-all → fetch flow in one call.
|
|
13
|
+
*
|
|
14
|
+
* Same API key, same base URL, same retry/timeout fetch as every other call — **Report Generator calls
|
|
15
|
+
* never count toward your API usage** (including the LLM generation). Reports are stored as
|
|
16
|
+
* `kind=report` artifacts (`format='html_report'`); browser-authored ProseMirror reports export
|
|
17
|
+
* PDF/DOCX/MD only from the editor, but API-generated HTML reports export as `html` or `md` here.
|
|
18
|
+
*
|
|
19
|
+
* Exposed as `client.aiReports` (mirrors the Python `AiReportsAPI`).
|
|
20
|
+
*/
|
|
21
|
+
/** A fetch-like function — the CrawlerClient hands in its retry/timeout wrapper. */
|
|
22
|
+
type AiReportsFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
23
|
+
/**
|
|
24
|
+
* Client for the key-authed Report Generator API.
|
|
25
|
+
*
|
|
26
|
+
* Obtained via `client.aiReports` — never constructed directly.
|
|
27
|
+
* Every method throws `UnexpectedStatus` on a non-2xx response.
|
|
28
|
+
*/
|
|
29
|
+
declare class AiReportsApi {
|
|
30
|
+
#private;
|
|
31
|
+
private readonly baseUrl;
|
|
32
|
+
private readonly doFetch;
|
|
33
|
+
constructor(baseUrl: string, apiKey: string, doFetch: AiReportsFetch);
|
|
34
|
+
private request;
|
|
35
|
+
/** `GET /ai-reports` — the self-documenting endpoint map + your account context. */
|
|
36
|
+
discovery(): Promise<Record<string, unknown>>;
|
|
37
|
+
/** The built-in report templates — each `{id, name, description?, ai_sections:[{section_type, label}], needs?}`. */
|
|
38
|
+
listTemplates(): Promise<Record<string, unknown>[]>;
|
|
39
|
+
/** Your saved reports (newest first, no content) — `kind=report` artifacts. */
|
|
40
|
+
listReports(): Promise<Record<string, unknown>[]>;
|
|
41
|
+
/** One report in full, including inline `content` (the report HTML). */
|
|
42
|
+
getReport(reportId: string): Promise<Record<string, unknown>>;
|
|
43
|
+
/** Read a report's raw HTML into a string buffer (maximum 10,000,000 bytes; not a streaming return type).
|
|
44
|
+
* Resolves `{ content, id, kind, name, format, createdAt }`. */
|
|
45
|
+
getReportRaw(reportId: string): Promise<Record<string, unknown>>;
|
|
46
|
+
/**
|
|
47
|
+
* Create a DRAFT report from a template + source artifacts. Renders the scaffold (static +
|
|
48
|
+
* deterministic data sections) and returns the list of AI sections still to fill.
|
|
49
|
+
*
|
|
50
|
+
* Resolves `{ id, name, html, ai_sections: [{section_type, label, ...}], skipped: [...] }`.
|
|
51
|
+
*/
|
|
52
|
+
createDraft(template: string, options?: {
|
|
53
|
+
sourceIds?: string[];
|
|
54
|
+
name?: string;
|
|
55
|
+
}): Promise<Record<string, unknown>>;
|
|
56
|
+
/**
|
|
57
|
+
* Generate ONE grounded AI section of a draft (omit `sectionType` to fill the next pending one).
|
|
58
|
+
* Resolves `{ section_type, filled, truncated, remaining: [...], complete }`. Throws
|
|
59
|
+
* `UnexpectedStatus` (409) when no sections remain or (502) on a copilot failure.
|
|
60
|
+
*/
|
|
61
|
+
fillSection(reportId: string, sectionType?: string): Promise<Record<string, unknown>>;
|
|
62
|
+
/** Rename a report. Resolves the updated report. */
|
|
63
|
+
renameReport(reportId: string, name: string): Promise<Record<string, unknown>>;
|
|
64
|
+
/** Delete a report. Resolves `true` on success (404 throws). */
|
|
65
|
+
deleteReport(reportId: string): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Generate a single grounded section ad-hoc (NOT tied to a stored report) from `sourceIds`.
|
|
68
|
+
* Provide `sectionType` (a template section) and/or a free-text `instruction`. Resolves
|
|
69
|
+
* `{ text, truncated, grounded, unsupported_ids }`.
|
|
70
|
+
*/
|
|
71
|
+
section(sourceIds: string[], options?: {
|
|
72
|
+
sectionType?: string;
|
|
73
|
+
instruction?: string;
|
|
74
|
+
selection?: string;
|
|
75
|
+
verbosity?: "concise" | "standard" | "detailed";
|
|
76
|
+
}): Promise<Record<string, unknown>>;
|
|
77
|
+
/**
|
|
78
|
+
* Export a report as `html` or `md`. The body IS the export file.
|
|
79
|
+
*
|
|
80
|
+
* Resolves `{ content, bytes, filename, contentType }`. `filename` is a sanitized basename from
|
|
81
|
+
* `Content-Disposition`. PDF/DOCX are browser-editor-only; browser-authored reports throw 422 here.
|
|
82
|
+
*/
|
|
83
|
+
exportReport(reportId: string, fmt?: "html" | "md"): Promise<Record<string, unknown>>;
|
|
84
|
+
/**
|
|
85
|
+
* Generate a report end-to-end: create the draft, fill every AI section, return the finished
|
|
86
|
+
* report. The convenience over `createDraft` + `fillSection`.
|
|
87
|
+
*
|
|
88
|
+
* If a section's copilot call fails (502), generation stops there and returns what filled so far:
|
|
89
|
+
* the report keeps the sections completed before the failure, the failed section is recorded in
|
|
90
|
+
* `sections` as `{ error: "generation failed", status: 502 }`, and that section plus any after it
|
|
91
|
+
* stay unfilled cards. Re-run `generateReport` or fill the rest individually with `fillSection`.
|
|
92
|
+
*
|
|
93
|
+
* Resolves `{ report, sections: [<fill result per section>], skipped: [...] }`.
|
|
94
|
+
*/
|
|
95
|
+
generateReport(template: string, options?: {
|
|
96
|
+
sourceIds?: string[];
|
|
97
|
+
name?: string;
|
|
98
|
+
}): Promise<Record<string, unknown>>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Artifact Manager API (Artifact Manager) — key-authed access to YOUR stored artifacts.
|
|
103
|
+
*
|
|
104
|
+
* The Artifact Manager API lives at `/artifact-manager/*`, outside the versioned
|
|
105
|
+
* `/v1` enrichment contract, so it is not part of the
|
|
106
|
+
* OpenAPI snapshot or the generated layer. This module is the hand-written
|
|
107
|
+
* client for it, exposed as `client.artifactManager` (mirrors the Python wrapper's
|
|
108
|
+
* `ArtifactManagerAPI`).
|
|
109
|
+
*
|
|
110
|
+
* Same API key, same base URL, same retry/timeout fetch as every other call —
|
|
111
|
+
* but **artifactManager calls never count toward your API usage** (account
|
|
112
|
+
* self-service over your own data, not enrichment compute).
|
|
113
|
+
*/
|
|
114
|
+
/** A fetch-like function — the CrawlerClient hands in its retry/timeout wrapper. */
|
|
115
|
+
type ArtifactManagerFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
116
|
+
interface ArtifactManagerArtifact {
|
|
117
|
+
id: string;
|
|
118
|
+
kind: "input" | "artifact_enrichment" | "report" | "inventory_enrichment" | "inventory_asset";
|
|
119
|
+
name: string;
|
|
120
|
+
mime?: string | null;
|
|
121
|
+
format?: string | null;
|
|
122
|
+
content?: string | null;
|
|
123
|
+
byte_size?: number;
|
|
124
|
+
favorite?: boolean;
|
|
125
|
+
folder_id?: string | null;
|
|
126
|
+
created_at?: string;
|
|
127
|
+
updated_at?: string;
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
}
|
|
130
|
+
interface ArtifactManagerFolder {
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
artifact_count?: number;
|
|
134
|
+
[key: string]: unknown;
|
|
135
|
+
}
|
|
136
|
+
interface ArtifactManagerRawArtifact {
|
|
137
|
+
content: string;
|
|
138
|
+
id: string;
|
|
139
|
+
kind: string;
|
|
140
|
+
name: string;
|
|
141
|
+
format: string;
|
|
142
|
+
mime: string;
|
|
143
|
+
created_at: string;
|
|
144
|
+
}
|
|
145
|
+
interface ArtifactManagerExport {
|
|
146
|
+
/** The export decoded as text. Lossy for the binary XLSX formats (`emass`/`workbook`) — use `bytes`. */
|
|
147
|
+
content: string;
|
|
148
|
+
/** The raw export bytes (authoritative; write to a file for the binary `emass`/`workbook` XLSX). */
|
|
149
|
+
bytes: Uint8Array;
|
|
150
|
+
/** A sanitized basename safe to join beneath a caller-selected output directory. */
|
|
151
|
+
filename: string;
|
|
152
|
+
contentType: string;
|
|
153
|
+
}
|
|
154
|
+
interface ArtifactManagerRating {
|
|
155
|
+
rating: "up" | "down" | null;
|
|
156
|
+
counts: {
|
|
157
|
+
up: number;
|
|
158
|
+
down: number;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Client for the key-authed Artifact Manager API (Artifact Manager).
|
|
163
|
+
*
|
|
164
|
+
* Obtained via `client.artifactManager` — never constructed directly.
|
|
165
|
+
* Every method throws `UnexpectedStatus` on a non-2xx response.
|
|
166
|
+
*/
|
|
167
|
+
declare class ArtifactManagerApi {
|
|
168
|
+
#private;
|
|
169
|
+
private readonly baseUrl;
|
|
170
|
+
private readonly doFetch;
|
|
171
|
+
constructor(baseUrl: string, apiKey: string, doFetch: ArtifactManagerFetch);
|
|
172
|
+
private request;
|
|
173
|
+
/** `GET /artifact-manager` — the self-documenting endpoint map + your account context. */
|
|
174
|
+
discovery(): Promise<Record<string, unknown>>;
|
|
175
|
+
/**
|
|
176
|
+
* List your artifacts (newest first, no content).
|
|
177
|
+
*
|
|
178
|
+
* @param options `kind` (input|enrichment|report) · `folder` (UUID or `"__root__"`)
|
|
179
|
+
* · `since`/`until` (ISO `created_at` window).
|
|
180
|
+
*/
|
|
181
|
+
listArtifacts(options?: {
|
|
182
|
+
kind?: "input" | "artifact_enrichment" | "report" | "inventory_enrichment" | "inventory_asset";
|
|
183
|
+
folder?: string;
|
|
184
|
+
since?: string;
|
|
185
|
+
until?: string;
|
|
186
|
+
}): Promise<ArtifactManagerArtifact[]>;
|
|
187
|
+
/**
|
|
188
|
+
* Upload input artifacts (max 20/call, ≤10 MB content each).
|
|
189
|
+
*
|
|
190
|
+
* @param artifacts Each `{ name, content, format: "paste"|"file", mime? }`.
|
|
191
|
+
* @param options File into an existing `folderId`, or create one via `newFolderName`.
|
|
192
|
+
* @returns `{ ids, folderId }` — the new artifact ids.
|
|
193
|
+
*/
|
|
194
|
+
uploadArtifacts(artifacts: Array<{
|
|
195
|
+
name: string;
|
|
196
|
+
content: string;
|
|
197
|
+
format: "paste" | "file";
|
|
198
|
+
mime?: string;
|
|
199
|
+
}>, options?: {
|
|
200
|
+
folderId?: string;
|
|
201
|
+
newFolderName?: string;
|
|
202
|
+
}): Promise<{
|
|
203
|
+
ids: string[];
|
|
204
|
+
folderId: string | null;
|
|
205
|
+
}>;
|
|
206
|
+
/** One artifact in full, including inline `content`. */
|
|
207
|
+
getArtifact(artifactId: string): Promise<ArtifactManagerArtifact>;
|
|
208
|
+
/**
|
|
209
|
+
* Read an artifact's raw body into a string buffer (maximum 10,000,000 bytes; this is not a
|
|
210
|
+
* streaming return type). Metadata rides `X-Artifact-*` headers.
|
|
211
|
+
*/
|
|
212
|
+
getArtifactRaw(artifactId: string): Promise<ArtifactManagerRawArtifact>;
|
|
213
|
+
/**
|
|
214
|
+
* Partial update: rename, star/unstar, and/or move between folders.
|
|
215
|
+
*
|
|
216
|
+
* `folderId: null` moves the artifact back to root; omit it to leave the
|
|
217
|
+
* folder unchanged.
|
|
218
|
+
*/
|
|
219
|
+
updateArtifact(artifactId: string, update: {
|
|
220
|
+
name?: string;
|
|
221
|
+
favorite?: boolean;
|
|
222
|
+
folderId?: string | null;
|
|
223
|
+
}): Promise<ArtifactManagerArtifact>;
|
|
224
|
+
/** Delete one artifact. Resolves `true` on success (404 throws). */
|
|
225
|
+
deleteArtifact(artifactId: string): Promise<boolean>;
|
|
226
|
+
/** Duplicate an artifact as "Copy of …". Resolves to the new artifact id. */
|
|
227
|
+
copyArtifact(artifactId: string): Promise<string>;
|
|
228
|
+
/**
|
|
229
|
+
* Persist a COMPLETED artifact enrichment into your library, by its engine `enrichmentId`.
|
|
230
|
+
*
|
|
231
|
+
* The programmatic equivalent of the portal's "Save enrichment" button. Run `client.enricher.enrich`
|
|
232
|
+
* (`POST /v1/artifact-enrich` → poll), then pass the returned `enrichment_id` here to file the finished
|
|
233
|
+
* report as a `kind=artifact_enrichment` artifact on your account (or use `enrich({ save: true })` to do both in
|
|
234
|
+
* one call). The engine returns the report but never persists it — this is the only way to add it to the
|
|
235
|
+
* Artifact Manager. Idempotent (a repeat returns `{ already_persisted: true }`). Optionally file it into
|
|
236
|
+
* a folder by id (`folderId`) or create one (`newFolderName`). Usage-exempt. Resolves to
|
|
237
|
+
* `{ enrichment_artifact_id }` (or `{ already_persisted: true }`). Save within ~1 h of completion.
|
|
238
|
+
*/
|
|
239
|
+
saveEnrichment(enrichmentId: string, opts?: {
|
|
240
|
+
folderId?: string | null;
|
|
241
|
+
newFolderName?: string | null;
|
|
242
|
+
}): Promise<Record<string, unknown>>;
|
|
243
|
+
/** Delete many artifacts in one call (≤200/call). Resolves to the number removed. */
|
|
244
|
+
bulkDelete(artifactIds: string[]): Promise<number>;
|
|
245
|
+
/**
|
|
246
|
+
* Move many artifacts into a folder (≤200/call). `folderId: null` un-files them
|
|
247
|
+
* to root. Resolves to the number moved.
|
|
248
|
+
*/
|
|
249
|
+
moveToFolder(artifactIds: string[], folderId?: string | null): Promise<number>;
|
|
250
|
+
/**
|
|
251
|
+
* Star (`favorite: true`) or unstar (`false`) many artifacts at once (≤200/call).
|
|
252
|
+
* Resolves to the number updated.
|
|
253
|
+
*/
|
|
254
|
+
bulkSetFavorite(artifactIds: string[], favorite: boolean): Promise<number>;
|
|
255
|
+
/** Bundle an explicit set of your artifacts into one `.zip` (the bulk "Download .zip"). Enrichments
|
|
256
|
+
* contribute their machine exports under a per-enrichment subfolder; every other kind contributes its raw
|
|
257
|
+
* deliverable. Returns the raw `.zip` bytes. See {@link downloadFolder} for the whole-folder twin. */
|
|
258
|
+
downloadBundle(artifactIds: string[]): Promise<Uint8Array>;
|
|
259
|
+
/** Your thumbs rating on an enrichment + the aggregate counts. */
|
|
260
|
+
getRating(enrichmentId: string): Promise<ArtifactManagerRating>;
|
|
261
|
+
/** Rate an enrichment `"up"`/`"down"`, or clear your rating with `null`. */
|
|
262
|
+
setRating(enrichmentId: string, rating: "up" | "down" | null): Promise<Record<string, unknown>>;
|
|
263
|
+
/** A saved enrichment's machine-export formats (`stix`, `misp`, `csaf`, `vex`, `csv`, …). */
|
|
264
|
+
listExports(enrichmentId: string): Promise<string[]>;
|
|
265
|
+
/** Download one export. The body is the export file; `filename` is a sanitized basename from
|
|
266
|
+
* `Content-Disposition`. Text formats land in `content`; binary XLSX formats in `bytes`. */
|
|
267
|
+
getExport(enrichmentId: string, format: string): Promise<ArtifactManagerExport>;
|
|
268
|
+
/** Download EVERY machine export of a saved artifact as one `.zip` (one file per format —
|
|
269
|
+
* `stix.json`, `vex.json`, `emass.xlsx`, …). The bulk twin of {@link getExport}, matching the export
|
|
270
|
+
* panel's "Download all (.zip)" button. Works for any saved enrichment / inventory-enrichment /
|
|
271
|
+
* inventory id. Returns the raw `.zip` bytes. */
|
|
272
|
+
downloadAllExports(enrichmentId: string): Promise<Uint8Array>;
|
|
273
|
+
/**
|
|
274
|
+
* Difference matrix across 2–12 of your saved enrichments (oldest → newest). Each
|
|
275
|
+
* row is one finding's trajectory: new / resolved / changed / persistent.
|
|
276
|
+
*/
|
|
277
|
+
compareEnrichments(enrichmentIds: string[]): Promise<Record<string, unknown>>;
|
|
278
|
+
/** Your folders, each with a live `artifact_count`. */
|
|
279
|
+
listFolders(): Promise<ArtifactManagerFolder[]>;
|
|
280
|
+
/** Create a folder. Resolves to its id. */
|
|
281
|
+
createFolder(name: string): Promise<string>;
|
|
282
|
+
/** Rename a folder. */
|
|
283
|
+
renameFolder(folderId: string, name: string): Promise<Record<string, unknown>>;
|
|
284
|
+
/** Delete a folder — its artifacts move back to root, never deleted with it. */
|
|
285
|
+
deleteFolder(folderId: string): Promise<boolean>;
|
|
286
|
+
/** Download every artifact filed under a folder as one `<folder>.zip` (the folder "Download .zip").
|
|
287
|
+
* Enrichments contribute their machine exports under a per-enrichment subfolder; every other kind
|
|
288
|
+
* contributes its raw deliverable. Returns the raw `.zip` bytes. */
|
|
289
|
+
downloadFolder(folderId: string): Promise<Uint8Array>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Shared submit→poll core for the two async-enrichment engines (Enricher + Inventory).
|
|
294
|
+
*
|
|
295
|
+
* Both `client.enricher.enrich` and `client.inventoryManager.enrichInventory` submit a job to a
|
|
296
|
+
* `/v1/*-enrich` engine and poll `GET /v1/*-enrich/{id}` until it finishes. The loop lives here so the
|
|
297
|
+
* two engines can't drift — and so a single place carries the optional `onProgress` callback that
|
|
298
|
+
* surfaces the LIVE job (status, per-stage progress, and the granular `events[]` feed — each event
|
|
299
|
+
* stamped with the overall % it reached) on every tick. Mirrors the Python SDK's `_poll.py`. Status
|
|
300
|
+
* polls are billing-exempt, so calling back frequently costs no usage.
|
|
301
|
+
*/
|
|
302
|
+
/** Called with the raw job dict each poll: `{ status, progress, stages, events, result? }`. May be sync
|
|
303
|
+
* or async; any error it throws is swallowed (telemetry must never break the poll). */
|
|
304
|
+
type ProgressCallback = (job: Record<string, unknown>) => void | Promise<void>;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Inventory Manager API — key-authed access to YOUR monitored inventory context windows.
|
|
308
|
+
*
|
|
309
|
+
* The Inventory Manager API lives at `/inventory-manager/inventories/*` as its own
|
|
310
|
+
* section, split out of the Artifact Manager API so the two do not cross-contaminate. A
|
|
311
|
+
* **inventory** is a continuously-monitored context window: a manual asset inventory + attached
|
|
312
|
+
* reference artifacts + saved enrichment history, re-enrichable on demand and on a daily schedule.
|
|
313
|
+
*
|
|
314
|
+
* Same API key, same base URL, same retry/timeout fetch as every other call — but
|
|
315
|
+
* **inventoryManager calls never count toward your API usage** (account self-service over your own
|
|
316
|
+
* data), EXCEPT the inventory-enrichment submit (`enrichInventory`), which is enrichment compute and rides
|
|
317
|
+
* your key to `/v1/inventory-enrich`. Exposed as `client.inventoryManager` (mirrors the Python `InventoryManagerAPI`).
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
/** A fetch-like function — the CrawlerClient hands in its retry/timeout wrapper. */
|
|
321
|
+
type InventoryManagerFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
322
|
+
/** The editable Inventory Manager inventory fields (shared by createInventory / updateInventory). */
|
|
323
|
+
interface InventoryOptions {
|
|
324
|
+
description?: string;
|
|
325
|
+
/** Asset inventory — each `{ product, vendor?, versions?, ecosystem?, category?, criticality?,
|
|
326
|
+
* notes?, exposure?, environment?, owner?, tags? }`. */
|
|
327
|
+
items?: Array<Record<string, unknown>>;
|
|
328
|
+
monitoring?: boolean;
|
|
329
|
+
/** Attached reference-artifact ids (the inventory's context window). */
|
|
330
|
+
linkedArtifactIds?: string[];
|
|
331
|
+
}
|
|
332
|
+
/** An attachment requested for enrichment but omitted from its evidence context. */
|
|
333
|
+
interface AttachmentOmission {
|
|
334
|
+
attachment_id: string;
|
|
335
|
+
reason: string;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Client for the key-authed Inventory Manager API.
|
|
339
|
+
*
|
|
340
|
+
* Obtained via `client.inventoryManager` — never constructed directly.
|
|
341
|
+
* Every method throws `UnexpectedStatus` on a non-2xx response.
|
|
342
|
+
*/
|
|
343
|
+
declare class InventoryManagerApi {
|
|
344
|
+
#private;
|
|
345
|
+
private readonly baseUrl;
|
|
346
|
+
private readonly doFetch;
|
|
347
|
+
constructor(baseUrl: string, apiKey: string, doFetch: InventoryManagerFetch);
|
|
348
|
+
private request;
|
|
349
|
+
/**
|
|
350
|
+
* List your Inventory Manager inventories — each a continuously-monitored context window
|
|
351
|
+
* (asset inventory + attached artifacts + saved enrichment history). Newest first, no content.
|
|
352
|
+
*/
|
|
353
|
+
listInventories(): Promise<Record<string, unknown>[]>;
|
|
354
|
+
/**
|
|
355
|
+
* One inventory as a manifest: `{ inventory_name, description, monitoring, inventory[], attached[],
|
|
356
|
+
* enrichments[] }`. Pull specific artifacts/enrichments via the Artifact Manager API.
|
|
357
|
+
*/
|
|
358
|
+
getInventory(inventoryId: string): Promise<Record<string, unknown>>;
|
|
359
|
+
/**
|
|
360
|
+
* An inventory as a one-shot, bounded context bundle with artifact provenance and delimiters.
|
|
361
|
+
* Returns `{ id, name, inventory_name, description, monitoring, stats, context }`. `context`
|
|
362
|
+
* starts with a safe prompt preamble that labels the enclosed inventory and artifact text as
|
|
363
|
+
* untrusted data.
|
|
364
|
+
*/
|
|
365
|
+
getInventoryContext(inventoryId: string): Promise<Record<string, unknown>>;
|
|
366
|
+
/**
|
|
367
|
+
* List an inventory's saved enrichment history — the inventory's `inventory_enrichment` artifacts (newest first,
|
|
368
|
+
* no content; each row's `meta` carries the card stats: asset/CVE/KEV counts, scanned-at, monitoring
|
|
369
|
+
* delta). The data behind the UI's "Previous enrichments" strip.
|
|
370
|
+
*/
|
|
371
|
+
listEnrichments(inventoryId: string): Promise<Record<string, unknown>[]>;
|
|
372
|
+
/**
|
|
373
|
+
* CVE-matched difference matrix across 2–12 of your saved INVENTORY enrichments (oldest → newest). The
|
|
374
|
+
* inventory counterpart of `client.artifactManager.compareEnrichments`: each row is one CVE's trajectory —
|
|
375
|
+
* new / resolved / changed / persistent — across the selected inventory enrichments. Returns the `matrix`
|
|
376
|
+
* object (`columns`, `rows`, `counts`).
|
|
377
|
+
*/
|
|
378
|
+
compareEnrichments(enrichmentIds: string[]): Promise<Record<string, unknown>>;
|
|
379
|
+
/**
|
|
380
|
+
* Create an Inventory Manager inventory (a continuously-monitored context window).
|
|
381
|
+
*
|
|
382
|
+
* @param inventoryName The inventory's display name.
|
|
383
|
+
* @param options `description`, `items` (asset inventory — each `{ product, vendor?, versions?,
|
|
384
|
+
* ecosystem?, category?, criticality?, notes? }`), `monitoring` (always full depth — no fast/lite
|
|
385
|
+
* mode), `linkedArtifactIds`.
|
|
386
|
+
* @returns `{ id, item_count }`.
|
|
387
|
+
*/
|
|
388
|
+
createInventory(inventoryName: string, options?: InventoryOptions): Promise<Record<string, unknown>>;
|
|
389
|
+
/**
|
|
390
|
+
* Update an inventory's definition (name, description, inventory, monitoring, attachments).
|
|
391
|
+
* This is a **partial merge** (PATCH): only the fields you pass change — omitted fields are PRESERVED,
|
|
392
|
+
* including the asset-group metadata and daily-report config this method doesn't expose. `inventoryName`
|
|
393
|
+
* is still required by the API. Resolves `{ id, item_count }`.
|
|
394
|
+
*/
|
|
395
|
+
updateInventory(inventoryId: string, options: InventoryOptions & {
|
|
396
|
+
inventoryName: string;
|
|
397
|
+
}): Promise<Record<string, unknown>>;
|
|
398
|
+
/**
|
|
399
|
+
* Create an inventory by IMPORTING an asset-inventory file (you PICK the format — no auto-detect).
|
|
400
|
+
*
|
|
401
|
+
* @param options `format` — one of `json` (asset JSON), `sbom` (CycloneDX / SPDX SBOM), `csv`,
|
|
402
|
+
* `nmap` (nmap `-sV` XML), `list` (CPE / purl list), `grype`, `trivy` (SCA JSON), `depcheck`
|
|
403
|
+
* (OWASP Dependency-Check JSON), `nessus` (`.nessus` XML), `gvm` (OpenVAS / Greenbone XML);
|
|
404
|
+
* `content` — the file's text; optional `inventoryName` / `description` (override
|
|
405
|
+
* anything the file carries).
|
|
406
|
+
* @returns `{ id, item_count, imported, format, truncated? }`.
|
|
407
|
+
*/
|
|
408
|
+
importInventory(options: {
|
|
409
|
+
format: string;
|
|
410
|
+
/** The file's text — or a `Uint8Array` for the binary `xlsx` format (base64-encoded for you on the wire). */
|
|
411
|
+
content: string | Uint8Array;
|
|
412
|
+
inventoryName?: string;
|
|
413
|
+
description?: string;
|
|
414
|
+
inventoryId?: string;
|
|
415
|
+
mode?: "replace" | "append";
|
|
416
|
+
}): Promise<Record<string, unknown>>;
|
|
417
|
+
/**
|
|
418
|
+
* Parse + COMBINE several scan / inventory files into ONE deduped asset set WITHOUT saving (the
|
|
419
|
+
* multi-source twin of {@link parseScan}). Stage a CSV + an nmap scan + an SBOM and merge them; duplicate
|
|
420
|
+
* assets are deduped across sources, versions + named groups unioned, the set capped at 200.
|
|
421
|
+
*
|
|
422
|
+
* @param sources A list of `{ content, format?, label? }`. The `format` is **optional** — omit it and the
|
|
423
|
+
* file's format is auto-detected from its content (+ `label` as a filename hint); pin a `format` only to
|
|
424
|
+
* override. A binary `xlsx` source can't be sniffed, so it needs `format: "xlsx"` + `Uint8Array` content
|
|
425
|
+
* (base64-encoded on the wire). A source that fails to parse is ISOLATED (it appears in `per_source` with
|
|
426
|
+
* its `error`, contributing nothing — never failing the whole call).
|
|
427
|
+
* @returns `{ items, count, asset_groups, truncated?, per_source: [{ label, contributed, truncated?, error? }] }`.
|
|
428
|
+
*/
|
|
429
|
+
parseMulti(sources: Array<{
|
|
430
|
+
content: string | Uint8Array;
|
|
431
|
+
format?: string;
|
|
432
|
+
label?: string;
|
|
433
|
+
}>): Promise<Record<string, unknown>>;
|
|
434
|
+
/**
|
|
435
|
+
* Import + COMBINE several files into ONE inventory in a single call (the multi-source twin of
|
|
436
|
+
* {@link importInventory}). Each source parses in isolation then merges via the same dedup brain as
|
|
437
|
+
* {@link parseMulti}. No `inventoryId` CREATES a new inventory; with `inventoryId` the combined assets go
|
|
438
|
+
* INTO it (`mode` replace / append), preserving attachments / monitoring.
|
|
439
|
+
*/
|
|
440
|
+
importMulti(options: {
|
|
441
|
+
sources: Array<{
|
|
442
|
+
content: string | Uint8Array;
|
|
443
|
+
format?: string;
|
|
444
|
+
label?: string;
|
|
445
|
+
}>;
|
|
446
|
+
inventoryName?: string;
|
|
447
|
+
description?: string;
|
|
448
|
+
inventoryId?: string;
|
|
449
|
+
mode?: "replace" | "append";
|
|
450
|
+
}): Promise<Record<string, unknown>>;
|
|
451
|
+
/**
|
|
452
|
+
* REPLACE an inventory's asset inventory, PRESERVING its name / description / attached artifacts /
|
|
453
|
+
* monitoring / alert-prefs (the safe alternative to {@link updateInventory}, which resets omitted
|
|
454
|
+
* fields). To edit one field of one asset: {@link getInventory}, change the item in `inventory`, and
|
|
455
|
+
* replace it back. Resolves `{ id, item_count, mode }`.
|
|
456
|
+
*/
|
|
457
|
+
replaceAssets(inventoryId: string, items: Record<string, unknown>[]): Promise<Record<string, unknown>>;
|
|
458
|
+
/** APPEND assets to an inventory's inventory, preserving everything else. Resolves `{ id, item_count, mode }`. */
|
|
459
|
+
addAssets(inventoryId: string, items: Record<string, unknown>[]): Promise<Record<string, unknown>>;
|
|
460
|
+
/**
|
|
461
|
+
* Apply a recommended upgrade — set the matched asset's version to the published fix the Inventory
|
|
462
|
+
* Enricher surfaced (`recommended_fix_version` / `recommended_fix_version_kev`), PRESERVING everything
|
|
463
|
+
* else on the inventory. Match is by `product` (case-insensitive; `vendor` disambiguates duplicate
|
|
464
|
+
* product names). Writes the inventory only — it does NOT re-enrich (the next enrichment / daily monitor
|
|
465
|
+
* confirms the CVEs cleared). Resolves `{ id, product, version, item_count }` (404 when no asset matches).
|
|
466
|
+
*/
|
|
467
|
+
applyAssetFix(inventoryId: string, product: string, version: string, vendor?: string): Promise<Record<string, unknown>>;
|
|
468
|
+
/** List an inventory's asset-inventory export formats (`json` / `csv` / `cyclonedx` / `spdx`). */
|
|
469
|
+
listExportFormats(inventoryId: string): Promise<Record<string, unknown>[]>;
|
|
470
|
+
/**
|
|
471
|
+
* Export an inventory's asset inventory as a file — the resolved value IS the file. Resolves a
|
|
472
|
+
* `string` for the text formats and a `Uint8Array` for the binary `workbook` (write it straight to
|
|
473
|
+
* a `.xlsx` file).
|
|
474
|
+
*
|
|
475
|
+
* @param inventoryId The inventory id.
|
|
476
|
+
* @param format `json` / `csv` / `list` (CPE/purl) / `cyclonedx` / `spdx` (3.0.1) / `spdx2` (SPDX 2.3)
|
|
477
|
+
* / `workbook` (binary Excel .xlsx). `json` / `csv` / `list` round-trip back through
|
|
478
|
+
* {@link importInventory}. Defaults to `json`.
|
|
479
|
+
*/
|
|
480
|
+
exportInventory(inventoryId: string, format?: string): Promise<string | Uint8Array>;
|
|
481
|
+
/** Delete an inventory. Resolves `true` on success (404 throws). */
|
|
482
|
+
deleteInventory(inventoryId: string): Promise<boolean>;
|
|
483
|
+
/** Link an existing artifact to an inventory. Resolves to `{ ok, linked, already }`. */
|
|
484
|
+
attachToInventory(inventoryId: string, artifactId: string): Promise<Record<string, unknown>>;
|
|
485
|
+
/** Remove one attached artifact from an inventory (the inverse of {@link attachToInventory}).
|
|
486
|
+
* Atomic server-side operation that preserves every other field; idempotent. Resolves
|
|
487
|
+
* `{ ok, linked, removed }`. */
|
|
488
|
+
detachFromInventory(inventoryId: string, artifactId: string): Promise<Record<string, unknown>>;
|
|
489
|
+
/**
|
|
490
|
+
* REPLACE an inventory's attached reference artifacts in one call (the bulk twin of
|
|
491
|
+
* {@link attachToInventory}), PRESERVING its inventory / monitoring / alert-prefs. Only attachable
|
|
492
|
+
* kinds (`input` / `enrichment` / `report`) are kept; inventories and inventory enrichments are skipped. Deduped +
|
|
493
|
+
* capped at 100. Resolves `{ id, linked_count, attached, skipped, mode }`.
|
|
494
|
+
*/
|
|
495
|
+
setAttachments(inventoryId: string, artifactIds: string[]): Promise<Record<string, unknown>>;
|
|
496
|
+
/** APPEND several artifacts to an inventory's attachments in one call (bulk {@link attachToInventory});
|
|
497
|
+
* same filtering/cap/return as {@link setAttachments}. */
|
|
498
|
+
addAttachments(inventoryId: string, artifactIds: string[]): Promise<Record<string, unknown>>;
|
|
499
|
+
/** Toggle an inventory's daily monitoring (= daily enrichment). Routes through the automation endpoint
|
|
500
|
+
* (partial read-modify-write) so assets, attachments, asset groups, AND the daily-report config are
|
|
501
|
+
* all preserved. Enrichments always run at full depth. Resolves `{ id, automation }`. */
|
|
502
|
+
setMonitoring(inventoryId: string, monitoring: boolean): Promise<Record<string, unknown>>;
|
|
503
|
+
/** Star (`favorite: true`) or unstar (`false`) an inventory — the same ★ the inventory cards show. A
|
|
504
|
+
* favorite-only PATCH that leaves the asset inventory / attachments / monitoring / automation untouched.
|
|
505
|
+
* `listInventories` + `getInventory` echo `favorite` back. Usage-exempt. Resolves `{ id, favorite }`. */
|
|
506
|
+
setFavorite(inventoryId: string, favorite?: boolean): Promise<Record<string, unknown>>;
|
|
507
|
+
/** Read an inventory's DAILY-AUTOMATION config (the programmatic twin of the Automation modal):
|
|
508
|
+
* `{ monitoring, daily_enrichment_email, daily_report, daily_report_email,
|
|
509
|
+
* daily_report_template, daily_enrichment_next_run_at, custom_template_pinned }`. ONE pipeline on ONE
|
|
510
|
+
* timer: `daily_enrichment_next_run_at` is the epoch-ms countdown (null when monitoring is off); the
|
|
511
|
+
* daily report rides the same pipeline (right after the enrichment), no timer of its own. Usage-exempt. */
|
|
512
|
+
getAutomation(inventoryId: string): Promise<Record<string, unknown>>;
|
|
513
|
+
/** Manage an inventory's daily automation — set ONLY the fields you pass (partial read-modify-write,
|
|
514
|
+
* preserving assets/attachments). `monitoring` = the daily enrichment; `dailyReport` = ALSO generate a
|
|
515
|
+
* Report-Generator report from `dailyReportTemplate` (a built-in template id, e.g. `project_brief`) right
|
|
516
|
+
* after each daily enrichment, off its fresh findings. ONE pipeline: `dailyReport` REQUIRES `monitoring` —
|
|
517
|
+
* enabling it while monitoring is off rejects with a 400 (`UnexpectedStatus`); turning monitoring off
|
|
518
|
+
* cascades the report off. Each job's `*Email` toggle controls whether it emails the owner. The pipeline
|
|
519
|
+
* runs on the owner's key when the daily cron fires (the enrichment counts toward usage then). Resolves
|
|
520
|
+
* `{ id, automation }`. */
|
|
521
|
+
setAutomation(inventoryId: string, options: {
|
|
522
|
+
monitoring?: boolean;
|
|
523
|
+
dailyEnrichmentEmail?: boolean;
|
|
524
|
+
dailyReport?: boolean;
|
|
525
|
+
dailyReportEmail?: boolean;
|
|
526
|
+
dailyReportTemplate?: string;
|
|
527
|
+
}): Promise<Record<string, unknown>>;
|
|
528
|
+
/**
|
|
529
|
+
* Enrich an inventory's inventory end-to-end against the /v1 engine: submit → poll → return the report.
|
|
530
|
+
*
|
|
531
|
+
* Reads the inventory's asset inventory (`GET /inventory-manager/inventories/{id}`), submits those assets
|
|
532
|
+
* to the Threat Inventory Enricher (`POST /v1/inventory-enrich`, always full depth — there is no fast/lite
|
|
533
|
+
* mode), polls until done, and resolves to the enrichment report.
|
|
534
|
+
*
|
|
535
|
+
* The enrichment submit is enrichment compute and **counts toward your usage** (it rides your key to
|
|
536
|
+
* `/v1/inventory-enrich`); reading the inventory and polling do not.
|
|
537
|
+
*
|
|
538
|
+
* Resolves to `{ enrichment_id, report }`. If the inventory's inventory is empty this short-circuits and
|
|
539
|
+
* resolves to `{ enrichment_id: null, empty: true }` without submitting. Throws `UnexpectedStatus` on a
|
|
540
|
+
* non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
|
|
541
|
+
*/
|
|
542
|
+
enrichInventory(inventoryId: string, options?: {
|
|
543
|
+
include?: string[];
|
|
544
|
+
pollIntervalMs?: number;
|
|
545
|
+
timeoutMs?: number;
|
|
546
|
+
/** Called with the live job each poll (`{ status, progress, events }`, each event carrying the %
|
|
547
|
+
* it reached — a `✓ {CVE}` line per CVE) so you can render a live bar / feed. Polls are exempt. */
|
|
548
|
+
onProgress?: ProgressCallback;
|
|
549
|
+
/** Save the finished enrichment into this inventory's history after it completes (the `/v1` engine
|
|
550
|
+
* returns the report but never persists it) — the one-call equivalent of `enrichInventory` then
|
|
551
|
+
* `saveEnrichment`. When saved, the result also carries `saved`. Usage-exempt. */
|
|
552
|
+
save?: boolean;
|
|
553
|
+
/** The inventory's "artifact scans" — when on, its attached artifacts are resolved + sent so the
|
|
554
|
+
* engine ALSO runs a mini Artifact Enrichment over them (references surface on the report's
|
|
555
|
+
* `attachment_enrichment`). `undefined` (default) honors the inventory's saved toggle; `true`/`false`
|
|
556
|
+
* forces it for this run. */
|
|
557
|
+
enrichAttachments?: boolean;
|
|
558
|
+
/** Fail before submitting if any requested attachment cannot be resolved. Defaults to `false` for
|
|
559
|
+
* compatibility; permissive results carry `attachment_omissions` with an id and reason per skip. */
|
|
560
|
+
strictAttachments?: boolean;
|
|
561
|
+
}): Promise<Record<string, unknown>>;
|
|
562
|
+
/** Fetch the inventory's attached artifacts (≤20) and split them for the engine. Resolution is
|
|
563
|
+
* permissive: every skipped attachment is returned in `omissions`; callers that need complete
|
|
564
|
+
* evidence should use `enrichInventory({ strictAttachments: true })`. */
|
|
565
|
+
resolveAttachments(attachmentIds: string[]): Promise<{
|
|
566
|
+
text?: string;
|
|
567
|
+
files: Array<{
|
|
568
|
+
filename: string;
|
|
569
|
+
content_b64: string;
|
|
570
|
+
}>;
|
|
571
|
+
omissions: AttachmentOmission[];
|
|
572
|
+
}>;
|
|
573
|
+
/**
|
|
574
|
+
* Persist a COMPLETED inventory enrichment into this inventory's saved history, by its engine
|
|
575
|
+
* `enrichmentId`.
|
|
576
|
+
*
|
|
577
|
+
* The programmatic equivalent of the workbench's "Save enrichment" button. Run `enrichInventory`
|
|
578
|
+
* (`POST /v1/inventory-enrich` → poll), then pass the returned `enrichment_id` here to file the finished
|
|
579
|
+
* findings as a `kind=inventory_enrichment` artifact linked to the inventory (or use
|
|
580
|
+
* `enrichInventory({ save: true })` to do both in one call). The engine returns the report but never
|
|
581
|
+
* persists it — this is the only way to add it to the inventory's history. Idempotent (a repeat returns
|
|
582
|
+
* `{ ok: true, deduped: true }`). Usage-exempt. Resolves to `{ artifact_id }`. Save within ~1 h of completion.
|
|
583
|
+
*/
|
|
584
|
+
saveEnrichment(inventoryId: string, enrichmentId: string): Promise<Record<string, unknown>>;
|
|
585
|
+
/** Submit a raw asset list to the `/v1/inventory-enrich` engine, poll until done, resolve
|
|
586
|
+
* `{ enrichment_id, report }`. The shared submit→poll core behind `enrichInventory` and the `ingest`
|
|
587
|
+
* component. Throws `UnexpectedStatus` on an engine error, or `Error` on timeout. (Internal — used by
|
|
588
|
+
* `ingest.ts`; not part of the documented public surface.) */
|
|
589
|
+
enrichItems(items: unknown[], options?: {
|
|
590
|
+
include?: string[];
|
|
591
|
+
pollIntervalMs?: number;
|
|
592
|
+
timeoutMs?: number;
|
|
593
|
+
onProgress?: ProgressCallback;
|
|
594
|
+
attachmentsText?: string;
|
|
595
|
+
attachmentsFiles?: Array<{
|
|
596
|
+
filename: string;
|
|
597
|
+
content_b64: string;
|
|
598
|
+
}>;
|
|
599
|
+
}): Promise<Record<string, unknown>>;
|
|
600
|
+
/** Parse a scan / inventory FILE into canonical asset items WITHOUT saving anything (the parse-only twin
|
|
601
|
+
* of `importInventory`). You PICK the `format` — one of json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx
|
|
602
|
+
* (no auto-detect; pass a `Uint8Array` for the binary `xlsx`). Resolves
|
|
603
|
+
* `{ format, items, count, inventory_name?, truncated? }`. Usage-exempt — the building block for `ingestScan`. */
|
|
604
|
+
parseScan(content: string | Uint8Array, format: string): Promise<Record<string, unknown>>;
|
|
605
|
+
/** Scan → briefing in one call: parse the scan FILE (`parseScan`), enrich the discovered assets against
|
|
606
|
+
* the `/v1/inventory-enrich` ranking engine, and assemble a structured briefing. `format` is one of
|
|
607
|
+
* json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx. The parse is usage-exempt; the enrichment **submit counts
|
|
608
|
+
* toward usage** (one `/v1/inventory-enrich` request). Resolves
|
|
609
|
+
* `{ format, parsed_count, truncated?, enrichment_id, report, recommended_actions }` (report = the
|
|
610
|
+
* engine's KEV-first-ranked findings + rollup). An empty parse short-circuits to
|
|
611
|
+
* `{ format, parsed_count: 0, enrichment_id: null, empty: true }`. */
|
|
612
|
+
ingestScan(content: string | Uint8Array, format: string, options?: {
|
|
613
|
+
include?: string[];
|
|
614
|
+
pollIntervalMs?: number;
|
|
615
|
+
timeoutMs?: number;
|
|
616
|
+
onProgress?: ProgressCallback;
|
|
617
|
+
}): Promise<Record<string, unknown>>;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Enricher API — key-authed access to the async artifact-enrichment engine (submit → poll).
|
|
622
|
+
*
|
|
623
|
+
* A thin wrapper over the `/v1/artifact-enrich` engine endpoints: `client.enricher.enrich` stages
|
|
624
|
+
* artifacts, submits to the engine, polls until done, and returns the report. There is no save/discard —
|
|
625
|
+
* the engine pair is submit→poll only; persistence is the portal's job, not the API's.
|
|
626
|
+
*
|
|
627
|
+
* Same API key, same base URL, same retry/timeout fetch as every other call. The enrichment submit is
|
|
628
|
+
* enrichment compute and **counts toward your API usage** (it's a `/v1/artifact-enrich` request); polling
|
|
629
|
+
* is the engine's own status read. Exposed as `client.enricher` (mirrors the Python `EnricherAPI`).
|
|
630
|
+
*/
|
|
631
|
+
|
|
632
|
+
/** A fetch-like function — the CrawlerClient hands in its retry/timeout wrapper. */
|
|
633
|
+
type EnricherFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
634
|
+
/**
|
|
635
|
+
* Client for the artifact-enrichment engine (the async submit→poll lifecycle).
|
|
636
|
+
*
|
|
637
|
+
* Obtained via `client.enricher` — never constructed directly.
|
|
638
|
+
* Every method throws `UnexpectedStatus` on a non-2xx response.
|
|
639
|
+
*/
|
|
640
|
+
declare class EnricherApi {
|
|
641
|
+
#private;
|
|
642
|
+
private readonly baseUrl;
|
|
643
|
+
private readonly doFetch;
|
|
644
|
+
constructor(baseUrl: string, apiKey: string, doFetch: EnricherFetch);
|
|
645
|
+
private request;
|
|
646
|
+
/**
|
|
647
|
+
* Run an artifact enrichment end-to-end against the /v1 engine: submit → poll → return the report.
|
|
648
|
+
*
|
|
649
|
+
* Stages pasted `text` + base64 `files` (`[{ filename, content_b64 }]`), submits to
|
|
650
|
+
* `/v1/artifact-enrich`, polls the job until done, and resolves to the enrichment report.
|
|
651
|
+
*
|
|
652
|
+
* `stakeholder` is the optional SSVC stakeholder context applied to every reference when `include`
|
|
653
|
+
* contains `"ssvc"` (`{ method, exposure, human_impact, mission_prevalence, public_wellbeing_impact }`;
|
|
654
|
+
* omit to use the engine's CISA-coordinator defaults).
|
|
655
|
+
*
|
|
656
|
+
* Counts toward your API usage (it's `/v1/artifact-enrich` compute). Throws `UnexpectedStatus` on a
|
|
657
|
+
* non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
|
|
658
|
+
* Resolves to `{ enrichment_id, report }`.
|
|
659
|
+
*/
|
|
660
|
+
enrich(options?: {
|
|
661
|
+
text?: string;
|
|
662
|
+
files?: Array<{
|
|
663
|
+
filename: string;
|
|
664
|
+
content_b64: string;
|
|
665
|
+
}>;
|
|
666
|
+
formats?: string[];
|
|
667
|
+
include?: string[];
|
|
668
|
+
stakeholder?: Record<string, unknown>;
|
|
669
|
+
pollIntervalMs?: number;
|
|
670
|
+
timeoutMs?: number;
|
|
671
|
+
/** Called with the live job (`{ status, progress, events }`, each event carrying the % it reached)
|
|
672
|
+
* on every poll — render a live bar / stream the per-reference feed. Polls are billing-exempt. */
|
|
673
|
+
onProgress?: ProgressCallback;
|
|
674
|
+
/** Save the finished report into your Artifact Manager library after it completes (the `/v1` engine
|
|
675
|
+
* returns the report but never persists it) — the one-call equivalent of `enrich` then
|
|
676
|
+
* `artifactManager.saveEnrichment`. When saved, the result also carries `saved`. Usage-exempt. */
|
|
677
|
+
save?: boolean;
|
|
678
|
+
/** File the saved report into this folder id (with `save`). */
|
|
679
|
+
folderId?: string | null;
|
|
680
|
+
/** File the saved report into a NEW folder of this name (with `save`). */
|
|
681
|
+
newFolderName?: string | null;
|
|
682
|
+
}): Promise<Record<string, unknown>>;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* High-level wrapper around the generated Crimson Crawler API client.
|
|
687
|
+
*
|
|
688
|
+
* Configures API-key authentication (`apikey` header), reads connection details
|
|
689
|
+
* from environment variables when not supplied, and provides convenience
|
|
690
|
+
* methods that encode the most common `include=[...]` enrichment chains.
|
|
691
|
+
*
|
|
692
|
+
* Every method sends one request to the configured public API. The wrapper adds
|
|
693
|
+
* no caching, proxying, or extra network hops.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ```ts
|
|
697
|
+
* import { CrawlerClient } from "@crimson-crawler/crimson-crawler-client";
|
|
698
|
+
*
|
|
699
|
+
* const client = new CrawlerClient();
|
|
700
|
+
* const result = await client.enrichCveFull("CVE-2024-3400");
|
|
701
|
+
* console.log(result.cve?.cvss_score);
|
|
702
|
+
* ```
|
|
703
|
+
*/
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Default Crimson Crawler endpoint. `baseUrl` or
|
|
707
|
+
* `CRIMSON_CRAWLER_BASE_URL` selects a custom, self-hosted, or local
|
|
708
|
+
* deployment.
|
|
709
|
+
*/
|
|
710
|
+
declare const BASE_URL = "https://crimsoncrawler.com";
|
|
711
|
+
/** Sized for cold-cache full-chain enrich; reduce for fast-preset workloads. */
|
|
712
|
+
declare const DEFAULT_TIMEOUT_MS = 90000;
|
|
713
|
+
declare const ENV_API_KEY = "CRIMSON_CRAWLER_API_KEY";
|
|
714
|
+
declare const ENV_BASE_URL = "CRIMSON_CRAWLER_BASE_URL";
|
|
715
|
+
declare const ENV_VERIFY_SSL = "CRIMSON_CRAWLER_VERIFY_SSL";
|
|
716
|
+
interface CrawlerClientOptions {
|
|
717
|
+
/**
|
|
718
|
+
* API key. Sent as `apikey` header on every request. Defaults to the
|
|
719
|
+
* `CRIMSON_CRAWLER_API_KEY` env var. Required.
|
|
720
|
+
*/
|
|
721
|
+
apiKey?: string;
|
|
722
|
+
/**
|
|
723
|
+
* API endpoint. Falls back to the `CRIMSON_CRAWLER_BASE_URL` env var,
|
|
724
|
+
* then the hosted `https://crimsoncrawler.com` default. The API key is sent
|
|
725
|
+
* to this origin, so use a local/development key for custom endpoints.
|
|
726
|
+
*/
|
|
727
|
+
baseUrl?: string;
|
|
728
|
+
/**
|
|
729
|
+
* TLS certificate verification toggle. Falls back to the
|
|
730
|
+
* `CRIMSON_CRAWLER_VERIFY_SSL` env var (accepts `false`/`0`/`no` to
|
|
731
|
+
* disable), then to `true`. Prefer trusting the deployment's CA. Set to
|
|
732
|
+
* `false` only for local or isolated self-signed development endpoints.
|
|
733
|
+
*
|
|
734
|
+
* In Node, disabling verification uses a client-scoped undici Agent. Other
|
|
735
|
+
* runtimes reject requests because browser fetch does not expose a
|
|
736
|
+
* per-request TLS verification control.
|
|
737
|
+
*/
|
|
738
|
+
verifySsl?: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* Maximum number of automatic retries per request, applied to safe HTTP
|
|
741
|
+
* methods (`GET`/`HEAD`/`OPTIONS`) only. Mutating requests — including
|
|
742
|
+
* Platform writes and deletes — always make exactly one attempt
|
|
743
|
+
* regardless of this setting. Retries fire on transient failures only:
|
|
744
|
+
* HTTP `429`/`502`/`503`/`504` and network errors. Deterministic failures
|
|
745
|
+
* (other `4xx`, `500`) are never retried. Backoff is exponential with
|
|
746
|
+
* jitter; a `Retry-After` header (e.g. on `429`) is honored over the
|
|
747
|
+
* computed delay.
|
|
748
|
+
*
|
|
749
|
+
* Defaults to `2` (3 total attempts). Set to `0` to disable retries. Must be a
|
|
750
|
+
* non-negative integer — a negative or non-integer value throws `RangeError`.
|
|
751
|
+
*/
|
|
752
|
+
maxRetries?: number;
|
|
753
|
+
/**
|
|
754
|
+
* Also configure Hey API's module-level generated client for direct generated-function calls
|
|
755
|
+
* that omit an explicit `client`. Disabled by default because that singleton is shared across
|
|
756
|
+
* every `CrawlerClient` in the process. Do not enable it in multi-tenant applications.
|
|
757
|
+
*/
|
|
758
|
+
configureGlobalClient?: boolean;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Typed wrapper around the generated Crimson Crawler API client.
|
|
762
|
+
*
|
|
763
|
+
* Each instance owns its own Hey API `Client`, passed explicitly to every generated call, so
|
|
764
|
+
* concurrent clients with different credentials cannot cross-contaminate one another. Direct
|
|
765
|
+
* calls imported from `_generated/sdk.gen` must pass `client: crawler.api`. For single-client
|
|
766
|
+
* scripts only, `configureGlobalClient: true` also configures the generated module singleton.
|
|
767
|
+
*/
|
|
768
|
+
declare class CrawlerClient {
|
|
769
|
+
readonly baseUrl: string;
|
|
770
|
+
readonly verifySsl: boolean;
|
|
771
|
+
readonly maxRetries: number;
|
|
772
|
+
private readonly _client;
|
|
773
|
+
private readonly _artifactManager;
|
|
774
|
+
private readonly _inventoryManager;
|
|
775
|
+
private readonly _enricher;
|
|
776
|
+
private readonly _aiReports;
|
|
777
|
+
constructor(opts?: CrawlerClientOptions);
|
|
778
|
+
/** Underlying Hey API client, scoped to this instance. Use to call any of the 33 endpoints directly. */
|
|
779
|
+
get api(): Client;
|
|
780
|
+
/**
|
|
781
|
+
* The Artifact Manager API (Artifact Manager) — your stored artifacts, enrichment exports,
|
|
782
|
+
* ratings, enrichment-compare, and folders over the same key. Hand-written (the
|
|
783
|
+
* `/artifact-manager/*` surface lives outside the `/v1` OpenAPI contract) and
|
|
784
|
+
* **usage-exempt** — artifactManager calls never count toward your API usage.
|
|
785
|
+
*/
|
|
786
|
+
get artifactManager(): ArtifactManagerApi;
|
|
787
|
+
/**
|
|
788
|
+
* The Inventory Manager API — your monitored inventory context windows (asset inventory + attached
|
|
789
|
+
* artifacts + saved enrichment history) over the same key. Its own section at
|
|
790
|
+
* `/inventory-manager/inventories/*` (outside the `/v1` OpenAPI contract). **Usage-exempt** except
|
|
791
|
+
* `enrichInventory`'s submit, which is enrichment compute and counts toward your usage.
|
|
792
|
+
*/
|
|
793
|
+
get inventoryManager(): InventoryManagerApi;
|
|
794
|
+
/**
|
|
795
|
+
* The Enricher API — the async artifact-enrichment lifecycle (submit → poll → report) over the same
|
|
796
|
+
* key, straight against the `/v1/artifact-enrich` engine. The enrichment submit counts toward usage;
|
|
797
|
+
* polling is the engine's own status read.
|
|
798
|
+
*/
|
|
799
|
+
get enricher(): EnricherApi;
|
|
800
|
+
/**
|
|
801
|
+
* The Report Generator API — generate + manage grounded intelligence reports from
|
|
802
|
+
* your saved artifacts, at `/ai-reports/*` (its own section, outside the `/v1` OpenAPI contract).
|
|
803
|
+
* **Usage-exempt**, including the LLM generation.
|
|
804
|
+
*/
|
|
805
|
+
get aiReports(): AiReportsApi;
|
|
806
|
+
/**
|
|
807
|
+
* Walk the full CVE → CWE → CAPEC → ATT&CK → TIE chain plus MISP/knowledge base/web.
|
|
808
|
+
*
|
|
809
|
+
* @param cveId CVE identifier (e.g. `CVE-2024-3400`).
|
|
810
|
+
* @param include Override the default `CVE_FULL_WALK` chain.
|
|
811
|
+
*/
|
|
812
|
+
enrichCveFull(cveId: string, include?: readonly string[]): Promise<EnrichCveResponse>;
|
|
813
|
+
/**
|
|
814
|
+
* Enrich an IOC against MISP, link to ATT&CK, and add knowledge base/web context.
|
|
815
|
+
*
|
|
816
|
+
* @param value Indicator value (hash, IP, domain, URL).
|
|
817
|
+
* @param iocType MISP-style attribute type — `ip-dst`, `ip-src`, `domain`,
|
|
818
|
+
* `hostname`, `md5`, `sha1`, `sha256`, `url`, etc. Defaults to `ip-dst`.
|
|
819
|
+
* @param include Override the default `IOC_FULL_WALK` chain.
|
|
820
|
+
*/
|
|
821
|
+
enrichIocFull(value: string, iocType?: string, include?: readonly string[]): Promise<EnrichIocResponse>;
|
|
822
|
+
/**
|
|
823
|
+
* Walk CWE → CAPEC → ATT&CK with TIE predictions.
|
|
824
|
+
*
|
|
825
|
+
* @param cweId CWE identifier (e.g. `CWE-79`).
|
|
826
|
+
* @param include Override the default `CWE_FULL_WALK` chain.
|
|
827
|
+
*/
|
|
828
|
+
enrichCweFull(cweId: string, include?: readonly string[]): Promise<EnrichCweResponse>;
|
|
829
|
+
/**
|
|
830
|
+
* Enrich one or more ATT&CK techniques with TIE, adversary attribution,
|
|
831
|
+
* and Navigator JSON.
|
|
832
|
+
*
|
|
833
|
+
* @param techniqueIds ATT&CK technique IDs (e.g. `["T1190", "T1059.001"]`).
|
|
834
|
+
* @param framework ATT&CK matrix variant — `enterprise`, `ics`, or `mobile`.
|
|
835
|
+
* @param include Override the default `TECHNIQUE_FULL` chain.
|
|
836
|
+
*/
|
|
837
|
+
enrichTechniqueFull(techniqueIds: string[], framework?: "enterprise" | "ics" | "mobile", include?: readonly string[]): Promise<EnrichTechniqueResponse>;
|
|
838
|
+
/**
|
|
839
|
+
* Find vulnerabilities affecting a product/version and enrich each matched CVE.
|
|
840
|
+
*
|
|
841
|
+
* @param product Product name (e.g. `"Apache HTTP Server"`, `"nginx"`).
|
|
842
|
+
* @param options Optional `version`, `vendor`, and `include` overrides.
|
|
843
|
+
*/
|
|
844
|
+
enrichProductFull(product: string, options?: {
|
|
845
|
+
version?: string;
|
|
846
|
+
vendor?: string;
|
|
847
|
+
include?: readonly string[];
|
|
848
|
+
}): Promise<EnrichProductResponse>;
|
|
849
|
+
/**
|
|
850
|
+
* Enrich an open-source package — OSV.dev advisories + full CVE enrichment.
|
|
851
|
+
*
|
|
852
|
+
* The package-ecosystem sibling of {@link enrichProductFull}: OSV.dev supplies the
|
|
853
|
+
* package's advisories, and the CVEs they alias are enriched through the same
|
|
854
|
+
* CWE→CAPEC→ATT&CK + EPSS/KEV chain. Covers the dependency-vuln surface (npm /
|
|
855
|
+
* PyPI / Go / Maven / crates.io / …) the CPE-keyed product endpoint can't reach.
|
|
856
|
+
*
|
|
857
|
+
* @param ecosystem Package ecosystem (e.g. `"PyPI"`, `"npm"`, `"Go"`).
|
|
858
|
+
* @param packageName Package name as published in its registry (e.g. `"django"`).
|
|
859
|
+
* @param options Optional `version` and `include` overrides.
|
|
860
|
+
*/
|
|
861
|
+
enrichPackageFull(ecosystem: string, packageName: string, options?: {
|
|
862
|
+
version?: string;
|
|
863
|
+
include?: readonly string[];
|
|
864
|
+
}): Promise<EnrichPackageResponse>;
|
|
865
|
+
/**
|
|
866
|
+
* Keyword-search the ATT&CK knowledge base for matching techniques.
|
|
867
|
+
*
|
|
868
|
+
* A convenience wrapper over the generated `search_cti` endpoint, scoped to
|
|
869
|
+
* ATT&CK attack-patterns. Replaces the raw escape hatch callers previously
|
|
870
|
+
* used to hand-build the request.
|
|
871
|
+
*
|
|
872
|
+
* @param keyword Free-text query (e.g. `"phishing"`, `"credential dumping"`).
|
|
873
|
+
* @param options Optional `limit` (1-100, default 20).
|
|
874
|
+
*/
|
|
875
|
+
searchTechniques(keyword: string, options?: {
|
|
876
|
+
limit?: number;
|
|
877
|
+
}): Promise<SearchCtiResponse>;
|
|
878
|
+
/**
|
|
879
|
+
* Walk an ATLAS adversarial-ML technique to its ATT&CK mappings and adversary graph.
|
|
880
|
+
*
|
|
881
|
+
* @param techniqueId ATLAS technique ID (e.g. `AML.T0043`).
|
|
882
|
+
* @param options Optional `search` keyword and `include` override (default `ATLAS_FULL`).
|
|
883
|
+
*/
|
|
884
|
+
enrichAtlasFull(techniqueId?: string, options?: {
|
|
885
|
+
search?: string;
|
|
886
|
+
include?: readonly string[];
|
|
887
|
+
}): Promise<EnrichAtlasResponse>;
|
|
888
|
+
/**
|
|
889
|
+
* Walk a threat campaign to its techniques, the groups behind it, and the CVEs it exploited.
|
|
890
|
+
*
|
|
891
|
+
* @param campaignId ATT&CK campaign ID (e.g. `C0011`).
|
|
892
|
+
* @param options Optional `search` keyword, `framework` matrix, and `include`
|
|
893
|
+
* override (default `CAMPAIGN_FULL`).
|
|
894
|
+
*/
|
|
895
|
+
enrichCampaignFull(campaignId?: string, options?: {
|
|
896
|
+
search?: string;
|
|
897
|
+
framework?: "enterprise" | "ics" | "mobile";
|
|
898
|
+
include?: readonly string[];
|
|
899
|
+
}): Promise<EnrichCampaignResponse>;
|
|
900
|
+
/**
|
|
901
|
+
* Walk a CAPEC attack pattern to its ATT&CK techniques, exploitable CVEs, and adversaries.
|
|
902
|
+
*
|
|
903
|
+
* @param capecId CAPEC identifier (e.g. `CAPEC-66`).
|
|
904
|
+
* @param options Optional `search` keyword and `include` override (default `CAPEC_FULL`).
|
|
905
|
+
*/
|
|
906
|
+
enrichCapecFull(capecId?: string, options?: {
|
|
907
|
+
search?: string;
|
|
908
|
+
include?: readonly string[];
|
|
909
|
+
}): Promise<EnrichCapecResponse>;
|
|
910
|
+
/**
|
|
911
|
+
* Resolve a D3FEND defensive technique and the offensive techniques it counters.
|
|
912
|
+
*
|
|
913
|
+
* @param d3fendId D3FEND identifier (e.g. `D3-NTA`).
|
|
914
|
+
* @param options Optional `search` keyword and `include` override (default `DEFEND_FULL`).
|
|
915
|
+
*/
|
|
916
|
+
enrichDefendFull(d3fendId?: string, options?: {
|
|
917
|
+
search?: string;
|
|
918
|
+
include?: readonly string[];
|
|
919
|
+
}): Promise<EnrichDefendResponse>;
|
|
920
|
+
/**
|
|
921
|
+
* Walk a DISARM disinformation technique to its countermeasures and ATT&CK mappings.
|
|
922
|
+
*
|
|
923
|
+
* @param techniqueId DISARM technique ID (e.g. `T0086`).
|
|
924
|
+
* @param options Optional `search` keyword and `include` override (default `DISARM_FULL`).
|
|
925
|
+
*/
|
|
926
|
+
enrichDisarmFull(techniqueId?: string, options?: {
|
|
927
|
+
search?: string;
|
|
928
|
+
include?: readonly string[];
|
|
929
|
+
}): Promise<EnrichDisarmResponse>;
|
|
930
|
+
/**
|
|
931
|
+
* Profile a threat actor: techniques, tooling, campaigns, exploited CVEs, and targeting.
|
|
932
|
+
*
|
|
933
|
+
* @param groupId ATT&CK group ID (e.g. `G0016`).
|
|
934
|
+
* @param options Optional `search` keyword, `framework` matrix, and `include`
|
|
935
|
+
* override (default `GROUP_FULL`).
|
|
936
|
+
*/
|
|
937
|
+
enrichGroupFull(groupId?: string, options?: {
|
|
938
|
+
search?: string;
|
|
939
|
+
framework?: "enterprise" | "ics" | "mobile";
|
|
940
|
+
include?: readonly string[];
|
|
941
|
+
}): Promise<EnrichGroupResponse>;
|
|
942
|
+
/**
|
|
943
|
+
* Map a region's threat landscape — active groups, their techniques, and affected sectors.
|
|
944
|
+
*
|
|
945
|
+
* @param locationId Region identifier (e.g. `UA`, or an ATT&CK location STIX ID).
|
|
946
|
+
* @param options Optional `search` keyword and `include` override (default `LOCATION_FULL`).
|
|
947
|
+
*/
|
|
948
|
+
enrichLocationFull(locationId?: string, options?: {
|
|
949
|
+
search?: string;
|
|
950
|
+
include?: readonly string[];
|
|
951
|
+
}): Promise<EnrichLocationResponse>;
|
|
952
|
+
/**
|
|
953
|
+
* Map an industry sector's threat landscape — who targets it, how, and from where.
|
|
954
|
+
*
|
|
955
|
+
* @param sectorId Sector identifier (e.g. `energy`, or an ATT&CK sector STIX ID).
|
|
956
|
+
* @param options Optional `search` keyword and `include` override (default `SECTOR_FULL`).
|
|
957
|
+
*/
|
|
958
|
+
enrichSectorFull(sectorId?: string, options?: {
|
|
959
|
+
search?: string;
|
|
960
|
+
include?: readonly string[];
|
|
961
|
+
}): Promise<EnrichSectorResponse>;
|
|
962
|
+
/**
|
|
963
|
+
* Profile malware or a tool: the techniques it implements, who uses it, what it exploits.
|
|
964
|
+
*
|
|
965
|
+
* @param softwareId ATT&CK software ID (e.g. `S0002`).
|
|
966
|
+
* @param options Optional `search` keyword, `framework` matrix, and `include`
|
|
967
|
+
* override (default `SOFTWARE_FULL`).
|
|
968
|
+
*/
|
|
969
|
+
enrichSoftwareFull(softwareId?: string, options?: {
|
|
970
|
+
search?: string;
|
|
971
|
+
framework?: "enterprise" | "ics" | "mobile";
|
|
972
|
+
include?: readonly string[];
|
|
973
|
+
}): Promise<EnrichSoftwareResponse>;
|
|
974
|
+
/**
|
|
975
|
+
* Enrich a heterogeneous list of artifacts in one round trip.
|
|
976
|
+
*
|
|
977
|
+
* Each item carries its own `type` discriminator and per-item `include`, so a
|
|
978
|
+
* single call can mix CVEs, products, packages, techniques, IOCs, and more.
|
|
979
|
+
* Prefer this over N single-artifact calls: the server fans out internally and
|
|
980
|
+
* shares upstream lookups across the batch.
|
|
981
|
+
*
|
|
982
|
+
* @param items Discriminated batch items (`{ type: "cve", cve_id: "..." }`, …).
|
|
983
|
+
*/
|
|
984
|
+
enrichBatch(items: EnrichBatchRequest["items"]): Promise<EnrichBatchResponse>;
|
|
985
|
+
/**
|
|
986
|
+
* Fetch the source of a public proof-of-concept exploit repository.
|
|
987
|
+
*
|
|
988
|
+
* Retrieves the code behind a PoC reference (as surfaced by the `poc` enrichment
|
|
989
|
+
* layer) so it can be reviewed without leaving the API.
|
|
990
|
+
*
|
|
991
|
+
* @param repoUrl Public repository URL of the PoC.
|
|
992
|
+
*/
|
|
993
|
+
enrichPocSource(repoUrl: string): Promise<EnrichPocSourceResponse>;
|
|
994
|
+
/**
|
|
995
|
+
* Score your exposure to specific threat actors.
|
|
996
|
+
*
|
|
997
|
+
* Supply `groupIds`, `search` terms, or both; the server rejects a request
|
|
998
|
+
* carrying neither with `422`.
|
|
999
|
+
*
|
|
1000
|
+
* @param options `groupIds`, `search` terms, `framework` matrix, and `include` layers.
|
|
1001
|
+
*/
|
|
1002
|
+
assessGroupExposure(options?: {
|
|
1003
|
+
groupIds?: readonly string[];
|
|
1004
|
+
search?: readonly string[];
|
|
1005
|
+
framework?: "enterprise" | "ics" | "mobile";
|
|
1006
|
+
include?: readonly string[];
|
|
1007
|
+
}): Promise<AssessGroupExposureResponse>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Assess a portfolio of indicators — MISP corroboration, linked techniques, attribution.
|
|
1010
|
+
*
|
|
1011
|
+
* @param indicators Indicator objects, each `{ value, type? }` (`type` defaults to `ip-dst`).
|
|
1012
|
+
* @param options Optional `include` layers.
|
|
1013
|
+
*/
|
|
1014
|
+
assessIocPortfolio(indicators: AssessIocPortfolioRequest["indicators"], options?: {
|
|
1015
|
+
include?: readonly string[];
|
|
1016
|
+
}): Promise<AssessIocPortfolioResponse>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Score detection and mitigation coverage across a set of ATT&CK techniques.
|
|
1019
|
+
*
|
|
1020
|
+
* @param techniqueIds ATT&CK technique IDs (e.g. `["T1190", "T1059.001"]`).
|
|
1021
|
+
* @param options Optional `framework` matrix and `include` layers.
|
|
1022
|
+
*/
|
|
1023
|
+
assessTechniqueCoverage(techniqueIds: readonly string[], options?: {
|
|
1024
|
+
framework?: "enterprise" | "ics" | "mobile";
|
|
1025
|
+
include?: readonly string[];
|
|
1026
|
+
}): Promise<AssessTechniqueCoverageResponse>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Prioritize a set of CVEs — weaponization, exploit chains, and remediation order.
|
|
1029
|
+
*
|
|
1030
|
+
* @param cveIds CVE identifiers to assess.
|
|
1031
|
+
* @param options Optional `include` layers and an SSVC `stakeholder` profile that
|
|
1032
|
+
* tunes the decision to your deployment.
|
|
1033
|
+
*/
|
|
1034
|
+
assessVulnerabilityExposure(cveIds: readonly string[], options?: {
|
|
1035
|
+
include?: readonly string[];
|
|
1036
|
+
stakeholder?: ArtifactEnrichmentStakeholder;
|
|
1037
|
+
}): Promise<AssessVulnerabilityExposureResponse>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Search the CTI knowledge bases — ATT&CK, CWE, CAPEC, ATLAS, DISARM, and more.
|
|
1040
|
+
*
|
|
1041
|
+
* The unscoped sibling of {@link searchTechniques}: use this to reach any object
|
|
1042
|
+
* type across any source, and `searchTechniques` for the common ATT&CK-only case.
|
|
1043
|
+
*
|
|
1044
|
+
* @param query Free-text query.
|
|
1045
|
+
* @param options `sources`, `types`, `limit`, `page`, and the `deprecated`/`revoked` filters.
|
|
1046
|
+
*/
|
|
1047
|
+
searchCti(query: string, options?: {
|
|
1048
|
+
sources?: readonly string[];
|
|
1049
|
+
types?: NonNullable<SearchCtiRequest["types"]>;
|
|
1050
|
+
limit?: number;
|
|
1051
|
+
page?: number;
|
|
1052
|
+
deprecated?: boolean;
|
|
1053
|
+
revoked?: boolean;
|
|
1054
|
+
}): Promise<SearchCtiResponse>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Search the vulnerability corpus by identifier, mapping, score, or date window.
|
|
1057
|
+
*
|
|
1058
|
+
* Every filter is optional and they compose: a bare call returns the newest
|
|
1059
|
+
* CVEs, while `{ kevOnly: true, epssMin: 0.5 }` narrows to actively exploited,
|
|
1060
|
+
* high-probability ones.
|
|
1061
|
+
*
|
|
1062
|
+
* @param query Free-text query. Omit it to filter purely on the structured fields.
|
|
1063
|
+
* @param options Any combination of the corpus filters, plus `sort`, `limit`, `page`.
|
|
1064
|
+
*/
|
|
1065
|
+
searchCve(query?: string, options?: {
|
|
1066
|
+
cveId?: string;
|
|
1067
|
+
stixId?: string;
|
|
1068
|
+
cweId?: string;
|
|
1069
|
+
capecId?: string;
|
|
1070
|
+
attackId?: string;
|
|
1071
|
+
cpe?: string;
|
|
1072
|
+
cpesNotVulnerable?: string;
|
|
1073
|
+
createdByRef?: string;
|
|
1074
|
+
createdMin?: string;
|
|
1075
|
+
createdMax?: string;
|
|
1076
|
+
modifiedMin?: string;
|
|
1077
|
+
modifiedMax?: string;
|
|
1078
|
+
cvssMin?: number;
|
|
1079
|
+
cvssV2Min?: number;
|
|
1080
|
+
cvssV4Min?: number;
|
|
1081
|
+
epssMin?: number;
|
|
1082
|
+
epssPercentileMin?: number;
|
|
1083
|
+
kevOnly?: boolean;
|
|
1084
|
+
vulnStatus?: NonNullable<SearchCveRequest["vuln_status"]>;
|
|
1085
|
+
sort?: NonNullable<SearchCveRequest["sort"]>;
|
|
1086
|
+
include?: readonly string[];
|
|
1087
|
+
limit?: number;
|
|
1088
|
+
page?: number;
|
|
1089
|
+
}): Promise<SearchCveResponse>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Search the D3FEND defensive-countermeasure ontology.
|
|
1092
|
+
*
|
|
1093
|
+
* @param query Free-text query (e.g. `"network traffic analysis"`).
|
|
1094
|
+
* @param options `d3fendForm` to scope to a tactic/mitigation/artifact, plus `limit`, `page`.
|
|
1095
|
+
*/
|
|
1096
|
+
searchD3fend(query: string, options?: {
|
|
1097
|
+
d3fendForm?: NonNullable<SearchD3FendRequest["d3fend_form"]>;
|
|
1098
|
+
limit?: number;
|
|
1099
|
+
page?: number;
|
|
1100
|
+
}): Promise<SearchD3FendResponse>;
|
|
1101
|
+
/**
|
|
1102
|
+
* Search CISA's Known Exploited Vulnerabilities catalog.
|
|
1103
|
+
*
|
|
1104
|
+
* An empty call pages the whole catalog; `cveId` checks one CVE's KEV status.
|
|
1105
|
+
*
|
|
1106
|
+
* @param options `cveId`, `ransomwareStatus`, `limit`, `page`.
|
|
1107
|
+
*/
|
|
1108
|
+
searchKev(options?: {
|
|
1109
|
+
cveId?: string;
|
|
1110
|
+
ransomwareStatus?: NonNullable<SearchKevRequest["ransomware_status"]>;
|
|
1111
|
+
limit?: number;
|
|
1112
|
+
page?: number;
|
|
1113
|
+
}): Promise<SearchKevResponse>;
|
|
1114
|
+
/**
|
|
1115
|
+
* Hybrid-search the curated security knowledge base.
|
|
1116
|
+
*
|
|
1117
|
+
* @param query Natural-language question or keyword set.
|
|
1118
|
+
* @param options `collections` to search, `alpha` to trade keyword vs. vector
|
|
1119
|
+
* weighting (0 = pure vector, 1 = pure keyword), and `limit`.
|
|
1120
|
+
*/
|
|
1121
|
+
searchKnowledgebase(query: string, options?: {
|
|
1122
|
+
collections?: SearchKnowledgebaseRequest["collections"];
|
|
1123
|
+
alpha?: number;
|
|
1124
|
+
limit?: number;
|
|
1125
|
+
}): Promise<SearchKnowledgebaseResponse>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Search MISP events and attributes.
|
|
1128
|
+
*
|
|
1129
|
+
* @param options Attribute filters (`value`, `typeAttribute`, `category`, `toIds`),
|
|
1130
|
+
* event filters (`eventId`, `eventinfo`, `tags`, `threatLevelId`, `published`),
|
|
1131
|
+
* a `dateFrom`/`dateTo` window, plus `limit` and `page`.
|
|
1132
|
+
*/
|
|
1133
|
+
searchMisp(options?: {
|
|
1134
|
+
value?: string;
|
|
1135
|
+
typeAttribute?: string;
|
|
1136
|
+
category?: string;
|
|
1137
|
+
toIds?: boolean;
|
|
1138
|
+
eventId?: string;
|
|
1139
|
+
eventinfo?: string;
|
|
1140
|
+
tags?: readonly string[];
|
|
1141
|
+
threatLevelId?: string;
|
|
1142
|
+
published?: boolean;
|
|
1143
|
+
dateFrom?: string;
|
|
1144
|
+
dateTo?: string;
|
|
1145
|
+
limit?: number;
|
|
1146
|
+
page?: number;
|
|
1147
|
+
}): Promise<SearchMispResponse>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Find public proof-of-concept exploits for a CVE.
|
|
1150
|
+
*
|
|
1151
|
+
* Pair with {@link enrichPocSource} to pull the code behind a match.
|
|
1152
|
+
*
|
|
1153
|
+
* @param cveId CVE identifier (e.g. `CVE-2024-3400`).
|
|
1154
|
+
* @param options Optional `limit` (default 25).
|
|
1155
|
+
*/
|
|
1156
|
+
searchPoc(cveId: string, options?: {
|
|
1157
|
+
limit?: number;
|
|
1158
|
+
}): Promise<SearchPocResponse>;
|
|
1159
|
+
/**
|
|
1160
|
+
* List the products a vendor ships, as known to the CPE dictionary.
|
|
1161
|
+
*
|
|
1162
|
+
* Use it to resolve the exact product string {@link enrichProductFull} expects.
|
|
1163
|
+
*
|
|
1164
|
+
* @param vendor Vendor name (e.g. `"microsoft"`).
|
|
1165
|
+
* @param options Optional `limit` (default 50).
|
|
1166
|
+
*/
|
|
1167
|
+
searchVendor(vendor: string, options?: {
|
|
1168
|
+
limit?: number;
|
|
1169
|
+
}): Promise<SearchVendorResponse>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Submit documents and/or text to the async artifact-enrichment engine.
|
|
1172
|
+
*
|
|
1173
|
+
* Returns immediately with an `enrichment_id` — poll {@link artifactEnrichStatus}
|
|
1174
|
+
* for the result, or use {@link enricher} to run the whole lifecycle.
|
|
1175
|
+
*
|
|
1176
|
+
* @param options `text` and/or base64 `files` to analyze, output `formats`,
|
|
1177
|
+
* report `include` sections, and an SSVC `stakeholder` profile.
|
|
1178
|
+
*/
|
|
1179
|
+
artifactEnrich(options?: {
|
|
1180
|
+
text?: string;
|
|
1181
|
+
files?: ArtifactEnrichmentDocRequest["files"];
|
|
1182
|
+
formats?: ArtifactEnrichmentDocRequest["formats"];
|
|
1183
|
+
include?: readonly string[];
|
|
1184
|
+
stakeholder?: ArtifactEnrichmentStakeholder;
|
|
1185
|
+
}): Promise<ArtifactEnrichResponse>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Read the progress or result of an artifact enrichment.
|
|
1188
|
+
*
|
|
1189
|
+
* @param enrichmentId The `enrichment_id` returned by {@link artifactEnrich}.
|
|
1190
|
+
*/
|
|
1191
|
+
artifactEnrichStatus(enrichmentId: string): Promise<ArtifactEnrichStatusResponse>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Submit an asset inventory to the async inventory-enrichment engine.
|
|
1194
|
+
*
|
|
1195
|
+
* Returns immediately with an `enrichment_id` — poll {@link inventoryEnrichStatus}
|
|
1196
|
+
* for the result. Enriches each asset's CVEs and rolls the findings up to a
|
|
1197
|
+
* fleet-level risk picture.
|
|
1198
|
+
*
|
|
1199
|
+
* @param items Assets to enrich, each at minimum `{ product }`.
|
|
1200
|
+
* @param options Optional `attachmentsText`/`attachmentsFiles` for extra context
|
|
1201
|
+
* and per-asset CVE `include` layers.
|
|
1202
|
+
*/
|
|
1203
|
+
inventoryEnrich(items: readonly InventoryAsset[], options?: {
|
|
1204
|
+
attachmentsText?: string;
|
|
1205
|
+
attachmentsFiles?: ArtifactEnrichmentDocRequest["files"];
|
|
1206
|
+
include?: readonly string[];
|
|
1207
|
+
}): Promise<InventoryEnrichResponse>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Read the progress or result of an inventory enrichment.
|
|
1210
|
+
*
|
|
1211
|
+
* @param enrichmentId The `enrichment_id` returned by {@link inventoryEnrich}.
|
|
1212
|
+
*/
|
|
1213
|
+
inventoryEnrichStatus(enrichmentId: string): Promise<InventoryEnrichStatusResponse>;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* Exception types for the Crimson Crawler client.
|
|
1218
|
+
*
|
|
1219
|
+
* Callers should catch `CrawlerClientError` to handle any client-raised
|
|
1220
|
+
* problem.
|
|
1221
|
+
*/
|
|
1222
|
+
declare class CrawlerClientError extends Error {
|
|
1223
|
+
constructor(message: string);
|
|
1224
|
+
}
|
|
1225
|
+
declare class MissingCredentials extends CrawlerClientError {
|
|
1226
|
+
constructor(message: string);
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Raised when the server returns a non-success status that the wrapper
|
|
1230
|
+
* surfaces as an error rather than letting it pass through silently.
|
|
1231
|
+
*
|
|
1232
|
+
* Wraps the underlying response so callers can inspect status + body.
|
|
1233
|
+
*/
|
|
1234
|
+
declare class UnexpectedStatus extends CrawlerClientError {
|
|
1235
|
+
readonly status: number;
|
|
1236
|
+
readonly body: unknown;
|
|
1237
|
+
constructor(status: number, body: unknown, message?: string);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Scan → briefing ingest — the TypeScript SDK's copy of the **ingest component**.
|
|
1242
|
+
*
|
|
1243
|
+
* One ingest file per client, kept logically IDENTICAL across them so the scan→briefing workflow reads the
|
|
1244
|
+
* same everywhere: this TS SDK copy, the Python SDK's `ingest.py`, the CLI's `ingest.py`, and the MCP's
|
|
1245
|
+
* `ingest.py` (same logic over its own transport + a bounded poll). `InventoryManagerApi.ingestScan`
|
|
1246
|
+
* delegates here, using the SDK's `parseScan` + `enrichItems`.
|
|
1247
|
+
*
|
|
1248
|
+
* • `assembleBriefing` — PURE (no I/O): turns a `/v1/inventory-enrich` result into a briefing by attaching a
|
|
1249
|
+
* top-N KEV-first `recommended_actions` list (the engine already ranks per-asset findings).
|
|
1250
|
+
* • `ingestScan` — the orchestration: parse the scan (usage-exempt) → enrich the assets (one billable
|
|
1251
|
+
* `/v1/inventory-enrich` submit) → assemble. Takes the live `InventoryManagerApi` and uses its
|
|
1252
|
+
* `parseScan` + `enrichItems`, so the HTTP/key/retry transport stays in the SDK client.
|
|
1253
|
+
*/
|
|
1254
|
+
|
|
1255
|
+
/** Turn a `/v1/inventory-enrich` result into a scan **briefing** — the engine already ranks per-asset
|
|
1256
|
+
* findings KEV-first, so this just attaches a top-N `recommended_actions` list (highest-priority CVEs
|
|
1257
|
+
* across all assets, KEV first then weaponization, deduped). Mirrors the Python `assemble_briefing`. Pure. */
|
|
1258
|
+
declare function assembleBriefing(report: Record<string, unknown>, meta: {
|
|
1259
|
+
format: string;
|
|
1260
|
+
parsedCount: number;
|
|
1261
|
+
truncated: unknown;
|
|
1262
|
+
enrichmentId: unknown;
|
|
1263
|
+
}): Record<string, unknown>;
|
|
1264
|
+
/** Parse a scan FILE (server-side, all 11 formats) → enrich the assets against `/v1/inventory-enrich` →
|
|
1265
|
+
* assemble a briefing. An empty parse short-circuits. Mirrors the Python `ingest_scan`. */
|
|
1266
|
+
declare function ingestScan(invApi: InventoryManagerApi, content: string | Uint8Array, format: string, options?: {
|
|
1267
|
+
include?: string[];
|
|
1268
|
+
pollIntervalMs?: number;
|
|
1269
|
+
timeoutMs?: number;
|
|
1270
|
+
onProgress?: ProgressCallback;
|
|
1271
|
+
}): Promise<Record<string, unknown>>;
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Crimson Crawler API client.
|
|
1275
|
+
*
|
|
1276
|
+
* Typed TypeScript wrapper for the Crimson Crawler v1 API. Built on top of an
|
|
1277
|
+
* `@hey-api/openapi-ts` codegen layer; adds API-key authentication, sensible
|
|
1278
|
+
* defaults, and convenience methods for the most common enrichment chains.
|
|
1279
|
+
*/
|
|
1280
|
+
|
|
1281
|
+
declare const __version__: string;
|
|
1282
|
+
|
|
1283
|
+
export { AiReportsApi, ArtifactManagerApi, type ArtifactManagerArtifact, type ArtifactManagerExport, type ArtifactManagerFolder, type ArtifactManagerRating, type ArtifactManagerRawArtifact, type AttachmentOmission, BASE_URL, CrawlerClient, CrawlerClientError, type CrawlerClientOptions, DEFAULT_TIMEOUT_MS, ENV_API_KEY, ENV_BASE_URL, ENV_VERIFY_SSL, EnricherApi, InventoryManagerApi, type InventoryOptions, MissingCredentials, UnexpectedStatus, __version__, assembleBriefing, ingestScan };
|