feat: 支持获取剪贴版

This commit is contained in:
余泓铮
2025-08-11 21:14:21 +08:00
parent 0b11c5491f
commit 25f9510de1
3 changed files with 31 additions and 1 deletions
+29
View File
@@ -1043,6 +1043,22 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
continue
}
if action.Method == option.ACTION_StartToGoal {
planningResults, err := uiDriver.StartToGoal(ctx,
action.Params.(string), action.GetOptions()...)
actionResult.Elapsed = time.Since(actionStartTime).Milliseconds()
actionResult.Plannings = planningResults
stepResult.Actions = append(stepResult.Actions, actionResult)
if err != nil {
actionResult.Error = err.Error()
if !code.IsErrorPredefined(err) {
err = errors.Wrap(code.MobileUIDriverError, err.Error())
}
return stepResult, err
}
continue
}
// handle AI operations (ai_action, ai_query, ai_assert) with unified result storage
if action.Method == option.ACTION_AIAction || action.Method == option.ACTION_Query || action.Method == option.ACTION_AIAssert {
var aiResult *uixt.AIExecutionResult
@@ -1070,6 +1086,19 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
}
continue
}
if action.Method == option.ACTION_GetPasteboard {
content, err := uiDriver.GetPasteboard()
if err != nil {
actionResult.Error = err.Error()
if !code.IsErrorPredefined(err) {
err = errors.Wrap(code.MobileUIDriverError, err.Error())
}
return stepResult, err
}
actionResult.ExtraData = content
stepResult.Actions = append(stepResult.Actions, actionResult)
continue
}
// handle other non-AI actions
sessionData, err := uiDriver.ExecuteAction(ctx, action)