@midscene/core 1.0.1-beta-20251124014653.0 → 1.0.1-beta-20251124032544.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 (32) hide show
  1. package/dist/es/agent/agent.mjs +1 -1
  2. package/dist/es/agent/agent.mjs.map +1 -1
  3. package/dist/es/agent/tasks.mjs +5 -4
  4. package/dist/es/agent/tasks.mjs.map +1 -1
  5. package/dist/es/agent/utils.mjs +1 -1
  6. package/dist/es/ai-model/conversation-history.mjs +28 -11
  7. package/dist/es/ai-model/conversation-history.mjs.map +1 -1
  8. package/dist/es/ai-model/llm-planning.mjs +20 -22
  9. package/dist/es/ai-model/llm-planning.mjs.map +1 -1
  10. package/dist/es/ai-model/prompt/llm-planning.mjs +6 -5
  11. package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
  12. package/dist/es/types.mjs.map +1 -1
  13. package/dist/es/utils.mjs +2 -2
  14. package/dist/lib/agent/agent.js +1 -1
  15. package/dist/lib/agent/agent.js.map +1 -1
  16. package/dist/lib/agent/tasks.js +5 -4
  17. package/dist/lib/agent/tasks.js.map +1 -1
  18. package/dist/lib/agent/utils.js +1 -1
  19. package/dist/lib/ai-model/conversation-history.js +28 -11
  20. package/dist/lib/ai-model/conversation-history.js.map +1 -1
  21. package/dist/lib/ai-model/llm-planning.js +20 -22
  22. package/dist/lib/ai-model/llm-planning.js.map +1 -1
  23. package/dist/lib/ai-model/prompt/llm-planning.js +6 -5
  24. package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
  25. package/dist/lib/types.js.map +1 -1
  26. package/dist/lib/utils.js +2 -2
  27. package/dist/types/agent/tasks.d.ts +2 -2
  28. package/dist/types/ai-model/conversation-history.d.ts +3 -2
  29. package/dist/types/ai-model/llm-planning.d.ts +2 -1
  30. package/dist/types/ai-model/prompt/llm-planning.d.ts +3 -2
  31. package/dist/types/types.d.ts +1 -0
  32. package/package.json +7 -7
@@ -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 { ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam, ThinkingLevel } from '../types';
6
+ import type { ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam, ThinkingStrategy } 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';
@@ -45,7 +45,7 @@ export declare class TaskExecutor {
45
45
  private createPlanningTask;
46
46
  runPlans(title: string, plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig): Promise<ExecutionResult>;
47
47
  private getReplanningCycleLimit;
48
- action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, thinkingLevel: ThinkingLevel, includeBboxInPlanning: boolean, actionContext?: string, cacheable?: boolean): Promise<ExecutionResult<{
48
+ action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, thinkingStrategy: ThinkingStrategy, actionContext?: string, cacheable?: boolean): Promise<ExecutionResult<{
49
49
  yamlFlow?: MidsceneYamlFlowItem[];
50
50
  } | undefined>>;
51
51
  private createTypeQueryTask;
@@ -10,9 +10,10 @@ export declare class ConversationHistory {
10
10
  append(message: ChatCompletionMessageParam): void;
11
11
  seed(messages: ChatCompletionMessageParam[]): void;
12
12
  reset(): void;
13
- snapshot(): ChatCompletionMessageParam[];
13
+ snapshot(options?: {
14
+ maxImageMessages?: number;
15
+ }): ChatCompletionMessageParam[];
14
16
  get length(): number;
15
17
  [Symbol.iterator](): IterableIterator<ChatCompletionMessageParam>;
16
18
  toJSON(): ChatCompletionMessageParam[];
17
- private pruneOldestUserMessageIfNecessary;
18
19
  }
@@ -1,4 +1,4 @@
1
- import type { DeviceAction, InterfaceType, PlanningAIResponse, UIContext } from '../types';
1
+ import type { DeviceAction, InterfaceType, PlanningAIResponse, ThinkingStrategy, 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: {
@@ -9,4 +9,5 @@ export declare function plan(userInstruction: string, opts: {
9
9
  modelConfig: IModelConfig;
10
10
  conversationHistory?: ConversationHistory;
11
11
  includeBbox: boolean;
12
+ thinkingStrategy: ThinkingStrategy;
12
13
  }): Promise<PlanningAIResponse>;
@@ -1,10 +1,11 @@
1
- import type { DeviceAction } from '../../types';
1
+ import type { DeviceAction, ThinkingStrategy } from '../../types';
2
2
  import type { TVlModeTypes } from '@midscene/shared/env';
3
3
  import type { ResponseFormatJSONSchema } from 'openai/resources/index';
4
4
  export declare const descriptionForAction: (action: DeviceAction<any>, locatorSchemaTypeDescription: string) => string;
5
- export declare function systemPromptToTaskPlanning({ actionSpace, vlMode, includeBbox, }: {
5
+ export declare function systemPromptToTaskPlanning({ actionSpace, vlMode, includeBbox, thinkingStrategy, }: {
6
6
  actionSpace: DeviceAction<any>[];
7
7
  vlMode: TVlModeTypes | undefined;
8
8
  includeBbox: boolean;
9
+ thinkingStrategy: ThinkingStrategy;
9
10
  }): Promise<string>;
10
11
  export declare const planSchema: ResponseFormatJSONSchema;
@@ -96,6 +96,7 @@ export interface LocateResult {
96
96
  rect?: Rect;
97
97
  }
98
98
  export type ThinkingLevel = 'off' | 'medium' | 'high';
99
+ export type ThinkingStrategy = 'off' | 'cot';
99
100
  export interface ServiceTaskInfo {
100
101
  durationMs: number;
101
102
  formatResponse?: string;
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-20251124014653.0",
4
+ "version": "1.0.1-beta-20251124032544.0",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "main": "./dist/lib/index.js",
@@ -85,21 +85,21 @@
85
85
  "dotenv": "^16.4.5",
86
86
  "https-proxy-agent": "7.0.2",
87
87
  "openai": "6.3.0",
88
+ "jsonrepair": "3.12.0",
89
+ "semver": "7.5.2",
90
+ "js-yaml": "4.1.0",
91
+ "zod": "3.24.3",
88
92
  "socks-proxy-agent": "8.0.4",
89
- "@midscene/shared": "1.0.1-beta-20251124014653.0"
93
+ "@midscene/shared": "1.0.1-beta-20251124032544.0"
90
94
  },
91
95
  "devDependencies": {
92
- "jsonrepair": "3.12.0",
93
96
  "@rslib/core": "^0.11.2",
94
97
  "@types/node": "^18.0.0",
95
98
  "@types/node-fetch": "2.6.11",
96
99
  "@types/js-yaml": "4.0.9",
97
100
  "@types/semver": "7.7.0",
98
101
  "typescript": "^5.8.3",
99
- "semver": "7.5.2",
100
- "js-yaml": "4.1.0",
101
- "vitest": "3.0.5",
102
- "zod": "3.24.3"
102
+ "vitest": "3.0.5"
103
103
  },
104
104
  "engines": {
105
105
  "node": ">=18.0.0"