@midscene/core 1.0.1-beta-20251126084350.0 → 1.0.1-beta-20251126094110.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.
Files changed (39) hide show
  1. package/dist/es/agent/agent.mjs +5 -13
  2. package/dist/es/agent/agent.mjs.map +1 -1
  3. package/dist/es/agent/execution-session.mjs +6 -6
  4. package/dist/es/agent/execution-session.mjs.map +1 -1
  5. package/dist/es/agent/tasks.mjs +76 -68
  6. package/dist/es/agent/tasks.mjs.map +1 -1
  7. package/dist/es/agent/utils.mjs +1 -1
  8. package/dist/es/ai-model/conversation-history.mjs +5 -0
  9. package/dist/es/ai-model/conversation-history.mjs.map +1 -1
  10. package/dist/es/ai-model/llm-planning.mjs +22 -17
  11. package/dist/es/ai-model/llm-planning.mjs.map +1 -1
  12. package/dist/es/ai-model/prompt/llm-planning.mjs +2 -0
  13. package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
  14. package/dist/es/task-runner.mjs +13 -7
  15. package/dist/es/task-runner.mjs.map +1 -1
  16. package/dist/es/utils.mjs +2 -2
  17. package/dist/lib/agent/agent.js +5 -13
  18. package/dist/lib/agent/agent.js.map +1 -1
  19. package/dist/lib/agent/execution-session.js +6 -6
  20. package/dist/lib/agent/execution-session.js.map +1 -1
  21. package/dist/lib/agent/tasks.js +76 -68
  22. package/dist/lib/agent/tasks.js.map +1 -1
  23. package/dist/lib/agent/utils.js +1 -1
  24. package/dist/lib/ai-model/conversation-history.js +5 -0
  25. package/dist/lib/ai-model/conversation-history.js.map +1 -1
  26. package/dist/lib/ai-model/llm-planning.js +22 -17
  27. package/dist/lib/ai-model/llm-planning.js.map +1 -1
  28. package/dist/lib/ai-model/prompt/llm-planning.js +2 -0
  29. package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
  30. package/dist/lib/task-runner.js +13 -7
  31. package/dist/lib/task-runner.js.map +1 -1
  32. package/dist/lib/utils.js +2 -2
  33. package/dist/types/agent/agent.d.ts +2 -3
  34. package/dist/types/agent/execution-session.d.ts +9 -3
  35. package/dist/types/agent/tasks.d.ts +1 -2
  36. package/dist/types/ai-model/conversation-history.d.ts +2 -0
  37. package/dist/types/ai-model/llm-planning.d.ts +1 -1
  38. package/dist/types/task-runner.d.ts +7 -3
  39. 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 ThinkingLevel, type UIContext } from '../index';
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';
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';
@@ -59,7 +59,6 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
59
59
  reportHTMLString(): string;
60
60
  writeOutActionDumps(): void;
61
61
  private callbackOnTaskStartTip;
62
- private handleRunnerAfterFlush;
63
62
  wrapActionInActionSpace<T extends DeviceAction>(name: string): (param: ActionParam<T>) => Promise<ActionReturn<T>>;
64
63
  callActionInActionSpace<T = any>(type: string, opt?: T): Promise<any>;
65
64
  aiTap(locatePrompt: TUserPrompt, opt?: LocateOption): Promise<any>;
@@ -95,7 +94,7 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
95
94
  aiScroll(scrollParam: ScrollParam, locatePrompt?: TUserPrompt, opt?: LocateOption): Promise<any>;
