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