@aixnn/aixautots 0.5.3 → 0.5.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.
@@ -0,0 +1,487 @@
1
+ import * as react from 'react';
2
+ import react__default, { ReactNode } from 'react';
3
+ import { A as AixConfig, R as ResolvedConfig, c as AixClient, e as EnvEventKind, q as EnvFinished, t as EnvSetupInput, x as EnvTeardownInput, E as EnvOs } from '../config-fsx4jlLK.js';
4
+ import { D as DeviceChannel, A as AdbResult, W as WdaResult, S as ScriptEvent, e as ScriptRunInput } from '../script-debugger-Cu_coj-h.js';
5
+ import { F as FlowEvent, b as FlowSubmit, B as BatchConfig } from '../automation-queue-CKsueO9z.js';
6
+ import { M as MirrorSession, I as InputMessage, b as ScrcpyProfileName } from '../mirror-session-DM-trg1F.js';
7
+ import { w as AuthResult, aH as SendCodeResult, a$ as VerifyCodeResult, ap as Project, I as CreateProjectInput, J as CreateProjectResult, am as PowerAction, aG as ScreenshotResult, X as ElementNode, D as DeviceRow, N as NodeRow, ah as NodeScope, aF as RegisterNodeResult, ag as NodeOwnerPolicy, aL as Shortcut, ae as NewShortcut, aN as ShortcutRunResult, an as PowerRunResult, f as ScriptSummary, S as Script, E as Cluster, G as CreateClusterInput, Z as FleetRunDetail, Y as FleetMode, d as AgentTaskBlocker, e as AgentTaskEvidence, aT as TaskStatus, aV as TaskSummary, aR as TaskListFilter, b0 as WebhookConfig, L as CreateWebhookInput, aE as RegisterNodeInput, ab as Locator, H as CreateLocatorInput, a0 as ImageArtifact, a1 as ImageInput, aa as LlmTestResult, U as DeviceRate, aB as RateInput, y as BillingPlan, aj as PlanInput, V as DeviceUsageSession, aC as RebateLedgerRow, x as BalanceResp, aX as TopupInput, aY as TopupResult, q as ApiTokenRow, K as CreateTokenInput, M as CreatedToken } from '../types-C2WXVcam.js';
8
+ import { a as TaskAgentDevice, b as TaskAgentDeviceStatus, T as TaskAgentRunner } from '../task-agent-runner-CMq9Cir1.js';
9
+ export { D as Device, i as DevicesProvider, j as DevicesProviderProps, k as DevicesView, c as TaskAgentNodeSnapshot, d as TaskAgentPreflightResult, e as TaskAgentRunRequest, f as TaskAgentStreamEvent, g as TaskAgentTarget, m as mapDevice, p as preflightTaskAgentDevice, u as useDevicesView } from '../task-agent-runner-CMq9Cir1.js';
10
+ import { L as LogEntry } from '../use-script-run-Diay7ibY.js';
11
+ export { b as LogLevel, S as ScriptRunStatus, a as StepEvent, U as UseScriptRun, u as useScriptRun } from '../use-script-run-Diay7ibY.js';
12
+ import { A as AgentKind } from '../agent-runner-V60B0is1.js';
13
+ import '../device-normalize-BaThgnH7.js';
14
+
15
+ declare function AixProvider({ config, children }: {
16
+ config: AixConfig;
17
+ children: react__default.ReactNode;
18
+ }): react__default.JSX.Element;
19
+ declare function useAixConfig(): ResolvedConfig;
20
+
21
+ interface UseDevice {
22
+ deviceId: string;
23
+ channel: DeviceChannel | null;
24
+ error: Error | null;
25
+ }
26
+ declare function useDevice(deviceId: string): UseDevice;
27
+
28
+ interface UseCommands {
29
+ ready: boolean;
30
+ loading: boolean;
31
+ error: Error | null;
32
+ lastResult: AdbResult | WdaResult | null;
33
+ adb(argv: string[], opts?: {
34
+ timeoutMs?: number;
35
+ }): Promise<AdbResult>;
36
+ wda(method: string, path: string, body?: unknown): Promise<WdaResult>;
37
+ }
38
+ declare function useCommands(deviceId: string): UseCommands;
39
+
40
+ interface UseScript {
41
+ ready: boolean;
42
+ running: boolean;
43
+ runId: string | null;
44
+ events: ScriptEvent[];
45
+ error: Error | null;
46
+ run(input: ScriptRunInput): Promise<{
47
+ runId: string;
48
+ }>;
49
+ call(method: string, args?: unknown): Promise<unknown>;
50
+ cancel(): Promise<void>;
51
+ clearEvents(): void;
52
+ }
53
+ declare function useScript(deviceId: string, opts: {
54
+ engine: 'frida' | 'scriptlet';
55
+ }): UseScript;
56
+
57
+ interface UseFlowRun {
58
+ taskId: string | null;
59
+ events: FlowEvent[];
60
+ done: boolean;
61
+ error: Error | null;
62
+ submit(body: FlowSubmit): Promise<{
63
+ taskId: string;
64
+ }>;
65
+ close(): void;
66
+ }
67
+ declare function useFlowRun(): UseFlowRun;
68
+
69
+ interface UseMirror {
70
+ session: MirrorSession | null;
71
+ stream: MediaStream | null;
72
+ error: Error | null;
73
+ sendInput(msg: InputMessage): void;
74
+ /** Switch the device encode profile (node restarts its capture pipeline). */
75
+ setQuality(profile: ScrcpyProfileName): void;
76
+ }
77
+ declare function useMirror(sessionId: string): UseMirror;
78
+
79
+ /** 一次群控的软上限:每台设备一条 WebRTC 连接,浏览器并发与带宽有限。超出的
80
+ * id 被截断并 console.warn。 */
81
+ declare const GROUP_MIRROR_MAX = 9;
82
+ interface UseGroupMirror {
83
+ /** device id → live MediaStream(按各设备出流时间陆续填充)。 */
84
+ streams: Map<string, MediaStream>;
85
+ /** device id → join/连接错误(其余设备不受影响)。 */
86
+ errors: Map<string, Error>;
87
+ /** 已成功 join 的会话数(含尚未出流的)。 */
88
+ connected: number;
89
+ /** 把一条控制消息扇出到所有已连接设备。坐标为 [0,1] 归一化,天然适配
90
+ * 不同分辨率(各节点自行缩放到 px)。 */
91
+ broadcastInput(msg: InputMessage): void;
92
+ /** 所有已连接设备统一切画质档位。 */
93
+ setQualityAll(profile: ScrcpyProfileName): void;
94
+ }
95
+ declare function useGroupMirror(ids: string[]): UseGroupMirror;
96
+
97
+ /** The shared, memoized resource client for the current `<AixProvider>` config. */
98
+ declare function useClient(): AixClient;
99
+ interface Query<T> {
100
+ data: T | null;
101
+ loading: boolean;
102
+ error: Error | null;
103
+ refetch: () => Promise<void>;
104
+ setData: (updater: (prev: T | null) => T | null) => void;
105
+ }
106
+ /** Run an async loader on mount (and when `deps` change), tracking
107
+ * loading/error and exposing a `refetch`. Safe against unmount. */
108
+ declare function useQuery<T>(loader: () => Promise<T>, deps: unknown[]): Query<T>;
109
+
110
+ interface UseAuth {
111
+ login(email: string, password: string): Promise<AuthResult>;
112
+ register(email: string, password: string): Promise<AuthResult>;
113
+ sendCode(email: string): Promise<SendCodeResult>;
114
+ verifyCode(email: string, code: string): Promise<VerifyCodeResult>;
115
+ setPassword(password: string): Promise<void>;
116
+ projectUser(projectId: string): Promise<{
117
+ token: string;
118
+ user_id: string;
119
+ project_id: string;
120
+ }>;
121
+ }
122
+ /** Auth flows. Token persistence/caching is the app's responsibility — wire the
123
+ * returned tokens back into the `AixConfig.auth` credential closures. */
124
+ declare function useAuth(): UseAuth;
125
+
126
+ interface UseProjects extends Query<Project[]> {
127
+ create(input: CreateProjectInput): Promise<CreateProjectResult>;
128
+ remove(id: string): Promise<void>;
129
+ rotateSecret(id: string): Promise<string>;
130
+ }
131
+ declare function useProjects(): UseProjects;
132
+
133
+ type UseDevices = Query<DeviceRow[]>;
134
+ /** List the caller's devices (raw backend rows; map to UI shape in the app). */
135
+ declare function useDevices(): UseDevices;
136
+ interface UseDeviceActions {
137
+ power(action: PowerAction, extra?: Record<string, unknown>): Promise<unknown>;
138
+ control(op: Record<string, unknown>): Promise<unknown>;
139
+ installApkUrl(url: string): Promise<unknown>;
140
+ lease(): Promise<unknown>;
141
+ release(): Promise<unknown>;
142
+ claim(): Promise<unknown>;
143
+ screenshot(): Promise<ScreenshotResult>;
144
+ captureUiTree(): Promise<ElementNode>;
145
+ }
146
+ /** Imperative live-device actions for one device id. */
147
+ declare function useDeviceActions(deviceId: string): UseDeviceActions;
148
+
149
+ interface NodesView {
150
+ nodes: NodeRow[];
151
+ loading: boolean;
152
+ error: string | null;
153
+ fetchNodes: () => Promise<void>;
154
+ /** Background refetch: updates `nodes` without toggling `loading` or
155
+ * clobbering `error`, so pollers don't flicker the UI. */
156
+ refreshNodes: () => Promise<void>;
157
+ createNode: (name: string, scope: NodeScope, region?: string) => Promise<RegisterNodeResult>;
158
+ updateNode: (id: string, patch: {
159
+ name?: string;
160
+ scope?: NodeScope;
161
+ region?: string | null;
162
+ owner_policy?: NodeOwnerPolicy;
163
+ }) => Promise<void>;
164
+ rotateToken: (id: string) => Promise<RegisterNodeResult>;
165
+ removeNode: (id: string) => Promise<void>;
166
+ }
167
+ interface NodesProviderProps {
168
+ children: ReactNode;
169
+ /** Fetch the list on mount (default true). */
170
+ autoFetch?: boolean;
171
+ }
172
+ declare function NodesProvider({ children, autoFetch }: NodesProviderProps): react.FunctionComponentElement<react.ProviderProps<NodesView | null>>;
173
+ /** Access the shared nodes view. Must be inside a `<NodesProvider>`. */
174
+ declare function useNodesView(): NodesView;
175
+
176
+ interface ShortcutsView {
177
+ shortcuts: Shortcut[];
178
+ loading: boolean;
179
+ error: string | null;
180
+ fetch: (platform?: 'android' | 'ios' | 'any') => Promise<void>;
181
+ create: (body: NewShortcut) => Promise<Shortcut | null>;
182
+ update: (id: string, body: NewShortcut) => Promise<Shortcut | null>;
183
+ remove: (id: string) => Promise<void>;
184
+ /** Run a shortcut (a parameterised function script) on the given devices via a
185
+ * Broadcast fleet run, then poll the run to a terminal state so the caller
186
+ * gets a real receipt (per-device status/output). Returns `null` when there
187
+ * are no target devices. The run keeps going server-side if polling times out
188
+ * (`result.timedOut === true`). */
189
+ runShortcut: (shortcut: Shortcut, values: Record<string, unknown>, deviceIds: string[]) => Promise<ShortcutRunResult | null>;
190
+ /** Run a power-kind shortcut: call the backend power API per device and return
191
+ * a per-device receipt (`ok` + raw `result`, or `error` on rejection). The
192
+ * backend awaits the node, so `ok` reflects whether the op actually ran. */
193
+ runPower: (shortcut: Shortcut, deviceIds: string[]) => Promise<PowerRunResult[]>;
194
+ }
195
+ interface ShortcutsProviderProps {
196
+ children: ReactNode;
197
+ }
198
+ declare function ShortcutsProvider({ children }: ShortcutsProviderProps): react.FunctionComponentElement<react.ProviderProps<ShortcutsView | null>>;
199
+ /** Access the shared shortcuts view. Must be inside a `<ShortcutsProvider>`. */
200
+ declare function useShortcutsView(): ShortcutsView;
201
+
202
+ interface UseScripts extends Query<ScriptSummary[]> {
203
+ get(id: string): Promise<Script>;
204
+ save(script: Script): Promise<unknown>;
205
+ remove(id: string): Promise<void>;
206
+ duplicate(id: string): Promise<ScriptSummary>;
207
+ setVisibility(id: string, visibility: string): Promise<ScriptSummary>;
208
+ }
209
+ /** Stored script (flow) library CRUD. */
210
+ declare function useScripts(): UseScripts;
211
+
212
+ interface UseClusters extends Query<Cluster[]> {
213
+ create(input: CreateClusterInput): Promise<Cluster>;
214
+ remove(id: string): Promise<void>;
215
+ setDevices(id: string, deviceIds: string[]): Promise<Cluster>;
216
+ run(id: string, flow: unknown): Promise<{
217
+ run_id: string;
218
+ }>;
219
+ }
220
+ declare function useClusters(): UseClusters;
221
+
222
+ type FleetStatus = 'idle' | 'running' | 'paused' | 'completed' | 'failed';
223
+ interface UseFleetRun {
224
+ runId: string | null;
225
+ status: FleetStatus;
226
+ progress: number;
227
+ detail: FleetRunDetail | null;
228
+ error: Error | null;
229
+ start(script: Script, deviceIds: string[], mode?: FleetMode): Promise<string>;
230
+ cancel(): Promise<void>;
231
+ pause(): Promise<void>;
232
+ resume(): Promise<void>;
233
+ reset(): void;
234
+ }
235
+ /** Submit a fleet run and poll per-device progress until terminal. */
236
+ declare function useFleetRun(pollMs?: number): UseFleetRun;
237
+
238
+ interface TaskAgentDeviceRun extends TaskAgentDevice {
239
+ /** Stable backend target id. Controls always address this id, never a device id. */
240
+ targetId?: string;
241
+ /** Current immutable attempt id, replaced only when the backend creates a retry. */
242
+ attemptId?: string;
243
+ status: TaskAgentDeviceStatus;
244
+ error?: string;
245
+ blocker?: AgentTaskBlocker | null;
246
+ evidence: AgentTaskEvidence[];
247
+ }
248
+ interface UseTaskAgentRun {
249
+ runId: string | null;
250
+ agent: AgentKind;
251
+ concurrency: number;
252
+ devices: TaskAgentDeviceRun[];
253
+ logs: LogEntry[];
254
+ error: string | null;
255
+ running: boolean;
256
+ start(input: {
257
+ agent: AgentKind;
258
+ devices: TaskAgentDevice[];
259
+ prompt: string;
260
+ concurrency: number;
261
+ }): Promise<void>;
262
+ resume(runId: string, devices: TaskAgentDevice[]): Promise<void>;
263
+ cancelAll(): Promise<void>;
264
+ cancelDevice(deviceId: string): Promise<void>;
265
+ retryDevice(deviceId: string): Promise<void>;
266
+ approveDevice(deviceId: string): Promise<void>;
267
+ clearLogs(): void;
268
+ reset(): void;
269
+ }
270
+ /**
271
+ * State adapter for a task-agent runner. It owns cursor-safe stream aggregation
272
+ * while the runner submits and controls node-backed tasks, so web hosts never
273
+ * acquire a Tauri dependency.
274
+ */
275
+ declare function useTaskAgentRun(runner?: TaskAgentRunner): UseTaskAgentRun;
276
+
277
+ interface UseTaskStatus {
278
+ data: TaskStatus | null;
279
+ loading: boolean;
280
+ error: Error | null;
281
+ done: boolean;
282
+ refetch: () => Promise<void>;
283
+ }
284
+ /** Read a webhook task's status. Polls until terminal when `pollMs > 0`;
285
+ * TanStack-friendly — also exposes `refetch` for manual/external control. */
286
+ declare function useTaskStatus(taskId: string | null, pollMs?: number): UseTaskStatus;
287
+
288
+ interface UseTasks extends Query<TaskSummary[]> {
289
+ cancel(id: string): Promise<void>;
290
+ }
291
+ /** List webhook tasks (newest first), with optional device/status filter. */
292
+ declare function useTasks(filter?: TaskListFilter): UseTasks;
293
+
294
+ interface UseAutomationQueue extends UseTasks {
295
+ /** 展开并提交一个批次(rows×mode → 多次 `/api/webhook/tasks`),返回 task id
296
+ * 数组,并刷新队列列表。见 `core/automation-queue` 的 `submitBatch`。 */
297
+ submitBatch(config: BatchConfig): Promise<string[]>;
298
+ /** 暂停一个任务(still-pending 目标 → paused),刷新列表。 */
299
+ pause(id: string): Promise<void>;
300
+ /** 恢复一个被暂停的任务(paused → pending),刷新列表。 */
301
+ resume(id: string): Promise<void>;
302
+ }
303
+ /** 自动化队列 hook:复用 `useTasks`(列表/轮询/cancel),再叠加批次提交与
304
+ * 暂停/恢复。webhook 入站任务与本地批次落同一张表 → 同一队列统一展示。 */
305
+ declare function useAutomationQueue(filter?: TaskListFilter): UseAutomationQueue;
306
+
307
+ interface UseInspector {
308
+ screenshot: string | null;
309
+ tree: ElementNode | null;
310
+ selected: ElementNode | null;
311
+ loading: boolean;
312
+ error: Error | null;
313
+ captureScreenshot(): Promise<void>;
314
+ captureTree(): Promise<void>;
315
+ refresh(): Promise<void>;
316
+ select(el: ElementNode | null): void;
317
+ }
318
+ /** Capture a device screenshot + UI tree via the live-op proxy. */
319
+ declare function useInspector(deviceId: string | null): UseInspector;
320
+
321
+ /** A locator probe result — the device-op `find_elements` returns the lighter
322
+ * `Element` shape (rect + identity, NO xpath/children) used for highlight. */
323
+ interface MatchElement {
324
+ rect: {
325
+ x: number;
326
+ y: number;
327
+ width: number;
328
+ height: number;
329
+ };
330
+ label: string | null;
331
+ text: string | null;
332
+ resource_id: string | null;
333
+ class_name: string | null;
334
+ }
335
+ /** A device-side `Locator` — serde tag/value pair the node deserializes. */
336
+ interface InspectorLocator {
337
+ strategy: string;
338
+ value: string;
339
+ }
340
+ interface InspectorView {
341
+ screenshot: string | null;
342
+ tree: ElementNode | null;
343
+ selectedElement: ElementNode | null;
344
+ loading: boolean;
345
+ error: string | null;
346
+ /** Last verified locator + its live matches (highlighted on the screenshot). */
347
+ verifyLocator: InspectorLocator | null;
348
+ matches: MatchElement[];
349
+ verifying: boolean;
350
+ recording: boolean;
351
+ /** Recorded automation lines — each is one `device.*` TS statement. */
352
+ recordedLines: string[];
353
+ captureScreenshot: () => Promise<void>;
354
+ captureTree: () => Promise<void>;
355
+ selectElement: (el: ElementNode | null) => void;
356
+ refresh: () => Promise<void>;
357
+ /** Clear captured state (used when switching devices). */
358
+ reset: () => void;
359
+ tap: (x: number, y: number) => Promise<void>;
360
+ inputText: (text: string) => Promise<void>;
361
+ pressKey: (key: string) => Promise<void>;
362
+ swipe: (x1: number, y1: number, x2: number, y2: number, duration?: number) => Promise<void>;
363
+ longPress: (x: number, y: number, durationSecs?: number) => Promise<void>;
364
+ verify: (strategy: string, value: string) => Promise<void>;
365
+ clearMatches: () => void;
366
+ setRecording: (on: boolean) => void;
367
+ recordLine: (line: string) => void;
368
+ removeLine: (index: number) => void;
369
+ clearRecording: () => void;
370
+ }
371
+ interface InspectorProviderProps {
372
+ children: ReactNode;
373
+ }
374
+ declare function InspectorProvider({ children }: InspectorProviderProps): react.FunctionComponentElement<react.ProviderProps<InspectorView | null>>;
375
+ /** Access the shared inspector view. Must be inside an `<InspectorProvider>`. */
376
+ declare function useInspectorView(): InspectorView;
377
+
378
+ interface UseWebhooks extends Query<WebhookConfig[]> {
379
+ create(input: CreateWebhookInput): Promise<void>;
380
+ setEnabled(id: string, enabled: boolean): Promise<void>;
381
+ remove(id: string): Promise<void>;
382
+ trigger(eventType: string, payload?: unknown): Promise<void>;
383
+ }
384
+ declare function useWebhooks(): UseWebhooks;
385
+
386
+ interface UseNodes extends Query<NodeRow[]> {
387
+ register(input: string | RegisterNodeInput): Promise<RegisterNodeResult>;
388
+ }
389
+ declare function useNodes(): UseNodes;
390
+
391
+ interface UseEnvRun {
392
+ reqId: string | null;
393
+ events: EnvEventKind[];
394
+ /** The terminal `finished` frame once it arrives (carries ok/result/error). */
395
+ finished: EnvFinished | null;
396
+ done: boolean;
397
+ error: Error | null;
398
+ setup(nodeId: string, input?: EnvSetupInput): Promise<{
399
+ reqId: string;
400
+ }>;
401
+ status(nodeId: string, input?: {
402
+ os?: EnvSetupInput['os'];
403
+ }): Promise<{
404
+ reqId: string;
405
+ }>;
406
+ teardown(nodeId: string, input?: EnvTeardownInput): Promise<{
407
+ reqId: string;
408
+ }>;
409
+ close(): void;
410
+ }
411
+ /** Trigger + stream a node's env-base setup/status/teardown. Reuses the SDK's
412
+ * `EnvRun`, which itself reuses the shared `/ws/execution` relay — no new WS. */
413
+ declare function useEnvRun(): UseEnvRun;
414
+
415
+ interface UseEnvGate {
416
+ os: EnvOs | null;
417
+ /** null until the first probe resolves; then true iff the base is missing. */
418
+ needsSetup: boolean | null;
419
+ ready: boolean;
420
+ probing: boolean;
421
+ error: Error | null;
422
+ open: boolean;
423
+ setOpen(o: boolean): void;
424
+ /** Status-probe events — pass as `seedEvents` to <EnvInitDialog>. */
425
+ statusEvents: EnvEventKind[];
426
+ /** Re-run the probe (e.g. after setup completes, to confirm readiness). */
427
+ refresh(): void;
428
+ }
429
+ declare function useEnvGate(nodeId: string | null, opts?: {
430
+ os?: EnvOs | null;
431
+ autoOpen?: boolean;
432
+ }): UseEnvGate;
433
+
434
+ interface UseLocators extends Query<Locator[]> {
435
+ create(input: CreateLocatorInput): Promise<Locator>;
436
+ remove(id: string): Promise<void>;
437
+ }
438
+ declare function useLocators(): UseLocators;
439
+
440
+ interface UseImages extends Query<ImageArtifact[]> {
441
+ upsert(input: ImageInput): Promise<ImageArtifact>;
442
+ setActive(id: string, active: boolean): Promise<void>;
443
+ remove(id: string): Promise<void>;
444
+ }
445
+ declare function useImages(): UseImages;
446
+
447
+ interface UseLlm {
448
+ test(opts?: {
449
+ token?: string;
450
+ model?: string;
451
+ }): Promise<LlmTestResult>;
452
+ }
453
+ declare function useLlm(): UseLlm;
454
+
455
+ interface UseAdmin {
456
+ listRates(): Promise<DeviceRate[]>;
457
+ upsertRate(body: RateInput): Promise<DeviceRate>;
458
+ listPlans(): Promise<BillingPlan[]>;
459
+ createPlan(body: PlanInput): Promise<BillingPlan>;
460
+ usage(): Promise<DeviceUsageSession[]>;
461
+ ledger(): Promise<RebateLedgerRow[]>;
462
+ setRebate(projectId: string, ratio: number): Promise<unknown>;
463
+ setNodePlatform(nodeId: string, isPlatform: boolean): Promise<unknown>;
464
+ }
465
+ /** Imperative admin/billing operations (admin-scoped). Pair with `useImages`
466
+ * for the image catalog. */
467
+ declare function useAdmin(): UseAdmin;
468
+
469
+ interface UseBilling extends Query<BalanceResp> {
470
+ /** 充值到指定用户钱包(admin scope),成功后刷新余额。 */
471
+ topup(input: TopupInput): Promise<TopupResult>;
472
+ }
473
+ /** 当前钱包余额 + 最近流水;`topup` 充值后自动刷新。 */
474
+ declare function useBilling(): UseBilling;
475
+
476
+ interface UseApiTokens extends Query<ApiTokenRow[]> {
477
+ /** 创建一个 PAT;返回值含明文 `token`(仅此一次)。成功后刷新列表。 */
478
+ create(input: CreateTokenInput): Promise<CreatedToken>;
479
+ /** 撤销一个 PAT,成功后刷新列表。 */
480
+ revoke(id: string): Promise<void>;
481
+ /** 轮换一个 PAT;返回新明文 `token`。成功后刷新列表。 */
482
+ rotate(id: string): Promise<CreatedToken>;
483
+ }
484
+ /** 名下用户 PAT 列表 + 创建/撤销/轮换(改完刷新列表)。 */
485
+ declare function useApiTokens(): UseApiTokens;
486
+
487
+ export { AixProvider, ElementNode, type FleetStatus, GROUP_MIRROR_MAX, type InspectorLocator, InspectorProvider, type InspectorProviderProps, type InspectorView, LogEntry, type MatchElement, NodesProvider, type NodesProviderProps, type NodesView, type Query, ShortcutsProvider, type ShortcutsProviderProps, type ShortcutsView, TaskAgentDevice, type TaskAgentDeviceRun, TaskAgentDeviceStatus, TaskAgentRunner, type UseAdmin, type UseApiTokens, type UseAuth, type UseAutomationQueue, type UseBilling, type UseClusters, type UseCommands, type UseDevice, type UseDeviceActions, type UseDevices, type UseEnvGate, type UseEnvRun, type UseFleetRun, type UseFlowRun, type UseGroupMirror, type UseImages, type UseInspector, type UseLlm, type UseLocators, type UseMirror, type UseNodes, type UseProjects, type UseScript, type UseScripts, type UseTaskAgentRun, type UseTaskStatus, type UseTasks, type UseWebhooks, useAdmin, useAixConfig, useApiTokens, useAuth, useAutomationQueue, useBilling, useClient, useClusters, useCommands, useDevice, useDeviceActions, useDevices, useEnvGate, useEnvRun, useFleetRun, useFlowRun, useGroupMirror, useImages, useInspector, useInspectorView, useLlm, useLocators, useMirror, useNodes, useNodesView, useProjects, useQuery, useScript, useScripts, useShortcutsView, useTaskAgentRun, useTaskStatus, useTasks, useWebhooks };
@@ -0,0 +1,114 @@
1
+ import { A as AixConfig, R as ResolvedConfig, F as FridaEventFrame, S as ScriptletEventFrame, b as StatusFrame, O as OutgoingFrame } from './config-fsx4jlLK.js';
2
+
3
+ declare class DeviceTunnel {
4
+ readonly streamId: string;
5
+ private readonly sink;
6
+ private readonly dataListeners;
7
+ constructor(streamId: string, sink: (frame: OutgoingFrame) => void);
8
+ send(bytes: Uint8Array): void;
9
+ onData(cb: (b: Uint8Array) => void): () => void;
10
+ _deliver(b: Uint8Array): void;
11
+ close(): void;
12
+ }
13
+ interface AdbResult {
14
+ exit: number | null;
15
+ stdout: string;
16
+ stderr: string;
17
+ stdout_b64: string;
18
+ }
19
+ interface WdaResult {
20
+ status: number;
21
+ body: unknown;
22
+ }
23
+ declare class DeviceChannel {
24
+ private readonly cfg;
25
+ readonly deviceId: string;
26
+ private readonly pending;
27
+ private corr;
28
+ private socketRef;
29
+ private channelClosed;
30
+ private readonly fridaListeners;
31
+ private readonly scriptletListeners;
32
+ private readonly statusListeners;
33
+ private readonly tunnels;
34
+ private constructor();
35
+ static open(cfg: AixConfig | ResolvedConfig, deviceId: string, opts?: {
36
+ prefer?: 'direct' | 'relay';
37
+ }): Promise<DeviceChannel>;
38
+ private nextId;
39
+ private request;
40
+ on(event: 'frida_event', cb: (e: Omit<FridaEventFrame, 't'>) => void): () => void;
41
+ on(event: 'scriptlet_event', cb: (e: Omit<ScriptletEventFrame, 't'>) => void): () => void;
42
+ on(event: 'status', cb: (s: Omit<StatusFrame, 't'>) => void): () => void;
43
+ fridaRun(script: string, target?: unknown, spawn?: boolean): Promise<{
44
+ run_id: string;
45
+ }>;
46
+ fridaCall(runId: string, method: string, args?: unknown): Promise<unknown>;
47
+ fridaCancel(runId: string): Promise<unknown>;
48
+ scriptletRun(script: string, vars?: unknown): Promise<{
49
+ run_id: string;
50
+ }>;
51
+ scriptletCall(runId: string, method: string, args?: unknown): Promise<unknown>;
52
+ scriptletCancel(runId: string): Promise<unknown>;
53
+ protected onMessage(text: string): void;
54
+ openTunnel(kind: 'adb' | 'wda' | 'frida' | 'tcp', addr?: string): DeviceTunnel;
55
+ adbExec(argv: string[], o?: {
56
+ timeoutMs?: number;
57
+ }): Promise<AdbResult>;
58
+ wdaReq(method: string, path: string, body?: unknown): Promise<WdaResult>;
59
+ close(): void;
60
+ }
61
+
62
+ type ScriptEngine = 'frida' | 'scriptlet' | 'flow';
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 };