agent-device 0.8.2 → 0.8.4

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 (45) hide show
  1. package/README.md +1 -50
  2. package/dist/src/224.js +2 -2
  3. package/dist/src/331.js +1 -1
  4. package/dist/src/bin.js +61 -60
  5. package/dist/src/client-shared.d.ts +20 -0
  6. package/dist/src/core/dispatch-resolve.d.ts +2 -2
  7. package/dist/src/daemon/handlers/install-source.d.ts +35 -1
  8. package/dist/src/daemon/handlers/session-batch.d.ts +2 -0
  9. package/dist/src/daemon/handlers/session-close.d.ts +31 -0
  10. package/dist/src/daemon/handlers/session-deploy.d.ts +37 -0
  11. package/dist/src/daemon/handlers/session-device-utils.d.ts +25 -0
  12. package/dist/src/daemon/handlers/session-open-target.d.ts +3 -0
  13. package/dist/src/daemon/handlers/session-open.d.ts +22 -0
  14. package/dist/src/daemon/handlers/session-perf.d.ts +2 -0
  15. package/dist/src/daemon/handlers/session-runtime-command.d.ts +9 -0
  16. package/dist/src/daemon/handlers/session-runtime.d.ts +41 -0
  17. package/dist/src/daemon/handlers/session-startup-metrics.d.ts +11 -0
  18. package/dist/src/daemon/handlers/session.d.ts +4 -29
  19. package/dist/src/daemon/selectors-build.d.ts +4 -0
  20. package/dist/src/daemon/selectors-match.d.ts +5 -0
  21. package/dist/src/daemon/selectors-parse.d.ts +29 -0
  22. package/dist/src/daemon/selectors-resolve.d.ts +32 -0
  23. package/dist/src/daemon/selectors.d.ts +5 -65
  24. package/dist/src/daemon.js +35 -35
  25. package/dist/src/platforms/android/app-lifecycle.d.ts +1 -0
  26. package/dist/src/platforms/android/index.d.ts +3 -2
  27. package/dist/src/platforms/android/screenshot.d.ts +16 -0
  28. package/dist/src/platforms/android/snapshot.d.ts +0 -1
  29. package/dist/src/platforms/ios/config.d.ts +1 -0
  30. package/dist/src/platforms/ios/index.d.ts +1 -1
  31. package/dist/src/platforms/ios/screenshot-status-bar.d.ts +2 -0
  32. package/dist/src/platforms/ios/screenshot.d.ts +2 -1
  33. package/dist/src/utils/command-schema.d.ts +2 -0
  34. package/dist/src/utils/device.d.ts +1 -1
  35. package/dist/src/utils/interactors.d.ts +7 -0
  36. package/dist/src/utils/output.d.ts +3 -1
  37. package/dist/src/utils/path-resolution.d.ts +8 -0
  38. package/dist/src/utils/screenshot-diff.d.ts +23 -0
  39. package/package.json +5 -5
  40. package/skills/agent-device/SKILL.md +4 -0
  41. package/skills/agent-device/references/snapshot-refs.md +1 -0
  42. package/skills/dogfood/SKILL.md +12 -12
  43. package/skills/dogfood/references/issue-taxonomy.md +5 -5
  44. package/skills/dogfood/templates/dogfood-report-template.md +19 -19
  45. package/dist/src/utils/interactive.d.ts +0 -1
