@midscene/core 1.0.5-beta-20260104063142.0 → 1.1.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/agent.mjs +3 -4
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/task-builder.mjs +1 -0
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +7 -4
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/inspect.mjs +4 -2
- package/dist/es/ai-model/inspect.mjs.map +1 -1
- package/dist/es/ai-model/llm-planning.mjs +4 -1
- package/dist/es/ai-model/llm-planning.mjs.map +1 -1
- package/dist/es/ai-model/service-caller/index.mjs +52 -7
- package/dist/es/ai-model/service-caller/index.mjs.map +1 -1
- package/dist/es/service/index.mjs +7 -4
- package/dist/es/service/index.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/agent/agent.js +3 -4
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/task-builder.js +1 -0
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/tasks.js +7 -4
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/inspect.js +4 -2
- package/dist/lib/ai-model/inspect.js.map +1 -1
- package/dist/lib/ai-model/llm-planning.js +4 -1
- package/dist/lib/ai-model/llm-planning.js.map +1 -1
- package/dist/lib/ai-model/service-caller/index.js +54 -6
- package/dist/lib/ai-model/service-caller/index.js.map +1 -1
- package/dist/lib/service/index.js +7 -4
- package/dist/lib/service/index.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/agent/agent.d.ts +2 -1
- package/dist/types/agent/tasks.d.ts +2 -2
- package/dist/types/ai-model/inspect.d.ts +2 -0
- package/dist/types/ai-model/llm-planning.d.ts +2 -1
- package/dist/types/ai-model/service-caller/index.d.ts +15 -2
- package/dist/types/types.d.ts +5 -0
- package/dist/types/yaml.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActionParam, type ActionReturn, type AgentAssertOpt, type AgentDescribeElementAtPointResult, type AgentOpt, type AgentWaitForOpt, type DeviceAction, type ExecutionDump, type GroupedActionDump, type LocateOption, type LocateResultElement, type LocateValidatorResult, type LocatorValidatorOption, type OnTaskStartTip, type ScrollParam, Service, type ServiceAction, type ServiceExtractOption, type ServiceExtractParam, type TUserPrompt, type UIContext } from '../index';
|
|
1
|
+
import { type ActionParam, type ActionReturn, type AgentAssertOpt, type AgentDescribeElementAtPointResult, type AgentOpt, type AgentWaitForOpt, type DeepThinkOption, type DeviceAction, type ExecutionDump, type GroupedActionDump, type LocateOption, type LocateResultElement, type LocateValidatorResult, type LocatorValidatorOption, type OnTaskStartTip, type ScrollParam, Service, type ServiceAction, type ServiceExtractOption, type ServiceExtractParam, type TUserPrompt, type UIContext } from '../index';
|
|
2
2
|
export type TestStatus = 'passed' | 'failed' | 'timedOut' | 'skipped' | 'interrupted';
|
|
3
3
|
import type { AbstractInterface } from '../device';
|
|
4
4
|
import type { TaskRunner } from '../task-runner';
|
|
@@ -7,6 +7,7 @@ import { TaskCache } from './task-cache';
|
|
|
7
7
|
import { TaskExecutor } from './tasks';
|
|
8
8
|
export type AiActOptions = {
|
|
9
9
|
cacheable?: boolean;
|
|
10
|
+
deepThink?: DeepThinkOption;
|
|
10
11
|
};
|
|
11
12
|
export declare class Agent<InterfaceType extends AbstractInterface = AbstractInterface> {
|
|
12
13
|
interface: InterfaceType;
|
|
@@ -3,7 +3,7 @@ import type { AbstractInterface } from '../device';
|
|
|
3
3
|
import type Service from '../service';
|
|
4
4
|
import type { TaskRunner } from '../task-runner';
|
|
5
5
|
import { TaskExecutionError } from '../task-runner';
|
|
6
|
-
import type { DeviceAction, ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam } from '../types';
|
|
6
|
+
import type { DeepThinkOption, DeviceAction, ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam } from '../types';
|
|
7
7
|
import type { IModelConfig } from '@midscene/shared/env';
|
|
8
8
|
import type { TaskCache } from './task-cache';
|
|
9
9
|
export { locatePlanForLocate } from './task-builder';
|
|
@@ -46,7 +46,7 @@ export declare class TaskExecutor {
|
|
|
46
46
|
runner: TaskRunner;
|
|
47
47
|
}>;
|
|
48
48
|
runPlans(title: string, plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig): Promise<ExecutionResult>;
|
|
49
|
-
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number): Promise<ExecutionResult<{
|
|
49
|
+
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number, deepThink?: DeepThinkOption): Promise<ExecutionResult<{
|
|
50
50
|
yamlFlow?: MidsceneYamlFlowItem[];
|
|
51
51
|
} | undefined>>;
|
|
52
52
|
private createTypeQueryTask;
|
|
@@ -23,6 +23,7 @@ export declare function AiLocateElement(options: {
|
|
|
23
23
|
rect?: Rect;
|
|
24
24
|
rawResponse: string;
|
|
25
25
|
usage?: AIUsageInfo;
|
|
26
|
+
reasoning_content?: string;
|
|
26
27
|
}>;
|
|
27
28
|
export declare function AiLocateSection(options: {
|
|
28
29
|
context: UIContext;
|
|
@@ -45,6 +46,7 @@ export declare function AiExtractElementInfo<T>(options: {
|
|
|
45
46
|
}): Promise<{
|
|
46
47
|
parseResult: AIDataExtractionResponse<T>;
|
|
47
48
|
usage: AIUsageInfo | undefined;
|
|
49
|
+
reasoning_content: string | undefined;
|
|
48
50
|
}>;
|
|
49
51
|
export declare function AiJudgeOrderSensitive(description: string, callAIFn: typeof callAIWithObjectResponse<{
|
|
50
52
|
isOrderSensitive: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeviceAction, InterfaceType, PlanningAIResponse, UIContext } from '../types';
|
|
1
|
+
import type { DeepThinkOption, DeviceAction, InterfaceType, PlanningAIResponse, UIContext } from '../types';
|
|
2
2
|
import type { IModelConfig } from '@midscene/shared/env';
|
|
3
3
|
import type { ConversationHistory } from './conversation-history';
|
|
4
4
|
export declare function plan(userInstruction: string, opts: {
|
|
@@ -10,4 +10,5 @@ export declare function plan(userInstruction: string, opts: {
|
|
|
10
10
|
conversationHistory: ConversationHistory;
|
|
11
11
|
includeBbox: boolean;
|
|
12
12
|
imagesIncludeCount?: number;
|
|
13
|
+
deepThink?: DeepThinkOption;
|
|
13
14
|
}): Promise<PlanningAIResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AIUsageInfo } from '../../types';
|
|
1
|
+
import { type AIUsageInfo, type DeepThinkOption } from '../../types';
|
|
2
2
|
import type { StreamingCallback } from '../../types';
|
|
3
3
|
import { type IModelConfig, type TVlModeTypes } from '@midscene/shared/env';
|
|
4
4
|
import type { ChatCompletionMessageParam } from 'openai/resources/index';
|
|
@@ -6,15 +6,20 @@ import type { AIActionType, AIArgs } from '../../common';
|
|
|
6
6
|
export declare function callAI(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig, options?: {
|
|
7
7
|
stream?: boolean;
|
|
8
8
|
onChunk?: StreamingCallback;
|
|
9
|
+
deepThink?: DeepThinkOption;
|
|
9
10
|
}): Promise<{
|
|
10
11
|
content: string;
|
|
12
|
+
reasoning_content?: string;
|
|
11
13
|
usage?: AIUsageInfo;
|
|
12
14
|
isStreamed: boolean;
|
|
13
15
|
}>;
|
|
14
|
-
export declare function callAIWithObjectResponse<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig
|
|
16
|
+
export declare function callAIWithObjectResponse<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig, options?: {
|
|
17
|
+
deepThink?: DeepThinkOption;
|
|
18
|
+
}): Promise<{
|
|
15
19
|
content: T;
|
|
16
20
|
contentString: string;
|
|
17
21
|
usage?: AIUsageInfo;
|
|
22
|
+
reasoning_content?: string;
|
|
18
23
|
}>;
|
|
19
24
|
export declare function callAIWithStringResponse(msgs: AIArgs, AIActionTypeValue: AIActionType, modelConfig: IModelConfig): Promise<{
|
|
20
25
|
content: string;
|
|
@@ -22,4 +27,12 @@ export declare function callAIWithStringResponse(msgs: AIArgs, AIActionTypeValue
|
|
|
22
27
|
}>;
|
|
23
28
|
export declare function extractJSONFromCodeBlock(response: string): string;
|
|
24
29
|
export declare function preprocessDoubaoBboxJson(input: string): string;
|
|
30
|
+
export declare function resolveDeepThinkConfig({ deepThink, vlMode, }: {
|
|
31
|
+
deepThink?: DeepThinkOption;
|
|
32
|
+
vlMode?: TVlModeTypes;
|
|
33
|
+
}): {
|
|
34
|
+
config: Record<string, unknown>;
|
|
35
|
+
debugMessage?: string;
|
|
36
|
+
warningMessage?: string;
|
|
37
|
+
};
|
|
25
38
|
export declare function safeParseJson(input: string, vlMode: TVlModeTypes | undefined): any;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export interface LocateResult {
|
|
|
97
97
|
rect?: Rect;
|
|
98
98
|
}
|
|
99
99
|
export type ThinkingLevel = 'off' | 'medium' | 'high';
|
|
100
|
+
export type DeepThinkOption = 'unset' | true | false;
|
|
100
101
|
export interface ServiceTaskInfo {
|
|
101
102
|
durationMs: number;
|
|
102
103
|
formatResponse?: string;
|
|
@@ -105,6 +106,7 @@ export interface ServiceTaskInfo {
|
|
|
105
106
|
searchArea?: Rect;
|
|
106
107
|
searchAreaRawResponse?: string;
|
|
107
108
|
searchAreaUsage?: AIUsageInfo;
|
|
109
|
+
reasoning_content?: string;
|
|
108
110
|
}
|
|
109
111
|
export interface DumpMeta {
|
|
110
112
|
logTime: number;
|
|
@@ -140,6 +142,7 @@ export interface ServiceExtractResult<T> extends ServiceResultBase {
|
|
|
140
142
|
data: T;
|
|
141
143
|
thought?: string;
|
|
142
144
|
usage?: AIUsageInfo;
|
|
145
|
+
reasoning_content?: string;
|
|
143
146
|
}
|
|
144
147
|
export declare class ServiceError extends Error {
|
|
145
148
|
dump: ServiceDump;
|
|
@@ -193,6 +196,7 @@ export interface PlanningAIResponse extends Omit<RawResponsePlanningAIResponse,
|
|
|
193
196
|
yamlFlow?: MidsceneYamlFlowItem[];
|
|
194
197
|
yamlString?: string;
|
|
195
198
|
error?: string;
|
|
199
|
+
reasoning_content?: string;
|
|
196
200
|
}
|
|
197
201
|
export interface PlanningActionParamSleep {
|
|
198
202
|
timeMs: number;
|
|
@@ -269,6 +273,7 @@ export type ExecutionTask<E extends ExecutionTaskApply<any, any, any> = Executio
|
|
|
269
273
|
};
|
|
270
274
|
usage?: AIUsageInfo;
|
|
271
275
|
searchAreaUsage?: AIUsageInfo;
|
|
276
|
+
reasoning_content?: string;
|
|
272
277
|
};
|
|
273
278
|
export interface ExecutionDump extends DumpMeta {
|
|
274
279
|
name: string;
|
package/dist/types/yaml.d.ts
CHANGED
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.
|
|
4
|
+
"version": "1.1.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,7 +89,7 @@
|
|
|
89
89
|
"semver": "7.5.2",
|
|
90
90
|
"js-yaml": "4.1.0",
|
|
91
91
|
"zod": "3.24.3",
|
|
92
|
-
"@midscene/shared": "1.
|
|
92
|
+
"@midscene/shared": "1.1.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@rslib/core": "^0.18.3",
|