@ingcreators/annot-mcp 0.1.1 → 0.3.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 CHANGED
@@ -1,5 +1,91 @@
1
1
  # @ingcreators/annot-mcp
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 806badc: Retire the `@ingcreators/annot-imagequant` (GPL-3.0) dynamic-import
8
+ boundary that gated PNG-8 output in the headless annotator and the
9
+ MCP server. `Annotator.toEncoded()`'s smart mode now routes PNG-8
10
+ through the pure-TS Median Cut + Floyd–Steinberg dither at
11
+ `@ingcreators/annot-core/encode/quantize-median-cut` directly.
12
+
13
+ ### Removed public API
14
+ - `isImagequantAvailable()` is no longer exported from
15
+ `@ingcreators/annot-annotator`. PNG-8 is now unconditionally
16
+ available — callers that previously gated `format: "smart"` on
17
+ this can drop the check.
18
+ - `Annotator.toEncoded()` no longer emits
19
+ `EncodeResult.reason === "imagequant-missing"`. The
20
+ graceful-PNG-32-fallback path that produced this reason is
21
+ unreachable.
22
+
23
+ ### Removed dependency
24
+ - `@ingcreators/annot-imagequant` is dropped from
25
+ `@ingcreators/annot-annotator`'s `dependencies`. Consumers
26
+ that previously installed it as a side-effect of installing
27
+ `annot-annotator` will save the WASM payload from their
28
+ `node_modules`. `annot-mcp` inherits the removal transitively.
29
+
30
+ Phase 3 of `docs/plans/replace-libimagequant-with-median-cut.md`.
31
+ Phase 4 deletes the `@ingcreators/annot-imagequant` workspace
32
+ package and deprecates the published 0.1.0 on npm.
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [806badc]
37
+ - Updated dependencies [df1a429]
38
+ - Updated dependencies [2e92c97]
39
+ - Updated dependencies [657a685]
40
+ - @ingcreators/annot-annotator@0.5.0
41
+ - @ingcreators/annot-product-docs@0.2.0
42
+
43
+ ## 0.2.0
44
+
45
+ ### Minor Changes
46
+
47
+ - b3e8e53: Both packages now accept an optional `encode` option that flows through to `@ingcreators/annot-annotator@0.3.0`'s `toEncoded()` / `decodeAndEncodeImage()` pipeline. Achieves feature parity with the Chrome extension's "Save size" + "Format smart" capture settings for AI-agent (`annot-mcp`) and Playwright-test (`annot-playwright`) flows.
48
+
49
+ ## `annot-playwright`
50
+
51
+ ```ts
52
+ await annotator.annotateScreenshot(page, {
53
+ annotations: [...],
54
+ encode: { format: "smart", saveSizePreset: "standard" },
55
+ });
56
+ ```
57
+
58
+ Returned bytes shrink to PNG-8 / JPEG / resized PNG-32 per the smart heuristic; default behaviour when `encode` is omitted matches v0.2.x (raw PNG-32 from the annotator).
59
+
60
+ ## `annot-mcp`
61
+
62
+ All five tools (`annot_annotate_screenshot`, `annot_annotate_url`, `annot_redact_screenshot`, `annot_redact_url`, `annot_compare_screenshots`) accept the same `encode` shape on their MCP `inputSchema`. Agents can specify any subset:
63
+
64
+ ```jsonc
65
+ {
66
+ "url": "https://...",
67
+ "annotations": [...],
68
+ "encode": {
69
+ "format": "smart",
70
+ "saveSizePreset": "light",
71
+ "smartFallback": "jpeg"
72
+ }
73
+ }
74
+ ```
75
+
76
+ `format`: `"smart"` (default — PNG-8 for UI / PNG / JPEG for photos) / `"png"` / `"jpeg"`.
77
+ `saveSizePreset`: `"light"` 1280px / `"standard"` 1920px / `"highQuality"` 2560px / `"original"` no resize.
78
+ `smartFallback`, `smartColorThreshold`, `jpegPercent` all configurable.
79
+
80
+ Output `mimeType` flips to `image/jpeg` when the chosen path emits JPEG, so MCP clients render inline correctly. The text confirmation when `output` is set now includes the chosen format and any `reason` (`png-8` / `photo-fallback-jpeg` / `imagequant-missing` / …) for observability.
81
+
82
+ Backwards-compatible: when `encode` is omitted, all tools emit PNG-32 bytes verbatim (no decode/encode round-trip, same as v0.1.x / v0.2.x).
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [86d0853]
87
+ - @ingcreators/annot-annotator@0.3.0
88
+
3
89
  ## 0.1.1
4
90
 
5
91
  ### Patch Changes
package/README.md CHANGED
@@ -129,6 +129,43 @@ highlighted as `warning`-intent rects.
129
129
  content block listing the changed-region bboxes.
130
130
  - `output` (optional).
131
131
 
