@midscene/core 1.0.1-beta-20251028121806.0 → 1.0.1-beta-20251030070226.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/dist/es/agent/task-builder.mjs +7 -3
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +5 -0
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/index.mjs +2 -2
- package/dist/es/ai-model/inspect.mjs +21 -4
- package/dist/es/ai-model/inspect.mjs.map +1 -1
- package/dist/es/ai-model/prompt/llm-locator.mjs +8 -32
- package/dist/es/ai-model/prompt/llm-locator.mjs.map +1 -1
- package/dist/es/ai-model/prompt/llm-section-locator.mjs +15 -14
- package/dist/es/ai-model/prompt/llm-section-locator.mjs.map +1 -1
- package/dist/es/ai-model/prompt/order-sensitive-judge.mjs +35 -0
- package/dist/es/ai-model/prompt/order-sensitive-judge.mjs.map +1 -0
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/task-runner.mjs +31 -3
- package/dist/es/task-runner.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/agent/task-builder.js +7 -3
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/tasks.js +5 -0
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/index.js +13 -10
- package/dist/lib/ai-model/inspect.js +25 -5
- package/dist/lib/ai-model/inspect.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-locator.js +8 -32
- package/dist/lib/ai-model/prompt/llm-locator.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-section-locator.js +15 -14
- package/dist/lib/ai-model/prompt/llm-section-locator.js.map +1 -1
- package/dist/lib/ai-model/prompt/order-sensitive-judge.js +72 -0
- package/dist/lib/ai-model/prompt/order-sensitive-judge.js.map +1 -0
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/task-runner.js +31 -3
- package/dist/lib/task-runner.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/ai-model/index.d.ts +1 -1
- package/dist/types/ai-model/inspect.d.ts +6 -0
- package/dist/types/ai-model/prompt/llm-locator.d.ts +0 -1
- package/dist/types/ai-model/prompt/order-sensitive-judge.d.ts +2 -0
- package/dist/types/device/index.d.ts +4 -2
- package/dist/types/task-runner.d.ts +2 -0
- package/dist/types/types.d.ts +2 -1
- package/package.json +2 -3
|
@@ -4,7 +4,7 @@ export { describeUserPage } from './prompt/util';
|
|
|
4
4
|
export { generatePlaywrightTest, generatePlaywrightTestStream, } from './prompt/playwright-generator';
|
|
5
5
|
export { generateYamlTest, generateYamlTestStream, } from './prompt/yaml-generator';
|
|
6
6
|
export type { ChatCompletionMessageParam } from 'openai/resources/index';
|
|
7
|
-
export { AiLocateElement, AiExtractElementInfo, AiLocateSection, } from './inspect';
|
|
7
|
+
export { AiLocateElement, AiExtractElementInfo, AiLocateSection, AiJudgeOrderSensitive, } from './inspect';
|
|
8
8
|
export { plan } from './llm-planning';
|
|
9
9
|
export { adaptBboxToRect } from './common';
|
|
10
10
|
export { uiTarsPlanning, resizeImageForUiTars } from './ui-tars-planning';
|
|
@@ -46,3 +46,9 @@ export declare function AiExtractElementInfo<T>(options: {
|
|
|
46
46
|
parseResult: AIDataExtractionResponse<T>;
|
|
47
47
|
usage: AIUsageInfo | undefined;
|
|
48
48
|
}>;
|
|
49
|
+
export declare function AiJudgeOrderSensitive(description: string, callAIFn: typeof callAIWithObjectResponse<{
|
|
50
|
+
isOrderSensitive: boolean;
|
|
51
|
+
}>, modelConfig: IModelConfig): Promise<{
|
|
52
|
+
isOrderSensitive: boolean;
|
|
53
|
+
usage?: AIUsageInfo;
|
|
54
|
+
}>;
|
|
@@ -2,6 +2,5 @@ import { PromptTemplate } from '@langchain/core/prompts';
|
|
|
2
2
|
import type { TVlModeTypes } from '@midscene/shared/env';
|
|
3
3
|
export declare function systemPromptToLocateElement(vlMode: TVlModeTypes | undefined): string;
|
|
4
4
|
export declare const findElementPrompt: PromptTemplate<{
|
|
5
|
-
pageDescription: any;
|
|
6
5
|
targetElementDescription: any;
|
|
7
6
|
}, any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DeviceAction, LocateResultElement } from '../types';
|
|
2
|
+
import type { IModelConfig } from '@midscene/shared/env';
|
|
2
3
|
import type { ElementNode } from '@midscene/shared/extractor';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import type { ElementCacheFeature, Rect, Size, UIContext } from '../types';
|
|
@@ -7,8 +8,9 @@ export declare abstract class AbstractInterface {
|
|
|
7
8
|
abstract screenshotBase64(): Promise<string>;
|
|
8
9
|
abstract size(): Promise<Size>;
|
|
9
10
|
abstract actionSpace(): DeviceAction[] | Promise<DeviceAction[]>;
|
|
10
|
-
abstract cacheFeatureForRect?(rect: Rect,
|
|
11
|
-
|
|
11
|
+
abstract cacheFeatureForRect?(rect: Rect, options?: {
|
|
12
|
+
targetDescription?: string;
|
|
13
|
+
modelConfig?: IModelConfig;
|
|
12
14
|
}): Promise<ElementCacheFeature>;
|
|
13
15
|
abstract rectMatchesCacheFeature?(feature: ElementCacheFeature): Promise<Rect>;
|
|
14
16
|
abstract destroy?(): Promise<void>;
|
|
@@ -8,6 +8,8 @@ export declare class TaskRunner {
|
|
|
8
8
|
constructor(name: string, uiContextBuilder: () => Promise<UIContext>, options?: ExecutionTaskProgressOptions & {
|
|
9
9
|
tasks?: ExecutionTaskApply[];
|
|
10
10
|
});
|
|
11
|
+
private lastUiContext?;
|
|
12
|
+
private getUiContext;
|
|
11
13
|
private captureScreenshot;
|
|
12
14
|
private attachRecorderItem;
|
|
13
15
|
private markTaskAsPending;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -42,7 +42,6 @@ export type AISingleElementResponseByPosition = {
|
|
|
42
42
|
export type AISingleElementResponse = AISingleElementResponseById;
|
|
43
43
|
export interface AIElementCoordinatesResponse {
|
|
44
44
|
bbox: [number, number, number, number];
|
|
45
|
-
isOrderSensitive?: boolean;
|
|
46
45
|
errors?: string[];
|
|
47
46
|
}
|
|
48
47
|
export type AIElementResponse = AIElementCoordinatesResponse;
|
|
@@ -349,6 +348,8 @@ export interface DeviceAction<T = any> {
|
|
|
349
348
|
description?: string;
|
|
350
349
|
interfaceAlias?: string;
|
|
351
350
|
paramSchema?: z.ZodType<T>;
|
|
351
|
+
/** Optional delay (ms) after runner execution. This is useful to wait for the UI to update. Defaults to 300ms. Set to 0 to skip. */
|
|
352
|
+
delayAfterRunner?: number;
|
|
352
353
|
call: (param: T, context: ExecutorContext) => Promise<void> | void;
|
|
353
354
|
}
|
|
354
355
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/core",
|
|
3
3
|
"description": "Automate browser actions, extract data, and perform assertions using AI. It offers JavaScript SDK, Chrome extension, and support for scripting in YAML. See https://midscenejs.com/ for details.",
|
|
4
|
-
"version": "1.0.1-beta-
|
|
4
|
+
"version": "1.0.1-beta-20251030070226.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"main": "./dist/lib/index.js",
|
|
@@ -89,8 +89,7 @@
|
|
|
89
89
|
"zod": "3.24.3",
|
|
90
90
|
"semver": "7.5.2",
|
|
91
91
|
"js-yaml": "4.1.0",
|
|
92
|
-
"@midscene/
|
|
93
|
-
"@midscene/shared": "1.0.1-beta-20251028121806.0"
|
|
92
|
+
"@midscene/shared": "1.0.1-beta-20251030070226.0"
|
|
94
93
|
},
|
|
95
94
|
"devDependencies": {
|
|
96
95
|
"@rslib/core": "^0.11.2",
|