@@ -0,0 +1,22 @@
1
+ import { dispatchCommand, resolveTargetDevice } from '../../core/dispatch.ts';
2
+ import { ensureDeviceReady } from '../device-ready.ts';
3
+ import { stopIosRunnerSession } from '../../platforms/ios/runner-client.ts';
4
+ import { applyRuntimeHintsToApp, clearRuntimeHintsFromApp } from '../runtime-hints.ts';
5
+ import type { DeviceInfo } from '../../utils/device.ts';
6
+ import type { DaemonRequest, DaemonResponse } from '../types.ts';
7
+ import { SessionStore } from '../session-store.ts';
8
+ import { settleIosSimulator } from './session-device-utils.ts';
9
+ export declare function handleOpenCommand(params: {
10
+ req: DaemonRequest;
11
+ sessionName: string;
12
+ logPath: string;
13
+ sessionStore: SessionStore;
14
+ dispatch: typeof dispatchCommand;
15
+ ensureReady: typeof ensureDeviceReady;
16
+ resolveDevice: typeof resolveTargetDevice;
17
+ applyRuntimeHints?: typeof applyRuntimeHintsToApp;
18
+ clearRuntimeHints?: typeof clearRuntimeHintsFromApp;
19
+ stopIosRunner?: typeof stopIosRunnerSession;
20
+ settleSimulator?: typeof settleIosSimulator;
21
+ resolveAndroidPackageForOpen?: (device: DeviceInfo, openTarget: string | undefined) => Promise<string | undefined>;
22
+ }): Promise<DaemonResponse>;
@@ -0,0 +1,2 @@
1
+ import type { SessionState } from '../types.ts';
2
+ export declare function buildPerfResponseData(session: SessionState): Record<string, unknown>;
@@ -0,0 +1,9 @@
1
+ import type { DaemonRequest, DaemonResponse } from '../types.ts';
2
+ import { SessionStore } from '../session-store.ts';
3
+ import { clearRuntimeHintsFromApp } from '../runtime-hints.ts';
4
+ export declare function handleRuntimeCommand(params: {
5
+ req: DaemonRequest;
6
+ sessionName: string;
7
+ sessionStore: SessionStore;
8
+ clearRuntimeHints?: typeof clearRuntimeHintsFromApp;
9
+ }): Promise<DaemonResponse>;
@@ -0,0 +1,41 @@
1
+ import type { DeviceInfo } from '../../utils/device.ts';
2
+ import type { CommandFlags } from '../../core/dispatch.ts';
3
+ import type { DaemonRequest, DaemonResponse, SessionRuntimeHints, SessionState } from '../types.ts';
4
+ import { SessionStore } from '../session-store.ts';
5
+ import { type clearRuntimeHintsFromApp } from '../runtime-hints.ts';
6
+ export declare function countConfiguredRuntimeHints(runtime: SessionRuntimeHints | undefined): number;
7
+ export declare function buildRuntimeHints(flags: CommandFlags | undefined, platform?: 'ios' | 'android'): SessionRuntimeHints;
8
+ export declare function mergeRuntimeHints(current: SessionRuntimeHints | undefined, next: SessionRuntimeHints): SessionRuntimeHints;
9
+ export declare function setSessionRuntimeHintsForOpen(sessionStore: SessionStore, sessionName: string, runtime: SessionRuntimeHints | undefined): SessionRuntimeHints | undefined;
10
+ declare function resolveOpenRuntimeHints(params: {
11
+ req: DaemonRequest;
12
+ sessionStore: SessionStore;
13
+ sessionName: string;
14
+ device: DeviceInfo;
15
+ }): {
16
+ runtime: SessionRuntimeHints | undefined;
17
+ previousRuntime: SessionRuntimeHints | undefined;
18
+ replacedStoredRuntime: boolean;
19
+ };
20
+ export declare function tryResolveOpenRuntimeHints(params: Parameters<typeof resolveOpenRuntimeHints>[0]): {
21
+ ok: true;
22
+ data: ReturnType<typeof resolveOpenRuntimeHints>;
23
+ } | {
24
+ ok: false;
25
+ response: DaemonResponse;
26
+ };
27
+ export declare function recordOpenRuntimeAction(params: {
28
+ req: DaemonRequest;
29
+ sessionStore: SessionStore;
30
+ session: SessionState;
31
+ sessionName: string;
32
+ runtime: SessionRuntimeHints | undefined;
33
+ }): void;
34
+ export declare function maybeClearRemovedRuntimeTransportHints(params: {
35
+ replacedStoredRuntime: boolean;
36
+ previousRuntime: SessionRuntimeHints | undefined;
37
+ runtime: SessionRuntimeHints | undefined;
38
+ session: SessionState | undefined;
39
+ clearRuntimeHints: typeof clearRuntimeHintsFromApp;
40
+ }): Promise<void>;
41
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare const STARTUP_SAMPLE_METHOD = "open-command-roundtrip";
2
+ export declare const STARTUP_SAMPLE_DESCRIPTION = "Elapsed wall-clock time around dispatching the open command for the active session app target.";
3
+ export declare const PERF_STARTUP_SAMPLE_LIMIT = 20;
4
+ export declare const PERF_UNAVAILABLE_REASON = "Not implemented for this platform in this release.";
5
+ export type StartupPerfSample = {
6
+ durationMs: number;
7
+ measuredAt: string;
8
+ method: typeof STARTUP_SAMPLE_METHOD;
9
+ appTarget?: string;
10
+ appBundleId?: string;
11
+ };
@@ -7,39 +7,14 @@ import { stopIosRunnerSession } from '../../platforms/ios/runner-client.ts';
7
7
  import { shutdownSimulator } from '../../platforms/ios/simulator.ts';
8
8
  import { startAppLog, stopAppLog } from '../app-log.ts';
9
9
  import { applyRuntimeHintsToApp, clearRuntimeHintsFromApp } from '../runtime-hints.ts';
