@aixnn/aixautots 0.6.17 → 0.6.20
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/{automation-queue-DO8fOG6l.d.ts → automation-queue-GhfQtZLm.d.ts} +2 -2
- package/dist/{chunk-TJ2QIP5M.js → chunk-4NRIEM5Z.js} +249 -33
- package/dist/{chunk-WOPEKCVC.js → chunk-DAU3FVCV.js} +2 -2
- package/dist/chunk-DTXXQPOU.js +693 -0
- package/dist/{chunk-7BJPVSEZ.js → chunk-ED6CB3B4.js} +222 -12
- package/dist/{chunk-NIEGPH3E.js → chunk-FJKMRWYC.js} +55 -23
- package/dist/{chunk-ZDCTHR7D.js → chunk-H7KZUU67.js} +2 -2
- package/dist/{chunk-FJPIY4YI.js → chunk-HQ2L4NQ2.js} +262 -10
- package/dist/{chunk-LOKPZ677.js → chunk-JQBSGFAR.js} +2 -2
- package/dist/{chunk-2KPZSPV6.js → chunk-OJK35AQD.js} +105 -17
- package/dist/chunk-QISBQ532.js +1665 -0
- package/dist/{chunk-KASSYUGM.js → chunk-RFOJSDYI.js} +2 -2
- package/dist/{chunk-QEK25NUA.js → chunk-UEZVXYGP.js} +12 -5
- package/dist/{config-CBUhr4Gl.d.ts → config-C79rcedl.d.ts} +52 -10
- package/dist/core/index.d.ts +13 -9
- package/dist/core/index.js +2 -2
- package/dist/core/network-adb-node.d.ts +23 -0
- package/dist/core/network-adb-node.js +171 -0
- package/dist/{script-debugger-DoT02din.d.ts → device-channel-OiZwAqNQ.d.ts} +41 -55
- package/dist/{device-normalize-Vl5JYbAI.d.ts → device-normalize-ODrxJb-a.d.ts} +1 -1
- package/dist/device-session-PVHD6PNR.js +1 -0
- package/dist/i18n/index.js +1 -1
- package/dist/{mirror-session-Y1InpkUY.d.ts → mirror-session-DifANocH.d.ts} +2 -2
- package/dist/react/index.d.ts +19 -12
- package/dist/react/index.js +3 -3
- package/dist/script-debugger-DjxpvdaN.d.ts +56 -0
- package/dist/{task-agent-runner-Cl2ickJ1.d.ts → task-agent-runner-CAt-z8gr.d.ts} +3 -3
- package/dist/{types-Cp1ohbTb.d.ts → types-CBI5SIH5.d.ts} +102 -4
- package/dist/ui/billing.d.ts +43 -6
- package/dist/ui/billing.js +190 -309
- package/dist/ui/device-create.d.ts +1 -1
- package/dist/ui/device-create.js +7 -7
- package/dist/ui/device-mirror.js +5 -5
- package/dist/ui/devices.d.ts +5 -5
- package/dist/ui/devices.js +9 -9
- package/dist/ui/editor.d.ts +2 -2
- package/dist/ui/editor.js +5 -5
- package/dist/ui/index.d.ts +6 -4
- package/dist/ui/index.js +13 -492
- package/dist/ui/inspector.js +4 -4
- package/dist/ui/ip-commerce.d.ts +2 -2
- package/dist/ui/ip-commerce.js +5 -5
- package/dist/ui/market.js +4 -4
- package/dist/ui/mirror.d.ts +3 -3
- package/dist/ui/script-studio.js +4 -4
- package/dist/ui/scripts.d.ts +1 -1
- package/dist/ui/scripts.js +4 -4
- package/dist/ui/settings.d.ts +164 -0
- package/dist/ui/settings.js +10 -0
- package/dist/ui/tasks.js +9 -9
- package/package.json +9 -1
- package/dist/device-session-3XK2SZDF.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useAixT } from './chunk-FJPIY4YI.js';
|
|
2
1
|
import { Button } from './chunk-7RQTSTR6.js';
|
|
3
|
-
import {
|
|
2
|
+
import { useAixT } from './chunk-HQ2L4NQ2.js';
|
|
3
|
+
import { useClient } from './chunk-UEZVXYGP.js';
|
|
4
4
|
import { useSyncExternalStore, useState, useEffect } from 'react';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeviceChannel, ScriptDebugger, FlowRun, MirrorSession, normalizeDevices, submitBatch } from './chunk-
|
|
2
|
-
import { resolveConfig, AixClient, isFleetRunTerminal, joinUrl, AixAuthError, AixError, EnvRun, detectEnvOs, summarizeEnv, ReconnectingSocket, executionWsTicketUrl } from './chunk-
|
|
1
|
+
import { DeviceChannel, ScriptDebugger, FlowRun, MirrorSession, normalizeDevices, submitBatch } from './chunk-ED6CB3B4.js';
|
|
2
|
+
import { resolveConfig, AixClient, isFleetRunTerminal, joinUrl, AixAuthError, AixError, EnvRun, detectEnvOs, summarizeEnv, ReconnectingSocket, executionWsTicketUrl } from './chunk-OJK35AQD.js';
|
|
3
3
|
import React, { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, createElement } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -10,10 +10,16 @@ function AixProvider({ config, children }) {
|
|
|
10
10
|
// Spread individual stable primitives so an inline config object literal
|
|
11
11
|
// doesn't thrash the channel on every parent render.
|
|
12
12
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
-
[config.baseUrl, config.getAuthToken, config.fetchFn, config.wsFactory]
|
|
13
|
+
[config.baseUrl, config.channel, config.getAuthToken, config.fetchFn, config.wsFactory]
|
|
14
14
|
);
|
|
15
15
|
return /* @__PURE__ */ jsx(Ctx.Provider, { value: resolved, children });
|
|
16
16
|
}
|
|
17
|
+
function AixResolvedProvider({ config, children }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Ctx.Provider, { value: config, children });
|
|
19
|
+
}
|
|
20
|
+
function useOptionalAixConfig() {
|
|
21
|
+
return useContext(Ctx);
|
|
22
|
+
}
|
|
17
23
|
function useAixConfig() {
|
|
18
24
|
const c = useContext(Ctx);
|
|
19
25
|
if (!c) throw new Error("useAixConfig must be used within <AixProvider>");
|
|
@@ -2270,7 +2276,8 @@ function useBilling() {
|
|
|
2270
2276
|
await refetch();
|
|
2271
2277
|
return r;
|
|
2272
2278
|
}, [c, refetch]);
|
|
2273
|
-
|
|
2279
|
+
const lookupTopup = useCallback((requestId) => c.billing.lookupTopup(requestId), [c]);
|
|
2280
|
+
return { ...q, topup, lookupTopup };
|
|
2274
2281
|
}
|
|
2275
2282
|
function useApiTokens() {
|
|
2276
2283
|
const c = useClient();
|
|
@@ -2293,4 +2300,4 @@ function useApiTokens() {
|
|
|
2293
2300
|
return { ...q, create, revoke, rotate };
|
|
2294
2301
|
}
|
|
2295
2302
|
|
|
2296
|
-
export { AixProvider, DevicesProvider, GROUP_MIRROR_MAX, InspectorProvider, NodesProvider, ShortcutsProvider, createAgentTaskRunner, mapDevice, preflightTaskAgentDevice, useAdmin, useAixConfig, useApiTokens, useAuth, useAutomationQueue, useBilling, useClient, useClusters, useCommands, useDevice, useDeviceActions, useDevices, useDevicesView, useEnvGate, useEnvRun, useFleetRun, useFlowRun, useGroupMirror, useImages, useInspector, useInspectorView, useLlm, useLocators, useMirror, useNodes, useNodesView, useProjects, useQuery, useScript, useScriptRun, useScripts, useShortcutsView, useTaskAgentRun, useTaskStatus, useTasks, useWebhooks };
|
|
2303
|
+
export { AixProvider, AixResolvedProvider, DevicesProvider, GROUP_MIRROR_MAX, InspectorProvider, NodesProvider, ShortcutsProvider, createAgentTaskRunner, mapDevice, preflightTaskAgentDevice, useAdmin, useAixConfig, useApiTokens, useAuth, useAutomationQueue, useBilling, useClient, useClusters, useCommands, useDevice, useDeviceActions, useDevices, useDevicesView, useEnvGate, useEnvRun, useFleetRun, useFlowRun, useGroupMirror, useImages, useInspector, useInspectorView, useLlm, useLocators, useMirror, useNodes, useNodesView, useOptionalAixConfig, useProjects, useQuery, useScript, useScriptRun, useScripts, useShortcutsView, useTaskAgentRun, useTaskStatus, useTasks, useWebhooks };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as AuthResult, aP as SendCodeResult, bj as VerifyCodeResult, ay as ProjectUserResult, aw as Project, H as CreateProjectInput, I as CreateProjectResult, aA as ProvisionUserInput, aB as ProvisionUserResult, D as DeviceRow, P as ProvisionSpec, a as ProvisionResult, az as ProvisionOperation, C as CatalogBrand, U as DeviceOp, aO as ScreenshotResult, $ as ElementNode, at as PowerAction, R as DeveloperSettingsReceipt, Y as DeviceSnapshotList, q as AppCandidate, aL as RecycledDeviceRow, aE as ProxyPatchResult, M as CustomProxyAddress, aF as ProxyProbe, V as DeviceProfileView, aS as SetProfileResult, av as ProfileOverrides, a7 as InstallAntiDetectResult, aR as SetDisguiseResult, N as NodeRow, aM as RegisterNodeInput, aN as RegisterNodeResult, bh as UpdateNodeInput, aQ as SetDataRootResult, n as AgentTaskSubmitInput, o as AgentTaskSubmitResult, l as AgentTaskReadResult, k as AgentTaskEventsResult, b as DiscoveredDevice, h as AdbScanResult, ae as IosScanResult, ab as IosDiagnostics, a8 as IosAccountState, ad as IosLoginResult, ac as IosLibraryApp, z as Cluster, F as CreateClusterInput, f as ScriptSummary, S as Script, aT as Shortcut, ak as NewShortcut, ah as Locator, G as CreateLocatorInput, a3 as FleetRunSubmit, a1 as FleetRunDetail, b8 as TaskStatus, b6 as TaskListFilter, b7 as TaskListResult, b5 as TaskEventsResult, bk as WebhookConfig, K as CreateWebhookInput, ag as LlmTestResult, W as DeviceRate, aJ as RateInput, x as BillingPlan, ap as PlanInput, Z as DeviceUsageSession, aK as RebateLedgerRow, aq as PlatformOem, ar as PlatformOemInput, a4 as ImageArtifact, a5 as ImageInput, a6 as ImageOption, w as BalanceResp, ax as ProjectSubscription, b3 as SubscribeInput, ao as OwnNodeDailyCharge, be as TopupMethods, bm as WiseOrders, bl as WiseOrder, b2 as StripeTopupOrder, a$ as StripeCheckoutInput, b0 as StripeCheckoutResult, b1 as StripeReconcileResult, bd as TopupLookup, bc as TopupInput, bg as TopupResult, p as ApiTokenRow, J as CreateTokenInput, L as CreatedToken, s as AppTemplate, aj as NewAppTemplate, as as PortableSnapshot, aX as SnapshotKind, aZ as SnapshotOperationReceipt, aY as SnapshotOperation, aW as SnapshotGrant, an as NodeScope } from './types-CBI5SIH5.js';
|
|
2
2
|
|
|
3
3
|
type OutgoingFrame = {
|
|
4
|
+
t: 'network_adb';
|
|
5
|
+
id: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
} | {
|
|
4
8
|
t: 'adb_exec';
|
|
5
9
|
id: string;
|
|
6
10
|
argv: string[];
|
|
@@ -485,6 +489,8 @@ declare function pullFile(source: AixClient | AixConfig | ResolvedConfig, device
|
|
|
485
489
|
interface RequestOpts {
|
|
486
490
|
/** Optional request cancellation; no automatic retries are performed. */
|
|
487
491
|
signal?: AbortSignal;
|
|
492
|
+
/** Redirect handling for writes that cannot be replayed. */
|
|
493
|
+
redirect?: RequestRedirect;
|
|
488
494
|
/** Auth scope; defaults to 'caller'. */
|
|
489
495
|
scope?: Scope;
|
|
490
496
|
/** JSON body (serialized unless it is a string already). */
|
|
@@ -570,6 +576,8 @@ declare class DevicesApi {
|
|
|
570
576
|
/** Provision a virtual device (`POST /api/devices/provision`). The spec is
|
|
571
577
|
* opaque; `node_id` (optional) routes to a specific usable node. */
|
|
572
578
|
provision(spec: ProvisionSpec): Promise<ProvisionResult>;
|
|
579
|
+
/** Inspect a persisted provisioning operation without retrying creation or contacting the node. */
|
|
580
|
+
provisionOperation(operationId: string, options?: Pick<RequestOpts, 'signal'>): Promise<ProvisionOperation>;
|
|
573
581
|
/** Brand→model identity catalog for the create-wizard's 品牌 → 机型 picker
|
|
574
582
|
* (`GET /api/devices/profile-catalog`). Static read-only data; the chosen
|
|
575
583
|
* `model` is passed back via `ProvisionSpec.model` to lock the fingerprint base. */
|
|
@@ -580,12 +588,16 @@ declare class DevicesApi {
|
|
|
580
588
|
op<T = unknown>(deviceId: string, op: DeviceOp, options?: Pick<RequestOpts, 'signal'>): Promise<T>;
|
|
581
589
|
screenshot(deviceId: string): Promise<ScreenshotResult>;
|
|
582
590
|
captureUiTree(deviceId: string): Promise<ElementNode>;
|
|
583
|
-
/** Power / lifecycle op (`POST /api/devices/:id/power`).
|
|
584
|
-
*
|
|
585
|
-
* `{
|
|
586
|
-
*
|
|
587
|
-
*
|
|
591
|
+
/** Power / lifecycle op (`POST /api/devices/:id/power`). A confirmed Stop
|
|
592
|
+
* returns `{ stopped: true }`, but during an image cutover Stop may return
|
|
593
|
+
* `{ status: 'queued', desired_running: false }`. Reboot starts asynchronously
|
|
594
|
+
* and returns `{ status: 'rebooting', async: true }`. Non-2xx responses
|
|
595
|
+
* reject with the node/backend error. */
|
|
588
596
|
power<T = Record<string, unknown>>(deviceId: string, action: PowerAction, extra?: Record<string, unknown>): Promise<T>;
|
|
597
|
+
/** Read the virtual Android settings back from the device (not USB host authorization). */
|
|
598
|
+
getDeveloperSettings(deviceId: string): Promise<DeveloperSettingsReceipt>;
|
|
599
|
+
/** Enable developer mode and USB debugging; backend verifies both by reading Android settings. */
|
|
600
|
+
enableDeveloperSettings(deviceId: string): Promise<DeveloperSettingsReceipt>;
|
|
589
601
|
/** List all user data snapshots, including while the device is offline. */
|
|
590
602
|
listSnapshots(deviceId: string): Promise<DeviceSnapshotList>;
|
|
591
603
|
/** Save current data under a new server-generated identifier. */
|
|
@@ -611,7 +623,11 @@ declare class DevicesApi {
|
|
|
611
623
|
/** Install an apk/xapk already uploaded to R2 (key from `filesUploadUrl`). */
|
|
612
624
|
installByKey(deviceId: string, key: string): Promise<unknown>;
|
|
613
625
|
lease(deviceId: string): Promise<unknown>;
|
|
614
|
-
|
|
626
|
+
/** Release the caller's open real-device lease sessions and settle their billing.
|
|
627
|
+
* This does not stop, power off, or delete the device. */
|
|
628
|
+
release(deviceId: string): Promise<{
|
|
629
|
+
released: number;
|
|
630
|
+
}>;
|
|
615
631
|
claim(deviceId: string): Promise<unknown>;
|
|
616
632
|
/** 软删除(移入回收站)—`DELETE /api/devices/:id`。在线节点即时销毁容器,
|
|
617
633
|
* 离线节点标记 pending_destroy,待节点重连对账。3 天后自动彻底清除。 */
|
|
@@ -650,6 +666,8 @@ declare class DevicesApi {
|
|
|
650
666
|
}): Promise<unknown>;
|
|
651
667
|
/** Update only the device proxy and retain a typed patch receipt. */
|
|
652
668
|
updateProxy(deviceId: string, proxy: string): Promise<ProxyPatchResult>;
|
|
669
|
+
/** Retrieve only the configured custom proxy address for an authorized device. */
|
|
670
|
+
customProxyAddress(deviceId: string): Promise<CustomProxyAddress>;
|
|
653
671
|
/** Probe the device's configured proxy and report its egress IP/connectivity. */
|
|
654
672
|
probeProxy(deviceId: string): Promise<ProxyProbe>;
|
|
655
673
|
/** 休眠设备 (`POST /api/devices/:id/sleep`)。
|
|
@@ -1093,16 +1111,32 @@ declare class ImagesApi {
|
|
|
1093
1111
|
* 钱包身份恒为 user——项目 key/secret 调用解析到 representative user 的钱包。 */
|
|
1094
1112
|
declare class BillingApi {
|
|
1095
1113
|
private readonly c;
|
|
1096
|
-
|
|
1114
|
+
private readonly defaultChannel?;
|
|
1115
|
+
constructor(c: RestClient, defaultChannel?: string | undefined);
|
|
1097
1116
|
/** 当前钱包余额 + 最近流水(`GET /api/billing/balance`)。 */
|
|
1098
1117
|
balance(): Promise<BalanceResp>;
|
|
1118
|
+
/** Caller project runtime payer mode for display/diagnosis only; server admission is authoritative.
|
|
1119
|
+
* Account balance currency is reported by the server; this does not convert credits or points. */
|
|
1120
|
+
runtimePayer(): Promise<{
|
|
1121
|
+
mode: 'project' | 'paused' | 'personal';
|
|
1122
|
+
}>;
|
|
1099
1123
|
/** 名下项目订阅列表(`GET /api/billing/subscriptions`)。 */
|
|
1100
1124
|
subscriptions(): Promise<ProjectSubscription[]>;
|
|
1101
1125
|
/** 订阅一个套餐(`POST /api/billing/subscriptions`)。`plan_id` 由调用方传入。 */
|
|
1102
1126
|
subscribe(input: SubscribeInput): Promise<ProjectSubscription>;
|
|
1103
1127
|
/** 自有节点日费(`GET /api/billing/own-node-charges`)。 */
|
|
1104
1128
|
ownNodeCharges(): Promise<OwnNodeDailyCharge[]>;
|
|
1105
|
-
|
|
1129
|
+
topupMethods(): Promise<TopupMethods>;
|
|
1130
|
+
wiseOrders(): Promise<WiseOrders>;
|
|
1131
|
+
createWiseOrder(amount_cents: number, opts?: {
|
|
1132
|
+
channel?: string;
|
|
1133
|
+
}): Promise<WiseOrder>;
|
|
1134
|
+
stripeOrders(): Promise<StripeTopupOrder[]>;
|
|
1135
|
+
createStripeCheckout(input: StripeCheckoutInput): Promise<StripeCheckoutResult>;
|
|
1136
|
+
reconcileStripeCheckout(session_id: string): Promise<StripeReconcileResult>;
|
|
1137
|
+
/** 查询当前管理员身份,或按 UUID 核对未决充值;不执行写入。 */
|
|
1138
|
+
lookupTopup(requestId?: string): Promise<TopupLookup>;
|
|
1139
|
+
/** PUT 避免旧版仅 POST 的服务端将未携回执的请求重复入账。 */
|
|
1106
1140
|
topup(input: TopupInput): Promise<TopupResult>;
|
|
1107
1141
|
}
|
|
1108
1142
|
|
|
@@ -1317,6 +1351,8 @@ interface IpOrder {
|
|
|
1317
1351
|
entitlement_ids: string[];
|
|
1318
1352
|
apply_status?: string;
|
|
1319
1353
|
failure_reason?: string | null;
|
|
1354
|
+
/** Safe read-only provisioning projection; present when an attached device creation intent exists. */
|
|
1355
|
+
device_creation?: ProvisionOperation;
|
|
1320
1356
|
}
|
|
1321
1357
|
interface IpResource {
|
|
1322
1358
|
id: string;
|
|
@@ -1572,6 +1608,7 @@ declare class LocalNodeController {
|
|
|
1572
1608
|
}
|
|
1573
1609
|
|
|
1574
1610
|
interface IWebSocket {
|
|
1611
|
+
readonly bufferedAmount?: number;
|
|
1575
1612
|
send(data: string): void;
|
|
1576
1613
|
close(code?: number, reason?: string): void;
|
|
1577
1614
|
onopen: ((ev: unknown) => void) | null;
|
|
@@ -1655,6 +1692,9 @@ type RTCFactory = (config: {
|
|
|
1655
1692
|
interface AixConfig {
|
|
1656
1693
|
/** Backend base URL, e.g. "https://api.example.com". */
|
|
1657
1694
|
baseUrl: string;
|
|
1695
|
+
/** Optional developer channel attribution code passed at startup (e.g. "aixtab").
|
|
1696
|
+
* Automatically attached to billing top-up requests unless overridden per call. */
|
|
1697
|
+
channel?: string;
|
|
1658
1698
|
/** Legacy single-user-token path. Equivalent to `auth: { kind: 'user', getToken }`.
|
|
1659
1699
|
* Optional now that `auth` exists — provide this OR `auth` (or both). */
|
|
1660
1700
|
getAuthToken?: () => string | Promise<string>;
|
|
@@ -1673,6 +1713,8 @@ interface AixConfig {
|
|
|
1673
1713
|
}
|
|
1674
1714
|
interface ResolvedConfig {
|
|
1675
1715
|
baseUrl: string;
|
|
1716
|
+
/** Normalized startup developer channel code, if configured. */
|
|
1717
|
+
channel?: string;
|
|
1676
1718
|
/** Resolved user-bearer accessor (kept for the legacy device/mirror/flow
|
|
1677
1719
|
* paths). Throws if no user credential is configured. */
|
|
1678
1720
|
getAuthToken: () => string | Promise<string>;
|
|
@@ -1717,4 +1759,4 @@ declare function authHeader(getAuthToken: () => string | Promise<string>): Promi
|
|
|
1717
1759
|
}>;
|
|
1718
1760
|
declare function resolveConfig(cfg: AixConfig): ResolvedConfig;
|
|
1719
1761
|
|
|
1720
|
-
export { LlmApi as $, type AixConfig as A, BillingApi as B, type CachedUserCredentialOpts as C, type DcStream as D, type EnvOs as E, type FridaEventFrame as F, type ExecutionStreamEventsResult as G, type FileEntry as H, FleetApi as I, type IRTCDataChannel as J, type IRTCPeerConnection as K, type IWebSocket as L, ImagesApi as M, type IncomingFrame as N, type OutgoingFrame as O, type IpCatalog as P, type IpCatalogFilter as Q, type ResolvedConfig as R, type ScriptletEventFrame as S, IpCommerceApi as T, type IpOffer as U, type IpOrder as V, type WebSocketFactory as W, type IpQuote as X, type IpQuoteInput as Y, type IpResource as Z, type IpResourceConnection as _, type
|
|
1762
|
+
export { LlmApi as $, type AixConfig as A, BillingApi as B, type CachedUserCredentialOpts as C, type DcStream as D, type EnvOs as E, type FridaEventFrame as F, type ExecutionStreamEventsResult as G, type FileEntry as H, FleetApi as I, type IRTCDataChannel as J, type IRTCPeerConnection as K, type IWebSocket as L, ImagesApi as M, type IncomingFrame as N, type OutgoingFrame as O, type IpCatalog as P, type IpCatalogFilter as Q, type ResolvedConfig as R, type ScriptletEventFrame as S, IpCommerceApi as T, type IpOffer as U, type IpOrder as V, type WebSocketFactory as W, type IpQuote as X, type IpQuoteInput as Y, type IpResource as Z, type IpResourceConnection as _, type StatusFrame as a, LocalNodeController as a0, type LocalNodeOptions as a1, LocatorsApi as a2, type ManagedCreationInput as a3, type ManagedCreationQuote as a4, type ManagedCreationReceipt as a5, type ManagedCreations as a6, ManagedProxiesApi as a7, type ManagedProxyCatalog as a8, type ManagedProxyOrder as a9, WebhooksApi as aA, authHeader as aB, buildAuthProvider as aC, createCachedUserCredential as aD, createClient as aE, detectEnvOs as aF, envBlocker as aG, executionStreamEventsAfter as aH, executionWsTicketUrl as aI, executionWsUrl as aJ, isEnvEventFrame as aK, isExecutionFrame as aL, isFleetRunTerminal as aM, isFridaEventFrame as aN, isRetFrame as aO, isScriptletEventFrame as aP, isStatusFrame as aQ, joinUrl as aR, parseIncoming as aS, pullFile as aT, pushFile as aU, resolveConfig as aV, restClient as aW, runEnvToFinish as aX, summarizeEnv as aY, type ManagedProxyProduct as aa, type ManagedProxyPurchaseInput as ab, type ManagedProxyQuote as ac, type ManagedProxyQuoteInput as ad, type NodeHost as ae, type NodeHostStatus as af, NodesApi as ag, type ProgressFn as ah, ProjectsApi as ai, type ProxyIntegrationStatus as aj, type PullResult as ak, type PushInput as al, type RTCFactory as am, type RequestOpts as an, RestClient as ao, type RetFrame as ap, type Scope as aq, ScriptsApi as ar, ShortcutsApi as as, SnapshotsApi as at, type StreamTarget as au, TasksApi as av, type TransferOpts as aw, type TransferProgress as ax, type TransferResult as ay, UsersApi as az, type RunEventKind as b, AixClient as c, type EnvRoute as d, type EnvEventKind as e, AdminApi as f, ApiTokensApi as g, AuthApi as h, type AuthProvider as i, ClustersApi as j, type Credential as k, type DeviceReq as l, type DeviceResp as m, DeviceSession as n, DevicesApi as o, type EnvAction as p, type EnvFinished as q, type EnvResultDto as r, EnvRun as s, type EnvSetupInput as t, type EnvStepMeta as u, type EnvStepView as v, type EnvSummary as w, type EnvTeardownInput as x, type ExecutionFrame as y, type ExecutionStreamEvent as z };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { R as ResolvedConfig, W as WebSocketFactory } from '../config-
|
|
2
|
-
export { f as AdminApi, c as AixClient, A as AixConfig, g as ApiTokensApi, h as AuthApi, i as AuthProvider, B as BillingApi, C as CachedUserCredentialOpts, j as ClustersApi, k as Credential, D as DcStream, l as DeviceReq, m as DeviceResp, n as DeviceSession, o as DevicesApi, p as EnvAction, e as EnvEventKind, q as EnvFinished, E as EnvOs, r as EnvResultDto, d as EnvRoute, s as EnvRun, t as EnvSetupInput, u as EnvStepMeta, v as EnvStepView, w as EnvSummary, x as EnvTeardownInput, y as ExecutionFrame, z as ExecutionStreamEvent, G as ExecutionStreamEventsResult, H as FileEntry, I as FleetApi, F as FridaEventFrame, J as IRTCDataChannel, K as IRTCPeerConnection, L as IWebSocket, M as ImagesApi, N as IncomingFrame, P as IpCatalog, Q as IpCatalogFilter, T as IpCommerceApi, U as IpOffer, V as IpOrder, X as IpQuote, Y as IpQuoteInput, Z as IpResource, _ as IpResourceConnection, $ as LlmApi, a0 as LocalNodeController, a1 as LocalNodeOptions, a2 as LocatorsApi, a3 as ManagedCreationInput, a4 as ManagedCreationQuote, a5 as ManagedCreationReceipt, a6 as ManagedCreations, a7 as ManagedProxiesApi, a8 as ManagedProxyCatalog, a9 as ManagedProxyOrder, aa as ManagedProxyProduct, ab as ManagedProxyPurchaseInput, ac as ManagedProxyQuote, ad as ManagedProxyQuoteInput, ae as NodeHost, af as NodeHostStatus, ag as NodesApi, O as OutgoingFrame, ah as ProgressFn, ai as ProjectsApi, aj as ProxyIntegrationStatus, ak as PullResult, al as PushInput, am as RTCFactory, an as RequestOpts, ao as RestClient, ap as RetFrame,
|
|
3
|
-
export { A as AdbResult, D as DeviceChannel,
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { R as ResolvedConfig, W as WebSocketFactory } from '../config-C79rcedl.js';
|
|
2
|
+
export { f as AdminApi, c as AixClient, A as AixConfig, g as ApiTokensApi, h as AuthApi, i as AuthProvider, B as BillingApi, C as CachedUserCredentialOpts, j as ClustersApi, k as Credential, D as DcStream, l as DeviceReq, m as DeviceResp, n as DeviceSession, o as DevicesApi, p as EnvAction, e as EnvEventKind, q as EnvFinished, E as EnvOs, r as EnvResultDto, d as EnvRoute, s as EnvRun, t as EnvSetupInput, u as EnvStepMeta, v as EnvStepView, w as EnvSummary, x as EnvTeardownInput, y as ExecutionFrame, z as ExecutionStreamEvent, G as ExecutionStreamEventsResult, H as FileEntry, I as FleetApi, F as FridaEventFrame, J as IRTCDataChannel, K as IRTCPeerConnection, L as IWebSocket, M as ImagesApi, N as IncomingFrame, P as IpCatalog, Q as IpCatalogFilter, T as IpCommerceApi, U as IpOffer, V as IpOrder, X as IpQuote, Y as IpQuoteInput, Z as IpResource, _ as IpResourceConnection, $ as LlmApi, a0 as LocalNodeController, a1 as LocalNodeOptions, a2 as LocatorsApi, a3 as ManagedCreationInput, a4 as ManagedCreationQuote, a5 as ManagedCreationReceipt, a6 as ManagedCreations, a7 as ManagedProxiesApi, a8 as ManagedProxyCatalog, a9 as ManagedProxyOrder, aa as ManagedProxyProduct, ab as ManagedProxyPurchaseInput, ac as ManagedProxyQuote, ad as ManagedProxyQuoteInput, ae as NodeHost, af as NodeHostStatus, ag as NodesApi, O as OutgoingFrame, ah as ProgressFn, ai as ProjectsApi, aj as ProxyIntegrationStatus, ak as PullResult, al as PushInput, am as RTCFactory, an as RequestOpts, ao as RestClient, ap as RetFrame, b as RunEventKind, aq as Scope, S as ScriptletEventFrame, ar as ScriptsApi, as as ShortcutsApi, at as SnapshotsApi, a as StatusFrame, au as StreamTarget, av as TasksApi, aw as TransferOpts, ax as TransferProgress, ay as TransferResult, az as UsersApi, aA as WebhooksApi, aB as authHeader, aC as buildAuthProvider, aD as createCachedUserCredential, aE as createClient, aF as detectEnvOs, aG as envBlocker, aH as executionStreamEventsAfter, aI as executionWsTicketUrl, aJ as executionWsUrl, aK as isEnvEventFrame, aL as isExecutionFrame, aM as isFleetRunTerminal, aN as isFridaEventFrame, aO as isRetFrame, aP as isScriptletEventFrame, aQ as isStatusFrame, aR as joinUrl, aS as parseIncoming, aT as pullFile, aU as pushFile, aV as resolveConfig, aW as restClient, aX as runEnvToFinish, aY as summarizeEnv } from '../config-C79rcedl.js';
|
|
3
|
+
export { A as AdbResult, D as DeviceChannel, a as DeviceTunnel, N as NetworkAdbGrant, b as NetworkAdbState, W as WdaResult } from '../device-channel-OiZwAqNQ.js';
|
|
4
|
+
export { b as ScriptDebugger, c as ScriptDebuggerOptions, a as ScriptEngine, S as ScriptEvent, d as ScriptRunInput } from '../script-debugger-DjxpvdaN.js';
|
|
5
|
+
export { A as AutomationQueue, B as BatchConfig, F as FlowEvent, a as FlowRun, b as FlowSubmit, Q as QueueMode, s as submitBatch } from '../automation-queue-GhfQtZLm.js';
|
|
6
|
+
import { g as ScriptParam } from '../types-CBI5SIH5.js';
|
|
7
|
+
export { h as AdbScanResult, d as AgentTaskBlocker, i as AgentTaskCurrentAttempt, j as AgentTaskEvent, k as AgentTaskEventsResult, e as AgentTaskEvidence, l as AgentTaskReadResult, m as AgentTaskReadTarget, n as AgentTaskSubmitInput, o as AgentTaskSubmitResult, c as AgentTaskTarget, A as AgentTaskTargetStatus, p as ApiTokenRow, q as AppCandidate, r as AppEntry, s as AppTemplate, t as AppTemplateItemAndroid, u as AppTemplateItemIos, v as AuthResult, B as BalanceLedgerRow, w as BalanceResp, x as BillingPlan, C as CatalogBrand, y as CatalogModel, z as Cluster, E as ClusterMode, F as CreateClusterInput, G as CreateLocatorInput, H as CreateProjectInput, I as CreateProjectResult, J as CreateTokenInput, K as CreateWebhookInput, L as CreatedToken, M as CustomProxyAddress, O as Decimal, Q as DeveloperRef, R as DeveloperSettingsReceipt, T as DeviceLocation, U as DeviceOp, V as DeviceProfileView, W as DeviceRate, D as DeviceRow, X as DeviceSnapshot, Y as DeviceSnapshotList, Z as DeviceUsageSession, b as DiscoveredDevice, _ as DiscoveredStatus, $ as ElementNode, a0 as FleetMode, a1 as FleetRunDetail, a2 as FleetRunDeviceRow, a3 as FleetRunSubmit, a4 as ImageArtifact, a5 as ImageInput, a6 as ImageOption, a7 as InstallAntiDetectResult, a8 as IosAccountState, a9 as IosDeviceRow, aa as IosDiagnosticStage, ab as IosDiagnostics, ac as IosLibraryApp, ad as IosLoginResult, ae as IosScanResult, af as KnownDeviceOpName, ag as LlmTestResult, ah as Locator, ai as MdnsEntry, aj as NewAppTemplate, ak as NewShortcut, al as NodeEffectiveCaps, am as NodeOwnerPolicy, N as NodeRow, an as NodeScope, ao as OwnNodeDailyCharge, ap as PlanInput, aq as PlatformOem, ar as PlatformOemInput, as as PortableSnapshot, at as PowerAction, au as PowerRunResult, av as ProfileOverrides, aw as Project, ax as ProjectSubscription, ay as ProjectUserResult, az as ProvisionOperation, a as ProvisionResult, P as ProvisionSpec, aA as ProvisionUserInput, aB as ProvisionUserResult, aC as ProxyApplyReceipt, aD as ProxyApplyStatus, aE as ProxyPatchResult, aF as ProxyProbe, aG as ProxyProbeErrorCode, aH as ProxySummary, aI as ProxyUrl, aJ as RateInput, aK as RebateLedgerRow, aL as RecycledDeviceRow, aM as RegisterNodeInput, aN as RegisterNodeResult, aO as ScreenshotResult, S as Script, f as ScriptSummary, aP as SendCodeResult, aQ as SetDataRootResult, aR as SetDisguiseResult, aS as SetProfileResult, aT as Shortcut, aU as ShortcutParam, aV as ShortcutRunResult, aW as SnapshotGrant, aX as SnapshotKind, aY as SnapshotOperation, aZ as SnapshotOperationReceipt, a_ as SnapshotOperationStatus, a$ as StripeCheckoutInput, b0 as StripeCheckoutResult, b1 as StripeReconcileResult, b2 as StripeTopupOrder, b3 as SubscribeInput, b4 as TaskEvent, b5 as TaskEventsResult, b6 as TaskListFilter, b7 as TaskListResult, b8 as TaskStatus, b9 as TaskSubmitResult, ba as TaskSummary, bb as TaskTarget, bc as TopupInput, bd as TopupLookup, be as TopupMethods, bf as TopupReceipt, bg as TopupResult, bh as UpdateNodeInput, bi as User, bj as VerifyCodeResult, bk as WebhookConfig, bl as WiseOrder, bm as WiseOrders } from '../types-CBI5SIH5.js';
|
|
8
|
+
import { C as ControlMessage } from '../mirror-session-DifANocH.js';
|
|
9
|
+
export { I as InputMessage, M as MirrorJoinOptions, a as MirrorSession, S as SCRCPY_PROFILES, b as ScrcpyProfile, c as ScrcpyProfileName, q as qualityMessage } from '../mirror-session-DifANocH.js';
|
|
9
10
|
import { B as Box, D as DeviceSize } from '../coords-LPR_MPyp.js';
|
|
10
11
|
export { a as DevicePoint, t as toDevicePoint } from '../coords-LPR_MPyp.js';
|
|
11
|
-
export { D as DeviceTransport, N as NormalizedDevice, n as normalizeDevices } from '../device-normalize-
|
|
12
|
+
export { D as DeviceTransport, N as NormalizedDevice, n as normalizeDevices } from '../device-normalize-ODrxJb-a.js';
|
|
12
13
|
|
|
13
14
|
type AixErrorCode = 'auth' | 'network' | 'timeout' | 'offline' | 'locked' | 'protocol' | 'unknown';
|
|
14
15
|
interface AixErrorDetails {
|
|
@@ -72,6 +73,7 @@ interface ReconnectingSocketOpts {
|
|
|
72
73
|
declare class ReconnectingSocket {
|
|
73
74
|
private readonly o;
|
|
74
75
|
private ws;
|
|
76
|
+
private opened;
|
|
75
77
|
private closed;
|
|
76
78
|
private attempt;
|
|
77
79
|
private reconnectTimer;
|
|
@@ -85,6 +87,8 @@ declare class ReconnectingSocket {
|
|
|
85
87
|
* can run; queued messages/close events must never affect its replacement. */
|
|
86
88
|
reconnect(): void;
|
|
87
89
|
send(text: string): void;
|
|
90
|
+
/** Refuse ADB writes when transport backpressure is unavailable or over budget. */
|
|
91
|
+
sendBounded(text: string, maxBufferedBytes: number): void;
|
|
88
92
|
isConnected(): boolean;
|
|
89
93
|
close(): void;
|
|
90
94
|
}
|
package/dist/core/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AutomationQueue, DeviceChannel, DeviceTunnel, FlowRun, MirrorSession, SCHEMA_KEY, SCRCPY_PROFILES, ScriptDebugger, mintDeviceAccess, normalizeDevices, qualityMessage, schemaDefaults, schemaToVariables, submitBatch, targetParam, variablesToSchema, wsUrlFromAccess } from '../chunk-
|
|
2
|
-
export { AdminApi, AixAuthError, AixClient, AixDeviceOffline, AixError, AixLocked, AixProtocolError, AixTimeout, ApiTokensApi, AuthApi, BillingApi, ClustersApi, DeviceSession, DevicesApi, EnvRun, FleetApi, ImagesApi, IpCommerceApi, LlmApi, LocalNodeController, LocatorsApi, ManagedProxiesApi, NodesApi, ProjectsApi, ReconnectingSocket, RestClient, ScriptsApi, ShortcutsApi, SnapshotsApi, TasksApi, UsersApi, WebhooksApi, authHeader, buildAuthProvider, createCachedUserCredential, createClient, detectEnvOs, envBlocker, errorFromRet, executionStreamEventsAfter, executionWsTicketUrl, executionWsUrl, getIceServers, getLocale, isEnvEventFrame, isExecutionFrame, isFleetRunTerminal, isFridaEventFrame, isRetFrame, isScriptletEventFrame, isStatusFrame, joinUrl, mintViewerGrant, mintViewerToken, parseIncoming, pullFile, pushFile, resolveConfig, restClient, runEnvToFinish, setLocale, summarizeEnv, t } from '../chunk-
|
|
1
|
+
export { AutomationQueue, DeviceChannel, DeviceTunnel, FlowRun, MirrorSession, SCHEMA_KEY, SCRCPY_PROFILES, ScriptDebugger, mintDeviceAccess, normalizeDevices, qualityMessage, schemaDefaults, schemaToVariables, submitBatch, targetParam, variablesToSchema, wsUrlFromAccess } from '../chunk-ED6CB3B4.js';
|
|
2
|
+
export { AdminApi, AixAuthError, AixClient, AixDeviceOffline, AixError, AixLocked, AixProtocolError, AixTimeout, ApiTokensApi, AuthApi, BillingApi, ClustersApi, DeviceSession, DevicesApi, EnvRun, FleetApi, ImagesApi, IpCommerceApi, LlmApi, LocalNodeController, LocatorsApi, ManagedProxiesApi, NodesApi, ProjectsApi, ReconnectingSocket, RestClient, ScriptsApi, ShortcutsApi, SnapshotsApi, TasksApi, UsersApi, WebhooksApi, authHeader, buildAuthProvider, createCachedUserCredential, createClient, detectEnvOs, envBlocker, errorFromRet, executionStreamEventsAfter, executionWsTicketUrl, executionWsUrl, getIceServers, getLocale, isEnvEventFrame, isExecutionFrame, isFleetRunTerminal, isFridaEventFrame, isRetFrame, isScriptletEventFrame, isStatusFrame, joinUrl, mintViewerGrant, mintViewerToken, parseIncoming, pullFile, pushFile, resolveConfig, restClient, runEnvToFinish, setLocale, summarizeEnv, t } from '../chunk-OJK35AQD.js';
|
|
3
3
|
export { classifyDrag, mapKey, toDevicePoint } from '../chunk-NWFYTFMI.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { D as DeviceChannel } from '../device-channel-OiZwAqNQ.js';
|
|
2
|
+
import '../config-C79rcedl.js';
|
|
3
|
+
import '../types-CBI5SIH5.js';
|
|
4
|
+
|
|
5
|
+
/** Node-only TCP adapter. Call close() to revoke the grant. */
|
|
6
|
+
interface NetworkAdbBridge {
|
|
7
|
+
readonly host: '127.0.0.1' | '::';
|
|
8
|
+
readonly port: number;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
/** Opt-in all-interface listener. A firewall/VPN is still required: raw TCP adds no ADB authentication. */
|
|
12
|
+
interface AllInterfaceAdbOptions {
|
|
13
|
+
readonly listen: 'all';
|
|
14
|
+
readonly port?: number;
|
|
15
|
+
readonly allowedClients: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
/** Enables ADB only on the supplied, already authenticated device channel. Default is loopback.
|
|
18
|
+
* 'all' is explicit opt-in and requires a source allowlist; raw TCP does not replace a firewall/VPN
|
|
19
|
+
* or change ADB service authentication. Never expose this listener directly to the public internet.
|
|
20
|
+
*/
|
|
21
|
+
declare function openNetworkAdbBridge(channel: DeviceChannel, options?: number | AllInterfaceAdbOptions): Promise<NetworkAdbBridge>;
|
|
22
|
+
|
|
23
|
+
export { type AllInterfaceAdbOptions, type NetworkAdbBridge, openNetworkAdbBridge };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { createServer, isIP, BlockList } from 'net';
|
|
2
|
+
|
|
3
|
+
// src/core/network-adb-node.ts
|
|
4
|
+
var LOOPBACK = "127.0.0.1";
|
|
5
|
+
var ALL_INTERFACES = "::";
|
|
6
|
+
var CHUNK = 16 * 1024;
|
|
7
|
+
var MAX_WRITABLE = 1024 * 1024;
|
|
8
|
+
var OPEN_TIMEOUT_MS = 12e3;
|
|
9
|
+
var activeChannels = /* @__PURE__ */ new WeakSet();
|
|
10
|
+
function clientAllowlist(entries) {
|
|
11
|
+
if (!Array.isArray(entries) || entries.length === 0) throw new RangeError("allowedClients must contain at least one IP or CIDR");
|
|
12
|
+
const allowed = new BlockList();
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
if (typeof entry !== "string") throw new RangeError("invalid allowedClients IP or CIDR");
|
|
15
|
+
const parts = entry.split("/");
|
|
16
|
+
if (parts.length > 2) throw new RangeError("invalid allowedClients IP or CIDR");
|
|
17
|
+
const address = parts[0] ?? "";
|
|
18
|
+
const family = isIP(address);
|
|
19
|
+
if (!family || family === 6 && address.toLowerCase().startsWith("::ffff:")) throw new RangeError("invalid allowedClients IP or CIDR");
|
|
20
|
+
if (parts.length === 1) allowed.addAddress(address, family === 4 ? "ipv4" : "ipv6");
|
|
21
|
+
else {
|
|
22
|
+
const prefixText = parts[1] ?? "";
|
|
23
|
+
const prefix = Number(prefixText);
|
|
24
|
+
if (!/^\d+$/.test(prefixText) || prefix < 1 || prefix > (family === 4 ? 32 : 128)) throw new RangeError("invalid or unrestricted allowedClients CIDR");
|
|
25
|
+
if (family === 6 && prefix <= 96) {
|
|
26
|
+
const subnet = new BlockList();
|
|
27
|
+
subnet.addSubnet(address, prefix, "ipv6");
|
|
28
|
+
if (subnet.check("::ffff:0:0", "ipv6")) throw new RangeError("unrestricted mapped IPv4 range");
|
|
29
|
+
}
|
|
30
|
+
allowed.addSubnet(address, prefix, family === 4 ? "ipv4" : "ipv6");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return allowed;
|
|
34
|
+
}
|
|
35
|
+
async function openNetworkAdbBridge(channel, options = 0) {
|
|
36
|
+
const all = typeof options === "object" && options !== null && options.listen === "all";
|
|
37
|
+
if (typeof options !== "number" && !all) throw new RangeError("invalid ADB listener options");
|
|
38
|
+
const port = typeof options === "number" ? options : options.port ?? 0;
|
|
39
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) throw new RangeError("invalid local ADB port");
|
|
40
|
+
const allowed = all ? clientAllowlist(options.allowedClients) : void 0;
|
|
41
|
+
const host = all ? ALL_INTERFACES : LOOPBACK;
|
|
42
|
+
if (activeChannels.has(channel) || channel.networkAdbState.enabled) throw new Error("ADB grant already in use on this channel");
|
|
43
|
+
activeChannels.add(channel);
|
|
44
|
+
try {
|
|
45
|
+
await channel.setNetworkAdb(true);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
activeChannels.delete(channel);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
const clients = /* @__PURE__ */ new Set();
|
|
51
|
+
const streams = /* @__PURE__ */ new Map();
|
|
52
|
+
let server;
|
|
53
|
+
let closing;
|
|
54
|
+
let unsubscribe;
|
|
55
|
+
const stop = (revoke) => {
|
|
56
|
+
if (closing) return closing;
|
|
57
|
+
unsubscribe?.();
|
|
58
|
+
unsubscribe = void 0;
|
|
59
|
+
for (const client of clients) client.destroy();
|
|
60
|
+
for (const stream of streams.values()) {
|
|
61
|
+
try {
|
|
62
|
+
stream.close();
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
clients.clear();
|
|
67
|
+
streams.clear();
|
|
68
|
+
const srv = server;
|
|
69
|
+
const state = channel.networkAdbState;
|
|
70
|
+
const revokePending = revoke && state.enabled && state.socketConnected ? channel.setNetworkAdb(false).catch(() => {
|
|
71
|
+
if (channel.networkAdbState.enabled && channel.networkAdbState.socketConnected) channel.close();
|
|
72
|
+
}) : Promise.resolve();
|
|
73
|
+
closing = (async () => {
|
|
74
|
+
try {
|
|
75
|
+
if (srv?.listening) await new Promise((resolve) => srv.close(() => resolve()));
|
|
76
|
+
await revokePending;
|
|
77
|
+
} finally {
|
|
78
|
+
activeChannels.delete(channel);
|
|
79
|
+
}
|
|
80
|
+
})();
|
|
81
|
+
return closing;
|
|
82
|
+
};
|
|
83
|
+
const close = () => stop(true);
|
|
84
|
+
try {
|
|
85
|
+
server = createServer((client) => {
|
|
86
|
+
const remote = client.remoteAddress;
|
|
87
|
+
const mappedIPv4 = remote?.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i)?.[1];
|
|
88
|
+
if (allowed && (!remote || !(allowed.check(remote, isIP(remote) === 4 ? "ipv4" : "ipv6") || mappedIPv4 && allowed.check(mappedIPv4, "ipv4")))) {
|
|
89
|
+
client.destroy();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (closing || !channel.networkAdbState.enabled || clients.size >= 1) {
|
|
93
|
+
client.destroy();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
clients.add(client);
|
|
97
|
+
client.setNoDelay(true);
|
|
98
|
+
client.pause();
|
|
99
|
+
const timer = setTimeout(() => client.destroy(), OPEN_TIMEOUT_MS);
|
|
100
|
+
const end = () => {
|
|
101
|
+
clearTimeout(timer);
|
|
102
|
+
clients.delete(client);
|
|
103
|
+
const stream = streams.get(client);
|
|
104
|
+
streams.delete(client);
|
|
105
|
+
try {
|
|
106
|
+
stream?.close();
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
client.once("close", end);
|
|
111
|
+
client.on("error", () => client.destroy());
|
|
112
|
+
void channel.openNetworkAdbTunnel().then((stream) => {
|
|
113
|
+
if (client.destroyed || closing || !channel.networkAdbState.enabled) {
|
|
114
|
+
stream.close();
|
|
115
|
+
client.destroy();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
streams.set(client, stream);
|
|
119
|
+
stream.onClose(() => client.destroy());
|
|
120
|
+
stream.onData((bytes) => {
|
|
121
|
+
if (client.destroyed || bytes.length > MAX_WRITABLE || client.writableLength + bytes.length > MAX_WRITABLE) {
|
|
122
|
+
client.destroy();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
client.write(bytes);
|
|
127
|
+
} catch {
|
|
128
|
+
client.destroy();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
client.on("data", (bytes) => {
|
|
132
|
+
try {
|
|
133
|
+
for (let offset = 0; offset < bytes.length; offset += CHUNK) {
|
|
134
|
+
stream.send(bytes.subarray(offset, Math.min(offset + CHUNK, bytes.length)));
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
client.destroy();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
client.resume();
|
|
141
|
+
}).catch(() => client.destroy()).finally(() => clearTimeout(timer));
|
|
142
|
+
});
|
|
143
|
+
server.maxConnections = 1;
|
|
144
|
+
await new Promise((resolve, reject) => {
|
|
145
|
+
const srv = server;
|
|
146
|
+
const onError = (error) => {
|
|
147
|
+
srv.off("listening", onListening);
|
|
148
|
+
reject(error);
|
|
149
|
+
};
|
|
150
|
+
const onListening = () => {
|
|
151
|
+
srv.off("error", onError);
|
|
152
|
+
resolve();
|
|
153
|
+
};
|
|
154
|
+
srv.once("error", onError);
|
|
155
|
+
srv.once("listening", onListening);
|
|
156
|
+
srv.listen({ host, port, exclusive: true, ...all ? { ipv6Only: false } : {} });
|
|
157
|
+
});
|
|
158
|
+
const address = server.address();
|
|
159
|
+
if (!address || typeof address === "string" || address.address !== host) throw new Error("ADB listener did not bind requested address");
|
|
160
|
+
unsubscribe = channel.on("network_adb", (state) => {
|
|
161
|
+
if (!state.enabled || !state.socketConnected) void stop(false);
|
|
162
|
+
});
|
|
163
|
+
if (!channel.networkAdbState.enabled || !channel.networkAdbState.socketConnected) throw new Error("ADB grant was revoked before listener became ready");
|
|
164
|
+
return { host, port: address.port, close };
|
|
165
|
+
} catch (error) {
|
|
166
|
+
await close();
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { openNetworkAdbBridge };
|
|
@@ -1,15 +1,37 @@
|
|
|
1
|
-
import { A as AixConfig, R as ResolvedConfig, F as FridaEventFrame, S as ScriptletEventFrame,
|
|
1
|
+
import { A as AixConfig, R as ResolvedConfig, F as FridaEventFrame, S as ScriptletEventFrame, a as StatusFrame, O as OutgoingFrame } from './config-C79rcedl.js';
|
|
2
2
|
|
|
3
3
|
declare class DeviceTunnel {
|
|
4
4
|
readonly streamId: string;
|
|
5
5
|
private readonly sink;
|
|
6
|
+
private readonly canSend;
|
|
6
7
|
private readonly dataListeners;
|
|
7
|
-
|
|
8
|
+
private readonly closeListeners;
|
|
9
|
+
private closed;
|
|
10
|
+
private opened;
|
|
11
|
+
private readyResolve?;
|
|
12
|
+
private readyReject?;
|
|
13
|
+
private readyTimer?;
|
|
14
|
+
private readonly readyPromise;
|
|
15
|
+
constructor(streamId: string, sink: (frame: OutgoingFrame) => void, canSend?: () => boolean);
|
|
16
|
+
/** Resolves only when the server confirms this stream opened, never on permission grant. */
|
|
17
|
+
waitReady(timeoutMs?: number): Promise<void>;
|
|
8
18
|
send(bytes: Uint8Array): void;
|
|
9
19
|
onData(cb: (b: Uint8Array) => void): () => void;
|
|
20
|
+
onClose(cb: (reason?: string) => void): () => void;
|
|
21
|
+
_opened(): void;
|
|
10
22
|
_deliver(b: Uint8Array): void;
|
|
23
|
+
_end(reason?: string): void;
|
|
24
|
+
private _clearTimer;
|
|
11
25
|
close(): void;
|
|
12
26
|
}
|
|
27
|
+
/** A node grant for this WebSocket, not proof that an ADB stream or device connected. */
|
|
28
|
+
interface NetworkAdbGrant {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface NetworkAdbState {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
socketConnected: boolean;
|
|
34
|
+
}
|
|
13
35
|
interface AdbResult {
|
|
14
36
|
exit: number | null;
|
|
15
37
|
stdout: string;
|
|
@@ -31,6 +53,12 @@ declare class DeviceChannel {
|
|
|
31
53
|
private readonly scriptletListeners;
|
|
32
54
|
private readonly statusListeners;
|
|
33
55
|
private readonly tunnels;
|
|
56
|
+
private networkAdbEnabled;
|
|
57
|
+
private readonly networkAdbListeners;
|
|
58
|
+
private readonly networkAdbStreams;
|
|
59
|
+
private networkAdbGeneration;
|
|
60
|
+
private networkAdbOperation;
|
|
61
|
+
private networkAdbIntent;
|
|
34
62
|
private constructor();
|
|
35
63
|
static open(cfg: AixConfig | ResolvedConfig, deviceId: string, opts?: {
|
|
36
64
|
prefer?: 'direct' | 'relay';
|
|
@@ -40,6 +68,15 @@ declare class DeviceChannel {
|
|
|
40
68
|
on(event: 'frida_event', cb: (e: Omit<FridaEventFrame, 't'>) => void): () => void;
|
|
41
69
|
on(event: 'scriptlet_event', cb: (e: Omit<ScriptletEventFrame, 't'>) => void): () => void;
|
|
42
70
|
on(event: 'status', cb: (s: Omit<StatusFrame, 't'>) => void): () => void;
|
|
71
|
+
on(event: 'network_adb', cb: (s: NetworkAdbState) => void): () => void;
|
|
72
|
+
/** Permission is scoped to this socket only; an ack does not establish an ADB byte connection. */
|
|
73
|
+
get networkAdbState(): NetworkAdbState;
|
|
74
|
+
private emitNetworkAdb;
|
|
75
|
+
private resetNetworkAdb;
|
|
76
|
+
setNetworkAdb(enabled: boolean): Promise<NetworkAdbGrant>;
|
|
77
|
+
private applyNetworkAdb;
|
|
78
|
+
/** Opens raw ADB bytes on this granted channel, not a local TCP listener. */
|
|
79
|
+
openNetworkAdbTunnel(): Promise<DeviceTunnel>;
|
|
43
80
|
fridaRun(script: string, target?: unknown, spawn?: boolean): Promise<{
|
|
44
81
|
run_id: string;
|
|
45
82
|
}>;
|
|
@@ -51,6 +88,7 @@ declare class DeviceChannel {
|
|
|
51
88
|
scriptletCall(runId: string, method: string, args?: unknown): Promise<unknown>;
|
|
52
89
|
scriptletCancel(runId: string): Promise<unknown>;
|
|
53
90
|
protected onMessage(text: string): void;
|
|
91
|
+
private endTunnel;
|
|
54
92
|
openTunnel(kind: 'adb' | 'wda' | 'frida' | 'tcp', addr?: string): DeviceTunnel;
|
|
55
93
|
adbExec(argv: string[], o?: {
|
|
56
94
|
timeoutMs?: number;
|
|
@@ -59,56 +97,4 @@ declare class DeviceChannel {
|
|
|
59
97
|
close(): void;
|
|
60
98
|
}
|
|
61
99
|
|
|
62
|
-
type
|
|
63
|
-
/** A normalized streaming event from a running script (engine-agnostic). */
|
|
64
|
-
interface ScriptEvent {
|
|
65
|
-
runId: string;
|
|
66
|
-
name: string;
|
|
67
|
-
data: unknown;
|
|
68
|
-
}
|
|
69
|
-
type ScriptDebuggerOptions = {
|
|
70
|
-
engine: 'frida' | 'scriptlet';
|
|
71
|
-
channel: DeviceChannel;
|
|
72
|
-
} | {
|
|
73
|
-
engine: 'flow';
|
|
74
|
-
cfg: AixConfig | ResolvedConfig;
|
|
75
|
-
};
|
|
76
|
-
interface ScriptRunInput {
|
|
77
|
-
script?: string;
|
|
78
|
-
/** scriptlet: flow/vars object injected as JS `vars`. */
|
|
79
|
-
vars?: unknown;
|
|
80
|
-
/** frida: attach target (e.g. `{ pid }`). */
|
|
81
|
-
target?: unknown;
|
|
82
|
-
/** frida: spawn+resume instead of attach. */
|
|
83
|
-
spawn?: boolean;
|
|
84
|
-
flow?: unknown;
|
|
85
|
-
scriptId?: string;
|
|
86
|
-
deviceIds?: string[];
|
|
87
|
-
params?: unknown;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Unified run/call/cancel + event facade over a single script engine on a
|
|
91
|
-
* `DeviceChannel`. `frida`, `scriptlet`, and `flow` are supported.
|
|
92
|
-
* One debugger drives one run at a time; `run()` replaces any previous run's
|
|
93
|
-
* event subscription.
|
|
94
|
-
*/
|
|
95
|
-
declare class ScriptDebugger {
|
|
96
|
-
private readonly opts;
|
|
97
|
-
private runId;
|
|
98
|
-
private unsub;
|
|
99
|
-
private flow;
|
|
100
|
-
private readonly listeners;
|
|
101
|
-
constructor(opts: ScriptDebuggerOptions);
|
|
102
|
-
get engine(): ScriptEngine;
|
|
103
|
-
get currentRunId(): string | null;
|
|
104
|
-
on(_event: 'event', cb: (e: ScriptEvent) => void): () => void;
|
|
105
|
-
run(input: ScriptRunInput): Promise<{
|
|
106
|
-
runId: string;
|
|
107
|
-
}>;
|
|
108
|
-
call(method: string, args?: unknown): Promise<unknown>;
|
|
109
|
-
cancel(): Promise<void>;
|
|
110
|
-
private attachChannel;
|
|
111
|
-
private detach;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { type AdbResult as A, DeviceChannel as D, type ScriptEvent as S, type WdaResult as W, type ScriptEngine as a, DeviceTunnel as b, ScriptDebugger as c, type ScriptDebuggerOptions as d, type ScriptRunInput as e };
|
|
100
|
+
export { type AdbResult as A, DeviceChannel as D, type NetworkAdbGrant as N, type WdaResult as W, DeviceTunnel as a, type NetworkAdbState as b };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceRow } from './types-
|
|
1
|
+
import { D as DeviceRow } from './types-CBI5SIH5.js';
|
|
2
2
|
|
|
3
3
|
/** One backend device row as a transport of a (possibly de-duplicated) physical
|
|
4
4
|
* device. The same phone reachable over both USB and WiFi yields two rows with
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeviceSession, pullFile, pushFile } from './chunk-OJK35AQD.js';
|
package/dist/i18n/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AixI18nProvider, useAixLang, useAixT } from '../chunk-
|
|
1
|
+
export { AixI18nProvider, useAixLang, useAixT } from '../chunk-HQ2L4NQ2.js';
|