@autotest/agent 0.0.15 → 0.0.17
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/autotest-cli.js +1 -1
- package/dist/common/utils.d.ts +13 -0
- package/dist/core/agent/single_agent/agent.d.ts +8 -0
- package/dist/core/agent/single_agent/scroll_search_agent.d.ts +5 -0
- package/dist/core/device/hdc/ability.d.ts +15 -0
- package/dist/core/device/hdc/capture_card_recorder.d.ts +13 -0
- package/dist/core/device/hdc/index.d.ts +1 -0
- package/dist/core/mcp/mcp_tools.d.ts +0 -2
- package/dist/core/memory/compressed_session.d.ts +10 -0
- package/dist/index.js +1 -1
- package/dist/tools/batch_runner.js +1 -1
- package/dist/tools/case_runner/runner.js +1 -1
- package/dist/tools/config/config_tool.js +1 -1
- package/dist/tools/prompt_compare/compare_runner.js +1 -1
- package/package.json +2 -2
package/dist/common/utils.d.ts
CHANGED
|
@@ -35,6 +35,19 @@ export declare function normalizeCoord(coord: number): number;
|
|
|
35
35
|
* Mutates `args` in place. Returns true if any conversion occurred.
|
|
36
36
|
*/
|
|
37
37
|
export declare function normalizeToolCoordinates(toolName: string, args: Record<string, unknown>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Collapse repeated "(动态场景)" recording-signal markers in an action log to a
|
|
40
|
+
* single trailing occurrence.
|
|
41
|
+
*
|
|
42
|
+
* The marker is a pure signal — its presence triggers capture-card recording
|
|
43
|
+
* (see shouldRecordAction). The model sometimes re-appends it on retried /
|
|
44
|
+
* repeated steps because prior marked logs are fed back to it via
|
|
45
|
+
* historyActions, producing "name(动态场景)(动态场景)…". This keeps the
|
|
46
|
+
* display name and the feedback loop clean without losing the signal: any
|
|
47
|
+
* number of markers is reduced to exactly one at the end; logs without the
|
|
48
|
+
* marker are returned unchanged.
|
|
49
|
+
*/
|
|
50
|
+
export declare function normalizeActionLog(log: string): string;
|
|
38
51
|
/**
|
|
39
52
|
* Format a token count for display.
|
|
40
53
|
*
|
|
@@ -49,6 +49,14 @@ export declare class SingleAgent {
|
|
|
49
49
|
* Returns null when the output is not a judge-shaped JSON object, so that
|
|
50
50
|
* ordinary LLM judgment text falls through to the text heuristics. */
|
|
51
51
|
private static parseJudgeResult;
|
|
52
|
+
/** Shared "tool-start" pipeline used by both executeAction and
|
|
53
|
+
* executeActionWithRecording: build the tool-start event payload, record the
|
|
54
|
+
* MCP_TOOL_START event, fire onToolStart hooks, then normalize per-mille /
|
|
55
|
+
* integer coordinates to the 0-1 range before the adapter executes.
|
|
56
|
+
*
|
|
57
|
+
* `beforeScreenshotPath` is the pre-action screenshot for the report (null in
|
|
58
|
+
* recording mode, where the capture-card video frames serve as before-state). */
|
|
59
|
+
private prepareToolStart;
|
|
52
60
|
private executeAction;
|
|
53
61
|
/** Recording mode: start recording → execute action → record 3s → extract frames at
|
|
54
62
|
* 333ms intervals (~10 frames) → filter near-duplicates → build sprite → set as
|
|
@@ -22,6 +22,11 @@ export interface ScrollConfig {
|
|
|
22
22
|
defaultDistanceRatio: number;
|
|
23
23
|
minDistanceRatio: number;
|
|
24
24
|
swipeWaitMs: number;
|
|
25
|
+
/** Abort after this many consecutive no-content-change steps (a no-change
|
|
26
|
+
* triggers a direction switch, so 2 = "tried both directions, neither
|
|
27
|
+
* scrolls" → the region is not scrollable). Stops futile searches from
|
|
28
|
+
* burning all maxSteps of LLM calls. */
|
|
29
|
+
noChangeAbortSteps: number;
|
|
25
30
|
}
|
|
26
31
|
export declare const DEFAULT_SCROLL_CONFIG: ScrollConfig;
|
|
27
32
|
export interface SearchResult {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime main-ability discovery for HarmonyOS bundles.
|
|
3
|
+
*
|
|
4
|
+
* Instead of hard-coding the ability name per app, query the device with
|
|
5
|
+
* `bm dump -n <bundle>` and pick the launcher ability (the one whose skill
|
|
6
|
+
* declares `action.system.home` / `ohos.want.action.home`). This is the
|
|
7
|
+
* reliable source of truth used to recover when `aa start` fails because the
|
|
8
|
+
* guessed ability name was wrong.
|
|
9
|
+
*/
|
|
10
|
+
import type { HdcDriver } from './device';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the main (launcher) ability name for a bundle from the device at
|
|
13
|
+
* runtime. Returns the ability name, or `null` if it could not be determined.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getMainAbility(driver: HdcDriver, bundleName: string): Promise<string | null>;
|
|
@@ -39,6 +39,19 @@ export declare class CaptureCardRecorder {
|
|
|
39
39
|
* Kills the process, deletes .so files, video directory, and timestamp files.
|
|
40
40
|
* Safe to call even if nothing exists. */
|
|
41
41
|
private cleanupAllDeviceFiles;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a local .so file path for pushing to device.
|
|
44
|
+
*
|
|
45
|
+
* Priority:
|
|
46
|
+
* 1. SO_B64[soName] — base64 embedded in bundle (published package).
|
|
47
|
+
* Decodes to a temp file, caller is responsible for cleanup (isTemp=true).
|
|
48
|
+
* 2. resources/native/{soName} on disk — dev mode fallback.
|
|
49
|
+
* findDistRoot() 兼容普通构建(dist/core/device/hdc/)和 bundle 打包(dist/),
|
|
50
|
+
* 向上一级即项目根,拼接 resources/native/
|
|
51
|
+
*
|
|
52
|
+
* @returns { localPath, isTemp } or null if .so unavailable.
|
|
53
|
+
*/
|
|
54
|
+
private resolveLocalSo;
|
|
42
55
|
/**
|
|
43
56
|
* Send an HTTP GET to the perfmonitor daemon on the device via fport.
|
|
44
57
|
* @param path The URL path (e.g. '/StartRecord', '/StopRecord')
|
|
@@ -6,3 +6,4 @@ export { getScreenshot } from './screenshot';
|
|
|
6
6
|
export { inputText, typeText, clearText } from './input';
|
|
7
7
|
export { APP_PACKAGES, APP_ABILITIES, TOP_225_APP, BUNDLE_NAME_TO_APP_NAME, getPackageName, getAppName, listSupportedApps, } from './apps';
|
|
8
8
|
export { getAppDisplayName, getCurrentApp, tap, doubleTap, longPress, swipe, back, home, launchApp, resetDevice, } from './device';
|
|
9
|
+
export { getMainAbility } from './ability';
|
|
@@ -53,8 +53,6 @@ export declare const wait: (times: number) => Promise<string>;
|
|
|
53
53
|
export declare const goHome: () => Promise<string>;
|
|
54
54
|
/** Login placeholder tool. */
|
|
55
55
|
export declare const login: () => Promise<string>;
|
|
56
|
-
/** Resolve the main ability name for a bundle name. */
|
|
57
|
-
export declare function getMainAbilityForBundle(bundleName: string): string;
|
|
58
56
|
/**
|
|
59
57
|
* Load the detailed steps for a named skill.
|
|
60
58
|
* @param skillName The skill name to load.
|
|
@@ -28,6 +28,16 @@ export declare class CompressedSession {
|
|
|
28
28
|
getItems(limit?: number): Promise<Array<Record<string, unknown>>>;
|
|
29
29
|
addItems(newItems: Array<Record<string, unknown>>): Promise<void>;
|
|
30
30
|
popItem(): Record<string, unknown> | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Replace the data of the most-recently-added image part in the session.
|
|
33
|
+
*
|
|
34
|
+
* Used after a recording-sprite step: the sprite must reach the LLM full-res
|
|
35
|
+
* (for transient-frame judgment) but should not linger uncompressed in the
|
|
36
|
+
* image window for subsequent steps. The agent calls this right after the
|
|
37
|
+
* LLM call to swap the sprite's history copy for a compressed version.
|
|
38
|
+
* Returns true if an image part was found and replaced.
|
|
39
|
+
*/
|
|
40
|
+
replaceLastItemImage(newData: string): boolean;
|
|
31
41
|
clearSession(): void;
|
|
32
42
|
private _filterImagesToKeepRecent;
|
|
33
43
|
private _maybeCompress;
|