10
- type ReinstallOps = {
11
- ios: (device: DeviceInfo, app: string, appPath: string) => Promise<{
12
- bundleId: string;
13
- }>;
14
- android: (device: DeviceInfo, app: string, appPath: string) => Promise<{
15
- package: string;
16
- }>;
17
- };
18
- type AppDeployOps = {
19
- ios: (device: DeviceInfo, app: string, appPath: string) => Promise<{
20
- bundleId?: string;
21
- appName?: string;
22
- launchTarget?: string;
23
- }>;
24
- android: (device: DeviceInfo, app: string, appPath: string) => Promise<{
25
- package?: string;
26
- appName?: string;
27
- launchTarget?: string;
28
- }>;
29
- };
30
- type InstallOps = AppDeployOps;
10
+ import { settleIosSimulator } from './session-device-utils.ts';
11
+ import { type ShutdownAndroidEmulatorFn } from './session-close.ts';
12
+ import { type InstallOps, type ReinstallOps } from './session-deploy.ts';
31
13
  type EnsureAndroidEmulatorBoot = (params: {
32
14
  avdName: string;
33
15
  serial?: string;
34
16
  headless?: boolean;
35
17
  }) => Promise<DeviceInfo>;
36
- declare function settleIosSimulator(device: DeviceInfo, delayMs: number): Promise<void>;
37
- declare function shutdownAndroidEmulator(device: DeviceInfo): Promise<{
38
- success: boolean;
39
- exitCode: number;
40
- stdout: string;
41
- stderr: string;
42
- }>;
43
18
  export declare function handleSessionCommands(params: {
44
19
  req: DaemonRequest;
45
20
  sessionName: string;
@@ -62,6 +37,6 @@ export declare function handleSessionCommands(params: {
62
37
  clearRuntimeHints?: typeof clearRuntimeHintsFromApp;
63
38
  settleSimulator?: typeof settleIosSimulator;
64
39
  shutdownSimulator?: typeof shutdownSimulator;
65
- shutdownAndroidEmulator?: typeof shutdownAndroidEmulator;
40
+ shutdownAndroidEmulator?: ShutdownAndroidEmulatorFn;
66
41
  }): Promise<DaemonResponse | null>;
67
42
  export {};
@@ -0,0 +1,4 @@
1
+ import type { SnapshotNode } from '../utils/snapshot.ts';
2
+ export declare function buildSelectorChainForNode(node: SnapshotNode, _platform: 'ios' | 'android', options?: {
3
+ action?: 'click' | 'fill' | 'get';
4
+ }): string[];
@@ -0,0 +1,5 @@
1
+ import type { SnapshotNode } from '../utils/snapshot.ts';
2
+ import type { Selector } from './selectors-parse.ts';
3
+ export declare function matchesSelector(node: SnapshotNode, selector: Selector, platform: 'ios' | 'android'): boolean;
4
+ export declare function isNodeVisible(node: SnapshotNode): boolean;
5
+ export declare function isNodeEditable(node: SnapshotNode, platform: 'ios' | 'android'): boolean;
@@ -0,0 +1,29 @@
1
+ export type SelectorKey = 'id' | 'role' | 'text' | 'label' | 'value' | 'visible' | 'hidden' | 'editable' | 'selected' | 'enabled' | 'hittable';
2
+ export type SelectorTerm = {
3
+ key: SelectorKey;
4
+ value: string | boolean;
5
+ };
6
+ export type Selector = {
7
+ raw: string;
8
+ terms: SelectorTerm[];
9
+ };
10
+ export type SelectorChain = {
11
+ raw: string;
12
+ selectors: Selector[];
13
+ };
14
+ export declare function parseSelectorChain(expression: string): SelectorChain;
15
+ export declare function tryParseSelectorChain(expression: string): SelectorChain | null;
16
+ export declare function isSelectorToken(token: string): boolean;
17
+ export declare function splitSelectorFromArgs(args: string[], options?: {
18
+ preferTrailingValue?: boolean;
19
+ }): {
20
+ selectorExpression: string;
21
+ rest: string[];
22
+ } | null;
23
+ export declare function splitIsSelectorArgs(positionals: string[]): {
24
+ predicate: string;
25
+ split: {
26
+ selectorExpression: string;
27
+ rest: string[];
28
+ } | null;
29
+ };
@@ -0,0 +1,32 @@
1
+ import type { SnapshotNode, SnapshotState } from '../utils/snapshot.ts';
2
+ import type { Selector, SelectorChain } from './selectors-parse.ts';
3
+ export type SelectorDiagnostics = {
4
+ selector: string;
5
+ matches: number;
6
+ };
7
+ type SelectorResolution = {
8
+ node: SnapshotNode;
9
+ selector: Selector;
10
+ selectorIndex: number;
11
+ matches: number;
12
+ diagnostics: SelectorDiagnostics[];
13
+ };
14
+ export declare function resolveSelectorChain(nodes: SnapshotState['nodes'], chain: SelectorChain, options: {
15
+ platform: 'ios' | 'android';
16
+ requireRect?: boolean;
17
+ requireUnique?: boolean;
18
+ disambiguateAmbiguous?: boolean;
19
+ }): SelectorResolution | null;
20
+ export declare function findSelectorChainMatch(nodes: SnapshotState['nodes'], chain: SelectorChain, options: {
21
+ platform: 'ios' | 'android';
22
+ requireRect?: boolean;
23
+ }): {
24
+ selectorIndex: number;
25
+ selector: Selector;
26
+ matches: number;
27
+ diagnostics: SelectorDiagnostics[];
28
+ } | null;
29
+ export declare function formatSelectorFailure(chain: SelectorChain, diagnostics: SelectorDiagnostics[], options: {
30
+ unique?: boolean;
31
+ }): string;
32
+ export {};
@@ -1,65 +1,5 @@
1
- import type { SnapshotNode, SnapshotState } from '../utils/snapshot.ts';
2
- type SelectorKey = 'id' | 'role' | 'text' | 'label' | 'value' | 'visible' | 'hidden' | 'editable' | 'selected' | 'enabled' | 'hittable';
3
- type SelectorTerm = {
4
- key: SelectorKey;
5
- value: string | boolean;
6
- };
7
- type Selector = {
8
- raw: string;
9
- terms: SelectorTerm[];
10
- };
11
- export type SelectorChain = {
12
- raw: string;
13
- selectors: Selector[];
14
- };
15
- type SelectorDiagnostics = {
16
- selector: string;
17
- matches: number;
18
- };
19
- type SelectorResolution = {
20
- node: SnapshotNode;
21
- selector: Selector;
22
- selectorIndex: number;
23
- matches: number;
24
- diagnostics: SelectorDiagnostics[];
25
- };
26
- export declare function parseSelectorChain(expression: string): SelectorChain;
27
- export declare function tryParseSelectorChain(expression: string): SelectorChain | null;
28
- export declare function resolveSelectorChain(nodes: SnapshotState['nodes'], chain: SelectorChain, options: {
29
- platform: 'ios' | 'android';
30
- requireRect?: boolean;
31
- requireUnique?: boolean;
32
- disambiguateAmbiguous?: boolean;
33
- }): SelectorResolution | null;
34
- export declare function findSelectorChainMatch(nodes: SnapshotState['nodes'], chain: SelectorChain, options: {
35
- platform: 'ios' | 'android';
36
- requireRect?: boolean;
37
- }): {
38
- selectorIndex: number;
39
- selector: Selector;
40
- matches: number;
41
- diagnostics: SelectorDiagnostics[];
42
- } | null;
43
- export declare function formatSelectorFailure(chain: SelectorChain, diagnostics: SelectorDiagnostics[], options: {
44
- unique?: boolean;
45
- }): string;
46
- export declare function isSelectorToken(token: string): boolean;
47
- export declare function splitSelectorFromArgs(args: string[], options?: {
48
- preferTrailingValue?: boolean;
49
- }): {
50
- selectorExpression: string;
51
- rest: string[];
52
- } | null;
53
- export declare function splitIsSelectorArgs(positionals: string[]): {
54
- predicate: string;
55
- split: {
56
- selectorExpression: string;
57
- rest: string[];
58
- } | null;
59
- };
60
- export declare function isNodeVisible(node: SnapshotNode): boolean;
61
- export declare function isNodeEditable(node: SnapshotNode, platform: 'ios' | 'android'): boolean;
62
- export declare function buildSelectorChainForNode(node: SnapshotNode, _platform: 'ios' | 'android', options?: {
63
- action?: 'click' | 'fill' | 'get';
64
- }): string[];
65
- export {};
1
+ export type { SelectorChain } from './selectors-parse.ts';
2
+ export { parseSelectorChain, tryParseSelectorChain, isSelectorToken, splitSelectorFromArgs, splitIsSelectorArgs, } from './selectors-parse.ts';
3
+ export { isNodeVisible, isNodeEditable } from './selectors-match.ts';
4
+ export { resolveSelectorChain, findSelectorChainMatch, formatSelectorFailure, } from './selectors-resolve.ts';
5
+ export { buildSelectorChainForNode } from './selectors-build.ts';