agent-device 0.7.20 → 0.7.22
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/README.md +42 -0
- package/dist/src/224.js +2 -0
- package/dist/src/274.js +1 -0
- package/dist/src/331.js +3 -0
- package/dist/src/bin.d.ts +1 -0
- package/dist/src/bin.js +63 -59
- package/dist/src/cli-client-commands.d.ts +8 -0
- package/dist/src/cli.d.ts +6 -0
- package/dist/src/client-normalizers.d.ts +21 -0
- package/dist/src/client-types.d.ts +265 -0
- package/dist/src/client.d.ts +5 -0
- package/dist/src/core/app-events.d.ts +8 -0
- package/dist/src/core/batch.d.ts +17 -0
- package/dist/src/core/capabilities.d.ts +3 -0
- package/dist/src/core/dispatch-payload.d.ts +1 -0
- package/dist/src/core/dispatch-resolve.d.ts +28 -0
- package/dist/src/core/dispatch-series.d.ts +7 -0
- package/dist/src/core/dispatch.d.ts +34 -0
- package/dist/src/core/open-target.d.ts +4 -0
- package/dist/src/core/settings-contract.d.ts +8 -0
- package/dist/src/daemon/action-utils.d.ts +3 -0
- package/dist/src/daemon/app-log-android.d.ts +4 -0
- package/dist/src/daemon/app-log-ios.d.ts +6 -0
- package/dist/src/daemon/app-log-process.d.ts +15 -0
- package/dist/src/daemon/app-log-stream.d.ts +19 -0
- package/dist/src/daemon/app-log.d.ts +28 -0
- package/dist/src/daemon/artifact-archive.d.ts +12 -0
- package/dist/src/daemon/artifact-download.d.ts +12 -0
- package/dist/src/daemon/artifact-materialization.d.ts +17 -0
- package/dist/src/daemon/artifact-registry.d.ts +12 -0
- package/dist/src/daemon/config.d.ts +16 -0
- package/dist/src/daemon/context.d.ts +22 -0
- package/dist/src/daemon/device-ready.d.ts +6 -0
- package/dist/src/daemon/handlers/find.d.ts +40 -0
- package/dist/src/daemon/handlers/install-source.d.ts +10 -0
- package/dist/src/daemon/handlers/interaction.d.ts +14 -0
- package/dist/src/daemon/handlers/lease.d.ts +8 -0
- package/dist/src/daemon/handlers/parse-utils.d.ts +3 -0
- package/dist/src/daemon/handlers/record-trace.d.ts +15 -0
- package/dist/src/daemon/handlers/session-replay-heal.d.ts +8 -0
- package/dist/src/daemon/handlers/session-replay-script.d.ts +3 -0
- package/dist/src/daemon/handlers/session.d.ts +67 -0
- package/dist/src/daemon/handlers/snapshot.d.ts +32 -0
- package/dist/src/daemon/http-server.d.ts +26 -0
- package/dist/src/daemon/is-predicates.d.ts +14 -0
- package/dist/src/daemon/lease-context.d.ts +9 -0
- package/dist/src/daemon/lease-registry.d.ts +63 -0
- package/dist/src/daemon/materialized-path-registry.d.ts +15 -0
- package/dist/src/daemon/network-log.d.ts +32 -0
- package/dist/src/daemon/request-cancel.d.ts +9 -0
- package/dist/src/daemon/request-router.d.ts +17 -0
- package/dist/src/daemon/runtime-hints.d.ts +19 -0
- package/dist/src/daemon/script-utils.d.ts +15 -0
- package/dist/src/daemon/scroll-planner.d.ts +12 -0
- package/dist/src/daemon/selectors.d.ts +65 -0
- package/dist/src/daemon/server-lifecycle.d.ts +23 -0
- package/dist/src/daemon/session-routing.d.ts +3 -0
- package/dist/src/daemon/session-selector.d.ts +3 -0
- package/dist/src/daemon/session-store.d.ts +32 -0
- package/dist/src/daemon/snapshot-diff.d.ts +20 -0
- package/dist/src/daemon/snapshot-processing.d.ts +8 -0
- package/dist/src/daemon/transport.d.ts +6 -0
- package/dist/src/daemon/types.d.ts +115 -0
- package/dist/src/daemon/upload-registry.d.ts +7 -0
- package/dist/src/daemon/upload.d.ts +5 -0
- package/dist/src/daemon-client.d.ts +38 -0
- package/dist/src/daemon.d.ts +1 -0
- package/dist/src/daemon.js +36 -36
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +1 -0
- package/dist/src/platforms/android/adb.d.ts +5 -0
- package/dist/src/platforms/android/app-lifecycle.d.ts +30 -0
- package/dist/src/platforms/android/device-input-state.d.ts +19 -0
- package/dist/src/platforms/android/devices.d.ts +22 -0
- package/dist/src/platforms/android/index.d.ts +7 -0
- package/dist/src/platforms/android/input-actions.d.ts +12 -0
- package/dist/src/platforms/android/install-artifact.d.ts +11 -0
- package/dist/src/platforms/android/manifest.d.ts +1 -0
- package/dist/src/platforms/android/notifications.d.ts +11 -0
- package/dist/src/platforms/android/open-target.d.ts +4 -0
- package/dist/src/platforms/android/settings.d.ts +3 -0
- package/dist/src/platforms/android/snapshot.d.ts +8 -0
- package/dist/src/platforms/android/ui-hierarchy.d.ts +21 -0
- package/dist/src/platforms/appearance.d.ts +2 -0
- package/dist/src/platforms/boot-diagnostics.d.ts +14 -0
- package/dist/src/platforms/install-source.d.ts +26 -0
- package/dist/src/platforms/ios/apps.d.ts +34 -0
- package/dist/src/platforms/ios/config.d.ts +9 -0
- package/dist/src/platforms/ios/devicectl.d.ts +13 -0
- package/dist/src/platforms/ios/devices.d.ts +39 -0
- package/dist/src/platforms/ios/ensure-simulator.d.ts +18 -0
- package/dist/src/platforms/ios/index.d.ts +3 -0
- package/dist/src/platforms/ios/install-artifact.d.ts +18 -0
- package/dist/src/platforms/ios/launch-diagnostics.d.ts +11 -0
- package/dist/src/platforms/ios/plist.d.ts +1 -0
- package/dist/src/platforms/ios/runner-client.d.ts +36 -0
- package/dist/src/platforms/ios/runner-errors.d.ts +20 -0
- package/dist/src/platforms/ios/runner-session.d.ts +25 -0
- package/dist/src/platforms/ios/runner-transport.d.ts +10 -0
- package/dist/src/platforms/ios/runner-xctestrun.d.ts +18 -0
- package/dist/src/platforms/ios/screenshot.d.ts +13 -0
- package/dist/src/platforms/ios/simctl.d.ts +7 -0
- package/dist/src/platforms/ios/simulator.d.ts +11 -0
- package/dist/src/platforms/permission-utils.d.ts +9 -0
- package/dist/src/upload-client.d.ts +7 -0
- package/dist/src/utils/args.d.ts +15 -0
- package/dist/src/utils/command-schema.d.ts +93 -0
- package/dist/src/utils/device-isolation.d.ts +3 -0
- package/dist/src/utils/device.d.ts +27 -0
- package/dist/src/utils/diagnostics.d.ts +30 -0
- package/dist/src/utils/errors.d.ts +26 -0
- package/dist/src/utils/exec.d.ts +32 -0
- package/dist/src/utils/finders.d.ts +12 -0
- package/dist/src/utils/interactive.d.ts +1 -0
- package/dist/src/utils/interactors.d.ts +31 -0
- package/dist/src/utils/json-input.d.ts +1 -0
- package/dist/src/utils/keyed-lock.d.ts +1 -0
- package/dist/src/utils/output.d.ts +25 -0
- package/dist/src/utils/payload-input.d.ts +12 -0
- package/dist/src/utils/process-identity.d.ts +11 -0
- package/dist/src/utils/retry.d.ts +54 -0
- package/dist/src/utils/snapshot-lines.d.ts +12 -0
- package/dist/src/utils/snapshot.d.ts +42 -0
- package/dist/src/utils/timeouts.d.ts +3 -0
- package/dist/src/utils/version.d.ts +2 -0
- package/package.json +9 -1
- package/skills/agent-device/references/session-management.md +1 -1
- package/dist/src/678.js +0 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionStore } from '../session-store.ts';
|
|
2
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
3
|
+
export declare function handleInstallFromSourceCommand(params: {
|
|
4
|
+
req: DaemonRequest;
|
|
5
|
+
sessionName: string;
|
|
6
|
+
sessionStore: SessionStore;
|
|
7
|
+
}): Promise<DaemonResponse>;
|
|
8
|
+
export declare function handleReleaseMaterializedPathsCommand(params: {
|
|
9
|
+
req: DaemonRequest;
|
|
10
|
+
}): Promise<DaemonResponse>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { dispatchCommand, type CommandFlags } from '../../core/dispatch.ts';
|
|
2
|
+
import type { DaemonCommandContext } from '../context.ts';
|
|
3
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
4
|
+
import { SessionStore } from '../session-store.ts';
|
|
5
|
+
type ContextFromFlags = (flags: CommandFlags | undefined, appBundleId?: string, traceLogPath?: string) => DaemonCommandContext;
|
|
6
|
+
export declare function handleInteractionCommands(params: {
|
|
7
|
+
req: DaemonRequest;
|
|
8
|
+
sessionName: string;
|
|
9
|
+
sessionStore: SessionStore;
|
|
10
|
+
contextFromFlags: ContextFromFlags;
|
|
11
|
+
dispatch?: typeof dispatchCommand;
|
|
12
|
+
}): Promise<DaemonResponse | null>;
|
|
13
|
+
export declare function unsupportedRefSnapshotFlags(flags: CommandFlags | undefined): string[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
2
|
+
import type { LeaseRegistry } from '../lease-registry.ts';
|
|
3
|
+
type LeaseHandlerArgs = {
|
|
4
|
+
req: DaemonRequest;
|
|
5
|
+
leaseRegistry: LeaseRegistry;
|
|
6
|
+
};
|
|
7
|
+
export declare function handleLeaseCommands(args: LeaseHandlerArgs): Promise<DaemonResponse | null>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { runCmd, runCmdBackground } from '../../utils/exec.ts';
|
|
2
|
+
import { runIosRunnerCommand } from '../../platforms/ios/runner-client.ts';
|
|
3
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
4
|
+
import { SessionStore } from '../session-store.ts';
|
|
5
|
+
export declare function handleRecordTraceCommands(params: {
|
|
6
|
+
req: DaemonRequest;
|
|
7
|
+
sessionName: string;
|
|
8
|
+
sessionStore: SessionStore;
|
|
9
|
+
logPath?: string;
|
|
10
|
+
deps?: {
|
|
11
|
+
runCmd: typeof runCmd;
|
|
12
|
+
runCmdBackground: typeof runCmdBackground;
|
|
13
|
+
runIosRunnerCommand: typeof runIosRunnerCommand;
|
|
14
|
+
};
|
|
15
|
+
}): Promise<DaemonResponse | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SessionAction, SessionState } from '../types.ts';
|
|
2
|
+
import type { SnapshotState } from '../../utils/snapshot.ts';
|
|
3
|
+
export declare function parseSelectorWaitPositionals(positionals: string[]): {
|
|
4
|
+
selectorExpression: string | null;
|
|
5
|
+
selectorTimeout: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function collectReplaySelectorCandidates(action: SessionAction): string[];
|
|
8
|
+
export declare function healNumericGetTextDrift(action: SessionAction, snapshot: SnapshotState, session: SessionState): SessionAction | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { dispatchCommand, resolveTargetDevice } from '../../core/dispatch.ts';
|
|
2
|
+
import { type DeviceInfo } from '../../utils/device.ts';
|
|
3
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
4
|
+
import { SessionStore } from '../session-store.ts';
|
|
5
|
+
import { ensureDeviceReady } from '../device-ready.ts';
|
|
6
|
+
import { stopIosRunnerSession } from '../../platforms/ios/runner-client.ts';
|
|
7
|
+
import { shutdownSimulator } from '../../platforms/ios/simulator.ts';
|
|
8
|
+
import { startAppLog, stopAppLog } from '../app-log.ts';
|
|
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;
|
|
31
|
+
type EnsureAndroidEmulatorBoot = (params: {
|
|
32
|
+
avdName: string;
|
|
33
|
+
serial?: string;
|
|
34
|
+
headless?: boolean;
|
|
35
|
+
}) => 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
|
+
export declare function handleSessionCommands(params: {
|
|
44
|
+
req: DaemonRequest;
|
|
45
|
+
sessionName: string;
|
|
46
|
+
logPath: string;
|
|
47
|
+
sessionStore: SessionStore;
|
|
48
|
+
invoke: (req: DaemonRequest) => Promise<DaemonResponse>;
|
|
49
|
+
dispatch?: typeof dispatchCommand;
|
|
50
|
+
ensureReady?: typeof ensureDeviceReady;
|
|
51
|
+
resolveTargetDevice?: typeof resolveTargetDevice;
|
|
52
|
+
installOps?: InstallOps;
|
|
53
|
+
reinstallOps?: ReinstallOps;
|
|
54
|
+
stopIosRunner?: typeof stopIosRunnerSession;
|
|
55
|
+
appLogOps?: {
|
|
56
|
+
start: typeof startAppLog;
|
|
57
|
+
stop: typeof stopAppLog;
|
|
58
|
+
};
|
|
59
|
+
ensureAndroidEmulatorBoot?: EnsureAndroidEmulatorBoot;
|
|
60
|
+
resolveAndroidPackageForOpen?: (device: DeviceInfo, openTarget: string | undefined) => Promise<string | undefined>;
|
|
61
|
+
applyRuntimeHints?: typeof applyRuntimeHintsToApp;
|
|
62
|
+
clearRuntimeHints?: typeof clearRuntimeHintsFromApp;
|
|
63
|
+
settleSimulator?: typeof settleIosSimulator;
|
|
64
|
+
shutdownSimulator?: typeof shutdownSimulator;
|
|
65
|
+
shutdownAndroidEmulator?: typeof shutdownAndroidEmulator;
|
|
66
|
+
}): Promise<DaemonResponse | null>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { dispatchCommand } from '../../core/dispatch.ts';
|
|
2
|
+
import { runIosRunnerCommand } from '../../platforms/ios/runner-client.ts';
|
|
3
|
+
import type { DaemonRequest, DaemonResponse } from '../types.ts';
|
|
4
|
+
import { SessionStore } from '../session-store.ts';
|
|
5
|
+
import { type SelectorChain } from '../selectors.ts';
|
|
6
|
+
export declare function handleSnapshotCommands(params: {
|
|
7
|
+
req: DaemonRequest;
|
|
8
|
+
sessionName: string;
|
|
9
|
+
logPath: string;
|
|
10
|
+
sessionStore: SessionStore;
|
|
11
|
+
dispatchSnapshotCommand?: typeof dispatchCommand;
|
|
12
|
+
runnerCommand?: typeof runIosRunnerCommand;
|
|
13
|
+
}): Promise<DaemonResponse | null>;
|
|
14
|
+
type WaitParsed = {
|
|
15
|
+
kind: 'sleep';
|
|
16
|
+
durationMs: number;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'ref';
|
|
19
|
+
rawRef: string;
|
|
20
|
+
timeoutMs: number | null;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'selector';
|
|
23
|
+
selector: SelectorChain;
|
|
24
|
+
selectorExpression: string;
|
|
25
|
+
timeoutMs: number | null;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'text';
|
|
28
|
+
text: string;
|
|
29
|
+
timeoutMs: number | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function parseWaitArgs(args: string[]): WaitParsed | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import http, { type IncomingHttpHeaders } from 'node:http';
|
|
2
|
+
import type { DaemonRequest, DaemonResponse } from './types.ts';
|
|
3
|
+
type JsonRpcRequest = {
|
|
4
|
+
jsonrpc?: string;
|
|
5
|
+
id?: string | number | null;
|
|
6
|
+
method?: string;
|
|
7
|
+
params?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type HttpAuthHookContext = {
|
|
10
|
+
headers: IncomingHttpHeaders;
|
|
11
|
+
rpcRequest: JsonRpcRequest;
|
|
12
|
+
daemonRequest: DaemonRequest;
|
|
13
|
+
};
|
|
14
|
+
export type HttpAuthHookResult = boolean | void | {
|
|
15
|
+
ok?: boolean;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
details?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
export type HttpAuthHook = (context: HttpAuthHookContext) => Promise<HttpAuthHookResult> | HttpAuthHookResult;
|
|
22
|
+
export declare function createDaemonHttpServer(options: {
|
|
23
|
+
handleRequest: (req: DaemonRequest) => Promise<DaemonResponse>;
|
|
24
|
+
token?: string;
|
|
25
|
+
}): Promise<http.Server>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SnapshotState } from '../utils/snapshot.ts';
|
|
2
|
+
type IsPredicate = 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'text';
|
|
3
|
+
export declare function isSupportedPredicate(input: string): input is IsPredicate;
|
|
4
|
+
export declare function evaluateIsPredicate(params: {
|
|
5
|
+
predicate: Exclude<IsPredicate, 'exists'>;
|
|
6
|
+
node: SnapshotState['nodes'][number];
|
|
7
|
+
expectedText?: string;
|
|
8
|
+
platform: 'ios' | 'android';
|
|
9
|
+
}): {
|
|
10
|
+
pass: boolean;
|
|
11
|
+
actualText: string;
|
|
12
|
+
details: string;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DaemonRequest } from './types.ts';
|
|
2
|
+
export type LeaseScope = {
|
|
3
|
+
tenantId?: string;
|
|
4
|
+
runId?: string;
|
|
5
|
+
leaseId?: string;
|
|
6
|
+
leaseTtlMs?: number;
|
|
7
|
+
leaseBackend?: 'ios-simulator';
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveLeaseScope(req: Pick<DaemonRequest, 'flags' | 'meta'>): LeaseScope;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type LeaseBackend = 'ios-simulator';
|
|
2
|
+
export type SimulatorLease = {
|
|
3
|
+
leaseId: string;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
runId: string;
|
|
6
|
+
backend: LeaseBackend;
|
|
7
|
+
createdAt: number;
|
|
8
|
+
heartbeatAt: number;
|
|
9
|
+
expiresAt: number;
|
|
10
|
+
};
|
|
11
|
+
export type LeaseRegistryOptions = {
|
|
12
|
+
maxActiveSimulatorLeases?: number;
|
|
13
|
+
defaultLeaseTtlMs?: number;
|
|
14
|
+
minLeaseTtlMs?: number;
|
|
15
|
+
maxLeaseTtlMs?: number;
|
|
16
|
+
now?: () => number;
|
|
17
|
+
};
|
|
18
|
+
export type AllocateLeaseRequest = {
|
|
19
|
+
tenantId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
backend?: LeaseBackend;
|
|
22
|
+
ttlMs?: number;
|
|
23
|
+
};
|
|
24
|
+
export type HeartbeatLeaseRequest = {
|
|
25
|
+
leaseId: string;
|
|
26
|
+
tenantId?: string;
|
|
27
|
+
runId?: string;
|
|
28
|
+
ttlMs?: number;
|
|
29
|
+
};
|
|
30
|
+
export type ReleaseLeaseRequest = {
|
|
31
|
+
leaseId: string;
|
|
32
|
+
tenantId?: string;
|
|
33
|
+
runId?: string;
|
|
34
|
+
};
|
|
35
|
+
export type AdmissionRequest = {
|
|
36
|
+
tenantId: string | undefined;
|
|
37
|
+
runId: string | undefined;
|
|
38
|
+
leaseId: string | undefined;
|
|
39
|
+
backend?: LeaseBackend;
|
|
40
|
+
};
|
|
41
|
+
export declare class LeaseRegistry {
|
|
42
|
+
private readonly leases;
|
|
43
|
+
private readonly runBindings;
|
|
44
|
+
private readonly maxActiveSimulatorLeases;
|
|
45
|
+
private readonly defaultLeaseTtlMs;
|
|
46
|
+
private readonly minLeaseTtlMs;
|
|
47
|
+
private readonly maxLeaseTtlMs;
|
|
48
|
+
private readonly now;
|
|
49
|
+
constructor(options?: LeaseRegistryOptions);
|
|
50
|
+
allocateLease(request: AllocateLeaseRequest): SimulatorLease;
|
|
51
|
+
heartbeatLease(request: HeartbeatLeaseRequest): SimulatorLease;
|
|
52
|
+
releaseLease(request: ReleaseLeaseRequest): {
|
|
53
|
+
released: boolean;
|
|
54
|
+
};
|
|
55
|
+
assertLeaseAdmission(request: AdmissionRequest): void;
|
|
56
|
+
listActiveLeases(): SimulatorLease[];
|
|
57
|
+
private cleanupExpiredLeases;
|
|
58
|
+
private enforceCapacity;
|
|
59
|
+
private resolveLeaseTtlMs;
|
|
60
|
+
private refreshLease;
|
|
61
|
+
private bindingKey;
|
|
62
|
+
private assertOptionalScopeMatch;
|
|
63
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type RetainedMaterializedPaths = {
|
|
2
|
+
materializationId: string;
|
|
3
|
+
installablePath: string;
|
|
4
|
+
archivePath?: string;
|
|
5
|
+
expiresAt: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function retainMaterializedPaths(params: {
|
|
8
|
+
installablePath: string;
|
|
9
|
+
archivePath?: string;
|
|
10
|
+
tenantId?: string;
|
|
11
|
+
sessionName?: string;
|
|
12
|
+
ttlMs?: number;
|
|
13
|
+
}): Promise<RetainedMaterializedPaths>;
|
|
14
|
+
export declare function cleanupRetainedMaterializedPaths(materializationId: string, tenantId?: string): Promise<void>;
|
|
15
|
+
export declare function cleanupRetainedMaterializedPathsForSession(sessionName: string): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type NetworkIncludeMode = 'summary' | 'headers' | 'body' | 'all';
|
|
2
|
+
export type NetworkEntry = {
|
|
3
|
+
method?: string;
|
|
4
|
+
url: string;
|
|
5
|
+
status?: number;
|
|
6
|
+
timestamp?: string;
|
|
7
|
+
headers?: string;
|
|
8
|
+
requestBody?: string;
|
|
9
|
+
responseBody?: string;
|
|
10
|
+
raw: string;
|
|
11
|
+
line: number;
|
|
12
|
+
};
|
|
13
|
+
export type NetworkDump = {
|
|
14
|
+
path: string;
|
|
15
|
+
exists: boolean;
|
|
16
|
+
scannedLines: number;
|
|
17
|
+
matchedLines: number;
|
|
18
|
+
entries: NetworkEntry[];
|
|
19
|
+
include: NetworkIncludeMode;
|
|
20
|
+
limits: {
|
|
21
|
+
maxEntries: number;
|
|
22
|
+
maxPayloadChars: number;
|
|
23
|
+
maxScanLines: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function readRecentNetworkTraffic(logPath: string, options?: {
|
|
27
|
+
maxEntries?: number;
|
|
28
|
+
include?: NetworkIncludeMode;
|
|
29
|
+
maxPayloadChars?: number;
|
|
30
|
+
maxScanLines?: number;
|
|
31
|
+
}): NetworkDump;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppError } from '../utils/errors.ts';
|
|
2
|
+
export declare function resolveRequestTrackingId(requestId: string | undefined, fallbackSeed?: unknown): string;
|
|
3
|
+
export declare function registerRequestAbort(requestId: string | undefined): void;
|
|
4
|
+
export declare function markRequestCanceled(requestId: string | undefined): void;
|
|
5
|
+
export declare function clearRequestCanceled(requestId: string | undefined): void;
|
|
6
|
+
export declare function isRequestCanceled(requestId: string | undefined): boolean;
|
|
7
|
+
export declare function getRequestSignal(requestId: string | undefined): AbortSignal | undefined;
|
|
8
|
+
export declare function createRequestCanceledError(): AppError;
|
|
9
|
+
export declare function isRequestCanceledError(error: unknown): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { dispatchCommand } from '../core/dispatch.ts';
|
|
2
|
+
import type { DaemonRequest, DaemonResponse } from './types.ts';
|
|
3
|
+
import { SessionStore } from './session-store.ts';
|
|
4
|
+
import type { LeaseRegistry } from './lease-registry.ts';
|
|
5
|
+
export type RequestRouterDeps = {
|
|
6
|
+
logPath: string;
|
|
7
|
+
token: string;
|
|
8
|
+
sessionStore: SessionStore;
|
|
9
|
+
leaseRegistry: LeaseRegistry;
|
|
10
|
+
trackDownloadableArtifact: (opts: {
|
|
11
|
+
artifactPath: string;
|
|
12
|
+
tenantId?: string;
|
|
13
|
+
fileName?: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
dispatchCommand?: typeof dispatchCommand;
|
|
16
|
+
};
|
|
17
|
+
export declare function createRequestHandler(deps: RequestRouterDeps): (req: DaemonRequest) => Promise<DaemonResponse>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DeviceInfo } from '../utils/device.ts';
|
|
2
|
+
import type { SessionRuntimeHints } from './types.ts';
|
|
3
|
+
type ResolvedRuntimeTransport = {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
scheme: 'http' | 'https';
|
|
7
|
+
};
|
|
8
|
+
export declare function hasRuntimeTransportHints(runtime: SessionRuntimeHints | undefined): boolean;
|
|
9
|
+
export declare function resolveRuntimeTransportHints(runtime: SessionRuntimeHints | undefined): ResolvedRuntimeTransport | undefined;
|
|
10
|
+
export declare function applyRuntimeHintsToApp(params: {
|
|
11
|
+
device: DeviceInfo;
|
|
12
|
+
appId?: string;
|
|
13
|
+
runtime: SessionRuntimeHints | undefined;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
export declare function clearRuntimeHintsFromApp(params: {
|
|
16
|
+
device: DeviceInfo;
|
|
17
|
+
appId?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SessionAction } from './types.ts';
|
|
2
|
+
export declare function isClickLikeCommand(command: string): command is 'click' | 'press';
|
|
3
|
+
export declare function formatScriptArg(value: string): string;
|
|
4
|
+
export declare function formatScriptArgQuoteIfNeeded(value: string): string;
|
|
5
|
+
export declare function formatScriptActionSummary(action: SessionAction): string;
|
|
6
|
+
export declare function appendScriptSeriesFlags(parts: string[], action: Pick<SessionAction, 'command' | 'flags'>): void;
|
|
7
|
+
export declare function appendRuntimeHintFlags(parts: string[], flags: Pick<SessionAction, 'flags'>['flags']): void;
|
|
8
|
+
export declare function parseReplaySeriesFlags(command: string, args: string[]): {
|
|
9
|
+
positionals: string[];
|
|
10
|
+
flags: SessionAction['flags'];
|
|
11
|
+
};
|
|
12
|
+
export declare function parseReplayRuntimeFlags(args: string[]): {
|
|
13
|
+
positionals: string[];
|
|
14
|
+
flags: SessionAction['flags'];
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RawSnapshotNode, type Rect } from '../utils/snapshot.ts';
|
|
2
|
+
type ScrollIntoViewPlan = {
|
|
3
|
+
x: number;
|
|
4
|
+
startY: number;
|
|
5
|
+
endY: number;
|
|
6
|
+
count: number;
|
|
7
|
+
direction: 'up' | 'down';
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveViewportRect(nodes: RawSnapshotNode[], targetRect: Rect): Rect | null;
|
|
10
|
+
export declare function buildScrollIntoViewPlan(targetRect: Rect, viewportRect: Rect): ScrollIntoViewPlan | null;
|
|
11
|
+
export declare function isRectWithinSafeViewportBand(targetRect: Rect, viewportRect: Rect): boolean;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readVersion } from '../utils/version.ts';
|
|
2
|
+
import { readProcessStartTime } from '../utils/process-identity.ts';
|
|
3
|
+
export type DaemonLockInfo = {
|
|
4
|
+
pid: number;
|
|
5
|
+
version: string;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
processStartTime?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveDaemonCodeSignature(): string;
|
|
10
|
+
export declare function writeInfo(baseDir: string, infoPath: string, logPath: string, opts: {
|
|
11
|
+
socketPort?: number;
|
|
12
|
+
httpPort?: number;
|
|
13
|
+
token: string;
|
|
14
|
+
version: string;
|
|
15
|
+
codeSignature: string;
|
|
16
|
+
processStartTime: string | undefined;
|
|
17
|
+
}): void;
|
|
18
|
+
export declare function removeInfo(infoPath: string): void;
|
|
19
|
+
export declare function readLockInfo(lockPath: string): DaemonLockInfo | null;
|
|
20
|
+
export declare function acquireDaemonLock(baseDir: string, lockPath: string, lockData: DaemonLockInfo): boolean;
|
|
21
|
+
export declare function releaseDaemonLock(lockPath: string): void;
|
|
22
|
+
export declare function parseIntegerEnv(raw: string | undefined): number | undefined;
|
|
23
|
+
export { readVersion, readProcessStartTime };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CommandFlags } from '../core/dispatch.ts';
|
|
2
|
+
import type { SessionRuntimeHints, SessionState } from './types.ts';
|
|
3
|
+
export declare class SessionStore {
|
|
4
|
+
private readonly sessions;
|
|
5
|
+
private readonly runtimeHints;
|
|
6
|
+
private readonly sessionsDir;
|
|
7
|
+
constructor(sessionsDir: string);
|
|
8
|
+
get(name: string): SessionState | undefined;
|
|
9
|
+
has(name: string): boolean;
|
|
10
|
+
set(name: string, session: SessionState): void;
|
|
11
|
+
delete(name: string): boolean;
|
|
12
|
+
values(): IterableIterator<SessionState>;
|
|
13
|
+
toArray(): SessionState[];
|
|
14
|
+
getRuntimeHints(name: string): SessionRuntimeHints | undefined;
|
|
15
|
+
setRuntimeHints(name: string, hints: SessionRuntimeHints): void;
|
|
16
|
+
clearRuntimeHints(name: string): boolean;
|
|
17
|
+
recordAction(session: SessionState, entry: {
|
|
18
|
+
command: string;
|
|
19
|
+
positionals: string[];
|
|
20
|
+
flags: CommandFlags;
|
|
21
|
+
result?: Record<string, unknown>;
|
|
22
|
+
}): void;
|
|
23
|
+
writeSessionLog(session: SessionState): void;
|
|
24
|
+
defaultTracePath(session: SessionState): string;
|
|
25
|
+
/** Path to session-scoped app log file. Agent can grep this for token-efficient debugging. */
|
|
26
|
+
resolveAppLogPath(sessionName: string): string;
|
|
27
|
+
resolveAppLogPidPath(sessionName: string): string;
|
|
28
|
+
static safeSessionName(name: string): string;
|
|
29
|
+
static expandHome(filePath: string, cwd?: string): string;
|
|
30
|
+
private resolveScriptPath;
|
|
31
|
+
private buildOptimizedActions;
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SnapshotNode } from '../utils/snapshot.ts';
|
|
2
|
+
type SnapshotDiffLine = {
|
|
3
|
+
kind: 'added' | 'removed' | 'unchanged';
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
type SnapshotDiffSummary = {
|
|
7
|
+
additions: number;
|
|
8
|
+
removals: number;
|
|
9
|
+
unchanged: number;
|
|
10
|
+
};
|
|
11
|
+
type SnapshotDiffResult = {
|
|
12
|
+
summary: SnapshotDiffSummary;
|
|
13
|
+
lines: SnapshotDiffLine[];
|
|
14
|
+
};
|
|
15
|
+
type SnapshotDiffOptions = {
|
|
16
|
+
flatten?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function buildSnapshotDiff(previousNodes: SnapshotNode[], currentNodes: SnapshotNode[], options?: SnapshotDiffOptions): SnapshotDiffResult;
|
|
19
|
+
export declare function countSnapshotComparableLines(nodes: SnapshotNode[], options?: SnapshotDiffOptions): number;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RawSnapshotNode, SnapshotState } from '../utils/snapshot.ts';
|
|
2
|
+
export declare function findNodeByLabel(nodes: SnapshotState['nodes'], label: string): import("../index.ts").SnapshotNode | null;
|
|
3
|
+
export declare function resolveRefLabel(node: SnapshotState['nodes'][number], nodes: SnapshotState['nodes']): string | undefined;
|
|
4
|
+
export declare function pruneGroupNodes(nodes: RawSnapshotNode[]): RawSnapshotNode[];
|
|
5
|
+
export declare function normalizeType(type: string): string;
|
|
6
|
+
export declare function isFillableType(type: string, platform: 'ios' | 'android'): boolean;
|
|
7
|
+
export declare function findNearestHittableAncestor(nodes: SnapshotState['nodes'], node: SnapshotState['nodes'][number]): SnapshotState['nodes'][number] | null;
|
|
8
|
+
export declare function extractNodeText(node: SnapshotState['nodes'][number]): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import net from 'node:net';
|
|
2
|
+
import type { Server as HttpServer } from 'node:http';
|
|
3
|
+
import type { DaemonRequest, DaemonResponse } from './types.ts';
|
|
4
|
+
export declare function createSocketServer(handleRequest: (req: DaemonRequest) => Promise<DaemonResponse>): net.Server;
|
|
5
|
+
export declare function listenNetServer(server: net.Server): Promise<number>;
|
|
6
|
+
export declare function listenHttpServer(server: HttpServer): Promise<number>;
|