@crimson-crawler/crimson-crawler-client 4.1.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,56 @@
1
1
  'use strict';
2
2
 
3
- var chunk4PCL3ANB_cjs = require('./chunk-4PCL3ANB.cjs');
4
- var chunk4HSWOQA6_cjs = require('./chunk-4HSWOQA6.cjs');
3
+ var chunkTAMKRTM6_cjs = require('./chunk-TAMKRTM6.cjs');
4
+ var chunkASYQPVBW_cjs = require('./chunk-ASYQPVBW.cjs');
5
5
  var chunk4CXMKUDH_cjs = require('./chunk-4CXMKUDH.cjs');
6
6
  require('./chunk-75ZPJI57.cjs');
7
7
 
8
+ // src/cve-catalog.ts
9
+ function resolve(entries, keys) {
10
+ return keys.map((key) => {
11
+ if (typeof key !== "string" || !entries || !Object.hasOwn(entries, key)) {
12
+ throw new Error("Invalid CVE context catalogue reference");
13
+ }
14
+ return entries[key];
15
+ });
16
+ }
17
+ function expandCveContext(page) {
18
+ if (!("cve_context_catalog" in page)) {
19
+ if ((page.cves ?? []).some(
20
+ (row) => Object.keys(row.catalog_refs ?? {}).length
21
+ )) {
22
+ throw new Error("Invalid CVE context catalogue reference");
23
+ }
24
+ return page;
25
+ }
26
+ const catalog = page.cve_context_catalog ?? {};
27
+ for (const row of page.cves ?? []) {
28
+ for (const [field, keys] of Object.entries(row.catalog_refs ?? {})) {
29
+ if (!Array.isArray(keys))
30
+ throw new Error("Invalid CVE context catalogue reference");
31
+ switch (field) {
32
+ case "attack_patterns":
33
+ row.attack_patterns = resolve(catalog.attack_patterns, keys);
34
+ break;
35
+ case "techniques":
36
+ row.techniques = resolve(catalog.techniques, keys);
37
+ break;
38
+ case "mitigations":
39
+ row.mitigations = resolve(catalog.mitigations, keys);
40
+ break;
41
+ case "weaknesses":
42
+ row.weaknesses = resolve(catalog.weaknesses, keys);
43
+ break;
44
+ default:
45
+ throw new Error("Invalid CVE context catalogue reference");
46
+ }
47
+ }
48
+ row.catalog_refs = {};
49
+ }
50
+ page.cve_context_catalog = {};
51
+ return page;
52
+ }
53
+
8
54
  // src/exceptions.ts
