@autotest/agent 0.0.16 → 0.0.18

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.
@@ -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
  *
@@ -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;