replicant-mcp 1.4.5 → 1.4.6
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.
|
@@ -118,7 +118,7 @@ export class UiAutomatorAdapter {
|
|
|
118
118
|
}
|
|
119
119
|
async screenshot(deviceId, options = {}) {
|
|
120
120
|
const remotePath = "/sdcard/replicant-screenshot.png";
|
|
121
|
-
const maxDimension = options.maxDimension ??
|
|
121
|
+
const maxDimension = options.maxDimension ?? 800;
|
|
122
122
|
// Capture screenshot on device
|
|
123
123
|
const captureResult = await this.adb.shell(deviceId, `screencap -p ${remotePath}`);
|
|
124
124
|
if (captureResult.exitCode !== 0) {
|
|
@@ -139,10 +139,12 @@ export class UiAutomatorAdapter {
|
|
|
139
139
|
const scaleFactor = calculateScaleFactor(deviceWidth, deviceHeight, maxDimension);
|
|
140
140
|
const imageWidth = Math.round(deviceWidth / scaleFactor);
|
|
141
141
|
const imageHeight = Math.round(deviceHeight / scaleFactor);
|
|
142
|
-
//
|
|
142
|
+
// Sharpen, scale, convert to WebP, strip ICC profile
|
|
143
143
|
const buffer = await sharp(tempPath)
|
|
144
|
+
.sharpen({ sigma: 0.5 })
|
|
144
145
|
.resize(imageWidth, imageHeight)
|
|
145
|
-
.
|
|
146
|
+
.webp({ quality: 72, effort: 5, smartSubsample: true })
|
|
147
|
+
.withMetadata({})
|
|
146
148
|
.toBuffer();
|
|
147
149
|
// Update scaling state (now supported for inline!)
|
|
148
150
|
this.scalingState = {
|
|
@@ -155,7 +157,7 @@ export class UiAutomatorAdapter {
|
|
|
155
157
|
return {
|
|
156
158
|
mode: "inline",
|
|
157
159
|
base64: buffer.toString("base64"),
|
|
158
|
-
mimeType: "image/
|
|
160
|
+
mimeType: "image/webp",
|
|
159
161
|
sizeBytes: buffer.length,
|
|
160
162
|
device: { width: deviceWidth, height: deviceHeight },
|
|
161
163
|
image: { width: imageWidth, height: imageHeight },
|
package/dist/tools/ui.js
CHANGED
|
@@ -102,7 +102,7 @@ export async function handleUiTool(input, context, uiConfig) {
|
|
|
102
102
|
visualModePackages: [],
|
|
103
103
|
autoFallbackScreenshot: true,
|
|
104
104
|
includeBase64: false,
|
|
105
|
-
maxImageDimension:
|
|
105
|
+
maxImageDimension: 800,
|
|
106
106
|
};
|
|
107
107
|
switch (input.operation) {
|
|
108
108
|
case "dump": {
|
package/dist/types/config.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface UiConfig {
|
|
|
9
9
|
autoFallbackScreenshot: boolean;
|
|
10
10
|
/** Include base64-encoded screenshot in response (default: false) */
|
|
11
11
|
includeBase64: boolean;
|
|
12
|
-
/** Maximum dimension (width or height) for screenshots in pixels (default:
|
|
12
|
+
/** Maximum dimension (width or height) for screenshots in pixels (default: 800) */
|
|
13
13
|
maxImageDimension: number;
|
|
14
14
|
}
|
|
15
15
|
export interface ReplicantConfig {
|
package/dist/types/config.js
CHANGED