@midscene/core 0.25.4-beta-20250811115904.0 → 0.25.4-beta-20250812025613.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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getVersion
3
- } from "./chunk-SR67R2OE.js";
3
+ } from "./chunk-YNPMUA35.js";
4
4
  import {
5
5
  AiAssert,
6
6
  AiExtractElementInfo,
@@ -11,7 +11,7 @@ import {
11
11
  describeUserPage,
12
12
  expandSearchArea,
13
13
  plan
14
- } from "./chunk-NY6RQSGJ.js";
14
+ } from "./chunk-UC5NNLPY.js";
15
15
 
16
16
  // src/ai-model/action-executor.ts
17
17
  import {
package/dist/es/utils.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  uploadTestInfoToServer,
13
13
  writeDumpReport,
14
14
  writeLogFile
15
- } from "./chunk-SR67R2OE.js";
15
+ } from "./chunk-YNPMUA35.js";
16
16
  export {
17
17
  getTmpDir,
18
18
  getTmpFile,
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkNY6RQSGJjs = require('./chunk-NY6RQSGJ.js');
22
+ var _chunkUC5NNLPYjs = require('./chunk-UC5NNLPY.js');
23
23
 
24
24
 
25
25
 
@@ -41,4 +41,4 @@ var _chunkNY6RQSGJjs = require('./chunk-NY6RQSGJ.js');
41
41
 
42
42
 
43
43
 
44
- exports.AIActionType = _chunkNY6RQSGJjs.AIActionType; exports.AiAssert = _chunkNY6RQSGJjs.AiAssert; exports.AiExtractElementInfo = _chunkNY6RQSGJjs.AiExtractElementInfo; exports.AiLocateElement = _chunkNY6RQSGJjs.AiLocateElement; exports.AiLocateSection = _chunkNY6RQSGJjs.AiLocateSection; exports.adaptBboxToRect = _chunkNY6RQSGJjs.adaptBboxToRect; exports.callAi = _chunkNY6RQSGJjs.call; exports.callAiFn = _chunkNY6RQSGJjs.callAiFn; exports.callAiFnWithStringResponse = _chunkNY6RQSGJjs.callAiFnWithStringResponse; exports.callToGetJSONObject = _chunkNY6RQSGJjs.callToGetJSONObject; exports.describeUserPage = _chunkNY6RQSGJjs.describeUserPage; exports.elementByPositionWithElementInfo = _chunkNY6RQSGJjs.elementByPositionWithElementInfo; exports.generatePlaywrightTest = _chunkNY6RQSGJjs.generatePlaywrightTest; exports.generatePlaywrightTestStream = _chunkNY6RQSGJjs.generatePlaywrightTestStream; exports.generateYamlTest = _chunkNY6RQSGJjs.generateYamlTest; exports.generateYamlTestStream = _chunkNY6RQSGJjs.generateYamlTestStream; exports.plan = _chunkNY6RQSGJjs.plan; exports.resizeImageForUiTars = _chunkNY6RQSGJjs.resizeImageForUiTars; exports.systemPromptToLocateElement = _chunkNY6RQSGJjs.systemPromptToLocateElement; exports.vlmPlanning = _chunkNY6RQSGJjs.vlmPlanning;
44
+ exports.AIActionType = _chunkUC5NNLPYjs.AIActionType; exports.AiAssert = _chunkUC5NNLPYjs.AiAssert; exports.AiExtractElementInfo = _chunkUC5NNLPYjs.AiExtractElementInfo; exports.AiLocateElement = _chunkUC5NNLPYjs.AiLocateElement; exports.AiLocateSection = _chunkUC5NNLPYjs.AiLocateSection; exports.adaptBboxToRect = _chunkUC5NNLPYjs.adaptBboxToRect; exports.callAi = _chunkUC5NNLPYjs.call; exports.callAiFn = _chunkUC5NNLPYjs.callAiFn; exports.callAiFnWithStringResponse = _chunkUC5NNLPYjs.callAiFnWithStringResponse; exports.callToGetJSONObject = _chunkUC5NNLPYjs.callToGetJSONObject; exports.describeUserPage = _chunkUC5NNLPYjs.describeUserPage; exports.elementByPositionWithElementInfo = _chunkUC5NNLPYjs.elementByPositionWithElementInfo; exports.generatePlaywrightTest = _chunkUC5NNLPYjs.generatePlaywrightTest; exports.generatePlaywrightTestStream = _chunkUC5NNLPYjs.generatePlaywrightTestStream; exports.generateYamlTest = _chunkUC5NNLPYjs.generateYamlTest; exports.generateYamlTestStream = _chunkUC5NNLPYjs.generateYamlTestStream; exports.plan = _chunkUC5NNLPYjs.plan; exports.resizeImageForUiTars = _chunkUC5NNLPYjs.resizeImageForUiTars; exports.systemPromptToLocateElement = _chunkUC5NNLPYjs.systemPromptToLocateElement; exports.vlmPlanning = _chunkUC5NNLPYjs.vlmPlanning;
@@ -760,16 +760,15 @@ You are a versatile professional in software UI automation. Your outstanding con
760
760
  ## Workflow
761
761
 
762
762
  1. Receive the screenshot, element description of screenshot(if any), user's instruction and previous logs.
763
- 2. Decompose the user's task into a sequence of actions, and place it in the \`actions\` field. There are different types of actions (${actionNameList}). The "About the action" section below will give you more details.
764
- 3. Precisely locate the target element if it's already shown in the screenshot, put the location info in the \`locate\` field of the action.
765
- 4. If some target elements is not shown in the screenshot, consider the user's instruction is not feasible on this page. Follow the next steps.
766
- 5. Consider whether the user's instruction will be accomplished after all the actions
767
- - If yes, set \`taskWillBeAccomplished\` to true
768
- - If no, don't plan more actions by closing the array. Get ready to reevaluate the task. Some talent people like you will handle this. Give him a clear description of what have been done and what to do next. Put your new plan in the \`furtherPlan\` field. The "How to compose the \`taskWillBeAccomplished\` and \`furtherPlan\` fields" section will give you more details.
763
+ 2. Decompose the user's task into a sequence of feasible actions, and place it in the \`actions\` field. There are different types of actions (${actionNameList}). The "About the action" section below will give you more details.
764
+ 3. Consider whether the user's instruction will be accomplished after the actions you composed.
765
+ - If the instruction is accomplished, set \`more_actions_needed_by_instruction\` to false.
766
+ - If more actions are needed, set \`more_actions_needed_by_instruction\` to true. Get ready to hand over to the next talent people like you. Carefully log what have been done in the \`log\` field, he or she will continue the task according to your logs.
767
+ 4. If the task is not feasible on this page, set \`error\` field to the reason.
769
768
 
770
769
  ## Constraints
771
770
 
772
- - All the actions you composed MUST be based on the page context information you get.
771
+ - All the actions you composed MUST be feasible, which means all the action fields can be filled with the page context information you get. If not, don't plan this action.
773
772
  - Trust the "What have been done" field about the task (if any), don't repeat actions in it.
774
773
  - Respond only with valid JSON. Do not write an introduction or summary or markdown prefix like \`\`\`json\`\`\`.
775
774
  - If the screenshot and the instruction are totally irrelevant, set reason in the \`error\` field.
@@ -807,15 +806,20 @@ The JSON format is as follows:
807
806
 
808
807
  ### Example: Decompose a task
809
808
 
810
- When the instruction is 'Click the language switch button, wait 1s, click "English"', and not log is provided
809
+ When you received the following information:
810
+
811
+ * Instruction: 'Click the language switch button, wait 1s, click "English"'
812
+ * Logs: null
813
+ * Page Context (screenshot and description) shows: There is a language switch button, and the "English" option is not shown in the screenshot now.
811
814
 
812
815
  By viewing the page screenshot and description, you should consider this and output the JSON:
813
816
 
814
- * The main steps should be: tap the switch button, sleep, and tap the 'English' option
815
- * The language switch button is shown in the screenshot, but it's not marked with a rectangle. So we have to use the page description to find the element. By carefully checking the context information (coordinates, attributes, content, etc.), you can find the element.
817
+ * The user intent is: tap the switch button, sleep, and tap the 'English' option
818
+ * The language switch button is shown in the screenshot, and can be located by the page description or the id marked with a rectangle. So we can plan a Tap action to do this.
819
+ * Plan a Sleep action to wait for 1 second to ensure the language options are displayed.
816
820
  * The "English" option button is not shown in the screenshot now, it means it may only show after the previous actions are finished. So don't plan any action to do this.
817
821
  * Log what these action do: Click the language switch button to open the language options. Wait for 1 second.
818
- * The task cannot be accomplished (because we cannot see the "English" option now), so the \`more_actions_needed_by_instruction\` field is true.
822
+ * The task cannot be accomplished (because the last tapping action is not finished yet), so the \`more_actions_needed_by_instruction\` field is true. The \`error\` field is null.
819
823
 
820
824
  {
821
825
  "actions":[
@@ -845,7 +849,7 @@ Wrong output:
845
849
  "thought": "Click the language switch button to open the language options.",
846
850
  "param": null,
847
851
  "locate": {
848
- { "id": "c81c4e9a33" }, // WRONG: prompt is missing
852
+ { "id": "c81c4e9a33" }, // WRONG: prompt is missing, this is not a valid LocateParam
849
853
  }
850
854
  },
851
855
  {
@@ -858,10 +862,6 @@ Wrong output:
858
862
  "more_actions_needed_by_instruction": false, // WRONG: should be true
859
863
  "log": "Click the language switch button to open the language options",
860
864
  }
861
-
862
- Reason:
863
- * The \`prompt\` is missing in the first 'Locate' action
864
- * Since the option button is not shown in the screenshot, there are still more actions to be done, so the \`more_actions_needed_by_instruction\` field should be true
865
865
  `;
866
866
  async function systemPromptToTaskPlanning({
867
867
  actionSpace,
@@ -2911,4 +2911,4 @@ async function resizeImageForUiTars(imageBase64, size) {
2911
2911
 
2912
2912
  exports.systemPromptToLocateElement = systemPromptToLocateElement; exports.call = call2; exports.callToGetJSONObject = callToGetJSONObject; exports.callAiFnWithStringResponse = callAiFnWithStringResponse; exports.AIActionType = AIActionType; exports.callAiFn = callAiFn; exports.adaptBboxToRect = adaptBboxToRect; exports.expandSearchArea = expandSearchArea; exports.elementByPositionWithElementInfo = elementByPositionWithElementInfo; exports.describeUserPage = describeUserPage; exports.generateYamlTest = generateYamlTest; exports.generateYamlTestStream = generateYamlTestStream; exports.generatePlaywrightTest = generatePlaywrightTest; exports.generatePlaywrightTestStream = generatePlaywrightTestStream; exports.AiLocateElement = AiLocateElement; exports.AiLocateSection = AiLocateSection; exports.AiExtractElementInfo = AiExtractElementInfo; exports.AiAssert = AiAssert; exports.plan = plan; exports.vlmPlanning = vlmPlanning; exports.resizeImageForUiTars = resizeImageForUiTars;
2913
2913
 
2914
- //# sourceMappingURL=chunk-NY6RQSGJ.js.map
2914
+ //# sourceMappingURL=chunk-UC5NNLPY.js.map