@ingcreators/annot-mcp 0.1.0 → 0.2.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/CHANGELOG.md +53 -0
- package/README.md +6 -10
- package/dist/dsl/schema.d.ts +44 -184
- package/dist/dsl/types.d.ts +7 -68
- package/dist/index.d.ts +1 -1
- package/dist/index.js +727 -815
- package/dist/io/encode-output.d.ts +29 -0
- package/dist/tools/annotate-screenshot.d.ts +41 -4
- package/dist/tools/annotate-url.d.ts +53 -16
- package/dist/tools/compare-screenshots.d.ts +38 -0
- package/dist/tools/redact-screenshot.d.ts +41 -4
- package/dist/tools/redact-url.d.ts +40 -4
- package/package.json +2 -2
- package/dist/dsl/svg-primitives.d.ts +0 -34
- package/dist/dsl/to-svg.d.ts +0 -10
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EncodeOptions } from '@ingcreators/annot-annotator';
|
|
2
|
+
export interface EncodedToolOutput {
|
|
3
|
+
bytes: Uint8Array;
|
|
4
|
+
mimeType: "image/png" | "image/jpeg";
|
|
5
|
+
chosen: "png" | "jpeg";
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Apply the agent-provided `encode` options to a PNG byte stream
|
|
12
|
+
* the tool just produced. Returns the original bytes verbatim
|
|
13
|
+
* when no options are passed (the fast path for back-compat).
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyEncodeOptions(pngBytes: Uint8Array, dimensions: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}, encode: Partial<EncodeOptions> | undefined): Promise<EncodedToolOutput>;
|
|
19
|
+
/**
|
|
20
|
+
* Apply the agent-provided `encode` options to RGBA bytes (rather
|
|
21
|
+
* than already-encoded PNG bytes). Used by the annotate tools that
|
|
22
|
+
* go through `annotator.toEncoded()` directly — but currently
|
|
23
|
+
* unused because the tools opt for the "encode the PNG output"
|
|
24
|
+
* path via {@link applyEncodeOptions} for code uniformity.
|
|
25
|
+
*
|
|
26
|
+
* Exported for power callers who want to drive the pipeline
|
|
27
|
+
* themselves.
|
|
28
|
+
*/
|
|
29
|
+
export { decodeAndEncodeImage } from '@ingcreators/annot-annotator';
|
|
@@ -29,6 +29,10 @@ export declare const annotateScreenshotTool: {
|
|
|
29
29
|
readonly type: "string";
|
|
30
30
|
readonly description: string;
|
|
31
31
|
};
|
|
32
|
+
readonly encode: {
|
|
33
|
+
readonly $ref: "#/$defs/EncodeOptions";
|
|
34
|
+
readonly description: string;
|
|
35
|
+
};
|
|
32
36
|
};
|
|
33
37
|
readonly $defs: {
|
|
34
38
|
readonly BboxAnnotation: {
|
|
@@ -190,6 +194,42 @@ export declare const annotateScreenshotTool: {
|
|
|
190
194
|
};
|
|
191
195
|
})[];
|
|
192
196
|
};
|
|
197
|
+
readonly EncodeOptions: {
|
|
198
|
+
type: string;
|
|
199
|
+
additionalProperties: boolean;
|
|
200
|
+
properties: {
|
|
201
|
+
format: {
|
|
202
|
+
type: string;
|
|
203
|
+
enum: string[];
|
|
204
|
+
description: string;
|
|
205
|
+
};
|
|
206
|
+
saveSizePreset: {
|
|
207
|
+
type: string;
|
|
208
|
+
enum: string[];
|
|
209
|
+
description: string;
|
|
210
|
+
};
|
|
211
|
+
smartFallback: {
|
|
212
|
+
type: string;
|
|
213
|
+
enum: string[];
|
|
214
|
+
description: string;
|
|
215
|
+
};
|
|
216
|
+
smartColorThreshold: {
|
|
217
|
+
type: string;
|
|
218
|
+
minimum: number;
|
|
219
|
+
description: string;
|
|
220
|
+
};
|
|
221
|
+
jpegPercent: {
|
|
222
|
+
type: string;
|
|
223
|
+
minimum: number;
|
|
224
|
+
maximum: number;
|
|
225
|
+
description: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
readonly Locator: {
|
|
230
|
+
type: string;
|
|
231
|
+
minLength: number;
|
|
232
|
+
};
|
|
193
233
|
readonly BBox: {
|
|
194
234
|
type: string;
|
|
195
235
|
required: string[];
|
|
@@ -250,10 +290,6 @@ export declare const annotateScreenshotTool: {
|
|
|
250
290
|
};
|
|
251
291
|
};
|
|
252
292
|
};
|
|
253
|
-
readonly Locator: {
|
|
254
|
-
type: string;
|
|
255
|
-
minLength: number;
|
|
256
|
-
};
|
|
257
293
|
};
|
|
258
294
|
};
|
|
259
295
|
};
|
|
@@ -268,6 +304,7 @@ interface AnnotateScreenshotInput {
|
|
|
268
304
|
image?: unknown;
|
|
269
305
|
annotations?: unknown;
|
|
270
306
|
output?: unknown;
|
|
307
|
+
encode?: unknown;
|
|
271
308
|
}
|
|
272
309
|
/** MCP `tools/call` result content block. */
|
|
273
310
|
type ContentBlock = {
|
|
@@ -58,22 +58,14 @@ export declare const annotateUrlTool: {
|
|
|
58
58
|
readonly type: "string";
|
|
59
59
|
readonly description: string;
|
|
60
60
|
};
|
|
61
|
+
readonly encode: {
|
|
62
|
+
readonly $ref: "#/$defs/EncodeOptions";
|
|
63
|
+
readonly description: string;
|
|
64
|
+
};
|
|
61
65
|
};
|
|
62
66
|
readonly $defs: {
|
|
63
67
|
readonly LocatorAnnotation: {
|
|
64
68
|
oneOf: ({
|
|
65
|
-
type: string;
|
|
66
|
-
required: string[];
|
|
67
|
-
additionalProperties: boolean;
|
|
68
|
-
properties: {
|
|
69
|
-
type: {
|
|
70
|
-
const: string;
|
|
71
|
-
};
|
|
72
|
-
svgFragment: {
|
|
73
|
-
type: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
} | {
|
|
77
69
|
type: string;
|
|
78
70
|
required: string[];
|
|
79
71
|
additionalProperties: boolean;
|
|
@@ -257,8 +249,56 @@ export declare const annotateUrlTool: {
|
|
|
257
249
|
required: string[];
|
|
258
250
|
}[];
|
|
259
251
|
}[];
|
|
252
|
+
} | {
|
|
253
|
+
type: string;
|
|
254
|
+
required: string[];
|
|
255
|
+
additionalProperties: boolean;
|
|
256
|
+
properties: {
|
|
257
|
+
type: {
|
|
258
|
+
const: string;
|
|
259
|
+
};
|
|
260
|
+
svgFragment: {
|
|
261
|
+
type: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
260
264
|
})[];
|
|
261
265
|
};
|
|
266
|
+
readonly EncodeOptions: {
|
|
267
|
+
type: string;
|
|
268
|
+
additionalProperties: boolean;
|
|
269
|
+
properties: {
|
|
270
|
+
format: {
|
|
271
|
+
type: string;
|
|
272
|
+
enum: string[];
|
|
273
|
+
description: string;
|
|
274
|
+
};
|
|
275
|
+
saveSizePreset: {
|
|
276
|
+
type: string;
|
|
277
|
+
enum: string[];
|
|
278
|
+
description: string;
|
|
279
|
+
};
|
|
280
|
+
smartFallback: {
|
|
281
|
+
type: string;
|
|
282
|
+
enum: string[];
|
|
283
|
+
description: string;
|
|
284
|
+
};
|
|
285
|
+
smartColorThreshold: {
|
|
286
|
+
type: string;
|
|
287
|
+
minimum: number;
|
|
288
|
+
description: string;
|
|
289
|
+
};
|
|
290
|
+
jpegPercent: {
|
|
291
|
+
type: string;
|
|
292
|
+
minimum: number;
|
|
293
|
+
maximum: number;
|
|
294
|
+
description: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
readonly Locator: {
|
|
299
|
+
type: string;
|
|
300
|
+
minLength: number;
|
|
301
|
+
};
|
|
262
302
|
readonly BBox: {
|
|
263
303
|
type: string;
|
|
264
304
|
required: string[];
|
|
@@ -319,10 +359,6 @@ export declare const annotateUrlTool: {
|
|
|
319
359
|
};
|
|
320
360
|
};
|
|
321
361
|
};
|
|
322
|
-
readonly Locator: {
|
|
323
|
-
type: string;
|
|
324
|
-
minLength: number;
|
|
325
|
-
};
|
|
326
362
|
};
|
|
327
363
|
};
|
|
328
364
|
};
|
|
@@ -337,6 +373,7 @@ interface AnnotateUrlInput {
|
|
|
337
373
|
fullPage?: unknown;
|
|
338
374
|
waitFor?: unknown;
|
|
339
375
|
output?: unknown;
|
|
376
|
+
encode?: unknown;
|
|
340
377
|
}
|
|
341
378
|
export declare function handleAnnotateUrl(input: AnnotateUrlInput, deps: AnnotateUrlDeps): Promise<AnnotateToolResult>;
|
|
342
379
|
export {};
|
|
@@ -32,6 +32,43 @@ export declare const compareScreenshotsTool: {
|
|
|
32
32
|
readonly output: {
|
|
33
33
|
readonly type: "string";
|
|
34
34
|
};
|
|
35
|
+
readonly encode: {
|
|
36
|
+
readonly $ref: "#/$defs/EncodeOptions";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly $defs: {
|
|
40
|
+
readonly EncodeOptions: {
|
|
41
|
+
type: string;
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
properties: {
|
|
44
|
+
format: {
|
|
45
|
+
type: string;
|
|
46
|
+
enum: string[];
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
saveSizePreset: {
|
|
50
|
+
type: string;
|
|
51
|
+
enum: string[];
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
smartFallback: {
|
|
55
|
+
type: string;
|
|
56
|
+
enum: string[];
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
smartColorThreshold: {
|
|
60
|
+
type: string;
|
|
61
|
+
minimum: number;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
jpegPercent: {
|
|
65
|
+
type: string;
|
|
66
|
+
minimum: number;
|
|
67
|
+
maximum: number;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
35
72
|
};
|
|
36
73
|
};
|
|
37
74
|
};
|
|
@@ -44,6 +81,7 @@ interface CompareScreenshotsInput {
|
|
|
44
81
|
threshold?: unknown;
|
|
45
82
|
includeChangeList?: unknown;
|
|
46
83
|
output?: unknown;
|
|
84
|
+
encode?: unknown;
|
|
47
85
|
}
|
|
48
86
|
export declare function handleCompareScreenshots(input: CompareScreenshotsInput, deps: CompareScreenshotsDeps): Promise<AnnotateToolResult>;
|
|
49
87
|
export {};
|
|
@@ -21,6 +21,10 @@ export declare const redactScreenshotTool: {
|
|
|
21
21
|
readonly output: {
|
|
22
22
|
readonly type: "string";
|
|
23
23
|
};
|
|
24
|
+
readonly encode: {
|
|
25
|
+
readonly $ref: "#/$defs/EncodeOptions";
|
|
26
|
+
readonly description: string;
|
|
27
|
+
};
|
|
24
28
|
};
|
|
25
29
|
readonly $defs: {
|
|
26
30
|
readonly BboxRedactRegion: {
|
|
@@ -40,6 +44,42 @@ export declare const redactScreenshotTool: {
|
|
|
40
44
|
};
|
|
41
45
|
};
|
|
42
46
|
};
|
|
47
|
+
readonly EncodeOptions: {
|
|
48
|
+
type: string;
|
|
49
|
+
additionalProperties: boolean;
|
|
50
|
+
properties: {
|
|
51
|
+
format: {
|
|
52
|
+
type: string;
|
|
53
|
+
enum: string[];
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
saveSizePreset: {
|
|
57
|
+
type: string;
|
|
58
|
+
enum: string[];
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
smartFallback: {
|
|
62
|
+
type: string;
|
|
63
|
+
enum: string[];
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
smartColorThreshold: {
|
|
67
|
+
type: string;
|
|
68
|
+
minimum: number;
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
jpegPercent: {
|
|
72
|
+
type: string;
|
|
73
|
+
minimum: number;
|
|
74
|
+
maximum: number;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly Locator: {
|
|
80
|
+
type: string;
|
|
81
|
+
minLength: number;
|
|
82
|
+
};
|
|
43
83
|
readonly BBox: {
|
|
44
84
|
type: string;
|
|
45
85
|
required: string[];
|
|
@@ -100,10 +140,6 @@ export declare const redactScreenshotTool: {
|
|
|
100
140
|
};
|
|
101
141
|
};
|
|
102
142
|
};
|
|
103
|
-
readonly Locator: {
|
|
104
|
-
type: string;
|
|
105
|
-
minLength: number;
|
|
106
|
-
};
|
|
107
143
|
};
|
|
108
144
|
};
|
|
109
145
|
};
|
|
@@ -111,6 +147,7 @@ interface RedactScreenshotInput {
|
|
|
111
147
|
image?: unknown;
|
|
112
148
|
regions?: unknown;
|
|
113
149
|
output?: unknown;
|
|
150
|
+
encode?: unknown;
|
|
114
151
|
}
|
|
115
152
|
export declare function handleRedactScreenshot(input: RedactScreenshotInput): Promise<AnnotateToolResult>;
|
|
116
153
|
export {};
|
|
@@ -53,6 +53,9 @@ export declare const redactUrlTool: {
|
|
|
53
53
|
readonly output: {
|
|
54
54
|
readonly type: "string";
|
|
55
55
|
};
|
|
56
|
+
readonly encode: {
|
|
57
|
+
readonly $ref: "#/$defs/EncodeOptions";
|
|
58
|
+
};
|
|
56
59
|
};
|
|
57
60
|
readonly $defs: {
|
|
58
61
|
readonly LocatorRedactRegion: {
|
|
@@ -77,6 +80,42 @@ export declare const redactUrlTool: {
|
|
|
77
80
|
required: string[];
|
|
78
81
|
}[];
|
|
79
82
|
};
|
|
83
|
+
readonly EncodeOptions: {
|
|
84
|
+
type: string;
|
|
85
|
+
additionalProperties: boolean;
|
|
86
|
+
properties: {
|
|
87
|
+
format: {
|
|
88
|
+
type: string;
|
|
89
|
+
enum: string[];
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
saveSizePreset: {
|
|
93
|
+
type: string;
|
|
94
|
+
enum: string[];
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
smartFallback: {
|
|
98
|
+
type: string;
|
|
99
|
+
enum: string[];
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
smartColorThreshold: {
|
|
103
|
+
type: string;
|
|
104
|
+
minimum: number;
|
|
105
|
+
description: string;
|
|
106
|
+
};
|
|
107
|
+
jpegPercent: {
|
|
108
|
+
type: string;
|
|
109
|
+
minimum: number;
|
|
110
|
+
maximum: number;
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly Locator: {
|
|
116
|
+
type: string;
|
|
117
|
+
minLength: number;
|
|
118
|
+
};
|
|
80
119
|
readonly BBox: {
|
|
81
120
|
type: string;
|
|
82
121
|
required: string[];
|
|
@@ -137,10 +176,6 @@ export declare const redactUrlTool: {
|
|
|
137
176
|
};
|
|
138
177
|
};
|
|
139
178
|
};
|
|
140
|
-
readonly Locator: {
|
|
141
|
-
type: string;
|
|
142
|
-
minLength: number;
|
|
143
|
-
};
|
|
144
179
|
};
|
|
145
180
|
};
|
|
146
181
|
};
|
|
@@ -154,6 +189,7 @@ interface RedactUrlInput {
|
|
|
154
189
|
fullPage?: unknown;
|
|
155
190
|
waitFor?: unknown;
|
|
156
191
|
output?: unknown;
|
|
192
|
+
encode?: unknown;
|
|
157
193
|
}
|
|
158
194
|
export declare function handleRedactUrl(input: RedactUrlInput, deps: RedactUrlDeps): Promise<AnnotateToolResult>;
|
|
159
195
|
export type RedactRegionStyle = RedactStyle;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingcreators/annot-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model Context Protocol server exposing the Annot headless annotator as agent-callable tools. Drop into Claude Desktop / Claude Code / Cursor and let an AI agent compose Annot with @playwright/mcp + GitHub MCP for one-turn bug-report autopilot, visual-diff PR review, and locator-first annotation workflows.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "ingcreators",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@napi-rs/canvas": "^0.1.0",
|
|
57
57
|
"pixelmatch": "^7.1.0",
|
|
58
58
|
"playwright-core": "^1.50.0",
|
|
59
|
-
"@ingcreators/annot-annotator": "0.
|
|
59
|
+
"@ingcreators/annot-annotator": "0.3.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "vite build",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface BoundingBox {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
7
|
-
export interface Point {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
}
|
|
11
|
-
export interface RectOptions {
|
|
12
|
-
stroke?: string;
|
|
13
|
-
strokeWidth?: number;
|
|
14
|
-
fill?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ArrowOptions {
|
|
17
|
-
color?: string;
|
|
18
|
-
strokeWidth?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface TextOptions {
|
|
21
|
-
color?: string;
|
|
22
|
-
fontSize?: number;
|
|
23
|
-
anchor?: "start" | "middle" | "end";
|
|
24
|
-
}
|
|
25
|
-
/** Outline a bounding box with an SVG `<rect>`. */
|
|
26
|
-
export declare function rectForBoundingBox(bbox: BoundingBox, opts?: RectOptions): string;
|
|
27
|
-
/**
|
|
28
|
-
* Draw an arrow from `from` to `to`. Inlines a unique-id `<marker>`
|
|
29
|
-
* definition so the helper is self-contained — call it twice and
|
|
30
|
-
* each call produces a distinct arrowhead marker.
|
|
31
|
-
*/
|
|
32
|
-
export declare function arrowBetween(from: Point, to: Point, opts?: ArrowOptions): string;
|
|
33
|
-
/** Drop a text label at a position. */
|
|
34
|
-
export declare function textAt(at: Point, content: string, opts?: TextOptions): string;
|
package/dist/dsl/to-svg.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BboxAnnotation } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Convert a list of bbox-flavour annotations into a single SVG
|
|
4
|
-
* fragment string. The fragment is suitable as the
|
|
5
|
-
* `annotationsSvg` payload for `@ingcreators/annot-annotator`.
|
|
6
|
-
*
|
|
7
|
-
* Phase 1 emits the bare fragments only (no `<svg>` wrapper); the
|
|
8
|
-
* annotator's sanitiser handles wrapping at rasterise time.
|
|
9
|
-
*/
|
|
10
|
-
export declare function bboxAnnotationsToSvg(annotations: readonly BboxAnnotation[]): string;
|