Skip to content

Commit bb0dab0

Browse files
committed
chore: remove dead node/ts code paths
1 parent 8eea063 commit bb0dab0

21 files changed

Lines changed: 45 additions & 69 deletions

src/core/batch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AppError } from '../utils/errors.ts';
22
import type { BatchStep, CommandFlags } from './dispatch.ts';
33

44
export const DEFAULT_BATCH_MAX_STEPS = 100;
5-
export const BATCH_BLOCKED_COMMANDS = new Set(['batch', 'replay']);
5+
const BATCH_BLOCKED_COMMANDS = new Set(['batch', 'replay']);
66

77
export type NormalizedBatchStep = {
88
command: string;

src/daemon/is-predicates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { SnapshotState } from '../utils/snapshot.ts';
22
import { extractNodeText } from './snapshot-processing.ts';
33
import { isNodeEditable, isNodeVisible } from './selectors.ts';
44

5-
export type IsPredicate = 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text';
5+
type IsPredicate = 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text';
66

77
export function isSupportedPredicate(input: string): input is IsPredicate {
88
return ['visible', 'hidden', 'exists', 'editable', 'selected', 'text'].includes(input);

src/daemon/scroll-planner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { centerOfRect, type RawSnapshotNode, type Rect } from '../utils/snapshot.ts';
22

3-
export type ScrollIntoViewPlan = {
3+
type ScrollIntoViewPlan = {
44
x: number;
55
startY: number;
66
endY: number;

src/daemon/selectors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type SelectorTerm = {
2121
value: string | boolean;
2222
};
2323

24-
export type Selector = {
24+
type Selector = {
2525
raw: string;
2626
terms: SelectorTerm[];
2727
};
@@ -31,12 +31,12 @@ export type SelectorChain = {
3131
selectors: Selector[];
3232
};
3333

34-
export type SelectorDiagnostics = {
34+
type SelectorDiagnostics = {
3535
selector: string;
3636
matches: number;
3737
};
3838

39-
export type SelectorResolution = {
39+
type SelectorResolution = {
4040
node: SnapshotNode;
4141
selector: Selector;
4242
selectorIndex: number;
@@ -233,7 +233,7 @@ export function isNodeEditable(node: SnapshotNode, platform: 'ios' | 'android'):
233233

234234
export function buildSelectorChainForNode(
235235
node: SnapshotNode,
236-
platform: 'ios' | 'android',
236+
_platform: 'ios' | 'android',
237237
options: { action?: 'click' | 'fill' | 'get' } = {},
238238
): string[] {
239239
const chain: string[] = [];

src/daemon/snapshot-diff.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import type { SnapshotNode } from '../utils/snapshot.ts';
22
import { buildSnapshotDisplayLines, displayLabel, formatRole, formatSnapshotLine } from '../utils/snapshot-lines.ts';
33

4-
export type SnapshotDiffLine = {
4+
type SnapshotDiffLine = {
55
kind: 'added' | 'removed' | 'unchanged';
66
text: string;
77
};
88

9-
export type SnapshotDiffSummary = {
9+
type SnapshotDiffSummary = {
1010
additions: number;
1111
removals: number;
1212
unchanged: number;
1313
};
1414

15-
export type SnapshotDiffResult = {
15+
type SnapshotDiffResult = {
1616
summary: SnapshotDiffSummary;
1717
lines: SnapshotDiffLine[];
1818
};
1919

20-
export type SnapshotDiffOptions = {
20+
type SnapshotDiffOptions = {
2121
flatten?: boolean;
2222
};
2323

@@ -26,7 +26,7 @@ type SnapshotComparableLine = {
2626
comparable: string;
2727
};
2828

29-
export function snapshotNodeToComparableLine(node: SnapshotNode, depthOverride?: number): string {
29+
function snapshotNodeToComparableLine(node: SnapshotNode, depthOverride?: number): string {
3030
const role = formatRole(node.type ?? 'Element');
3131
const textPart = displayLabel(node, role);
3232
const enabledPart = node.enabled === false ? 'disabled' : 'enabled';

src/platforms/android/devices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function listAndroidDevices(): Promise<DeviceInfo[]> {
7676
return devices;
7777
}
7878

79-
export async function isAndroidBooted(serial: string): Promise<boolean> {
79+
async function isAndroidBooted(serial: string): Promise<boolean> {
8080
try {
8181
const result = await readAndroidBootProp(serial);
8282
return result.stdout.trim() === '1';

src/platforms/android/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function adbArgs(device: DeviceInfo, args: string[]): string[] {
1616
return ['-s', device.id, ...args];
1717
}
1818

19-
export async function resolveAndroidApp(
19+
async function resolveAndroidApp(
2020
device: DeviceInfo,
2121
app: string,
2222
): Promise<{ type: 'intent' | 'package'; value: string }> {
@@ -320,7 +320,7 @@ export async function closeAndroidApp(device: DeviceInfo, app: string): Promise<
320320
await runCmd('adb', adbArgs(device, ['shell', 'am', 'force-stop', resolved.value]));
321321
}
322322

323-
export async function uninstallAndroidApp(
323+
async function uninstallAndroidApp(
324324
device: DeviceInfo,
325325
app: string,
326326
): Promise<{ package: string }> {
@@ -342,7 +342,7 @@ export async function uninstallAndroidApp(
342342
return { package: resolved.value };
343343
}
344344

345-
export async function installAndroidApp(device: DeviceInfo, appPath: string): Promise<void> {
345+
async function installAndroidApp(device: DeviceInfo, appPath: string): Promise<void> {
346346
await runCmd('adb', adbArgs(device, ['install', appPath]));
347347
}
348348

src/platforms/boot-diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { asAppError } from '../utils/errors.ts';
22

3-
export type BootFailureReason =
3+
type BootFailureReason =
44
| 'IOS_BOOT_TIMEOUT'
55
| 'IOS_RUNNER_CONNECT_TIMEOUT'
66
| 'IOS_TOOL_MISSING'

src/platforms/ios/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isEnvTruthy, TIMEOUT_PROFILES } from '../../utils/retry.ts';
1+
import { TIMEOUT_PROFILES } from '../../utils/retry.ts';
22
import { resolveTimeoutMs } from '../../utils/timeouts.ts';
33

44
export const IOS_BOOT_TIMEOUT_MS = resolveTimeoutMs(
@@ -24,5 +24,3 @@ export const IOS_DEVICECTL_TIMEOUT_MS = resolveTimeoutMs(
2424
20_000,
2525
1_000,
2626
);
27-
28-
export const RETRY_LOGS_ENABLED = isEnvTruthy(process.env.AGENT_DEVICE_RETRY_LOGS);

src/platforms/ios/runner-client.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { bootFailureHint, classifyBootFailure } from '../boot-diagnostics.ts';
1313
import { resolveTimeoutMs, resolveTimeoutSeconds } from '../../utils/timeouts.ts';
1414
import { isRequestCanceled } from '../../daemon/request-cancel.ts';
1515

16-
export type RunnerCommand = {
16+
type RunnerCommand = {
1717
command:
1818
| 'tap'
1919
| 'tapSeries'
@@ -58,7 +58,7 @@ export type RunnerCommand = {
5858
clearFirst?: boolean;
5959
};
6060

61-
export type RunnerSession = {
61+
type RunnerSession = {
6262
device: DeviceInfo;
6363
deviceId: string;
6464
port: number;
@@ -116,18 +116,6 @@ const RUNNER_STOP_WAIT_TIMEOUT_MS = 10_000;
116116
const RUNNER_SHUTDOWN_TIMEOUT_MS = 15_000;
117117
const RUNNER_DERIVED_ROOT = path.join(os.homedir(), '.agent-device', 'ios-runner');
118118

119-
export type RunnerSnapshotNode = {
120-
index: number;
121-
type?: string;
122-
label?: string;
123-
value?: string;
124-
identifier?: string;
125-
rect?: { x: number; y: number; width: number; height: number };
126-
enabled?: boolean;
127-
hittable?: boolean;
128-
depth?: number;
129-
};
130-
131119
export async function runIosRunnerCommand(
132120
device: DeviceInfo,
133121
command: RunnerCommand,

0 commit comments

Comments
 (0)