@midscene/web 1.12.7-beta-20260911063016.0 → 1.12.7
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/dist/es/bridge-mode/io-client.mjs +1 -1
- package/dist/es/bridge-mode/io-server.mjs +2 -2
- package/dist/es/bridge-mode/io-server.mjs.map +1 -1
- package/dist/es/bridge-mode/page-browser-side.mjs +1 -1
- package/dist/es/bridge-mode/page-browser-side.mjs.map +1 -1
- package/dist/es/cli.mjs +1 -1
- package/dist/es/puppeteer/base-page.mjs +2 -1
- package/dist/es/puppeteer/base-page.mjs.map +1 -1
- package/dist/es/puppeteer/screenshot.mjs +19 -0
- package/dist/es/puppeteer/screenshot.mjs.map +1 -0
- package/dist/es/static/static-agent.mjs +15 -1
- package/dist/es/static/static-agent.mjs.map +1 -1
- package/dist/es/static/static-page.mjs +19 -0
- package/dist/es/static/static-page.mjs.map +1 -1
- package/dist/lib/bridge-mode/io-client.js +1 -1
- package/dist/lib/bridge-mode/io-server.js +2 -2
- package/dist/lib/bridge-mode/io-server.js.map +1 -1
- package/dist/lib/bridge-mode/page-browser-side.js +1 -1
- package/dist/lib/bridge-mode/page-browser-side.js.map +1 -1
- package/dist/lib/cli.js +1 -1
- package/dist/lib/puppeteer/base-page.js +2 -1
- package/dist/lib/puppeteer/base-page.js.map +1 -1
- package/dist/lib/puppeteer/screenshot.js +53 -0
- package/dist/lib/puppeteer/screenshot.js.map +1 -0
- package/dist/lib/static/static-agent.js +15 -1
- package/dist/lib/static/static-agent.js.map +1 -1
- package/dist/lib/static/static-page.js +19 -0
- package/dist/lib/static/static-page.js.map +1 -1
- package/dist/types/puppeteer/screenshot.d.ts +4 -0
- package/dist/types/static/static-agent.d.ts +3 -0
- package/dist/types/static/static-page.d.ts +4 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static/static-page.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/static/static-page.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n DeviceAction,\n Point,\n ScreenshotRef,\n UIContext,\n} from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport {\n type InputPrimitives,\n defineActionsFromInputPrimitives,\n} from '@midscene/core/device';\nimport { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED } from '@midscene/shared/common';\n\nconst ThrowNotImplemented = (methodName: string) => {\n throw new Error(\n `The method \"${methodName}\" is not implemented as designed since this is a static UI context. (${ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED})`,\n );\n};\n\ntype SerializedStaticScreenshot = {\n base64?: unknown;\n _base64?: unknown;\n type?: unknown;\n} & Partial<Omit<ScreenshotRef, 'type'>>;\n\ntype StaticPageUIContext = Omit<\n UIContext,\n 'deprecatedDpr' | 'screenshot'\n> & {\n screenshot: UIContext['screenshot'] | SerializedStaticScreenshot;\n};\n\nfunction screenshotBase64FromContext(\n screenshot: StaticPageUIContext['screenshot'],\n): string {\n const record = screenshot as SerializedStaticScreenshot;\n const base64 = record.base64 ?? record._base64;\n if (typeof base64 === 'string') {\n return base64;\n }\n\n if (record.type === 'midscene_screenshot_ref') {\n throw new Error(\n 'StaticPage screenshot is a serialized reference without base64 data',\n );\n }\n\n throw new Error(\n 'StaticPage screenshot must include base64 data before execution',\n );\n}\n\nexport default class StaticPage implements AbstractInterface {\n interfaceType = 'static';\n\n private uiContext: StaticPageUIContext;\n readonly inputPrimitives: InputPrimitives = {\n pointer: {\n tap: async () => ThrowNotImplemented('Tap'),\n rightClick: async () => ThrowNotImplemented('RightClick'),\n hover: async () => ThrowNotImplemented('Hover'),\n dragAndDrop: async () => ThrowNotImplemented('DragAndDrop'),\n },\n keyboard: {\n typeText: async () => ThrowNotImplemented('Input'),\n keyboardPress: async () => ThrowNotImplemented('KeyboardPress'),\n clearInput: async () => ThrowNotImplemented('ClearInput'),\n },\n touch: {\n swipe: async () => ThrowNotImplemented('Swipe'),\n },\n scroll: {\n scroll: async () => ThrowNotImplemented('Scroll'),\n },\n };\n\n constructor(uiContext: StaticPageUIContext) {\n this.uiContext = uiContext;\n }\n\n actionSpace(): DeviceAction[] {\n // Return available actions for static page - they will throw \"not implemented\" errors when executed\n // but need to be available for planning phase\n return defineActionsFromInputPrimitives(this.inputPrimitives, {\n size: () => this.size(),\n });\n }\n\n async evaluateJavaScript<T = unknown>(script: string): Promise<T> {\n return ThrowNotImplemented('evaluateJavaScript');\n }\n\n // @deprecated\n async getElementsInfo() {\n return ThrowNotImplemented('getElementsInfo');\n }\n\n async getElementsNodeTree() {\n return ThrowNotImplemented('getElementsNodeTree');\n }\n\n async getXpathsByPoint(point: Point) {\n return ThrowNotImplemented('getXpathsByPoint');\n }\n\n async getElementInfoByXpath(xpath: string) {\n return ThrowNotImplemented('getElementInfoByXpath');\n }\n\n async size() {\n return {\n ...this.uiContext.shotSize,\n };\n }\n\n async screenshotBase64() {\n return screenshotBase64FromContext(this.uiContext.screenshot);\n }\n\n async url() {\n return Promise.resolve('https://static_page_without_url');\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilTop');\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilBottom');\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilLeft');\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilRight');\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollUp');\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollDown');\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollLeft');\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollRight');\n }\n\n async clearInput() {\n return ThrowNotImplemented('clearInput');\n }\n\n mouse = {\n click: ThrowNotImplemented.bind(null, 'mouse.click'),\n wheel: ThrowNotImplemented.bind(null, 'mouse.wheel'),\n move: ThrowNotImplemented.bind(null, 'mouse.move'),\n drag: ThrowNotImplemented.bind(null, 'mouse.drag'),\n };\n\n keyboard = {\n type: ThrowNotImplemented.bind(null, 'keyboard.type'),\n press: ThrowNotImplemented.bind(null, 'keyboard.press'),\n };\n\n async destroy(): Promise<void> {\n //\n }\n\n updateContext(newContext: StaticPageUIContext): void {\n this.uiContext = newContext;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","ThrowNotImplemented","methodName","Error","ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED","screenshotBase64FromContext","screenshot","record","base64","StaticPage","defineActionsFromInputPrimitives","script","point","xpath","Promise","startingPoint","distance","newContext","uiContext"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,A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,oBAAoB,IAAI,CAAC,MAAM;YACrC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;QACvC;QAEA,mCAAW;YACT,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;QACxC;QA5FE,IAAI,CAAC,SAAS,GAAGiB;IACnB;AAoGF"}
|
|
1
|
+
{"version":3,"file":"static/static-page.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/static/static-page.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n DeviceAction,\n Point,\n ScreenshotRef,\n UIContext,\n} from '@midscene/core';\nimport { ScreenshotItem } from '@midscene/core';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport {\n type InputPrimitives,\n defineActionsFromInputPrimitives,\n} from '@midscene/core/device';\nimport { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED } from '@midscene/shared/common';\n\nconst ThrowNotImplemented = (methodName: string) => {\n throw new Error(\n `The method \"${methodName}\" is not implemented as designed since this is a static UI context. (${ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED})`,\n );\n};\n\ntype SerializedStaticScreenshot = {\n base64?: unknown;\n _base64?: unknown;\n type?: unknown;\n} & Partial<Omit<ScreenshotRef, 'type'>>;\n\ntype StaticPageUIContext = Omit<\n UIContext,\n 'deprecatedDpr' | 'screenshot' | 'screenshotSequence'\n> & {\n screenshot: UIContext['screenshot'] | SerializedStaticScreenshot;\n screenshotSequence?: Array<\n UIContext['screenshot'] | SerializedStaticScreenshot\n >;\n};\n\nfunction screenshotBase64FromContext(\n screenshot: StaticPageUIContext['screenshot'],\n): string {\n const record = screenshot as SerializedStaticScreenshot;\n const base64 = record.base64 ?? record._base64;\n if (typeof base64 === 'string') {\n return base64;\n }\n\n if (record.type === 'midscene_screenshot_ref') {\n throw new Error(\n 'StaticPage screenshot is a serialized reference without base64 data',\n );\n }\n\n throw new Error(\n 'StaticPage screenshot must include base64 data before execution',\n );\n}\n\nfunction screenshotItemFromContext(\n screenshot: StaticPageUIContext['screenshot'],\n): ScreenshotItem {\n if (screenshot instanceof ScreenshotItem) {\n return screenshot;\n }\n\n const capturedAt =\n typeof screenshot.capturedAt === 'number'\n ? screenshot.capturedAt\n : Date.now();\n return ScreenshotItem.create(\n screenshotBase64FromContext(screenshot),\n capturedAt,\n );\n}\n\nfunction normalizeUIContext(uiContext: StaticPageUIContext): UIContext {\n return {\n ...uiContext,\n screenshot: screenshotItemFromContext(uiContext.screenshot),\n screenshotSequence: uiContext.screenshotSequence?.map(\n screenshotItemFromContext,\n ),\n };\n}\n\nexport default class StaticPage implements AbstractInterface {\n interfaceType = 'static';\n\n private uiContext: StaticPageUIContext;\n private normalizedUIContext?: UIContext;\n readonly inputPrimitives: InputPrimitives = {\n pointer: {\n tap: async () => ThrowNotImplemented('Tap'),\n rightClick: async () => ThrowNotImplemented('RightClick'),\n hover: async () => ThrowNotImplemented('Hover'),\n dragAndDrop: async () => ThrowNotImplemented('DragAndDrop'),\n },\n keyboard: {\n typeText: async () => ThrowNotImplemented('Input'),\n keyboardPress: async () => ThrowNotImplemented('KeyboardPress'),\n clearInput: async () => ThrowNotImplemented('ClearInput'),\n },\n touch: {\n swipe: async () => ThrowNotImplemented('Swipe'),\n },\n scroll: {\n scroll: async () => ThrowNotImplemented('Scroll'),\n },\n };\n\n constructor(uiContext: StaticPageUIContext) {\n this.uiContext = uiContext;\n }\n\n getUIContext(): UIContext {\n this.normalizedUIContext ??= normalizeUIContext(this.uiContext);\n return this.normalizedUIContext;\n }\n\n actionSpace(): DeviceAction[] {\n // Return available actions for static page - they will throw \"not implemented\" errors when executed\n // but need to be available for planning phase\n return defineActionsFromInputPrimitives(this.inputPrimitives, {\n size: () => this.size(),\n });\n }\n\n async evaluateJavaScript<T = unknown>(script: string): Promise<T> {\n return ThrowNotImplemented('evaluateJavaScript');\n }\n\n // @deprecated\n async getElementsInfo() {\n return ThrowNotImplemented('getElementsInfo');\n }\n\n async getElementsNodeTree() {\n return ThrowNotImplemented('getElementsNodeTree');\n }\n\n async getXpathsByPoint(point: Point) {\n return ThrowNotImplemented('getXpathsByPoint');\n }\n\n async getElementInfoByXpath(xpath: string) {\n return ThrowNotImplemented('getElementInfoByXpath');\n }\n\n async size() {\n return {\n ...this.uiContext.shotSize,\n };\n }\n\n async screenshotBase64() {\n return screenshotBase64FromContext(this.uiContext.screenshot);\n }\n\n async url() {\n return Promise.resolve('https://static_page_without_url');\n }\n\n async scrollUntilTop(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilTop');\n }\n\n async scrollUntilBottom(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilBottom');\n }\n\n async scrollUntilLeft(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilLeft');\n }\n\n async scrollUntilRight(startingPoint?: Point) {\n return ThrowNotImplemented('scrollUntilRight');\n }\n\n async scrollUp(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollUp');\n }\n\n async scrollDown(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollDown');\n }\n\n async scrollLeft(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollLeft');\n }\n\n async scrollRight(distance?: number, startingPoint?: Point) {\n return ThrowNotImplemented('scrollRight');\n }\n\n async clearInput() {\n return ThrowNotImplemented('clearInput');\n }\n\n mouse = {\n click: ThrowNotImplemented.bind(null, 'mouse.click'),\n wheel: ThrowNotImplemented.bind(null, 'mouse.wheel'),\n move: ThrowNotImplemented.bind(null, 'mouse.move'),\n drag: ThrowNotImplemented.bind(null, 'mouse.drag'),\n };\n\n keyboard = {\n type: ThrowNotImplemented.bind(null, 'keyboard.type'),\n press: ThrowNotImplemented.bind(null, 'keyboard.press'),\n };\n\n async destroy(): Promise<void> {\n //\n }\n\n updateContext(newContext: StaticPageUIContext): void {\n this.uiContext = newContext;\n this.normalizedUIContext = undefined;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","ThrowNotImplemented","methodName","Error","ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED","screenshotBase64FromContext","screenshot","record","base64","screenshotItemFromContext","ScreenshotItem","capturedAt","Date","normalizeUIContext","uiContext","StaticPage","defineActionsFromInputPrimitives","script","point","xpath","Promise","startingPoint","distance","newContext","undefined"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;ACQA,MAAMI,sBAAsB,CAACC;IAC3B,MAAM,IAAIC,MACR,CAAC,YAAY,EAAED,WAAW,qEAAqE,EAAEE,uBAA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;gBACR,UAAU,UAAYA,oBAAoB;gBAC1C,eAAe,UAAYA,oBAAoB;gBAC/C,YAAY,UAAYA,oBAAoB;YAC9C;YACA,OAAO;gBACL,OAAO,UAAYA,oBAAoB;YACzC;YACA,QAAQ;gBACN,QAAQ,UAAYA,oBAAoB;YAC1C;QACF;QA0FA,gCAAQ;YACN,OAAOA,oBAAoB,IAAI,CAAC,MAAM;YACtC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;YACtC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,MAAMA,oBAAoB,IAAI,CAAC,MAAM;QACvC;QAEA,mCAAW;YACT,MAAMA,oBAAoB,IAAI,CAAC,MAAM;YACrC,OAAOA,oBAAoB,IAAI,CAAC,MAAM;QACxC;QAjGE,IAAI,CAAC,SAAS,GAAGa;IACnB;AA0GF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Agent as PageAgent } from '@midscene/core/agent';
|
|
2
|
+
import type { UIContext } from '@midscene/core';
|
|
2
3
|
import type StaticPage from './static-page';
|
|
3
4
|
export declare class StaticPageAgent extends PageAgent {
|
|
5
|
+
private readonly staticPage;
|
|
4
6
|
constructor(page: StaticPage);
|
|
7
|
+
getUIContext(): Promise<UIContext>;
|
|
5
8
|
}
|
|
@@ -6,14 +6,17 @@ type SerializedStaticScreenshot = {
|
|
|
6
6
|
_base64?: unknown;
|
|
7
7
|
type?: unknown;
|
|
8
8
|
} & Partial<Omit<ScreenshotRef, 'type'>>;
|
|
9
|
-
type StaticPageUIContext = Omit<UIContext, 'deprecatedDpr' | 'screenshot'> & {
|
|
9
|
+
type StaticPageUIContext = Omit<UIContext, 'deprecatedDpr' | 'screenshot' | 'screenshotSequence'> & {
|
|
10
10
|
screenshot: UIContext['screenshot'] | SerializedStaticScreenshot;
|
|
11
|
+
screenshotSequence?: Array<UIContext['screenshot'] | SerializedStaticScreenshot>;
|
|
11
12
|
};
|
|
12
13
|
export default class StaticPage implements AbstractInterface {
|
|
13
14
|
interfaceType: string;
|
|
14
15
|
private uiContext;
|
|
16
|
+
private normalizedUIContext?;
|
|
15
17
|
readonly inputPrimitives: InputPrimitives;
|
|
16
18
|
constructor(uiContext: StaticPageUIContext);
|
|
19
|
+
getUIContext(): UIContext;
|
|
17
20
|
actionSpace(): DeviceAction[];
|
|
18
21
|
evaluateJavaScript<T = unknown>(script: string): Promise<T>;
|
|
19
22
|
getElementsInfo(): Promise<never>;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"Browser use",
|
|
9
9
|
"Android use"
|
|
10
10
|
],
|
|
11
|
-
"version": "1.12.7
|
|
11
|
+
"version": "1.12.7",
|
|
12
12
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
13
13
|
"homepage": "https://midscenejs.com/",
|
|
14
14
|
"main": "./dist/lib/index.js",
|
|
@@ -117,9 +117,9 @@
|
|
|
117
117
|
"socket.io-client": "4.8.1",
|
|
118
118
|
"ws": "^8.18.1",
|
|
119
119
|
"zod": "^3.25.1",
|
|
120
|
-
"@midscene/
|
|
121
|
-
"@midscene/
|
|
122
|
-
"@midscene/
|
|
120
|
+
"@midscene/shared": "1.12.7",
|
|
121
|
+
"@midscene/core": "1.12.7",
|
|
122
|
+
"@midscene/playground": "1.12.7"
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@playwright/test": "^1.45.0",
|