132
+ ### `annot_aria_snapshot`
133
+
134
+ Open a URL and return Playwright's AI-mode aria-snapshot
135
+ (YAML format with `[ref=eN]` markers). The same primitive
136
+ `playwright-mcp` and `playwright-cli` use. Foundational
137
+ input for the product-docs workflow (see
138
+ [`docs/plans/_done/living-product-docs.md`](../../docs/plans/_done/living-product-docs.md)).
139
+
140
+ **Inputs:**
141
+ - `url` — page URL to snapshot.
142
+ - `viewport` (optional) — `{ width, height, deviceScaleFactor }`.
143
+ - `waitFor` (optional) — `"load"` / `"domcontentloaded"` /
144
+ `"networkidle"`. Default `"load"`.
145
+ - `rootSelector` (optional, default `"body"`) — locator
146
+ selector whose subtree is snapshotted. Narrow to e.g.
147
+ `"main"` or `'[data-testid="login-form"]'` when only part
148
+ of the page is relevant.
149
+ - `timeout` (optional) — forwarded to
150
+ `locator.ariaSnapshot({ timeout })`. Default 30 s.
151
+ - `output` (optional, absolute path) — when set, the YAML is
152
+ written here and the tool returns a text confirmation;
153
+ otherwise the YAML is returned inline.
154
+
155
+ **Important:** refs (`eN`) are session-local. They identify
156
+ elements within THIS snapshot only. Do NOT persist refs
157
+ across sessions or runs. Persistent identifiers should use
158
+ `role + name` (with tree-path disambiguation for duplicates).
159
+
160
+ **Example output:**
161
+
162
+ ```yaml
163
+ - textbox "Email" [ref=e3]
164
+ - textbox "Password" [ref=e5]
165
+ - checkbox "Remember me" [ref=e7]
166
+ - button "Sign in" [ref=e9]
167
+ ```
168
+
132
169
  ## The annotation DSL
133
170
 
134
171
  Two flavours. `BboxAnnotation` (used by `_screenshot` tools)
@@ -285,6 +322,7 @@ is the composable primitive.
285
322
  | `src/tools/redact-screenshot.ts` | `annot_redact_screenshot` |
286
323
  | `src/tools/redact-url.ts` | `annot_redact_url` |
287
324
  | `src/tools/compare-screenshots.ts` | `annot_compare_screenshots` |
325
+ | `src/tools/aria-snapshot.ts` | `annot_aria_snapshot` |
288
326
 
289
327
  ## Runtime dependencies
290
328
 
@@ -0,0 +1,37 @@
1
+ import { BrowserPool } from './pool.js';
2
+ export interface AriaSnapshotOptions {
3
+ url: string;
4
+ viewport?: {
5
+ width: number;
6
+ height: number;
7
+ deviceScaleFactor?: number;
8
+ };
9
+ waitFor?: "load" | "domcontentloaded" | "networkidle";
10
+ /**
11
+ * Selector for the locator whose subtree is snapshotted.
12
+ * Defaults to `"body"` (whole page).
13
+ */
14
+ rootSelector?: string;
15
+ /**
16
+ * Pass-through to Playwright's `ariaSnapshot({ timeout })`.
17
+ * Defaults to Playwright's own default (30 s).
18
+ */
19
+ timeout?: number;
20
+ }
21
+ export interface AriaSnapshotResult {
22
+ /**
23
+ * YAML-formatted accessibility tree. When `mode: "ai"` is used
24
+ * (which `captureAriaSnapshot` always does), each interactive
25
+ * element carries a `[ref=eN]` marker.
26
+ */
27
+ yaml: string;
28
+ }
29
+ /**
30
+ * Acquire a browser, open a context + page, navigate to the URL,
31
+ * take an AI-mode aria-snapshot of the root locator's subtree,
32
+ * and close everything.
33
+ *
34
+ * On any error after browser acquisition, the page + context are
35
+ * closed and the browser is released before the error propagates.
36
+ */
37
+ export declare function captureAriaSnapshot(pool: BrowserPool, options: AriaSnapshotOptions): Promise<AriaSnapshotResult>;
@@ -270,6 +270,38 @@ export declare const LOCATOR_ANNOTATION_SCHEMA: {
270
270
  };
271
271
  })[];
272
272
  };
273
+ export declare const ENCODE_OPTIONS_SCHEMA: {
274
+ type: string;
275
+ additionalProperties: boolean;
276
+ properties: {
277
+ format: {
278
+ type: string;
279
+ enum: string[];
280
+ description: string;
281
+ };
282
+ saveSizePreset: {
283
+ type: string;
284
+ enum: string[];
285
+ description: string;
286
+ };
287
+ smartFallback: {
288
+ type: string;
289
+ enum: string[];
290
+ description: string;
291
+ };
292
+ smartColorThreshold: {
293
+ type: string;
294
+ minimum: number;
295
+ description: string;
296
+ };
297
+ jpegPercent: {
298
+ type: string;
299
+ minimum: number;
300
+ maximum: number;
301
+ description: string;
302
+ };
303
+ };
304
+ };
273
305
  export declare const LOCATOR_REDACT_REGION_SCHEMA: {
274
306
  type: string;
275
307
  additionalProperties: boolean;