@ingcreators/annot-annotator 0.5.0 → 0.6.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.
@@ -0,0 +1,63 @@
1
+ import { BboxRedactRegion } from './dsl/types.js';
2
+ /**
3
+ * Alias kept for back-compat with the original MCP-side surface.
4
+ * Pre-relocation, MCP exposed `RedactRegion` as the parameter type
5
+ * for `burnRedactions`. Annotator now consolidates around
6
+ * `BboxRedactRegion` (the structural twin already declared in the
7
+ * DSL types), and re-exports the legacy name so existing imports
8
+ * keep working without churn.
9
+ */
10
+ export type RedactRegion = BboxRedactRegion;
11
+ /**
12
+ * Burn regions into a PNG buffer. Returns a new PNG with each
13
+ * region painted over the source pixels per its `style`
14
+ * (`solid` / `mosaic` / `blur`). The function itself is
15
+ * intent-neutral: redaction is one use case, but the same
16
+ * primitive serves any "destructively modify these regions on
17
+ * the bitmap" task. See
18
+ * [`burnRegions`](./redact-burn.ts) for the
19
+ * operation-aligned alias added in Phase 3k.
20
+ *
21
+ * Regions are processed in order; later regions overlay earlier
22
+ * ones (no automatic deduplication or alpha-blending).
23
+ *
24
+ * **Other use cases beyond redaction** (intentional list — the
25
+ * function isn't redact-specific):
26
+ *
27
+ * - Editor-side "highlight this region with a translucent
28
+ * colour and ship it baked" workflow.
29
+ * - Visual-regression pre-processing — burn dynamic content
30
+ * (timestamps, login state badges) into the screenshot so
31
+ * pixel diffs stay deterministic.
32
+ * - Watermark / overlay burn for downstream distribution.
33
+ * - Privacy hardening at non-redact regions (e.g. blur a logo
34
+ * in a publicly-shared screenshot).
35
+ *
36
+ * **Note on naming**: this function is historically called
37
+ * `burnRedactions` because the MCP `annot_redact_screenshot`
38
+ * tool was its first caller. Since Phase 3k of
39
+ * `docs/plans/living-spec-authoring-roadmap.md`
40
+ * (Phase 3 follow-up #2), the operation-aligned alias
41
+ * `burnRegions` is preferred for new code. Both names point
42
+ * at the identical function — picking one or the other is
43
+ * purely a docs-readability choice.
44
+ */
45
+ export declare function burnRedactions(pngBytes: Uint8Array, regions: readonly BboxRedactRegion[]): Promise<Uint8Array>;
46
+ /**
47
+ * Operation-aligned alias for {@link burnRedactions}. Phase 3k of
48
+ * `docs/plans/living-spec-authoring-roadmap.md`
49
+ * (Phase 3 follow-up #2).
50
+ *
51
+ * The function `burnRedactions` is named for its first caller's
52
+ * intent (MCP's `annot_redact_screenshot`), but the underlying
53
+ * primitive is a `pngBytes + region[] → pngBytes` raster
54
+ * transform — generic over the caller's purpose (redaction,
55
+ * highlight burn-in, deterministic timestamp wipe-out, watermark
56
+ * overlay, …). New code should prefer the operation-aligned
57
+ * name `burnRegions`; existing `burnRedactions` callers keep
58
+ * working unchanged.
59
+ *
60
+ * Identity-equal to {@link burnRedactions} — picking one name
61
+ * over the other is purely a docs-readability choice.
62
+ */
63
+ export declare const burnRegions: typeof burnRedactions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingcreators/annot-annotator",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Headless annotator — render annotated screenshots from Node without a browser. Built on @resvg/resvg-js. Pairs with @ingcreators/annot-playwright for fail-on-test annotated reports.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ingcreators",
@@ -32,6 +32,10 @@
32
32
  ".": {
33
33
  "types": "./dist/index.d.ts",
34
34
  "default": "./dist/index.js"
35
+ },
36
+ "./flatten": {
37
+ "types": "./dist/flatten-editable-png.d.ts",
38
+ "default": "./dist/flatten-editable-png.js"
35
39
  }
36
40
  },
37
41
  "files": [
@@ -44,15 +48,16 @@
44
48
  },
45
49
  "devDependencies": {
46
50
  "typescript": "^6.0.3",
47
- "vite": "^8.0.13",
48
- "vite-plugin-dts": "^5.0.1",
49
- "@ingcreators/annot-core": "0.2.0"
51
+ "vite": "^8.0.16",
52
+ "vite-plugin-dts": "^5.0.3",
53
+ "@ingcreators/annot-core": "0.3.0"
50
54
  },
51
55
  "dependencies": {
52
56
  "@napi-rs/canvas": "^1.0.0",
53
57
  "@resvg/resvg-js": "^2.6.2",
54
58
  "@xmldom/xmldom": "^0.9.10",
55
- "pako": "^2.1.0"
59
+ "pako": "^2.1.0",
60
+ "pixelmatch": "^7.1.0"
56
61
  },
57
62
  "scripts": {
58
63
  "build": "vite build",