9
55
  var CrawlerClientError = class extends Error {
10
56
  constructor(message) {
@@ -29,6 +75,76 @@ var UnexpectedStatus = class extends CrawlerClientError {
29
75
  body;
30
76
  };
31
77
 
78
+ // src/paging.ts
79
+ function snapshotExpired(error) {
80
+ if (!(error instanceof UnexpectedStatus) || error.status !== 409)
81
+ return false;
82
+ let body = error.body;
83
+ if (typeof body === "string") {
84
+ try {
85
+ body = JSON.parse(body);
86
+ } catch {
87
+ return false;
88
+ }
89
+ }
90
+ if (!body || typeof body !== "object") return false;
91
+ const value = body;
92
+ return value.error === "snapshot_expired" || value.detail?.error === "snapshot_expired";
93
+ }
94
+ async function collectSnapshotPages(fetch, nextOffset) {
95
+ for (let attempt = 0; ; attempt++) {
96
+ const pages = [];
97
+ let offset = 0;
98
+ let snapshotId;
99
+ try {
100
+ for (; ; ) {
101
+ const page = await fetch(offset, snapshotId);
102
+ const current = page.snapshot_id ?? void 0;
103
+ const next = nextOffset(page);
104
+ if (current !== void 0 && (typeof current !== "string" || !current) || snapshotId !== void 0 && current !== snapshotId || next != null && current === void 0) {
105
+ throw new Error("Enrichment returned an invalid snapshot identifier");
106
+ }
107
+ snapshotId = current;
108
+ pages.push(page);
109
+ if (next == null) return pages;
110
+ if (!Number.isInteger(next) || next <= offset) {
111
+ throw new Error("Enrichment returned an invalid next offset");
112
+ }
113
+ offset = next;
114
+ }
115
+ } catch (error) {
116
+ if (attempt === 0 && snapshotExpired(error)) continue;
117
+ throw error;
118
+ }
119
+ }
120
+ }
121
+ async function* iterOsvPages(fetch) {
122
+ let offset = 0;
123
+ let snapshotId;
124
+ for (; ; ) {
125
+ const page = await fetch(offset, snapshotId);
126
+ if (snapshotId !== void 0 && page.errors?.some(
127
+ (error) => error.service === "osv" && error.error === "stored_copy_unavailable"
128
+ )) {
129
+ throw new Error("stored_copy_unavailable");
130
+ }
131
+ const current = page.osv_snapshot_id ?? void 0;
132
+ const next = page.osv_next_offset;
133
+ if (current !== void 0 && (typeof current !== "string" || !current) || current !== void 0 && snapshotId !== void 0 && current !== snapshotId) {
134
+ throw new Error("Enrichment returned an invalid OSV snapshot identifier");
135
+ }
136
+ if (next != null) {
137
+ if (current === void 0 || !Number.isInteger(next) || next < 0 || snapshotId !== void 0 && next <= offset) {
138
+ throw new Error("Enrichment returned an invalid OSV continuation");
139
+ }
140
+ }
141
+ yield page;
142
+ if (next == null) return;
143
+ offset = next;
144
+ snapshotId = current;
145
+ }
146
+ }
147
+
32
148
  // src/_auth.ts
33
149
  function withApiKeyHeader(input, init, headerName, apiKey, origin) {
34
150
  const inherited = init?.headers ?? (input instanceof Request ? input.headers : void 0);
@@ -46,6 +162,21 @@ function withApiKeyHeader(input, init, headerName, apiKey, origin) {
46
162
  return headers;
47
163
  }
48
164
 
165
+ // src/tlp.ts
166
+ var TLP_VALUES = [
167
+ "CLEAR",
168
+ "GREEN",
169
+ "AMBER",
170
+ "AMBER+STRICT",
171
+ "RED"
172
+ ];
173
+ var TLP_INVALID_MESSAGE = `tlp must be one of ${TLP_VALUES.join(", ")}`;
174
+ function validateTlp(value) {
175
+ if (value === void 0) return void 0;
176
+ if (TLP_VALUES.includes(value)) return value;
177
+ throw new RangeError(TLP_INVALID_MESSAGE);
178
+ }
179
+
49
180
  // src/url.ts
50
181
  function pathSegment(value) {
51
182
  return encodeURIComponent(value);
@@ -100,6 +231,28 @@ function downloadFilename(disposition, fallback) {
100
231
  }
101
232
  return basename;
102
233
  }
234
+ var STOP_STATUSES = {
235
+ 502: "generation failed",
236
+ 402: "no AI provider",
237
+ 429: "rate limited"
238
+ };
239
+ var QUOTA_ERROR = "report_inference_quota_exceeded";
240
+ function errorCode(body) {
241
+ let parsed = body;
242
+ if (typeof body === "string") {
243
+ try {
244
+ parsed = JSON.parse(body);
245
+ } catch {
246
+ return void 0;
247
+ }
248
+ }
249
+ return parsed && typeof parsed === "object" ? parsed.error : void 0;
250
+ }
251
+ function stopNote(err) {
252
+ if (err.status === 429 && errorCode(err.body) === QUOTA_ERROR)
253
+ return "quota exhausted";
254
+ return STOP_STATUSES[err.status];
255
+ }
103
256
  var AiReportsApi = class {
104
257
  baseUrl;
105
258
  // True ES2022 private field, not TypeScript `private`: `private` is erased at compile
@@ -177,12 +330,19 @@ var AiReportsApi = class {
177
330
  * Create a DRAFT report from a template + source artifacts. Renders the scaffold (static +
178
331
  * deterministic data sections) and returns the list of AI sections still to fill.
179
332
  *
180
- * Resolves `{ id, name, html, ai_sections: [{section_type, label, ...}], skipped: [...] }`.
333
+ * `tlp` is an optional TLP 2.0 marking stored on the report exactly (`CLEAR` / `GREEN` / `AMBER` /
334
+ * `AMBER+STRICT` / `RED`). Omit it to use your default report TLP (the Report Generator's
335
+ * Settings), raised to the most restrictive source marking. An invalid value throws `RangeError`
336
+ * before any request.
337
+ *
338
+ * Resolves `{ id, name, html, ai_sections: [{section_type, label, ...}], skipped: [...], tlp }`.
181
339
  */
182
340
  async createDraft(template, options = {}) {
341
+ const tlp = validateTlp(options.tlp);
183
342
  const body = { template };
184
343
  if (options.sourceIds !== void 0) body.source_ids = options.sourceIds;
185
344
  if (options.name !== void 0) body.name = options.name;
345
+ if (tlp !== void 0) body.tlp = tlp;
186
346
  return await (await this.request("POST", "/ai-reports/reports", { json: body })).json();
187
347
  }
188
348
  /**
@@ -235,13 +395,19 @@ var AiReportsApi = class {
235
395
  /**
236
396
  * Export a report as `html` or `md`. The body IS the export file.
237
397
  *
398
+ * `options.tlp` sets the TLP 2.0 marking written into the document (`CLEAR` / `GREEN` / `AMBER` /
399
+ * `AMBER+STRICT` / `RED`), overriding the report's stored TLP; omit it to stamp the report's own
400
+ * stored TLP. An invalid value throws a `RangeError` before any request.
401
+ *
238
402
  * Resolves `{ content, bytes, filename, contentType }`. `filename` is a sanitized basename from
239
- * `Content-Disposition`. PDF/DOCX are browser-editor-only; browser-authored reports throw 422 here.
403
+ * `Content-Disposition`. PDF/DOCX are browser-editor-only. Reports built in the browser export here too.
240
404
  */
241
- async exportReport(reportId, fmt = "html") {
405
+ async exportReport(reportId, fmt = "html", options = {}) {
406
+ const tlp = validateTlp(options.tlp);
242
407
  const resp = await this.request(
243
408
  "GET",
244
- `/ai-reports/reports/${pathSegment(reportId)}/export/${pathSegment(fmt)}`
409
+ `/ai-reports/reports/${pathSegment(reportId)}/export/${pathSegment(fmt)}`,
410
+ tlp === void 0 ? {} : { params: { tlp } }
245
411
  );
246
412
  const disposition = resp.headers.get("content-disposition") ?? "";
247
413
  const filename = downloadFilename(disposition, `${reportId}.${fmt}`);
@@ -255,13 +421,22 @@ var AiReportsApi = class {
255
421
  }
256
422
  /**
257
423
  * Generate a report end-to-end: create the draft, fill every AI section, return the finished
258
- * report. The convenience over `createDraft` + `fillSection`.
424
+ * report. The convenience over `createDraft` + `fillSection`; `options.tlp` is passed to
425
+ * `createDraft` (an exact marking; omit it for your default raised by the sources).
259
426
  *
260
- * If a section's copilot call fails (502), generation stops there and returns what filled so far:
427
+ * Report sections run on the account's own AI provider (bring-your-own-key, saved in portal
428
+ * API Dashboard → AI Provider). If a section's model call fails (502), generation stops there and
429
+ * returns what filled so far:
261
430
  * the report keeps the sections completed before the failure, the failed section is recorded in
262
431
  * `sections` as `{ error: "generation failed", status: 502 }`, and that section plus any after it
263
432
  * stay unfilled cards. Re-run `generateReport` or fill the rest individually with `fillSection`.
264
433
  *
434
+ * No AI key at all (402) stops the loop the same way, recorded as
435
+ * `{ error: "no AI provider", status: 402 }` — add a key, then fill the rest with `fillSection`. A
436
+ * spent daily allowance on the built-in AI (429) is recorded as `{ error: "quota exhausted", status: 429 }`
437
+ * (your own key has no limit), and a gateway rate limit as `{ error: "rate limited", status: 429 }`.
438
+ * Draft creation never calls a model.
439
+ *
265
440
  * Resolves `{ report, sections: [<fill result per section>], skipped: [...] }`.
266
441
  */
267
442
  async generateReport(template, options = {}) {
@@ -274,12 +449,12 @@ var AiReportsApi = class {
274
449
  try {
275
450
  result = await this.fillSection(reportId);
276
451
  } catch (err) {
277
- if (err instanceof UnexpectedStatus && err.status === 409) break;
278
- if (err instanceof UnexpectedStatus && err.status === 502) {
279
- sections.push({ error: "generation failed", status: 502 });
280
- break;
281
- }
282
- throw err;
452
+ if (!(err instanceof UnexpectedStatus)) throw err;
453
+ if (err.status === 409) break;
454
+ const note = stopNote(err);
455
+ if (note === void 0) throw err;
456
+ sections.push({ error: note, status: err.status });
457
+ break;
283
458
  }
284
459
  sections.push(result);
285
460
  if (result.complete) break;
@@ -391,14 +566,18 @@ var ArtifactManagerApi = class {
391
566
  * List your artifacts (newest first, no content).
392
567
  *
393
568
  * @param options `kind` (input|enrichment|report) · `folder` (UUID or `"__root__"`)
394
- * · `since`/`until` (ISO `created_at` window).
569
+ * · `since`/`until` (ISO `created_at` window) · `search` (names and contents, like the portal's search box)
570
+ * · `tlp` (filter by exact TLP 2.0 marking; each returned artifact carries its own `tlp`).
395
571
  */
396
572
  async listArtifacts(options = {}) {
573
+ const tlp = validateTlp(options.tlp);
397
574
  const params = {};
398
575
  if (options.kind) params.kind = options.kind;
399
576
  if (options.folder) params.folder = options.folder;
400
577
  if (options.since) params.since = options.since;
401
578
  if (options.until) params.until = options.until;
579
+ if (options.search) params.search = options.search;
580
+ if (tlp !== void 0) params.tlp = tlp;
402
581
  const resp = await this.request("GET", "/artifact-manager/artifacts", {
403
582
  params
404
583
  });
@@ -408,14 +587,17 @@ var ArtifactManagerApi = class {
408
587
  * Upload input artifacts (max 20/call, ≤10 MB content each).
409
588
  *
410
589
  * @param artifacts Each `{ name, content, format: "paste"|"file", mime? }`.
411
- * @param options File into an existing `folderId`, or create one via `newFolderName`.
590
+ * @param options File into an existing `folderId`, or create one via `newFolderName`; `tlp` marks
591
+ * EVERY artifact in the batch (default `AMBER`).
412
592
  * @returns `{ ids, folderId }` — the new artifact ids.
413
593
  */
414
594
  async uploadArtifacts(artifacts, options = {}) {
595
+ const tlp = validateTlp(options.tlp);
415
596
  const body = { artifacts };
416
597
  if (options.folderId !== void 0) body.folderId = options.folderId;
417
598
  if (options.newFolderName !== void 0)
418
599
  body.newFolderName = options.newFolderName;
600
+ if (tlp !== void 0) body.tlp = tlp;
419
601
  const resp = await this.request("POST", "/artifact-manager/artifacts", {
420
602
  json: body
421
603
  });
@@ -448,20 +630,24 @@ var ArtifactManagerApi = class {
448
630
  name: decodeHeader(resp.headers.get("x-artifact-name"), artifactId),
449
631
  format: resp.headers.get("x-artifact-format") ?? "",
450
632
  mime: resp.headers.get("x-artifact-mime") ?? "",
633
+ tlp: resp.headers.get("x-artifact-tlp") ?? "",
451
634
  created_at: resp.headers.get("x-artifact-created") ?? ""
452
635
  };
453
636
  }
454
637
  /**
455
- * Partial update: rename, star/unstar, and/or move between folders.
638
+ * Partial update: rename, star/unstar, move between folders, and/or set the TLP marking.
456
639
  *
457
640
  * `folderId: null` moves the artifact back to root; omit it to leave the
458
- * folder unchanged.
641
+ * folder unchanged. A call that sets only `tlp` is valid; an invalid value
642
+ * throws a `RangeError` before any request.
459
643
  */
460
644
  async updateArtifact(artifactId, update) {
645
+ const tlp = validateTlp(update.tlp);
461
646
  const body = {};
462
647
  if (update.name !== void 0) body.name = update.name;
463
648
  if (update.favorite !== void 0) body.favorite = update.favorite;
464
649
  if ("folderId" in update) body.folderId = update.folderId;
650
+ if (tlp !== void 0) body.tlp = tlp;
465
651
  const resp = await this.request(
466
652
  "PATCH",
467
653
  `/artifact-manager/artifacts/${pathSegment(artifactId)}`,
@@ -553,12 +739,17 @@ var ArtifactManagerApi = class {
553
739
  }
554
740
  /** Bundle an explicit set of your artifacts into one `.zip` (the bulk "Download .zip"). Enrichments
555
741
  * contribute their machine exports under a per-enrichment subfolder; every other kind contributes its raw
556
- * deliverable. Returns the raw `.zip` bytes. See {@link downloadFolder} for the whole-folder twin. */
557
- async downloadBundle(artifactIds) {
742
+ * deliverable. Returns the raw `.zip` bytes. `options.tlp` marks every wrapped export, overriding each
743
+ * artifact's own stored TLP; omit it to mark each with that artifact's own TLP.
744
+ * See {@link downloadFolder} for the whole-folder twin. */
745
+ async downloadBundle(artifactIds, options = {}) {
746
+ const tlp = validateTlp(options.tlp);
747
+ const body = { ids: artifactIds };
748
+ if (tlp !== void 0) body.tlp = tlp;
558
749
  const resp = await this.request(
559
750
  "POST",
560
751
  "/artifact-manager/artifacts/bundle",
561
- { json: { ids: artifactIds } }
752
+ { json: body }
562
753
  );
563
754
  return new Uint8Array(await resp.arrayBuffer());
564
755
  }
@@ -592,11 +783,18 @@ var ArtifactManagerApi = class {
592
783
  return (await resp.json()).formats;
593
784
  }
594
785
  /** Download one export. The body is the export file; `filename` is a sanitized basename from
595
- * `Content-Disposition`. Text formats land in `content`; binary XLSX formats in `bytes`. */
596
- async getExport(enrichmentId, format) {
786
+ * `Content-Disposition`. Text formats land in `content`; binary XLSX formats in `bytes`.
787
+ *
788
+ * `options.tlp` sets the TLP 2.0 marking written into the export (`CLEAR` / `GREEN` / `AMBER` /
789
+ * `AMBER+STRICT` / `RED`), overriding the artifact's stored TLP; omit it to stamp the artifact's
790
+ * own stored TLP. Formats with no marking slot — OpenVEX, CSV and the
791
+ * DISA eMASS worksheet — ignore it. An invalid value throws a `RangeError` before any request. */
792
+ async getExport(enrichmentId, format, options = {}) {
793
+ const tlp = validateTlp(options.tlp);
597
794
  const resp = await this.request(
598
795
  "GET",
599
- `/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/${pathSegment(format)}`
796
+ `/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/${pathSegment(format)}`,
797
+ tlp === void 0 ? {} : { params: { tlp } }
600
798
  );
601
799
  const disposition = resp.headers.get("content-disposition") ?? "";
602
800
  const filename = downloadFilename2(disposition, format);
@@ -611,11 +809,14 @@ var ArtifactManagerApi = class {
611
809
  /** Download EVERY machine export of a saved artifact as one `.zip` (one file per format —
612
810
  * `stix.json`, `vex.json`, `emass.xlsx`, …). The bulk twin of {@link getExport}, matching the export
613
811
  * panel's "Download all (.zip)" button. Works for any saved enrichment / inventory-enrichment /
614
- * inventory id. Returns the raw `.zip` bytes. */
615
- async downloadAllExports(enrichmentId) {
812
+ * inventory id. Returns the raw `.zip` bytes. `options.tlp` marks each export, overriding the
813
+ * artifact's stored TLP; omit it to stamp each with the artifact's own stored TLP. */
814
+ async downloadAllExports(enrichmentId, options = {}) {
815
+ const tlp = validateTlp(options.tlp);
616
816
  const resp = await this.request(
617
817
  "GET",
618
- `/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/all`
818
+ `/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/all`,
819
+ tlp === void 0 ? {} : { params: { tlp } }
619
820
  );
620
821
  return new Uint8Array(await resp.arrayBuffer());
621
822
  }
@@ -666,14 +867,50 @@ var ArtifactManagerApi = class {
666
867
  }
667
868
  /** Download every artifact filed under a folder as one `<folder>.zip` (the folder "Download .zip").
668
869
  * Enrichments contribute their machine exports under a per-enrichment subfolder; every other kind
669
- * contributes its raw deliverable. Returns the raw `.zip` bytes. */
670
- async downloadFolder(folderId) {
870
+ * contributes its raw deliverable. Returns the raw `.zip` bytes. `options.tlp` marks every wrapped
871
+ * export, overriding each artifact's own stored TLP; omit it to mark each with that artifact's own
872
+ * stored TLP. */
873
+ async downloadFolder(folderId, options = {}) {
874
+ const tlp = validateTlp(options.tlp);
671
875
  const resp = await this.request(
672
876
  "GET",
673
- `/artifact-manager/folders/${pathSegment(folderId)}/exports/all`
877
+ `/artifact-manager/folders/${pathSegment(folderId)}/exports/all`,
878
+ tlp === void 0 ? {} : { params: { tlp } }
674
879
  );
675
880
  return new Uint8Array(await resp.arrayBuffer());
676
881
  }
882
+ // -- Enricher settings -------------------------------------------------- //
883
+ /** Your default TLP 2.0 marking for NEW enrichments, as two independent values —
884
+ * `AMBER` for either one you have not set. The Artifact Enricher page's Settings
885
+ * button edits the same two values. */
886
+ async getEnricherSettings() {
887
+ const resp = await this.request("GET", "/artifact-manager/settings");
888
+ return await resp.json();
889
+ }
890
+ /** Set the default marking a NEW enrichment starts from. Pass one or both — only what
891
+ * you pass is written, and the stored pair is returned. An invalid value throws
892
+ * before any request; passing neither throws too.
893
+ *
894
+ * The value is a BASELINE, not an override: an enrichment saved afterwards is marked
895
+ * with the most restrictive of the setting and the artifacts it was built from, so a
896
+ * more restrictive source still wins. An explicit `tlp` on `client.enricher.enrich(...)`
897
+ * overrides `artifact_tlp` for that run's exports. */
898
+ async setEnricherSettings(options) {
899
+ const artifactTlp = validateTlp(options.artifactTlp);
900
+ const inventoryTlp = validateTlp(options.inventoryTlp);
901
+ const json = {};
902
+ if (artifactTlp !== void 0) json.artifact_tlp = artifactTlp;
903
+ if (inventoryTlp !== void 0) json.inventory_tlp = inventoryTlp;
904
+ if (!Object.keys(json).length) {
905
+ throw new RangeError(
906
+ "setEnricherSettings needs artifactTlp and/or inventoryTlp"
907
+ );
908
+ }
909
+ const resp = await this.request("PUT", "/artifact-manager/settings", {
910
+ json
911
+ });
912
+ return await resp.json();
913
+ }
677
914
  };
678
915
 
679
916
  // src/_poll.ts
@@ -690,8 +927,8 @@ async function beforeDeadline(operation, remaining, enrichmentId) {
690
927
  if (remaining <= 0) throw timeoutError(enrichmentId);
691
928
  let cancelDeadline = () => {
692
929
  };
693
- const deadline = new Promise((resolve) => {
694
- const timer = setTimeout(() => resolve(TIMED_OUT), remaining);
930
+ const deadline = new Promise((resolve2) => {
931
+ const timer = setTimeout(() => resolve2(TIMED_OUT), remaining);
695
932
  cancelDeadline = () => clearTimeout(timer);
696
933
  });
697
934
  void Promise.resolve(operation).catch(() => void 0);
@@ -746,7 +983,7 @@ async function pollUntilDone(request, enrichmentId, statusPath, opts) {
746
983
  remaining = remainingMs(deadline);
747
984
  await beforeDeadline(
748
985
  new Promise(
749
- (resolve) => setTimeout(resolve, Math.min(opts.pollIntervalMs, remaining))
986
+ (resolve2) => setTimeout(resolve2, Math.min(opts.pollIntervalMs, remaining))
750
987
  ),
751
988
  remaining,
752
989
  enrichmentId
@@ -781,12 +1018,20 @@ function assembleBriefing(report, meta) {
781
1018
  const actions = [...seen.values()].sort(
782
1019
  (a, b) => (a.kev ? 0 : 1) - (b.kev ? 0 : 1) || (b.weaponization_score || 0) - (a.weaponization_score || 0)
783
1020
  ).slice(0, 10);
1021
+ const unverifiedAssets = assets.filter(
1022
+ (asset) => asset.status !== "error" && (asset.match === "none" || asset.match === "cpe_fuzzy")
1023
+ ).map((asset) => ({
1024
+ product: asset.product || asset.name || "\u2014",
1025
+ versions: (Array.isArray(asset.versions) ? asset.versions : []).filter(Boolean).slice(0, 1),
1026
+ match_detail: asset.match_detail ?? null
1027
+ }));
784
1028
  const out = {
785
1029
  format: meta.format,
786
1030
  parsed_count: meta.parsedCount,
787
1031
  enrichment_id: meta.enrichmentId,
788
1032
  report,
789
- recommended_actions: actions
1033
+ recommended_actions: actions,
1034
+ unverified_assets: unverifiedAssets
790
1035
  };
791
1036
  if (meta.truncated) out.truncated = meta.truncated;
792
1037
  return out;
@@ -820,6 +1065,29 @@ function wireContent(content) {
820
1065
  function wireSources(sources) {
821
1066
  return sources.map((s) => ({ ...s, content: wireContent(s.content) }));
822
1067
  }
1068
+ function historyParams(opts) {
1069
+ const types = Array.isArray(opts.types) ? opts.types.join(",") : opts.types;
1070
+ const raw = {
1071
+ type: types,
1072
+ q: opts.q,
1073
+ since: opts.since,
1074
+ until: opts.until,
1075
+ actor: opts.actor,
1076
+ limit: opts.limit,
1077
+ cursor: opts.cursor
1078
+ };
1079
+ const params = {};
1080
+ for (const [k, v] of Object.entries(raw))
1081
+ if (v !== void 0) params[k] = String(v);
1082
+ return params;
1083
+ }
1084
+ function manifestVexOverlay(manifest) {
1085
+ const overlay = manifest.vex_overlay;
1086
+ if (!overlay || typeof overlay !== "object" || !("document" in overlay))
1087
+ return void 0;
1088
+ const doc = overlay.document;
1089
+ return typeof doc === "string" && doc.trim() ? doc : void 0;
1090
+ }
823
1091
  function inventoryBody(inventoryName, o) {
824
1092
  const body = { inventory_name: inventoryName };
825
1093
  if (o.description !== void 0) body.description = o.description;
@@ -932,14 +1200,37 @@ var InventoryManagerApi = class {
932
1200
  );
933
1201
  return (await resp.json()).matrix;
934
1202
  }
1203
+ /**
1204
+ * One page of an inventory's change history, newest first. Covers asset, attachment, TLP, rename,
1205
+ * settings and VEX changes, saved enrichments and generated reports. Exports and Copy for AI are
1206
+ * not logged. Pass `cursor` from a previous page's `next_cursor` to continue.
1207
+ */
1208
+ async getHistory(inventoryId, opts = {}) {
1209
+ const resp = await this.request(
1210
+ "GET",
1211
+ `/inventory-manager/inventories/${pathSegment(inventoryId)}/history`,
1212
+ { params: historyParams(opts) }
1213
+ );
1214
+ return await resp.json();
1215
+ }
1216
+ /** Yield every history item newest first, following `next_cursor` across pages until exhausted. */
1217
+ async *iterHistory(inventoryId, opts = {}) {
1218
+ let cursor;
1219
+ do {
1220
+ const page = await this.getHistory(inventoryId, { ...opts, cursor });
1221
+ yield* page.items;
1222
+ cursor = page.next_cursor ?? void 0;
1223
+ } while (cursor);
1224
+ }
935
1225
  /**
936
1226
  * Create an Inventory Manager inventory (a continuously-monitored context window).
937
1227
  *
938
1228
  * @param inventoryName The inventory's display name.
939
1229
  * @param options `description`, `items` (asset inventory — each `{ product, vendor?, versions?,
940
1230
  * ecosystem?, category?, criticality?, notes? }`), `monitoring` (always full depth — no fast/lite
941
- * mode), `linkedArtifactIds`.
942
- * @returns `{ id, item_count }`.
1231
+ * mode), `linkedArtifactIds` (each takes the new inventory's own TLP 2.0 marking).
1232
+ * @returns `{ id, item_count }`, plus `attachment_tlp` / `attachment_tlp_ids` when
1233
+ * `linkedArtifactIds` were passed (the marking carried onto them).
943
1234
  */
944
1235
  async createInventory(inventoryName, options = {}) {
945
1236
  const resp = await this.request("POST", "/inventory-manager/inventories", {
@@ -951,7 +1242,10 @@ var InventoryManagerApi = class {
951
1242
  * Update an inventory's definition (name, description, inventory, monitoring, attachments).
952
1243
  * This is a **partial merge** (PATCH): only the fields you pass change — omitted fields are PRESERVED,
953
1244
  * including the asset-group metadata and daily-report config this method doesn't expose. `inventoryName`
954
- * is still required by the API. Resolves `{ id, item_count }`.
1245
+ * is still required by the API. Any artifact newly added through `linkedArtifactIds` takes the
1246
+ * inventory's own TLP 2.0 marking (already-attached artifacts are left alone). Resolves
1247
+ * `{ id, item_count }`, plus `attachment_tlp` / `attachment_tlp_ids` (the marking carried onto newly
1248
+ * attached artifacts).
955
1249
  */
956
1250
  async updateInventory(inventoryId, options) {
957
1251
  const resp = await this.request(
@@ -966,10 +1260,14 @@ var InventoryManagerApi = class {
966
1260
  *
967
1261
  * @param options `format` — one of `json` (asset JSON), `sbom` (CycloneDX / SPDX SBOM), `csv`,
968
1262
  * `nmap` (nmap `-sV` XML), `list` (CPE / purl list), `grype`, `trivy` (SCA JSON), `depcheck`
969
- * (OWASP Dependency-Check JSON), `nessus` (`.nessus` XML), `gvm` (OpenVAS / Greenbone XML);
970
- * `content` — the file's text; optional `inventoryName` / `description` (override
971
- * anything the file carries).
972
- * @returns `{ id, item_count, imported, format, truncated? }`.
1263
+ * (OWASP Dependency-Check JSON), `nessus` (`.nessus` XML), `gvm` (OpenVAS / Greenbone XML),
1264
+ * `vex` (a VEX suppression overlay — OpenVEX 0.2.0 / CSAF 2.0 VEX JSON; attaches to the
1265
+ * inventory named by `inventoryId`, or creates a bare inventory holding it — imports NO assets);
1266
+ * `content` — the file's text (or `Uint8Array` for the binary `xlsx`); optional
1267
+ * `inventoryName` / `description` (override anything the file carries).
1268
+ * @returns `{ id, item_count, imported, format, truncated?, dropped? }` — `dropped` (SBOM imports
1269
+ * only) counts dependency edges the parser could not retain (#334). `format:'vex'` returns
1270
+ * `{ id, imported:0, format:'vex', statements }` instead.
973
1271
  */
974
1272
  async importInventory(options) {
975
1273
  const body = {
@@ -1001,7 +1299,7 @@ var InventoryManagerApi = class {
1001
1299
  * override. A binary `xlsx` source can't be sniffed, so it needs `format: "xlsx"` + `Uint8Array` content
1002
1300
  * (base64-encoded on the wire). A source that fails to parse is ISOLATED (it appears in `per_source` with
1003
1301
  * its `error`, contributing nothing — never failing the whole call).
1004
- * @returns `{ items, count, asset_groups, truncated?, per_source: [{ label, contributed, truncated?, error? }] }`.
1302
+ * @returns `{ items, count, asset_groups, truncated?, dropped?, per_source: [{ label, contributed, truncated?, dropped?, error? }] }`.
1005
1303
  */
1006
1304
  async parseMulti(sources) {
1007
1305
  const resp = await this.request(
@@ -1067,12 +1365,16 @@ var InventoryManagerApi = class {
1067
1365
  * Apply a recommended upgrade — set the matched asset's version to the published fix the Inventory
1068
1366
  * Enricher surfaced (`recommended_fix_version` / `recommended_fix_version_kev`), PRESERVING everything
1069
1367
  * else on the inventory. Match is by `product` (case-insensitive; `vendor` disambiguates duplicate
1070
- * product names). Writes the inventory only — it does NOT re-enrich (the next enrichment / daily monitor
1071
- * confirms the CVEs cleared). Resolves `{ id, product, version, item_count }` (404 when no asset matches).
1368
+ * product names). This rewrites **every** asset carrying that product — pass `group` to scope the fix
1369
+ * to one host/asset group (`group` is the asset's own grouping, which host-derived imports set per
1370
+ * host). Writes the inventory only — it does NOT re-enrich (the next enrichment / daily monitor
1371
+ * confirms the CVEs cleared). Resolves `{ id, product, version, applied, item_count }` (404 when no
1372
+ * asset matches, or none matches within `group`).
1072
1373
  */
1073
- async applyAssetFix(inventoryId, product, version, vendor) {
1374
+ async applyAssetFix(inventoryId, product, version, vendor, group) {
1074
1375
  const json = { product, version };
1075
1376
  if (vendor !== void 0) json.vendor = vendor;
1377
+ if (group !== void 0) json.group = group;
1076
1378
  const resp = await this.request(
1077
1379
  "PATCH",
1078
1380
  `/inventory-manager/inventories/${pathSegment(inventoryId)}/asset-version`,
@@ -1095,15 +1397,22 @@ var InventoryManagerApi = class {
1095
1397
  *
1096
1398
  * @param inventoryId The inventory id.
1097
1399
  * @param format `json` / `csv` / `list` (CPE/purl) / `cyclonedx` / `spdx` (3.0.1) / `spdx2` (SPDX 2.3)
1098
- * / `workbook` (binary Excel .xlsx). `json` / `csv` / `list` round-trip back through
1099
- * {@link importInventory}. Defaults to `json`.
1100
- */
1101
- async exportInventory(inventoryId, format = "json") {
1400
+ * / `workbook` (binary Excel .xlsx) / `all` (.zip of every format). `json` / `csv` / `list` round-trip
1401
+ * back through {@link importInventory}. Defaults to `json`.
1402
+ * @param options.tlp The TLP 2.0 marking written into the asset-inventory formats that have a slot
1403
+ * (`cyclonedx` / `spdx` / `spdx2` / `workbook`; `CLEAR` / `GREEN` / `AMBER` / `AMBER+STRICT` / `RED`),
1404
+ * overriding the inventory's stored TLP; omit it to stamp the inventory's own stored TLP.
1405
+ * `json` / `csv` / `list` have no marking slot and ignore it. An invalid value
1406
+ * throws a `RangeError` before any request.
1407
+ */
1408
+ async exportInventory(inventoryId, format = "json", options = {}) {
1409
+ const tlp = validateTlp(options.tlp);
1102
1410
  const resp = await this.request(
1103
1411
  "GET",
1104
- `/inventory-manager/inventories/${pathSegment(inventoryId)}/export/${pathSegment(format)}`
1412
+ `/inventory-manager/inventories/${pathSegment(inventoryId)}/export/${pathSegment(format)}`,
1413
+ tlp === void 0 ? {} : { params: { tlp } }
1105
1414
  );
1106
- return format === "workbook" ? new Uint8Array(await resp.arrayBuffer()) : await resp.text();
1415
+ return format === "workbook" || format === "all" ? new Uint8Array(await resp.arrayBuffer()) : await resp.text();
1107
1416
  }
1108
1417
  /** Delete an inventory. Resolves `true` on success (404 throws). */
1109
1418
  async deleteInventory(inventoryId) {
@@ -1113,7 +1422,9 @@ var InventoryManagerApi = class {
1113
1422
  );
1114
1423
  return Boolean((await resp.json()).deleted);
1115
1424
  }
1116
- /** Link an existing artifact to an inventory. Resolves to `{ ok, linked, already }`. */
1425
+ /** Link an existing artifact to an inventory. The newly attached artifact takes the INVENTORY's own
1426
+ * TLP 2.0 marking (it can raise or lower the artifact's marking). Resolves to
1427
+ * `{ ok, linked, already, attachment_tlp, attachment_tlp_ids }`. */
1117
1428
  async attachToInventory(inventoryId, artifactId) {
1118
1429
  const resp = await this.request(
1119
1430
  "POST",
@@ -1139,7 +1450,8 @@ var InventoryManagerApi = class {
1139
1450
  * REPLACE an inventory's attached reference artifacts in one call (the bulk twin of
1140
1451
  * {@link attachToInventory}), PRESERVING its inventory / monitoring / alert-prefs. Only attachable
1141
1452
  * kinds (`input` / `enrichment` / `report`) are kept; inventories and inventory enrichments are skipped. Deduped +
1142
- * capped at 100. Resolves `{ id, linked_count, attached, skipped, mode }`.
1453
+ * capped at 100. Each newly attached artifact takes the inventory's own TLP 2.0 marking. Resolves
1454
+ * `{ id, linked_count, attached, skipped, mode, attachment_tlp, attachment_tlp_ids }`.
1143
1455
  */
1144
1456
  async setAttachments(inventoryId, artifactIds) {
1145
1457
  const resp = await this.request(
@@ -1152,7 +1464,8 @@ var InventoryManagerApi = class {
1152
1464
  return await resp.json();
1153
1465
  }
1154
1466
  /** APPEND several artifacts to an inventory's attachments in one call (bulk {@link attachToInventory});
1155
- * same filtering/cap/return as {@link setAttachments}. */
1467
+ * same filtering/cap/return as {@link setAttachments} — including the re-marking of the newly attached
1468
+ * artifacts to the inventory's own TLP 2.0 marking. */
1156
1469
  async addAttachments(inventoryId, artifactIds) {
1157
1470
  const resp = await this.request(
1158
1471
  "PATCH",
@@ -1228,7 +1541,14 @@ var InventoryManagerApi = class {
1228
1541
  * The enrichment submit is enrichment compute and **counts toward your usage** (it rides your key to
1229
1542
  * `/v1/inventory-enrich`); reading the inventory and polling do not.
1230
1543
  *
1231
- * Resolves to `{ enrichment_id, report }`. If the inventory's inventory is empty this short-circuits and
1544
+ * The inventory's attached **VEX suppression overlay** (imported with `format: 'vex'`) always rides along
1545
+ * as the engine's `vex_overlay`, so findings the VEX marks `not_affected`/`fixed` come back
1546
+ * `suppressed_by_vex` (retained + justification, excluded from the actionable counts) instead of being
1547
+ * re-reported. Nothing to pass — it is read from the inventory manifest.
1548
+ *
1549
+ * Resolves to `{ enrichment_id, report }`; `report` is the InventoryEnrichmentResult (per-asset CVEs with
1550
+ * CVSS vectors, EPSS percentile, NIST LEV (`lev`), KEV detail, Metasploit / Nuclei, `provenance`; plus `technique_catalog` and
1551
+ * `mitigation_catalog`). If the inventory's inventory is empty this short-circuits and
1232
1552
  * resolves to `{ enrichment_id: null, empty: true }` without submitting. Throws `UnexpectedStatus` on a
1233
1553
  * non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
1234
1554
  */
@@ -1241,13 +1561,13 @@ var InventoryManagerApi = class {
1241
1561
  const items = Array.isArray(manifest.inventory) ? manifest.inventory : [];
1242
1562
  if (items.length === 0) return { enrichment_id: null, empty: true };
1243
1563
  const doAttach = options.enrichAttachments ?? manifest.enrich_attachments === true;
1244
- let attachmentsText;
1564
+ let attachmentsTexts = [];
1245
1565
  let attachmentsFiles;
1246
1566
  let attachmentOmissions = [];
1247
1567
  if (doAttach) {
1248
1568
  const ids = (Array.isArray(manifest.attached) ? manifest.attached : []).map((a) => a?.id).filter((x) => typeof x === "string");
1249
1569
  const resolved = await this.resolveAttachments(ids);
1250
- attachmentsText = resolved.text;
1570
+ attachmentsTexts = resolved.texts;
1251
1571
  if (resolved.files.length) attachmentsFiles = resolved.files;
1252
1572
  attachmentOmissions = resolved.omissions;
1253
1573
  if (options.strictAttachments && attachmentOmissions.length) {
@@ -1258,8 +1578,9 @@ var InventoryManagerApi = class {
1258
1578
  }
1259
1579
  const result = await this.enrichItems(items, {
1260
1580
  ...options,
1261
- attachmentsText,
1262
- attachmentsFiles
1581
+ attachmentsTexts,
1582
+ attachmentsFiles,
1583
+ vexOverlay: manifestVexOverlay(manifest)
1263
1584
  });
1264
1585
  if (doAttach) result.attachment_omissions = attachmentOmissions;
1265
1586
  if (options.save && result.enrichment_id) {
@@ -1270,11 +1591,15 @@ var InventoryManagerApi = class {
1270
1591
  }
1271
1592
  return result;
1272
1593
  }
1273
- /** Fetch the inventory's attached artifacts (≤20) and split them for the engine. Resolution is
1274
- * permissive: every skipped attachment is returned in `omissions`; callers that need complete
1275
- * evidence should use `enrichInventory({ strictAttachments: true })`. */
1594
+ /** Fetch the inventory's attached artifacts (≤20) and split them for the engine: TEXT artifacts become
1595
+ * one `texts` entry each, carrying the id and name of the artifact they came from, and BINARY ones
1596
+ * (`X-Artifact-Format: file`) become raw `files` entries that name their source artifact too.
1597
+ * Attribution is per artifact rather than a whole-run id list — the id is known for the exact block
1598
+ * fetched, so nothing has to be inferred from the text later. Resolution is permissive: every skipped
1599
+ * attachment is returned in `omissions`; callers that need complete evidence should use
1600
+ * `enrichInventory({ strictAttachments: true })`. */
1276
1601
  async resolveAttachments(attachmentIds) {
1277
- const parts = [];
1602
+ const texts = [];
1278
1603
  const files = [];
1279
1604
  const omissions = attachmentIds.slice(20).map((attachmentId) => ({
1280
1605
  attachment_id: attachmentId,
@@ -1303,7 +1628,11 @@ var InventoryManagerApi = class {
1303
1628
  }
1304
1629
  }
1305
1630
  if (resp.headers.get("X-Artifact-Format") === "file") {
1306
- files.push({ filename: name, content_b64: content });
1631
+ files.push({
1632
+ filename: name,
1633
+ content_b64: content,
1634
+ source_artifact_id: aid
1635
+ });
1307
1636
  continue;
1308
1637
  }
1309
1638
  if (total >= 5e5) {
@@ -1314,8 +1643,11 @@ var InventoryManagerApi = class {
1314
1643
  continue;
1315
1644
  }
1316
1645
  const chunk = content.slice(0, Math.min(8e4, 5e5 - total));
1317
- parts.push(`--- Attached: ${name} ---
1318
- ${chunk}`);
1646
+ texts.push({
1647
+ text: chunk,
1648
+ source_artifact_id: aid,
1649
+ filename: name
1650
+ });
1319
1651
  total += chunk.length;
1320
1652
  } catch (error) {
1321
1653
  omissions.push({
@@ -1324,8 +1656,7 @@ ${chunk}`);
1324
1656
  });
1325
1657
  }
1326
1658
  }
1327
- const text = parts.join("\n\n");
1328
- return { text: text.trim() ? text : void 0, files, omissions };
1659
+ return { texts, files, omissions };
1329
1660
  }
1330
1661
  /**
1331
1662
  * Persist a COMPLETED inventory enrichment into this inventory's saved history, by its engine
@@ -1359,8 +1690,14 @@ ${chunk}`);
1359
1690
  if (options.include) body.include = options.include;
1360
1691
  if (options.attachmentsText)
1361
1692
  body.attachments_text = options.attachmentsText;
1693
+ if (options.attachmentsTexts?.length)
1694
+ body.attachments_texts = options.attachmentsTexts;
1695
+ if (options.attachedArtifactIds?.length)
1696
+ body.attached_artifact_ids = options.attachedArtifactIds;
1362
1697
  if (options.attachmentsFiles?.length)
1363
1698
  body.attachments_files = options.attachmentsFiles;
1699
+ if (options.vexOverlay)
1700
+ body.vex_overlay = { format: "vex", content: options.vexOverlay };
1364
1701
  const submit = await (await this.request("POST", "/v1/inventory-enrich", { json: body })).json();
1365
1702
  const enrichmentId = submit.enrichment_id;
1366
1703
  const job = await pollUntilDone(
@@ -1376,9 +1713,11 @@ ${chunk}`);
1376
1713
  return { enrichment_id: enrichmentId, report: job.result };
1377
1714
  }
1378
1715
  /** Parse a scan / inventory FILE into canonical asset items WITHOUT saving anything (the parse-only twin
1379
- * of `importInventory`). You PICK the `format` — one of json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx
1380
- * (no auto-detect; pass a `Uint8Array` for the binary `xlsx`). Resolves
1381
- * `{ format, items, count, inventory_name?, truncated? }`. Usage-exempt — the building block for `ingestScan`. */
1716
+ * of `importInventory`). You PICK the `format` — one of json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx/vex
1717
+ * (no auto-detect; pass a `Uint8Array` for the binary `xlsx`; `vex` is a VEX suppression overlay
1718
+ * parse — OpenVEX/CSAF — returning `{ items: [], vex_overlay }`). Resolves
1719
+ * `{ format, items, count, inventory_name?, truncated?, dropped? }` (`dropped` — SBOM only — is the
1720
+ * dependency edges not retained, #334). Usage-exempt — the building block for `ingestScan`. */
1382
1721
  async parseScan(content, format) {
1383
1722
  const resp = await this.request(
1384
1723
  "POST",
@@ -1389,10 +1728,11 @@ ${chunk}`);
1389
1728
  }
1390
1729
  /** Scan → briefing in one call: parse the scan FILE (`parseScan`), enrich the discovered assets against
1391
1730
  * the `/v1/inventory-enrich` ranking engine, and assemble a structured briefing. `format` is one of
1392
- * json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx. The parse is usage-exempt; the enrichment **submit counts
1731
+ * json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx/vex. The parse is usage-exempt; the enrichment **submit counts
1393
1732
  * toward usage** (one `/v1/inventory-enrich` request). Resolves
1394
- * `{ format, parsed_count, truncated?, enrichment_id, report, recommended_actions }` (report = the
1395
- * engine's KEV-first-ranked findings + rollup). An empty parse short-circuits to
1733
+ * `{ format, parsed_count, truncated?, enrichment_id, report, recommended_actions, unverified_assets }`
1734
+ * (report = the engine's KEV-first-ranked findings + rollup; unverified_assets names the assets whose
1735
+ * identity never resolved). An empty parse short-circuits to
1396
1736
  * `{ format, parsed_count: 0, enrichment_id: null, empty: true }`. */
1397
1737
  async ingestScan(content, format, options = {}) {
1398
1738
  return ingestScan(this, content, format, options);
@@ -1446,8 +1786,13 @@ var EnricherApi = class {
1446
1786
  /**
1447
1787
  * Run an artifact enrichment end-to-end against the /v1 engine: submit → poll → return the report.
1448
1788
  *
1449
- * Stages pasted `text` + base64 `files` (`[{ filename, content_b64 }]`), submits to
1450
- * `/v1/artifact-enrich`, polls the job until done, and resolves to the enrichment report.
1789
+ * Stages pasted `text` + base64 `files` (`[{ filename, content_b64, source_artifact_id? }]`), submits
1790
+ * to `/v1/artifact-enrich`, polls the job until done, and resolves to the enrichment report.
1791
+ *
1792
+ * `texts` is the per-artifact form of `text` (`[{ text, source_artifact_id?, filename? }]`) — use it
1793
+ * when the blocks came from several stored artifacts, so the report attributes each reference to the
1794
+ * artifact it appeared in. `attachedArtifactIds` names the artifacts an opaque `text` blob came from;
1795
+ * attribution is never inferred from the text itself.
1451
1796
  *
1452
1797
  * `stakeholder` is the optional SSVC stakeholder context applied to every reference when `include`
1453
1798
  * contains `"ssvc"` (`{ method, exposure, human_impact, mission_prevalence, public_wellbeing_impact }`;
@@ -1455,7 +1800,10 @@ var EnricherApi = class {
1455
1800
  *
1456
1801
  * Counts toward your API usage (it's `/v1/artifact-enrich` compute). Throws `UnexpectedStatus` on a
1457
1802
  * non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
1458
- * Resolves to `{ enrichment_id, report }`.
1803
+ * Resolves to `{ enrichment_id, report }`. `report` is the ArtifactEnrichmentReport (`report.meta.schema_version`):
1804
+ * each reference carries its full record — CVSS vectors, EPSS percentile, NIST LEV (`lev`), CWEs, the CISA KEV record,
1805
+ * Metasploit / Nuclei, OSV fixed versions, ATT&CK v18 detection data, knowledge-base profiles, threat actors
1806
+ * targeting a country or sector, and `provenance`.
1459
1807
  */
1460
1808
  async enrich(options = {}) {
1461
1809
  validatePollOptions(
@@ -1464,10 +1812,15 @@ var EnricherApi = class {
1464
1812
  );
1465
1813
  const body = {};
1466
1814
  if (options.text) body.text = options.text;
1815
+ if (options.texts) body.texts = options.texts;
1467
1816
  if (options.files) body.files = options.files;
1817
+ if (options.attachedArtifactIds)
1818
+ body.attached_artifact_ids = options.attachedArtifactIds;
1468
1819
  if (options.formats) body.formats = options.formats;
1469
1820
  if (options.include) body.include = options.include;
1470
1821
  if (options.stakeholder) body.stakeholder = options.stakeholder;
1822
+ const tlp = validateTlp(options.tlp);
1823
+ if (tlp !== void 0) body.tlp = tlp;
1471
1824
  const submit = await (await this.request("POST", "/v1/artifact-enrich", { json: body })).json();
1472
1825
  const enrichmentId = submit.enrichment_id;
1473
1826
  const job = await pollUntilDone(
@@ -1500,6 +1853,40 @@ var EnricherApi = class {
1500
1853
  }
1501
1854
  return result;
1502
1855
  }
1856
+ /**
1857
+ * Run an Event Enrichment end-to-end against the /v1 engine: submit → poll → return the result.
1858
+ *
1859
+ * Submits a raw security event (a Defender XDR / Sentinel alert, a SIEM/EDR log line, any JSON or
1860
+ * text) to `/v1/event-enrich`, polls the job until done, and resolves to
1861
+ * `{ enrichment_id, result }` — where `result` is the EventEnrichmentResult (per-indicator
1862
+ * findings + the aggregate event threat assessment). CC extracts every indicator server-side.
1863
+ * Each CVE indicator carries `kev` and `weaponized` (a Metasploit module exists, which floors its
1864
+ * verdict at high); `threat_assessment` counts both as `kev_count` / `weaponized_count`.
1865
+ *
1866
+ * Counts toward your API usage (it's `/v1/event-enrich` compute). Throws `UnexpectedStatus` on a
1867
+ * non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
1868
+ */
1869
+ async enrichEvent(options) {
1870
+ validatePollOptions(
1871
+ options.pollIntervalMs ?? 1500,
1872
+ options.timeoutMs ?? 12e5
1873
+ );
1874
+ const body = { event: options.event };
1875
+ if (options.eventId) body.event_id = options.eventId;
1876
+ const submit = await (await this.request("POST", "/v1/event-enrich", { json: body })).json();
1877
+ const enrichmentId = submit.enrichment_id;
1878
+ const job = await pollUntilDone(
1879
+ (m, p, timeoutMs) => this.request(m, p, { timeoutMs }),
1880
+ enrichmentId,
1881
+ `/v1/event-enrich/${pathSegment(enrichmentId)}`,
1882
+ {
1883
+ pollIntervalMs: options.pollIntervalMs ?? 1500,
1884
+ timeoutMs: options.timeoutMs ?? 12e5,
1885
+ onProgress: options.onProgress
1886
+ }
1887
+ );
1888
+ return { enrichment_id: enrichmentId, result: job.result };
1889
+ }
1503
1890
  };
1504
1891
 
1505
1892
  // src/retry.ts
@@ -1514,7 +1901,7 @@ var RETRY_MAX_DELAY = 8;
1514
1901
  var RETRY_JITTER_RATIO = 0.25;
1515
1902
  var RETRY_AFTER_MAX = 60;
1516
1903
  var DEFAULT_MAX_RETRIES = 2;
1517
- var defaultSleep = (seconds) => new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
1904
+ var defaultSleep = (seconds) => new Promise((resolve2) => setTimeout(resolve2, seconds * 1e3));
1518
1905
  function computeBackoff(attempt, rng = Math.random) {
1519
1906
  const raw = RETRY_BASE_DELAY * 2 ** attempt;
1520
1907
  const jitter = raw * RETRY_JITTER_RATIO * (rng() * 2 - 1);
@@ -1714,7 +2101,7 @@ var CrawlerClient = class {
1714
2101
  this._enricher = new EnricherApi(this.baseUrl, apiKey, retryFetch);
1715
2102
  this._aiReports = new AiReportsApi(this.baseUrl, apiKey, retryFetch);
1716
2103
  }
1717
- /** Underlying Hey API client, scoped to this instance. Use to call any of the 33 endpoints directly. */
2104
+ /** Underlying Hey API client, scoped to this instance. Use to call any of the 37 `/v1` operations (31 synchronous + 6 async-engine) directly. */
1718
2105
  get api() {
1719
2106
  return this._client;
1720
2107
  }
@@ -1732,6 +2119,8 @@ var CrawlerClient = class {
1732
2119
  * artifacts + saved enrichment history) over the same key. Its own section at
1733
2120
  * `/inventory-manager/inventories/*` (outside the `/v1` OpenAPI contract). **Usage-exempt** except
1734
2121
  * `enrichInventory`'s submit, which is enrichment compute and counts toward your usage.
2122
+ * For full log sources, PoCs, Sigma rules, or D3FEND rows, call `enrichCveFull` with the CVE ID,
2123
+ * `techniques`, the base layer, and its `*_full` token.
1735
2124
  */
1736
2125
  get inventoryManager() {
1737
2126
  return this._inventoryManager;
@@ -1756,26 +2145,60 @@ var CrawlerClient = class {
1756
2145
  /**
1757
2146
  * Walk the full CVE → CWE → CAPEC → ATT&CK → TIE chain plus MISP/knowledge base/web.
1758
2147
  *
2148
+ * Returns one page. OSV advisories are paged: while `osv_next_offset` is set, request the next
2149
+ * page with that offset and the response's `osv_snapshot_id`, or stream the whole walk with
2150
+ * {@link iterCveOsvPages}.
2151
+ *
1759
2152
  * @param cveId CVE identifier (e.g. `CVE-2024-3400`).
1760
- * @param include Override the default `CVE_FULL_WALK` chain.
1761
- */
1762
- async enrichCveFull(cveId, include = chunk4PCL3ANB_cjs.CVE_FULL_WALK) {
1763
- const result = await chunk4HSWOQA6_cjs.enrichCve({
2153
+ * @param include Override `CVE_FULL_WALK`, which includes stored permissive OSV and Android
2154
+ * bulletin data. Restricted or unknown-licence OSV records require `osv_restricted`, which the
2155
+ * cursor is bound to.
2156
+ * @param options `osvOffset` (from the previous page's `osv_next_offset`) and `osvSnapshotId`
2157
+ * (the previous page's `osv_snapshot_id`; required with a continuation). A continuation answers
2158
+ * 409 `snapshot_expired` when its snapshot is gone and 503 `snapshot_unavailable` when the store is down.
2159
+ */
2160
+ async enrichCveFull(cveId, include = chunkTAMKRTM6_cjs.CVE_FULL_WALK, options = {}) {
2161
+ const result = await chunkASYQPVBW_cjs.enrichCve({
1764
2162
  client: this._client,
1765
- body: { cve_id: cveId, include: [...include] }
2163
+ body: {
2164
+ cve_id: cveId,
2165
+ include: [...include],
2166
+ ...options.osvOffset !== void 0 && {
2167
+ osv_offset: options.osvOffset
2168
+ },
2169
+ ...options.osvSnapshotId !== void 0 && {
2170
+ osv_snapshot_id: options.osvSnapshotId
2171
+ }
2172
+ }
1766
2173
  });
1767
2174
  return ensureOk(result);
1768
2175
  }
1769
2176
  /**
1770
- * Enrich an IOC against MISP, link to ATT&CK, and add knowledge base/web context.
2177
+ * Stream every OSV advisory page of one CVE without an aggregate buffer. The first page is the
2178
+ * complete enrichment; later pages repeat the request with the cursor and carry the next
2179
+ * `osv_advisories` slice. A changed or expired snapshot throws `UnexpectedStatus` (409
2180
+ * `snapshot_expired`) instead of restarting after a yield. The caller owns any collection bound;
2181
+ * `osv_advisories_total` is exact.
2182
+ */
2183
+ async *iterCveOsvPages(cveId, include = chunkTAMKRTM6_cjs.CVE_FULL_WALK) {
2184
+ yield* iterOsvPages(
2185
+ (osvOffset, osvSnapshotId) => this.enrichCveFull(cveId, include, {
2186
+ osvOffset,
2187
+ ...osvSnapshotId !== void 0 && { osvSnapshotId }
2188
+ })
2189
+ );
2190
+ }
2191
+ /**
2192
+ * Enrich an IOC against MISP, link to ATT&CK, and add knowledge base context.
1771
2193
  *
1772
2194
  * @param value Indicator value (hash, IP, domain, URL).
1773
2195
  * @param iocType MISP-style attribute type — `ip-dst`, `ip-src`, `domain`,
1774
2196
  * `hostname`, `md5`, `sha1`, `sha256`, `url`, etc. Defaults to `ip-dst`.
1775
- * @param include Override the default `IOC_FULL_WALK` chain.
2197
+ * @param include Override `IOC_FULL_WALK`. `network_context` and `listed_on` are defaults;
2198
+ * `domain_context` and `hashlookup` remain explicit includes.
1776
2199
  */
1777
- async enrichIocFull(value, iocType = "ip-dst", include = chunk4PCL3ANB_cjs.IOC_FULL_WALK) {
1778
- const result = await chunk4HSWOQA6_cjs.enrichIoc({
2200
+ async enrichIocFull(value, iocType = "ip-dst", include = chunkTAMKRTM6_cjs.IOC_FULL_WALK) {
2201
+ const result = await chunkASYQPVBW_cjs.enrichIoc({
1779
2202
  client: this._client,
1780
2203
  body: { value, type: iocType, include: [...include] }
1781
2204
  });
@@ -1784,29 +2207,45 @@ var CrawlerClient = class {
1784
2207
  /**
1785
2208
  * Walk CWE → CAPEC → ATT&CK with TIE predictions.
1786
2209
  *
1787
- * @param cweId CWE identifier (e.g. `CWE-79`).
1788
- * @param include Override the default `CWE_FULL_WALK` chain.
2210
+ * @param cweId CWE identifier (e.g. `CWE-79`). Supply this or `search`.
2211
+ * @param options Optional `search` keyword (discover weaknesses by name) and `include` override.
1789
2212
  */
1790
- async enrichCweFull(cweId, include = chunk4PCL3ANB_cjs.CWE_FULL_WALK) {
1791
- const result = await chunk4HSWOQA6_cjs.enrichCwe({
2213
+ async enrichCweFull(cweId = null, options = {}) {
2214
+ const result = await chunkASYQPVBW_cjs.enrichCwe({
1792
2215
  client: this._client,
1793
- body: { cwe_id: cweId, include: [...include] }
2216
+ body: {
2217
+ cwe_id: cweId ?? void 0,
2218
+ search: options.search,
2219
+ include: [...options.include ?? chunkTAMKRTM6_cjs.CWE_FULL_WALK]
2220
+ }
1794
2221
  });
1795
2222
  return ensureOk(result);
1796
2223
  }
1797
2224
  /**
1798
- * Enrich one or more ATT&CK techniques with TIE, adversary attribution,
1799
- * and Navigator JSON.
1800
- *
1801
- * @param techniqueIds ATT&CK technique IDs (e.g. `["T1190", "T1059.001"]`).
1802
- * @param framework ATT&CK matrix variant — `enterprise`, `ics`, or `mobile`.
1803
- * @param include Override the default `TECHNIQUE_FULL` chain.
1804
- */
1805
- async enrichTechniqueFull(techniqueIds, framework = "enterprise", include = chunk4PCL3ANB_cjs.TECHNIQUE_FULL) {
1806
- const result = await chunk4HSWOQA6_cjs.enrichTechnique({
2225
+ * Enrich one or more ATT&CK techniques with TIE, adversary attribution,
2226
+ * and Navigator JSON.
2227
+ *
2228
+ * @param techniqueIds ATT&CK technique IDs (e.g. `["T1190", "T1059.001"]`). Omit it when
2229
+ * looking up by `assetId`.
2230
+ * @param framework ATT&CK matrix variant — `enterprise`, `ics`, or `mobile`.
2231
+ * @param include Override the default `TECHNIQUE_FULL` chain. `fraud` (opt-in) adds the MITRE
2232
+ * F3 fraud techniques whose borrowed ATT&CK ids resolve to each returned technique; the
2233
+ * other opt-ins are `fight` (FiGHT techniques by id), `lolbas` (facts-only binaries),
2234
+ * `sigma`, `lotl` (LOLDrivers plus the facts-only GTFOBins and HijackLibs rows mapped
2235
+ * onto the technique), `atomic_red_team` (Atomic Red Team tests: name, GUID, platforms,
2236
+ * executor and elevation flag, never a command body), `framework_mappings`, `asset_classes`, `log_sources` and
2237
+ * `analytic_details`.
2238
+
2239
+ * @param assetId ICS asset to look up from (e.g. `"A0002"`) — returns the techniques that
2240
+ * asset's classes target. Requires `framework: "ics"` and is mutually exclusive with
2241
+ * `techniqueIds`: it is a selector in its own right, not an added filter.
2242
+ */
2243
+ async enrichTechniqueFull(techniqueIds, framework = "enterprise", include = chunkTAMKRTM6_cjs.TECHNIQUE_FULL, assetId) {
2244
+ const result = await chunkASYQPVBW_cjs.enrichTechnique({
1807
2245
  client: this._client,
1808
2246
  body: {
1809
- technique_ids: techniqueIds,
2247
+ ...techniqueIds !== void 0 && { technique_ids: techniqueIds },
2248
+ ...assetId !== void 0 && { asset_id: assetId },
1810
2249
  framework,
1811
2250
  include: [...include]
1812
2251
  }
@@ -1814,22 +2253,36 @@ var CrawlerClient = class {
1814
2253
  return ensureOk(result);
1815
2254
  }
1816
2255
  /**
1817
- * Find vulnerabilities affecting a product/version and enrich each matched CVE.
2256
+ * Return one page of enriched CVEs for a product/version.
2257
+ * For full log sources, PoCs, Sigma rules, or D3FEND rows, call `enrichCveFull` with the CVE ID,
2258
+ * `techniques`, the base layer, and its `*_full` token.
1818
2259
  *
1819
- * @param product Product name (e.g. `"Apache HTTP Server"`, `"nginx"`).
1820
- * @param options Optional `version`, `vendor`, and `include` overrides.
2260
+ * @param product Product name (e.g. `"http_server"`, `"nginx"`).
2261
+ * @param options Optional version, vendor, include, limit, and offset. The full preset defaults to 2 CVEs per page.
1821
2262
  */
1822
2263
  async enrichProductFull(product, options = {}) {
1823
- const result = await chunk4HSWOQA6_cjs.enrichProduct({
2264
+ const result = await chunkASYQPVBW_cjs.enrichProduct({
1824
2265
  client: this._client,
1825
2266
  body: {
1826
2267
  product,
1827
2268
  ...options.version !== void 0 && { version: options.version },
1828
2269
  ...options.vendor !== void 0 && { vendor: options.vendor },
1829
- include: [...options.include ?? chunk4PCL3ANB_cjs.PRODUCT_FULL]
2270
+ limit: options.limit ?? 2,
2271
+ ...options.offset !== void 0 && { offset: options.offset },
2272
+ ...options.snapshotId !== void 0 && {
2273
+ snapshot_id: options.snapshotId
2274
+ },
2275
+ include: [...options.include ?? chunkTAMKRTM6_cjs.PRODUCT_FULL]
1830
2276
  }
1831
2277
  });
1832
- return ensureOk(result);
2278
+ return expandCveContext(ensureOk(result));
2279
+ }
2280
+ async *iterProductCves(product, options = {}) {
2281
+ const pages = await collectSnapshotPages(
2282
+ (offset, snapshotId) => this.enrichProductFull(product, { ...options, offset, snapshotId }),
2283
+ (page) => page.cves_next_offset
2284
+ );
2285
+ yield* pages;
1833
2286
  }
1834
2287
  /**
1835
2288
  * Enrich an open-source package — OSV.dev advisories + full CVE enrichment.
@@ -1844,16 +2297,48 @@ var CrawlerClient = class {
1844
2297
  * @param options Optional `version` and `include` overrides.
1845
2298
  */
1846
2299
  async enrichPackageFull(ecosystem, packageName, options = {}) {
1847
- const result = await chunk4HSWOQA6_cjs.enrichPackage({
2300
+ const result = await chunkASYQPVBW_cjs.enrichPackage({
1848
2301
  client: this._client,
1849
2302
  body: {
1850
2303
  ecosystem,
1851
2304
  package: packageName,
1852
2305
  ...options.version !== void 0 && { version: options.version },
1853
- include: [...options.include ?? chunk4PCL3ANB_cjs.PACKAGE_FULL]
2306
+ limit: options.limit ?? 5,
2307
+ ...options.offset !== void 0 && { offset: options.offset },
2308
+ ...options.snapshotId !== void 0 && {
2309
+ snapshot_id: options.snapshotId
2310
+ },
2311
+ include: [...options.include ?? chunkTAMKRTM6_cjs.PACKAGE_FULL]
1854
2312
  }
1855
2313
  });
1856
- return ensureOk(result);
2314
+ return expandCveContext(ensureOk(result));
2315
+ }
2316
+ async *iterPackageAdvisories(ecosystem, packageName, options = {}) {
2317
+ let offset = 0;
2318
+ let snapshotId;
2319
+ while (true) {
2320
+ const page = await this.enrichPackageFull(ecosystem, packageName, {
2321
+ ...options,
2322
+ offset,
2323
+ snapshotId
2324
+ });
2325
+ if (page.errors?.some(
2326
+ (error) => error.service === "osv" && error.error === "stored_copy_unavailable"
2327
+ )) {
2328
+ throw new Error("stored_copy_unavailable");
2329
+ }
2330
+ if (snapshotId !== void 0 && page.snapshot_id !== snapshotId) {
2331
+ throw new Error("Enrichment returned a different snapshot identifier");
2332
+ }
2333
+ const nextOffset = page.next_offset;
2334
+ if (nextOffset != null && (!page.snapshot_id || !Number.isInteger(nextOffset) || nextOffset <= offset)) {
2335
+ throw new Error("Enrichment returned an invalid package continuation");
2336
+ }
2337
+ yield page;
2338
+ if (nextOffset == null) return;
2339
+ offset = nextOffset;
2340
+ snapshotId = page.snapshot_id ?? void 0;
2341
+ }
1857
2342
  }
1858
2343
  /**
1859
2344
  * Keyword-search the ATT&CK knowledge base for matching techniques.
@@ -1866,7 +2351,7 @@ var CrawlerClient = class {
1866
2351
  * @param options Optional `limit` (1-100, default 20).
1867
2352
  */
1868
2353
  async searchTechniques(keyword, options = {}) {
1869
- const result = await chunk4HSWOQA6_cjs.searchCti({
2354
+ const result = await chunkASYQPVBW_cjs.searchCti({
1870
2355
  client: this._client,
1871
2356
  body: {
1872
2357
  query: keyword,
@@ -1890,12 +2375,12 @@ var CrawlerClient = class {
1890
2375
  * @param options Optional `search` keyword and `include` override (default `ATLAS_FULL`).
1891
2376
  */
1892
2377
  async enrichAtlasFull(techniqueId, options = {}) {
1893
- const result = await chunk4HSWOQA6_cjs.enrichAtlas({
2378
+ const result = await chunkASYQPVBW_cjs.enrichAtlas({
1894
2379
  client: this._client,
1895
2380
  body: {
1896
2381
  ...techniqueId !== void 0 && { technique_id: techniqueId },
1897
2382
  ...options.search !== void 0 && { search: options.search },
1898
- include: [...options.include ?? chunk4PCL3ANB_cjs.ATLAS_FULL]
2383
+ include: [...options.include ?? chunkTAMKRTM6_cjs.ATLAS_FULL]
1899
2384
  }
1900
2385
  });
1901
2386
  return ensureOk(result);
@@ -1908,13 +2393,13 @@ var CrawlerClient = class {
1908
2393
  * override (default `CAMPAIGN_FULL`).
1909
2394
  */
1910
2395
  async enrichCampaignFull(campaignId, options = {}) {
1911
- const result = await chunk4HSWOQA6_cjs.enrichCampaign({
2396
+ const result = await chunkASYQPVBW_cjs.enrichCampaign({
1912
2397
  client: this._client,
1913
2398
  body: {
1914
2399
  ...campaignId !== void 0 && { campaign_id: campaignId },
1915
2400
  ...options.search !== void 0 && { search: options.search },
1916
2401
  framework: options.framework ?? "enterprise",
1917
- include: [...options.include ?? chunk4PCL3ANB_cjs.CAMPAIGN_FULL]
2402
+ include: [...options.include ?? chunkTAMKRTM6_cjs.CAMPAIGN_FULL]
1918
2403
  }
1919
2404
  });
1920
2405
  return ensureOk(result);
@@ -1926,12 +2411,32 @@ var CrawlerClient = class {
1926
2411
  * @param options Optional `search` keyword and `include` override (default `CAPEC_FULL`).
1927
2412
  */
1928
2413
  async enrichCapecFull(capecId, options = {}) {
1929
- const result = await chunk4HSWOQA6_cjs.enrichCapec({
2414
+ const result = await chunkASYQPVBW_cjs.enrichCapec({
1930
2415
  client: this._client,
1931
2416
  body: {
1932
2417
  ...capecId !== void 0 && { capec_id: capecId },
1933
2418
  ...options.search !== void 0 && { search: options.search },
1934
- include: [...options.include ?? chunk4PCL3ANB_cjs.CAPEC_FULL]
2419
+ include: [...options.include ?? chunkTAMKRTM6_cjs.CAPEC_FULL]
2420
+ }
2421
+ });
2422
+ return ensureOk(result);
2423
+ }
2424
+ /**
2425
+ * Resolve a CLOAK concealment technique — details and knowledge base context.
2426
+ *
2427
+ * CLOAK objects carry no ATT&CK references, so there is no linked-technique layer:
2428
+ * the response has no `linked_techniques` field at all.
2429
+ *
2430
+ * @param cloakId CLOAK identifier (e.g. `TTP-496`, or a technique slug such as `ta6-te129`).
2431
+ * @param options Optional `search` keyword and `include` override (default `CLOAK_FULL`).
2432
+ */
2433
+ async enrichCloakFull(cloakId, options = {}) {
2434
+ const result = await chunkASYQPVBW_cjs.enrichCloak({
2435
+ client: this._client,
2436
+ body: {
2437
+ ...cloakId !== void 0 && { cloak_id: cloakId },
2438
+ ...options.search !== void 0 && { search: options.search },
2439
+ include: [...options.include ?? chunkTAMKRTM6_cjs.CLOAK_FULL]
1935
2440
  }
1936
2441
  });
1937
2442
  return ensureOk(result);
@@ -1943,29 +2448,55 @@ var CrawlerClient = class {
1943
2448
  * @param options Optional `search` keyword and `include` override (default `DEFEND_FULL`).
1944
2449
  */
1945
2450
  async enrichDefendFull(d3fendId, options = {}) {
1946
- const result = await chunk4HSWOQA6_cjs.enrichDefend({
2451
+ const result = await chunkASYQPVBW_cjs.enrichDefend({
1947
2452
  client: this._client,
1948
2453
  body: {
1949
2454
  ...d3fendId !== void 0 && { d3fend_id: d3fendId },
1950
2455
  ...options.search !== void 0 && { search: options.search },
1951
- include: [...options.include ?? chunk4PCL3ANB_cjs.DEFEND_FULL]
2456
+ include: [...options.include ?? chunkTAMKRTM6_cjs.DEFEND_FULL]
1952
2457
  }
1953
2458
  });
1954
2459
  return ensureOk(result);
1955
2460
  }
1956
2461
  /**
1957
- * Walk a DISARM disinformation technique to its countermeasures and ATT&CK mappings.
2462
+ * Walk a DISARM disinformation technique to its family links and context.
2463
+ *
2464
+ * DISARM has no course-of-action objects and no ATT&CK-Enterprise-keyed actors/campaigns, so the
2465
+ * response carries the technique, its DISARM family (`relatedDisarmTechniques`), and the
2466
+ * knowledge-base / web / summary context — nothing else.
1958
2467
  *
1959
2468
  * @param techniqueId DISARM technique ID (e.g. `T0086`).
1960
2469
  * @param options Optional `search` keyword and `include` override (default `DISARM_FULL`).
1961
2470
  */
1962
2471
  async enrichDisarmFull(techniqueId, options = {}) {
1963
- const result = await chunk4HSWOQA6_cjs.enrichDisarm({
2472
+ const result = await chunkASYQPVBW_cjs.enrichDisarm({
1964
2473
  client: this._client,
1965
2474
  body: {
1966
2475
  ...techniqueId !== void 0 && { technique_id: techniqueId },
1967
2476
  ...options.search !== void 0 && { search: options.search },
1968
- include: [...options.include ?? chunk4PCL3ANB_cjs.DISARM_FULL]
2477
+ include: [...options.include ?? chunkTAMKRTM6_cjs.DISARM_FULL]
2478
+ }
2479
+ });
2480
+ return ensureOk(result);
2481
+ }
2482
+ /**
2483
+ * Walk a MITRE F3 fraud technique to the ATT&CK techniques it borrows.
2484
+ *
2485
+ * F3 borrows real ATT&CK `T####` ids for the techniques it shares with Enterprise
2486
+ * ATT&CK, so a `T`-shaped id resolves here too. Unlike the other framework walks,
2487
+ * calling with neither an id nor `search` is valid — the server answers 200 with
2488
+ * nothing selected rather than rejecting the request.
2489
+ *
2490
+ * @param f3Id F3 identifier (e.g. `F1031`, `F1025.003`).
2491
+ * @param options Optional `search` keyword and `include` override (default `F3_FULL`).
2492
+ */
2493
+ async enrichF3Full(f3Id, options = {}) {
2494
+ const result = await chunkASYQPVBW_cjs.enrichF3({
2495
+ client: this._client,
2496
+ body: {
2497
+ ...f3Id !== void 0 && { f3_id: f3Id },
2498
+ ...options.search !== void 0 && { search: options.search },
2499
+ include: [...options.include ?? chunkTAMKRTM6_cjs.F3_FULL]
1969
2500
  }
1970
2501
  });
1971
2502
  return ensureOk(result);
@@ -1978,47 +2509,65 @@ var CrawlerClient = class {
1978
2509
  * override (default `GROUP_FULL`).
1979
2510
  */
1980
2511
  async enrichGroupFull(groupId, options = {}) {
1981
- const result = await chunk4HSWOQA6_cjs.enrichGroup({
2512
+ const result = await chunkASYQPVBW_cjs.enrichGroup({
1982
2513
  client: this._client,
1983
2514
  body: {
1984
2515
  ...groupId !== void 0 && { group_id: groupId },
1985
2516
  ...options.search !== void 0 && { search: options.search },
1986
2517
  framework: options.framework ?? "enterprise",
1987
- include: [...options.include ?? chunk4PCL3ANB_cjs.GROUP_FULL]
2518
+ ...options.limit !== void 0 && { limit: options.limit },
2519
+ ...options.offset !== void 0 && { offset: options.offset },
2520
+ ...options.snapshotId !== void 0 && {
2521
+ snapshot_id: options.snapshotId
2522
+ },
2523
+ include: [...options.include ?? chunkTAMKRTM6_cjs.GROUP_FULL]
1988
2524
  }
1989
2525
  });
1990
- return ensureOk(result);
2526
+ const page = ensureOk(result);
2527
+ expandGroupCatalogue(
2528
+ page.log_source_catalog,
2529
+ page.log_source_refs,
2530
+ page.group?.techniques
2531
+ );
2532
+ return page;
2533
+ }
2534
+ async *iterGroupPages(groupId, options = {}) {
2535
+ const pages = await collectSnapshotPages(
2536
+ (offset, snapshotId) => this.enrichGroupFull(groupId, { ...options, offset, snapshotId }),
2537
+ (page) => page.techniques_next_offset
2538
+ );
2539
+ yield* pages;
1991
2540
  }
1992
2541
  /**
1993
- * Map a region's threat landscape — active groups, their techniques, and affected sectors.
2542
+ * Map a region's profile — details plus knowledge base context.
1994
2543
  *
1995
- * @param locationId Region identifier (e.g. `UA`, or an ATT&CK location STIX ID).
2544
+ * @param locationId Region identifier (e.g. `US`, or a STIX location ID).
1996
2545
  * @param options Optional `search` keyword and `include` override (default `LOCATION_FULL`).
1997
2546
  */
1998
2547
  async enrichLocationFull(locationId, options = {}) {
1999
- const result = await chunk4HSWOQA6_cjs.enrichLocation({
2548
+ const result = await chunkASYQPVBW_cjs.enrichLocation({
2000
2549
  client: this._client,
2001
2550
  body: {
2002
2551
  ...locationId !== void 0 && { location_id: locationId },
2003
2552
  ...options.search !== void 0 && { search: options.search },
2004
- include: [...options.include ?? chunk4PCL3ANB_cjs.LOCATION_FULL]
2553
+ include: [...options.include ?? chunkTAMKRTM6_cjs.LOCATION_FULL]
2005
2554
  }
2006
2555
  });
2007
2556
  return ensureOk(result);
2008
2557
  }
2009
2558
  /**
2010
- * Map an industry sector's threat landscape — who targets it, how, and from where.
2559
+ * Map an industry sector's profile — details plus knowledge base context.
2011
2560
  *
2012
- * @param sectorId Sector identifier (e.g. `energy`, or an ATT&CK sector STIX ID).
2561
+ * @param sectorId Sector identifier (e.g. `energy`, or a STIX sector ID).
2013
2562
  * @param options Optional `search` keyword and `include` override (default `SECTOR_FULL`).
2014
2563
  */
2015
2564
  async enrichSectorFull(sectorId, options = {}) {
2016
- const result = await chunk4HSWOQA6_cjs.enrichSector({
2565
+ const result = await chunkASYQPVBW_cjs.enrichSector({
2017
2566
  client: this._client,
2018
2567
  body: {
2019
2568
  ...sectorId !== void 0 && { sector_id: sectorId },
2020
2569
  ...options.search !== void 0 && { search: options.search },
2021
- include: [...options.include ?? chunk4PCL3ANB_cjs.SECTOR_FULL]
2570
+ include: [...options.include ?? chunkTAMKRTM6_cjs.SECTOR_FULL]
2022
2571
  }
2023
2572
  });
2024
2573
  return ensureOk(result);
@@ -2031,13 +2580,13 @@ var CrawlerClient = class {
2031
2580
  * override (default `SOFTWARE_FULL`).
2032
2581
  */
2033
2582
  async enrichSoftwareFull(softwareId, options = {}) {
2034
- const result = await chunk4HSWOQA6_cjs.enrichSoftware({
2583
+ const result = await chunkASYQPVBW_cjs.enrichSoftware({
2035
2584
  client: this._client,
2036
2585
  body: {
2037
2586
  ...softwareId !== void 0 && { software_id: softwareId },
2038
2587
  ...options.search !== void 0 && { search: options.search },
2039
2588
  framework: options.framework ?? "enterprise",
2040
- include: [...options.include ?? chunk4PCL3ANB_cjs.SOFTWARE_FULL]
2589
+ include: [...options.include ?? chunkTAMKRTM6_cjs.SOFTWARE_FULL]
2041
2590
  }
2042
2591
  });
2043
2592
  return ensureOk(result);
@@ -2054,11 +2603,25 @@ var CrawlerClient = class {
2054
2603
  * @param items Discriminated batch items (`{ type: "cve", cve_id: "..." }`, …).
2055
2604
  */
2056
2605
  async enrichBatch(items) {
2057
- const result = await chunk4HSWOQA6_cjs.enrichBatch({
2606
+ const result = await chunkASYQPVBW_cjs.enrichBatch({
2058
2607
  client: this._client,
2059
2608
  body: { items }
2060
2609
  });
2061
- return ensureOk(result);
2610
+ const response = ensureOk(result);
2611
+ for (const row of response.results ?? []) {
2612
+ if ((row.type === "product" || row.type === "package") && row.data) {
2613
+ expandCveContext(row.data);
2614
+ }
2615
+ if (row.type === "group" && row.data) {
2616
+ const group = row.data;
2617
+ expandGroupCatalogue(
2618
+ group.log_source_catalog,
2619
+ group.log_source_refs,
2620
+ group.group?.techniques
2621
+ );
2622
+ }
2623
+ }
2624
+ return response;
2062
2625
  }
2063
2626
  /**
2064
2627
  * Fetch the source of a public proof-of-concept exploit repository.
@@ -2069,7 +2632,7 @@ var CrawlerClient = class {
2069
2632
  * @param repoUrl Public repository URL of the PoC.
2070
2633
  */
2071
2634
  async enrichPocSource(repoUrl) {
2072
- const result = await chunk4HSWOQA6_cjs.enrichPocSource({
2635
+ const result = await chunkASYQPVBW_cjs.enrichPocSource({
2073
2636
  client: this._client,
2074
2637
  body: { repo_url: repoUrl }
2075
2638
  });
@@ -2089,7 +2652,7 @@ var CrawlerClient = class {
2089
2652
  * @param options `groupIds`, `search` terms, `framework` matrix, and `include` layers.
2090
2653
  */
2091
2654
  async assessGroupExposure(options = {}) {
2092
- const result = await chunk4HSWOQA6_cjs.assessGroupExposure({
2655
+ const result = await chunkASYQPVBW_cjs.assessGroupExposure({
2093
2656
  client: this._client,
2094
2657
  body: {
2095
2658
  ...options.groupIds !== void 0 && {
@@ -2097,10 +2660,28 @@ var CrawlerClient = class {
2097
2660
  },
2098
2661
  ...options.search !== void 0 && { search: [...options.search] },
2099
2662
  framework: options.framework ?? "enterprise",
2663
+ ...options.limit !== void 0 && { limit: options.limit },
2664
+ ...options.offset !== void 0 && { offset: options.offset },
2665
+ ...options.snapshotId !== void 0 && {
2666
+ snapshot_id: options.snapshotId
2667
+ },
2100
2668
  ...options.include !== void 0 && { include: [...options.include] }
2101
2669
  }
2102
2670
  });
2103
- return ensureOk(result);
2671
+ const page = ensureOk(result);
2672
+ expandGroupCatalogue(
2673
+ page.log_source_catalog,
2674
+ page.log_source_refs,
2675
+ page.techniques
2676
+ );
2677
+ return page;
2678
+ }
2679
+ async *iterGroupExposurePages(options = {}) {
2680
+ const pages = await collectSnapshotPages(
2681
+ (offset, snapshotId) => this.assessGroupExposure({ ...options, offset, snapshotId }),
2682
+ (page) => page.techniques_next_offset
2683
+ );
2684
+ yield* pages;
2104
2685
  }
2105
2686
  /**
2106
2687
  * Assess a portfolio of indicators — MISP corroboration, linked techniques, attribution.
@@ -2109,7 +2690,7 @@ var CrawlerClient = class {
2109
2690
  * @param options Optional `include` layers.
2110
2691
  */
2111
2692
  async assessIocPortfolio(indicators, options = {}) {
2112
- const result = await chunk4HSWOQA6_cjs.assessIocPortfolio({
2693
+ const result = await chunkASYQPVBW_cjs.assessIocPortfolio({
2113
2694
  client: this._client,
2114
2695
  body: {
2115
2696
  indicators,
@@ -2125,7 +2706,7 @@ var CrawlerClient = class {
2125
2706
  * @param options Optional `framework` matrix and `include` layers.
2126
2707
  */
2127
2708
  async assessTechniqueCoverage(techniqueIds, options = {}) {
2128
- const result = await chunk4HSWOQA6_cjs.assessTechniqueCoverage({
2709
+ const result = await chunkASYQPVBW_cjs.assessTechniqueCoverage({
2129
2710
  client: this._client,
2130
2711
  body: {
2131
2712
  technique_ids: [...techniqueIds],
@@ -2138,23 +2719,48 @@ var CrawlerClient = class {
2138
2719
  /**
2139
2720
  * Prioritize a set of CVEs — weaponization, exploit chains, and remediation order.
2140
2721
  *
2722
+ * Returns one page. OSV advisories are aggregated across `cveIds` and paged: while
2723
+ * `osv_next_offset` is set, request the next page with that offset and the response's
2724
+ * `osv_snapshot_id`, or stream the whole walk with {@link iterVulnerabilityExposureOsvPages}.
2725
+ *
2141
2726
  * @param cveIds CVE identifiers to assess.
2142
- * @param options Optional `include` layers and an SSVC `stakeholder` profile that
2143
- * tunes the decision to your deployment.
2727
+ * @param options Optional `include` layers (a continuation must repeat them; `osv_restricted`
2728
+ * is the licence opt-in), an SSVC `stakeholder` profile that tunes the decision to your
2729
+ * deployment, and the `osvOffset` / `osvSnapshotId` cursor from the previous page.
2144
2730
  */
2145
2731
  async assessVulnerabilityExposure(cveIds, options = {}) {
2146
- const result = await chunk4HSWOQA6_cjs.assessVulnerabilityExposure({
2732
+ const result = await chunkASYQPVBW_cjs.assessVulnerabilityExposure({
2147
2733
  client: this._client,
2148
2734
  body: {
2149
2735
  cve_ids: [...cveIds],
2150
2736
  ...options.include !== void 0 && { include: [...options.include] },
2151
2737
  ...options.stakeholder !== void 0 && {
2152
2738
  stakeholder: options.stakeholder
2739
+ },
2740
+ ...options.osvOffset !== void 0 && {
2741
+ osv_offset: options.osvOffset
2742
+ },
2743
+ ...options.osvSnapshotId !== void 0 && {
2744
+ osv_snapshot_id: options.osvSnapshotId
2153
2745
  }
2154
2746
  }
2155
2747
  });
2156
2748
  return ensureOk(result);
2157
2749
  }
2750
+ /**
2751
+ * Stream every OSV advisory page of a vulnerability-exposure assessment without an aggregate
2752
+ * buffer. Same contract as {@link iterCveOsvPages}: the first page is the whole assessment, a
2753
+ * changed or expired snapshot throws instead of restarting, and the caller owns any collection bound.
2754
+ */
2755
+ async *iterVulnerabilityExposureOsvPages(cveIds, options = {}) {
2756
+ yield* iterOsvPages(
2757
+ (osvOffset, osvSnapshotId) => this.assessVulnerabilityExposure(cveIds, {
2758
+ ...options,
2759
+ osvOffset,
2760
+ ...osvSnapshotId !== void 0 && { osvSnapshotId }
2761
+ })
2762
+ );
2763
+ }
2158
2764
  // -- Search ------------------------------------------------------------ //
2159
2765
  //
2160
2766
  // Search endpoints query a corpus and return matches; they never walk an
@@ -2170,7 +2776,7 @@ var CrawlerClient = class {
2170
2776
  * @param options `sources`, `types`, `limit`, `page`, and the `deprecated`/`revoked` filters.
2171
2777
  */
2172
2778
  async searchCti(query, options = {}) {
2173
- const result = await chunk4HSWOQA6_cjs.searchCti({
2779
+ const result = await chunkASYQPVBW_cjs.searchCti({
2174
2780
  client: this._client,
2175
2781
  body: {
2176
2782
  query,
@@ -2181,7 +2787,8 @@ var CrawlerClient = class {
2181
2787
  ...options.deprecated !== void 0 && {
2182
2788
  deprecated: options.deprecated
2183
2789
  },
2184
- ...options.revoked !== void 0 && { revoked: options.revoked }
2790
+ ...options.revoked !== void 0 && { revoked: options.revoked },
2791
+ ...options.include !== void 0 && { include: [...options.include] }
2185
2792
  }
2186
2793
  });
2187
2794
  return ensureOk(result);
@@ -2195,9 +2802,12 @@ var CrawlerClient = class {
2195
2802
  *
2196
2803
  * @param query Free-text query. Omit it to filter purely on the structured fields.
2197
2804
  * @param options Any combination of the corpus filters, plus `sort`, `limit`, `page`.
2805
+ * `include` replaces the server defaults: `details`, `statistics`, `cna`, `epss_reports`,
2806
+ * and `kb_rankings` default on. `kb_rankings` keeps the top 100 rows per KB without yearly
2807
+ * trends; `kb_rankings_full` restores all fetched rows and trends.
2198
2808
  */
2199
2809
  async searchCve(query, options = {}) {
2200
- const result = await chunk4HSWOQA6_cjs.searchCve({
2810
+ const result = await chunkASYQPVBW_cjs.searchCve({
2201
2811
  client: this._client,
2202
2812
  body: {
2203
2813
  ...query !== void 0 && { query },
@@ -2252,10 +2862,12 @@ var CrawlerClient = class {
2252
2862
  * Search the D3FEND defensive-countermeasure ontology.
2253
2863
  *
2254
2864
  * @param query Free-text query (e.g. `"network traffic analysis"`).
2255
- * @param options `d3fendForm` to scope to a tactic/mitigation/artifact, plus `limit`, `page`.
2865
+ * @param options `d3fendForm` to scope to a tactic/mitigation/artifact, plus `limit`, `page`,
2866
+ * and `include`. `versions` defaults on and attaches each returned technique's revision history.
2867
+ * An explicit include replaces the defaults; pass `[]` to omit all optional layers.
2256
2868
  */
2257
2869
  async searchD3fend(query, options = {}) {
2258
- const result = await chunk4HSWOQA6_cjs.searchD3Fend({
2870
+ const result = await chunkASYQPVBW_cjs.searchD3Fend({
2259
2871
  client: this._client,
2260
2872
  body: {
2261
2873
  query,
@@ -2263,7 +2875,8 @@ var CrawlerClient = class {
2263
2875
  d3fend_form: options.d3fendForm
2264
2876
  },
2265
2877
  limit: options.limit ?? 20,
2266
- page: options.page ?? 1
2878
+ page: options.page ?? 1,
2879
+ ...options.include !== void 0 && { include: [...options.include] }
2267
2880
  }
2268
2881
  });
2269
2882
  return ensureOk(result);
@@ -2273,10 +2886,12 @@ var CrawlerClient = class {
2273
2886
  *
2274
2887
  * An empty call pages the whole catalog; `cveId` checks one CVE's KEV status.
2275
2888
  *
2276
- * @param options `cveId`, `ransomwareStatus`, `limit`, `page`.
2889
+ * @param options `cveId`, `ransomwareStatus`, `limit`, `page`, and `include`. `statistics`
2890
+ * defaults on for deployment-wide corpus coverage. An explicit include replaces the defaults;
2891
+ * pass `[]` to omit all optional layers.
2277
2892
  */
2278
2893
  async searchKev(options = {}) {
2279
- const result = await chunk4HSWOQA6_cjs.searchKev({
2894
+ const result = await chunkASYQPVBW_cjs.searchKev({
2280
2895
  client: this._client,
2281
2896
  body: {
2282
2897
  ...options.cveId !== void 0 && { cve_id: options.cveId },
@@ -2284,6 +2899,35 @@ var CrawlerClient = class {
2284
2899
  ransomware_status: options.ransomwareStatus
2285
2900
  },
2286
2901
  limit: options.limit ?? 50,
2902
+ page: options.page ?? 1,
2903
+ ...options.include !== void 0 && { include: [...options.include] }
2904
+ }
2905
+ });
2906
+ return ensureOk(result);
2907
+ }
2908
+ /**
2909
+ * Search the seeded CSAF vendor-advisory corpus.
2910
+ *
2911
+ * Filters combine with AND; this is the door for CVE-less advisories (publisher, sector,
2912
+ * product, CPE, TLP). `total` is the unpaginated match count.
2913
+ */
2914
+ async searchCsaf(options = {}) {
2915
+ const result = await chunkASYQPVBW_cjs.searchCsaf({
2916
+ client: this._client,
2917
+ body: {
2918
+ ...options.cveId !== void 0 && { cve_id: options.cveId },
2919
+ ...options.advisoryId !== void 0 && {
2920
+ advisory_id: options.advisoryId
2921
+ },
2922
+ ...options.publisher !== void 0 && {
2923
+ publisher: options.publisher
2924
+ },
2925
+ ...options.sector !== void 0 && { sector: options.sector },
2926
+ ...options.product !== void 0 && { product: options.product },
2927
+ ...options.cpe !== void 0 && { cpe: options.cpe },
2928
+ ...options.tlp !== void 0 && { tlp: options.tlp },
2929
+ sort: options.sort ?? "newest",
2930
+ limit: options.limit ?? 20,
2287
2931
  page: options.page ?? 1
2288
2932
  }
2289
2933
  });
@@ -2297,7 +2941,7 @@ var CrawlerClient = class {
2297
2941
  * weighting (0 = pure vector, 1 = pure keyword), and `limit`.
2298
2942
  */
2299
2943
  async searchKnowledgebase(query, options = {}) {
2300
- const result = await chunk4HSWOQA6_cjs.searchKnowledgebase({
2944
+ const result = await chunkASYQPVBW_cjs.searchKnowledgebase({
2301
2945
  client: this._client,
2302
2946
  body: {
2303
2947
  query,
@@ -2311,14 +2955,23 @@ var CrawlerClient = class {
2311
2955
  return ensureOk(result);
2312
2956
  }
2313
2957
  /**
2314
- * Search MISP events and attributes.
2958
+ * Search our curated MISP (public threat feeds) for events and attributes.
2959
+ * Feed list: https://crimsoncrawler.com/docs/guides/data-sources/#our-curated-misp.
2315
2960
  *
2316
2961
  * @param options Attribute filters (`value`, `typeAttribute`, `category`, `toIds`),
2317
2962
  * event filters (`eventId`, `eventinfo`, `tags`, `threatLevelId`, `published`),
2318
2963
  * a `dateFrom`/`dateTo` window, plus `limit` and `page`.
2964
+ * `include` takes any of `"sightings"` (asks MISP for the inline `Sighting` array so each
2965
+ * attribute's `sightings[]`/`sighting_count` and each returned event's sightings are real
2966
+ * counts instead of 0), `"event_reports"` (the analyst-written markdown narratives for the
2967
+ * matched events), `"stats"` (per-event attribute/object/sighting counts), `"tags"` (the
2968
+ * instance's tag vocabulary), `"feeds"` (feed previews), `"objects"` (full event bodies with
2969
+ * resolved references), `"misp_events_full"` (full event bodies), and `"version"`. Events
2970
+ * otherwise return summaries; `misp_events_total` is null when unknown.
2971
+ * Omit `include` for event reports, tags and version; pass `[]` to omit them.
2319
2972
  */
2320
2973
  async searchMisp(options = {}) {
2321
- const result = await chunk4HSWOQA6_cjs.searchMisp({
2974
+ const result = await chunkASYQPVBW_cjs.searchMisp({
2322
2975
  client: this._client,
2323
2976
  body: {
2324
2977
  ...options.value !== void 0 && { value: options.value },
@@ -2340,6 +2993,7 @@ var CrawlerClient = class {
2340
2993
  },
2341
2994
  ...options.dateFrom !== void 0 && { date_from: options.dateFrom },
2342
2995
  ...options.dateTo !== void 0 && { date_to: options.dateTo },
2996
+ ...options.include !== void 0 && { include: [...options.include] },
2343
2997
  limit: options.limit ?? 50,
2344
2998
  page: options.page ?? 1
2345
2999
  }
@@ -2355,7 +3009,7 @@ var CrawlerClient = class {
2355
3009
  * @param options Optional `limit` (default 25).
2356
3010
  */
2357
3011
  async searchPoc(cveId, options = {}) {
2358
- const result = await chunk4HSWOQA6_cjs.searchPoc({
3012
+ const result = await chunkASYQPVBW_cjs.searchPoc({
2359
3013
  client: this._client,
2360
3014
  body: {
2361
3015
  cve_id: cveId,
@@ -2373,10 +3027,11 @@ var CrawlerClient = class {
2373
3027
  * @param options Optional `limit` (default 50).
2374
3028
  */
2375
3029
  async searchVendor(vendor, options = {}) {
2376
- const result = await chunk4HSWOQA6_cjs.searchVendor({
3030
+ const result = await chunkASYQPVBW_cjs.searchVendor({
2377
3031
  client: this._client,
2378
3032
  body: {
2379
- vendor,
3033
+ vendor: vendor ?? void 0,
3034
+ q: options.q,
2380
3035
  limit: options.limit ?? 50
2381
3036
  }
2382
3037
  });
@@ -2399,15 +3054,19 @@ var CrawlerClient = class {
2399
3054
  * report `include` sections, and an SSVC `stakeholder` profile.
2400
3055
  */
2401
3056
  async artifactEnrich(options = {}) {
2402
- const result = await chunk4HSWOQA6_cjs.artifactEnrich({
3057
+ const result = await chunkASYQPVBW_cjs.artifactEnrich({
2403
3058
  client: this._client,
2404
3059
  body: {
2405
3060
  ...options.text !== void 0 && { text: options.text },
3061
+ ...options.texts !== void 0 && { texts: options.texts },
2406
3062
  ...options.files !== void 0 && { files: options.files },
2407
3063
  ...options.formats !== void 0 && { formats: options.formats },
2408
3064
  ...options.include !== void 0 && { include: [...options.include] },
2409
3065
  ...options.stakeholder !== void 0 && {
2410
3066
  stakeholder: options.stakeholder
3067
+ },
3068
+ ...options.attachedArtifactIds !== void 0 && {
3069
+ attached_artifact_ids: options.attachedArtifactIds
2411
3070
  }
2412
3071
  }
2413
3072
  });
@@ -2419,7 +3078,7 @@ var CrawlerClient = class {
2419
3078
  * @param enrichmentId The `enrichment_id` returned by {@link artifactEnrich}.
2420
3079
  */
2421
3080
  async artifactEnrichStatus(enrichmentId) {
2422
- const result = await chunk4HSWOQA6_cjs.artifactEnrichStatus({
3081
+ const result = await chunkASYQPVBW_cjs.artifactEnrichStatus({
2423
3082
  client: this._client,
2424
3083
  path: { enrichment_id: enrichmentId }
2425
3084
  });
@@ -2433,21 +3092,35 @@ var CrawlerClient = class {
2433
3092
  * fleet-level risk picture.
2434
3093
  *
2435
3094
  * @param items Assets to enrich, each at minimum `{ product }`.
2436
- * @param options Optional `attachmentsText`/`attachmentsFiles` for extra context
2437
- * and per-asset CVE `include` layers.
3095
+ * @param options Optional attachment context — `attachmentsText` (one opaque blob),
3096
+ * `attachmentsTexts` (one `{ text, source_artifact_id?, filename? }` entry per artifact, so
3097
+ * each block keeps its own attribution), `attachedArtifactIds` (the artifacts an opaque
3098
+ * `attachmentsText` came from) and `attachmentsFiles` (raw binary the engine parses) — plus
3099
+ * per-asset CVE `include` layers and `vexOverlay` — an OpenVEX 0.2.0 / CSAF 2.0 VEX
3100
+ * document (text) whose `not_affected`/`fixed` statements mark matching findings
3101
+ * `suppressed_by_vex` (retained + justification, excluded from the actionable counts).
2438
3102
  */
2439
3103
  async inventoryEnrich(items, options = {}) {
2440
- const result = await chunk4HSWOQA6_cjs.inventoryEnrich({
3104
+ const result = await chunkASYQPVBW_cjs.inventoryEnrich({
2441
3105
  client: this._client,
2442
3106
  body: {
2443
3107
  items: [...items],
2444
3108
  ...options.attachmentsText !== void 0 && {
2445
3109
  attachments_text: options.attachmentsText
2446
3110
  },
3111
+ ...options.attachmentsTexts !== void 0 && {
3112
+ attachments_texts: options.attachmentsTexts
3113
+ },
3114
+ ...options.attachedArtifactIds !== void 0 && {
3115
+ attached_artifact_ids: options.attachedArtifactIds
3116
+ },
2447
3117
  ...options.attachmentsFiles !== void 0 && {
2448
3118
  attachments_files: options.attachmentsFiles
2449
3119
  },
2450
- ...options.include !== void 0 && { include: [...options.include] }
3120
+ ...options.include !== void 0 && { include: [...options.include] },
3121
+ ...options.vexOverlay !== void 0 && {
3122
+ vex_overlay: { format: "vex", content: options.vexOverlay }
3123
+ }
2451
3124
  }
2452
3125
  });
2453
3126
  return ensureOk(result);
@@ -2458,13 +3131,58 @@ var CrawlerClient = class {
2458
3131
  * @param enrichmentId The `enrichment_id` returned by {@link inventoryEnrich}.
2459
3132
  */
2460
3133
  async inventoryEnrichStatus(enrichmentId) {
2461
- const result = await chunk4HSWOQA6_cjs.inventoryEnrichStatus({
3134
+ const result = await chunkASYQPVBW_cjs.inventoryEnrichStatus({
3135
+ client: this._client,
3136
+ path: { enrichment_id: enrichmentId }
3137
+ });
3138
+ return ensureOk(result);
3139
+ }
3140
+ /**
3141
+ * Submit a raw security event to the async Event Enricher engine.
3142
+ *
3143
+ * Returns immediately with an `enrichment_id` — poll {@link eventEnrichStatus}
3144
+ * for the result (per-indicator findings + the aggregate event threat
3145
+ * assessment), or use {@link enricher}.`enrichEvent` to run the whole lifecycle.
3146
+ * CC extracts every indicator server-side — you do NOT pre-parse the alert.
3147
+ *
3148
+ * @param event The raw event — a Defender XDR / Sentinel alert JSON, a SIEM/EDR
3149
+ * log line, or any text (≤200,000 chars).
3150
+ * @param options.eventId Optional caller-side event identifier (≤200 chars), echoed back on the result.
3151
+ */
3152
+ async eventEnrich(event, options = {}) {
3153
+ const result = await chunkASYQPVBW_cjs.eventEnrich({
3154
+ client: this._client,
3155
+ body: {
3156
+ event,
3157
+ ...options.eventId !== void 0 && { event_id: options.eventId }
3158
+ }
3159
+ });
3160
+ return ensureOk(result);
3161
+ }
3162
+ /**
3163
+ * Read the progress or result of an event enrichment.
3164
+ *
3165
+ * @param enrichmentId The `enrichment_id` returned by {@link eventEnrich}.
3166
+ */
3167
+ async eventEnrichStatus(enrichmentId) {
3168
+ const result = await chunkASYQPVBW_cjs.eventEnrichStatus({
2462
3169
  client: this._client,
2463
3170
  path: { enrichment_id: enrichmentId }
2464
3171
  });
2465
3172
  return ensureOk(result);
2466
3173
  }
2467
3174
  };
3175
+ function expandGroupCatalogue(catalog, refs, rows) {
3176
+ if (!catalog || !refs || !rows) return;
3177
+ for (const row of rows) {
3178
+ if (typeof row === "string") continue;
3179
+ const indices = refs[row.technique_id] ?? [];
3180
+ if (indices.some((i) => !Number.isInteger(i) || i < 0 || i >= catalog.length)) {
3181
+ throw new Error("Invalid group log-source catalogue reference");
3182
+ }
3183
+ if (indices.length) row.log_sources = indices.map((i) => catalog[i]);
3184
+ }
3185
+ }
2468
3186
  function ensureOk(result) {
2469
3187
  if (result.data !== void 0 && result.error === void 0) {
2470
3188
  return result.data;
@@ -2480,20 +3198,21 @@ function ensureOk(result) {
2480
3198
 
2481
3199
  // package.json
2482
3200
  var package_default = {
2483
- version: "4.1.1"};
3201
+ version: "5.0.0"};
2484
3202
 
2485
3203
  // src/index.ts
2486
3204
  var __version__ = package_default.version;
2487
3205
 
2488
3206
  Object.defineProperty(exports, "presets", {
2489
3207
  enumerable: true,
2490
- get: function () { return chunk4PCL3ANB_cjs.presets_exports; }
3208
+ get: function () { return chunkTAMKRTM6_cjs.presets_exports; }
2491
3209
  });
2492
3210
  exports.AiReportsApi = AiReportsApi;
2493
3211
  exports.ArtifactManagerApi = ArtifactManagerApi;
2494
3212
  exports.BASE_URL = BASE_URL;
2495
3213
  exports.CrawlerClient = CrawlerClient;
2496
3214
  exports.CrawlerClientError = CrawlerClientError;
3215
+ exports.DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES;
2497
3216
  exports.DEFAULT_TIMEOUT_MS = DEFAULT_TIMEOUT_MS;
2498
3217
  exports.ENV_API_KEY = ENV_API_KEY;
2499
3218
  exports.ENV_BASE_URL = ENV_BASE_URL;
@@ -2501,7 +3220,10 @@ exports.ENV_VERIFY_SSL = ENV_VERIFY_SSL;
2501
3220
  exports.EnricherApi = EnricherApi;
2502
3221
  exports.InventoryManagerApi = InventoryManagerApi;
2503
3222
  exports.MissingCredentials = MissingCredentials;
3223
+ exports.TLP_INVALID_MESSAGE = TLP_INVALID_MESSAGE;
3224
+ exports.TLP_VALUES = TLP_VALUES;
2504
3225
  exports.UnexpectedStatus = UnexpectedStatus;
2505
3226
  exports.__version__ = __version__;
2506
3227
  exports.assembleBriefing = assembleBriefing;
2507
3228
  exports.ingestScan = ingestScan;
3229
+ exports.validateTlp = validateTlp;