@ingcreators/annot-mcp 0.3.1 → 0.3.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,200 @@
1
1
  # @ingcreators/annot-mcp
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @ingcreators/annot-annotator@0.6.0
8
+ - @ingcreators/annot-product-docs@0.4.1
9
+
10
+ ## 0.3.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 0c7ac26: **Relocate `burnRedactions` from `@ingcreators/annot-mcp` to
15
+ `@ingcreators/annot-annotator`** — Phase 3e of
16
+ `docs/plans/living-spec-authoring-roadmap.md` (Phase 3 follow-up).
17
+
18
+ The destructive raster burn primitive (solid / mosaic / blur over
19
+ a PNG buffer, built on `@napi-rs/canvas`) historically lived in
20
+ `@ingcreators/annot-mcp` because the MCP server's
21
+ `annot_redact_screenshot` tool was the first caller. The function
22
+ itself has no MCP-specific surface — it's pure
23
+ (`pngBytes + regions → pngBytes`). To let non-MCP callers consume
24
+ it without dragging the MCP server's dep footprint (Playwright,
25
+ `@modelcontextprotocol/sdk`, etc.), the primitive moves to
26
+ `@ingcreators/annot-annotator` — the canonical Node-side raster
27
+ home, which already depends on `@napi-rs/canvas` for its encode
28
+ pipeline (so the move adds **zero** transitive deps).
29
+
30
+ ### `@ingcreators/annot-annotator` — new public surface
31
+
32
+ ```ts
33
+ import {
34
+ burnRedactions,
35
+ type RedactRegion,
36
+ } from "@ingcreators/annot-annotator";
37
+
38
+ const out = await burnRedactions(pngBytes, [
39
+ {
40
+ bbox: { x: 10, y: 20, width: 100, height: 30 },
41
+ style: "solid",
42
+ color: "#000000",
43
+ },
44
+ { bbox: { x: 200, y: 100, width: 80, height: 40 }, style: "mosaic" },
45
+ { bbox: { x: 0, y: 0, width: 64, height: 64 }, style: "blur" },
46
+ ]);
47
+ ```
48
+
49
+ `RedactRegion` is exposed as an alias of `BboxRedactRegion`
50
+ (structurally identical, already declared in the DSL types) so
51
+ existing MCP-side consumers see no shape change.
52
+
53
+ ### `@ingcreators/annot-mcp` — no public API change
54
+
55
+ The existing `burnRedactions` + `RedactRegion` re-exports from
56
+ the package root keep working byte-identical, sourced from the
57
+ annotator instead of the old MCP-local file. MCP's
58
+ `annot_redact_screenshot` / `annot_redact_url` tools continue
59
+ to import from `../redact/burn.js`, which is now a one-line
60
+ re-export from annotator.
61
+
62
+ ### Compatibility
63
+
64
+ Additive on annotator's side; zero behaviour change on MCP's
65
+ side. Tests move with the code (annotator 64 → 71 passed; MCP
66
+ 91 → 84 passed — same scenarios at the new home).
67
+
68
+ ### Out of scope
69
+
70
+ `@napi-rs/canvas` stays as an MCP direct dep — `compare/diff.ts`
71
+ and several other MCP tool tests still use it directly, so
72
+ collapsing it onto a transitive-via-annotator import is a
73
+ separate cleanup.
74
+
75
+ - 64dc6e8: **Relocate `diffScreenshots` from `@ingcreators/annot-mcp` to
76
+ `@ingcreators/annot-annotator`** — Phase 3i of
77
+ `docs/plans/living-spec-authoring-roadmap.md` (Phase 3
78
+ follow-up #2). Same pattern as 3e's `burnRedactions` relocate.
79
+
80
+ The pixelmatch-driven PNG comparison + contiguous-region bbox
81
+ aggregation lived in `@ingcreators/annot-mcp/compare/` for
82
+ historical reasons (the MCP server's
83
+ `annot_compare_screenshots` tool was the first caller). The
84
+ function itself has no MCP-specific surface — it's pure
85
+ (`pngBytes + pngBytes → DiffResult`). Relocating it to
86
+ `@ingcreators/annot-annotator` lets non-MCP callers
87
+ (Playwright visual regression fixtures, Astro pixel drift CI,
88
+ custom test reporters, editor before/after preview) consume
89
+ it without dragging the MCP server's dep footprint.
90
+
91
+ ### `@ingcreators/annot-annotator` — new public surface
92
+
93
+ ```ts
94
+ import {
95
+ diffScreenshots,
96
+ aggregateDiffRegions,
97
+ DimensionMismatchError,
98
+ type DiffResult,
99
+ type DiffOptions,
100
+ } from "@ingcreators/annot-annotator";
101
+
102
+ const result = await diffScreenshots(beforePng, afterPng, { threshold: 0.1 });
103
+ // → { mismatchedPixels: number, regions: BBox[], width, height }
104
+ ```
105
+
106
+ annotator gains `pixelmatch` (~4 KB, no transitive deps) as a
107
+ runtime dep.
108
+
109
+ ### `@ingcreators/annot-mcp` — no public API change
110
+
111
+ The existing `compare/diff.ts` + `compare/aggregate.ts` modules
112
+ become one-line re-export shims forwarding from annotator. MCP's
113
+ internal callers (`tools/compare-screenshots.ts`) and any
114
+ external consumer importing from `@ingcreators/annot-mcp` keep
115
+ working byte-identical.
116
+
117
+ ### Compatibility
118
+
119
+ Additive on annotator's side; zero behaviour change on MCP's
120
+ side. Tests move with the code (annotator 71 → 81 passed; MCP
121
+ 84 → 78 passed — same scenarios at the new home, plus a new
122
+ `diffScreenshots` smoke test that the MCP-side aggregate-only
123
+ test didn't cover).
124
+
125
+ ### Out of scope
126
+
127
+ `pixelmatch` stays as a direct MCP dep — even though MCP no
128
+ longer imports it from the moved code, it's a tiny package
129
+ and removing the explicit dep would force consumers to rely
130
+ on a transitive resolution through annotator, which is more
131
+ fragile than declaring the intent directly.
132
+
133
+ - 9697f27: **Export `burnRegions` as an operation-aligned alias for
134
+ `burnRedactions`** — Phase 3k of
135
+ `docs/plans/living-spec-authoring-roadmap.md`
136
+ (Phase 3 follow-up #2). Closes the follow-up.
137
+
138
+ `burnRedactions` is named for its first caller's intent (MCP's
139
+ `annot_redact_screenshot`), but the underlying primitive is a
140
+ `pngBytes + region[] → pngBytes` raster transform — generic
141
+ over the caller's purpose. The new export surfaces the
142
+ operation-aligned name alongside the intent-named original.
143
+
144
+ ### `@ingcreators/annot-annotator` — new public export
145
+
146
+ ```ts
147
+ import { burnRegions } from "@ingcreators/annot-annotator";
148
+
149
+ // Identical signature + behaviour to burnRedactions.
150
+ const out = await burnRegions(pngBytes, [
151
+ { bbox: { x: 10, y: 20, width: 100, height: 30 }, style: "mosaic" },
152
+ ]);
153
+ ```
154
+
155
+ Identity-equal to `burnRedactions` (`burnRegions === burnRedactions`
156
+ at the export level) — picking one name over the other is purely
157
+ a docs-readability choice.
158
+
159
+ ### Use cases that motivated the alias
160
+
161
+ The function isn't redact-specific — the JSDoc on `burnRedactions`
162
+ now enumerates:
163
+ - Editor-side "highlight this region with a translucent colour
164
+ and ship it baked" workflow.
165
+ - Visual-regression pre-processing — burn dynamic content
166
+ (timestamps, login state badges) into the screenshot so pixel
167
+ diffs stay deterministic.
168
+ - Watermark / overlay burn for downstream distribution.
169
+ - Privacy hardening at non-redact regions (e.g. blur a logo in
170
+ a publicly-shared screenshot).
171
+
172
+ For any of these, `burnRegions` reads as the natural name.
173
+ Redact callers stay on `burnRedactions` (still the recommended
174
+ name when the intent IS redaction); no migration forced.
175
+
176
+ ### `@ingcreators/annot-mcp` — no public API change
177
+
178
+ MCP's `compare/burn.ts` re-export shim + `index.ts` forward both
179
+ names. Existing `burnRedactions` callers see no change.
180
+
181
+ ### Compatibility
182
+
183
+ Additive. `burnRedactions` keeps its public API + JSDoc; the
184
+ alias is purely additive.
185
+
186
+ - Updated dependencies [6124d59]
187
+ - Updated dependencies [b5d52f6]
188
+ - Updated dependencies [fa712fd]
189
+ - Updated dependencies [0c7ac26]
190
+ - Updated dependencies [f09a6b1]
191
+ - Updated dependencies [0d19345]
192
+ - Updated dependencies [64dc6e8]
193
+ - Updated dependencies [691bec5]
194
+ - Updated dependencies [9697f27]
195
+ - @ingcreators/annot-annotator@0.6.0
196
+ - @ingcreators/annot-product-docs@0.4.0
197
+
3
198
  ## 0.3.1
4
199
 
5
200
  ### Patch Changes
@@ -1,6 +1 @@
1
- import { BBox } from '../dsl/types.js';
2
- /**
3
- * Walk a pixelmatch diff mask and return one bbox per contiguous
4
- * changed region. 4-connected adjacency.
5
- */
6
- export declare function aggregateDiffRegions(diffRgba: Uint8Array, width: number, height: number): BBox[];
1
+ export { aggregateDiffRegions } from '@ingcreators/annot-annotator';
@@ -1,30 +1 @@
1
- import { BBox } from '../dsl/types.js';
2
- export interface DiffResult {
3
- /** Number of mismatched pixels. */
4
- mismatchedPixels: number;
5
- /** Bounding boxes of contiguous changed regions. */
6
- regions: BBox[];
7
- /** Dimensions of the input pair. */
8
- width: number;
9
- height: number;
10
- }
11
- export interface DiffOptions {
12
- /** Matching threshold (0 to 1); smaller is more sensitive. */
13
- threshold?: number;
14
- }
15
- export declare class DimensionMismatchError extends Error {
16
- constructor(a: {
17
- width: number;
18
- height: number;
19
- }, b: {
20
- width: number;
21
- height: number;
22
- });
23
- }
24
- /**
25
- * Compare two PNGs pixel-by-pixel and return the changed-region
26
- * bboxes. Throws `DimensionMismatchError` when the inputs have
27
- * different sizes — the agent has to capture both with the same
28
- * viewport for the comparison to make sense.
29
- */
30
- export declare function diffScreenshots(before: Uint8Array, after: Uint8Array, options?: DiffOptions): Promise<DiffResult>;
1
+ export { type DiffOptions, type DiffResult, DimensionMismatchError, diffScreenshots, } from '@ingcreators/annot-annotator';
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { BBOX_ANNOTATION_SCHEMA, BBOX_REDACT_REGION_SCHEMA, LOCATOR_ANNOTATION_S
8
8
  export type { AnnotationStyle, BBox, BboxAnnotation, BboxArrowAnnotation, BboxCalloutAnnotation, BboxCircleAnnotation, BboxRectAnnotation, BboxRedactRegion, BboxTextAnnotation, Intent, Locator, LocatorAnnotation, LocatorArrowAnnotation, LocatorCalloutAnnotation, LocatorCircleAnnotation, LocatorRectAnnotation, LocatorRedactRegion, LocatorTextAnnotation, Point, RawAnnotation, RedactStyle, } from './dsl/types.js';
9
9
  export { InvalidPngError, type PngDimensions, readPngDimensions, } from './io/png-dimensions.js';
10
10
  export { InvalidImageInputError, type ResolvedImage, resolveImageInput, } from './io/read-image.js';
11
- export { burnRedactions, type RedactRegion } from './redact/burn.js';
11
+ export { burnRedactions, burnRegions, type RedactRegion } from './redact/burn.js';
12
12
  export { type CreateServerOptions, createServer } from './server.js';
13
13
  export { ANNOTATE_SCREENSHOT_TOOL_NAME, type AnnotateToolResult, annotateScreenshotTool, handleAnnotateScreenshot, } from './tools/annotate-screenshot.js';
14
14
  export { ANNOTATE_URL_TOOL_NAME, annotateUrlTool, handleAnnotateUrl, } from './tools/annotate-url.js';