96
95
  aiAct(taskPrompt: string, opt?: {
97
96
  cacheable?: boolean;
98
- _thinkingLevel?: ThinkingLevel;
97
+ _deepThink?: boolean;
99
98
  }): Promise<{
100
99
  result: Record<string, any>;
101
100
  } | {
@@ -10,12 +10,18 @@ type ExecutionSessionOptions = ExecutionTaskProgressOptions & {
10
10
  export declare class ExecutionSession {
11
11
  private readonly runner;
12
12
  constructor(name: string, contextProvider: () => Promise<UIContext>, options?: ExecutionSessionOptions);
13
- append(tasks: ExecutionTaskApply[] | ExecutionTaskApply): Promise<void>;
14
- appendAndRun(tasks: ExecutionTaskApply[] | ExecutionTaskApply): Promise<{
13
+ append(tasks: ExecutionTaskApply[] | ExecutionTaskApply, options?: {
14
+ allowWhenError?: boolean;
15
+ }): Promise<void>;
16
+ appendAndRun(tasks: ExecutionTaskApply[] | ExecutionTaskApply, options?: {
17
+ allowWhenError?: boolean;
18
+ }): Promise<{
15
19
  output: any;
16
20
  thought?: string;
17
21
  } | undefined>;
18
- run(): Promise<{
22
+ run(options?: {
23
+ allowWhenError?: boolean;
24
+ }): Promise<{
19
25
  output: any;
20
26
  thought?: string;
21
27
  } | undefined>;
@@ -42,10 +42,9 @@ export declare class TaskExecutor {
42
42
  loadYamlFlowAsPlanning(userInstruction: string, yamlString: string): Promise<{
43
43
  runner: TaskRunner;
44
44
  }>;
45
- private createPlanningTask;
46
45
  runPlans(title: string, plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig): Promise<ExecutionResult>;
47
46
  private getReplanningCycleLimit;
48
- action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, thinkingStrategy: ThinkingStrategy, actionContext?: string, cacheable?: boolean): Promise<ExecutionResult<{
47
+ action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, thinkingStrategy: ThinkingStrategy, backgroundKnowledge?: string, cacheable?: boolean): Promise<ExecutionResult<{
49
48
  yamlFlow?: MidsceneYamlFlowItem[];
50
49
  } | undefined>>;
51
50
  private createTypeQueryTask;
@@ -4,7 +4,9 @@ export interface ConversationHistoryOptions {
4
4
  }
5
5
  export declare class ConversationHistory {
6
6
  private readonly messages;
7
+ pendingFeedbackMessage: string;
7
8
  constructor(options?: ConversationHistoryOptions);
9
+ resetPendingFeedbackMessageIfExists(): void;
8
10
  append(message: ChatCompletionMessageParam): void;
9
11
  seed(messages: ChatCompletionMessageParam[]): void;
10
12
  reset(): void;
@@ -7,7 +7,7 @@ export declare function plan(userInstruction: string, opts: {
7
7
  actionSpace: DeviceAction<any>[];
8
8
  actionContext?: string;
9
9
  modelConfig: IModelConfig;
10
- conversationHistory?: ConversationHistory;
10
+ conversationHistory: ConversationHistory;
11
11
  includeBbox: boolean;
12
12
  thinkingStrategy: ThinkingStrategy;
13
13
  }): Promise<PlanningAIResponse>;
@@ -3,6 +3,9 @@ type TaskRunnerInitOptions = ExecutionTaskProgressOptions & {
3
3
  tasks?: ExecutionTaskApply[];
4
4
  onTaskUpdate?: (runner: TaskRunner, error?: TaskExecutionError) => Promise<void> | void;
5
5
  };
6
+ type TaskRunnerOperationOptions = {
7
+ allowWhenError?: boolean;
8
+ };
6
9
  export declare class TaskRunner {
7
10
  name: string;
8
11
  tasks: ExecutionTask[];
@@ -17,13 +20,14 @@ export declare class TaskRunner {
17
20
  private captureScreenshot;
18
21
  private attachRecorderItem;
19
22
  private markTaskAsPending;
23
+ private normalizeStatusFromError;
20
24
  private findPreviousNonSubTaskUIContext;
21
- append(task: ExecutionTaskApply[] | ExecutionTaskApply): Promise<void>;
22
- appendAndFlush(task: ExecutionTaskApply[] | ExecutionTaskApply): Promise<{
25
+ append(task: ExecutionTaskApply[] | ExecutionTaskApply, options?: TaskRunnerOperationOptions): Promise<void>;
26
+ appendAndFlush(task: ExecutionTaskApply[] | ExecutionTaskApply, options?: TaskRunnerOperationOptions): Promise<{
23
27
  output: any;
24
28
  thought?: string;
25
29
  } | undefined>;
26
- flush(): Promise<{
30
+ flush(options?: TaskRunnerOperationOptions): Promise<{
27
31
  output: any;
28
32
  thought?: string;
29
33
  } | undefined>;
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-20251126084350.0",
4
+ "version": "1.0.1-beta-20251126094110.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
  "js-yaml": "4.1.0",
90
90
  "zod": "3.24.3",
91
91
  "socks-proxy-agent": "8.0.4",
92
- "@midscene/shared": "1.0.1-beta-20251126084350.0"
92
+ "@midscene/shared": "1.0.1-beta-20251126094110.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@rslib/core": "^0.11.2",