remote-webview-debugger 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/CHANGELOG.zh-CN.md +66 -0
  3. package/LICENSE +21 -0
  4. package/NOTICE +17 -0
  5. package/README.ar.md +185 -0
  6. package/README.de.md +169 -0
  7. package/README.es.md +169 -0
  8. package/README.fr.md +169 -0
  9. package/README.ja.md +169 -0
  10. package/README.ko.md +169 -0
  11. package/README.md +167 -2
  12. package/README.pt-BR.md +169 -0
  13. package/README.ru.md +169 -0
  14. package/README.zh-CN.md +169 -0
  15. package/README.zh-TW.md +169 -0
  16. package/dist/index.d.ts +368 -0
  17. package/dist/index.mjs +8319 -0
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/locales/ar.d.ts +4 -0
  20. package/dist/locales/ar.js +2 -0
  21. package/dist/locales/ar.mjs +150 -0
  22. package/dist/locales/ar.mjs.map +1 -0
  23. package/dist/locales/de.d.ts +4 -0
  24. package/dist/locales/de.js +2 -0
  25. package/dist/locales/de.mjs +150 -0
  26. package/dist/locales/de.mjs.map +1 -0
  27. package/dist/locales/es.d.ts +4 -0
  28. package/dist/locales/es.js +2 -0
  29. package/dist/locales/es.mjs +150 -0
  30. package/dist/locales/es.mjs.map +1 -0
  31. package/dist/locales/fr.d.ts +4 -0
  32. package/dist/locales/fr.js +2 -0
  33. package/dist/locales/fr.mjs +150 -0
  34. package/dist/locales/fr.mjs.map +1 -0
  35. package/dist/locales/ja.d.ts +4 -0
  36. package/dist/locales/ja.js +2 -0
  37. package/dist/locales/ja.mjs +150 -0
  38. package/dist/locales/ja.mjs.map +1 -0
  39. package/dist/locales/ko.d.ts +4 -0
  40. package/dist/locales/ko.js +2 -0
  41. package/dist/locales/ko.mjs +156 -0
  42. package/dist/locales/ko.mjs.map +1 -0
  43. package/dist/locales/pt.d.ts +4 -0
  44. package/dist/locales/pt.js +2 -0
  45. package/dist/locales/pt.mjs +150 -0
  46. package/dist/locales/pt.mjs.map +1 -0
  47. package/dist/locales/ru.d.ts +4 -0
  48. package/dist/locales/ru.js +2 -0
  49. package/dist/locales/ru.mjs +150 -0
  50. package/dist/locales/ru.mjs.map +1 -0
  51. package/dist/locales/zh-TW.d.ts +4 -0
  52. package/dist/locales/zh-TW.js +2 -0
  53. package/dist/locales/zh-TW.mjs +150 -0
  54. package/dist/locales/zh-TW.mjs.map +1 -0
  55. package/dist/sdk.js +42 -0
  56. package/dist/sdk.js.map +1 -0
  57. package/package.json +76 -4
@@ -0,0 +1,368 @@
1
+ declare const AGENT_EN: {
2
+ missingParam: (name: string) => string;
3
+ notString: (name: string) => string;
4
+ unknownMethod: (method: string) => string;
5
+ needLevel: (level: string) => string;
6
+ takenOver: string;
7
+ userDenied: string;
8
+ confirmBusy: string;
9
+ unknownModifier: (m: string) => string;
10
+ unknownKey: (key: string) => string;
11
+ refNotInSnapshot: (ref: string) => string;
12
+ refDetached: (ref: string) => string;
13
+ queryNeedsCriteria: string;
14
+ noSuchRecord: (seq: string) => string;
15
+ noSuchSession: (id: string) => string;
16
+ noSessionLog: string;
17
+ sessionLogUnavailable: string;
18
+ readOnly: (tag: string) => string;
19
+ isSelect: (tag: string) => string;
20
+ notFillable: (tag: string) => string;
21
+ notSelect: (tag: string) => string;
22
+ singleSelect: string;
23
+ noSuchOption: (value: string, choices: string[]) => string;
24
+ optionDisabled: (value: string) => string;
25
+ badUrl: (url: string) => string;
26
+ httpOnly: string;
27
+ textAppearTimeout: (text: string) => string;
28
+ textGoneTimeout: (text: string) => string;
29
+ badFunction: (message: string) => string;
30
+ notAFunction: string;
31
+ elementDetached: (tag: string) => string;
32
+ notActionable: (tag: string, reason: string) => string;
33
+ notVisible: (tag: string) => string;
34
+ reasonMoving: string;
35
+ reasonOffscreen: string;
36
+ reasonObscured: (tag: string, ref: string) => string;
37
+ overlayHeader: string;
38
+ overlayMask: (tag: string, coverage: number, ref: string) => string;
39
+ overlayLayer: (tag: string, text: string, coverage: number, ref: string) => string;
40
+ reasonHidden: string;
41
+ reasonDisabled: string;
42
+ storageUnavailable: (area: string) => string;
43
+ badStorageArea: string;
44
+ requestFailed: string;
45
+ noSuchRequest: (id: string) => string;
46
+ netFailed: (what: string, error: string) => string;
47
+ wsFailed: (url: string) => string;
48
+ tapped: (role: string, text: string) => string;
49
+ tappedTag: (role: string, tag: string) => string;
50
+ roles: {
51
+ [role: string]: string;
52
+ };
53
+ element: string;
54
+ };
55
+ type AgentText = typeof AGENT_EN;
56
+ declare const USER_EN: {
57
+ quote: (name: string) => string;
58
+ click: (target: string) => string;
59
+ enterActivate: (target: string) => string;
60
+ enterSubmit: (target: string) => string;
61
+ };
62
+ type UserText = typeof USER_EN;
63
+ type Level = 'observe' | 'interact' | 'advanced';
64
+ type LevelText = {
65
+ observe: string;
66
+ interact: string;
67
+ advanced: string;
68
+ };
69
+ declare const ui: {
70
+ /** Levels in the floating window (auto-allow). */
71
+ levels: LevelText;
72
+ /** Levels in the attach dialog: what each choice adds. */
73
+ attachLevels: LevelText;
74
+ state: {
75
+ none: string;
76
+ observe: string;
77
+ agent: string;
78
+ user: string;
79
+ };
80
+ link: {
81
+ connecting: string;
82
+ online: string;
83
+ offline: string;
84
+ };
85
+ connecting: string;
86
+ helpPending: string;
87
+ copy: string;
88
+ copied: string;
89
+ noteHelp: string;
90
+ noteAuto: string;
91
+ noteShare: string;
92
+ help: string;
93
+ cancelHelp: string;
94
+ collapse: string;
95
+ deviceCode: string;
96
+ barViewing: string;
97
+ barAgent: string;
98
+ barUser: string;
99
+ connectedFor: (time: string) => string;
100
+ takeover: string;
101
+ handback: string;
102
+ end: string;
103
+ autoTitle: string;
104
+ autoOn: (level: string) => string;
105
+ autoOff: string;
106
+ lockTitle: string;
107
+ lockOn: string;
108
+ lockOff: string;
109
+ lockedToast: string;
110
+ unlockedToast: string;
111
+ autoOffToast: string;
112
+ autoDialogTitle: string;
113
+ autoDialogText: string;
114
+ turnOn: string;
115
+ cancel: string;
116
+ autoOnToast: (level: string) => string;
117
+ countdown: (seconds: number) => string;
118
+ agentName: string;
119
+ autoAllowedToast: (agent: string, level: string) => string;
120
+ attachTitle: string;
121
+ attachText: (agent: string) => string;
122
+ confirmTitle: string;
123
+ confirmText: (action: string) => string;
124
+ allow: string;
125
+ deny: string;
126
+ };
127
+ type UiMessages = typeof ui;
128
+ type AgentMessages = AgentText;
129
+ type ActionMessages = UserText;
130
+ interface Messages {
131
+ ui: UiMessages;
132
+ action: ActionMessages;
133
+ agent: AgentMessages;
134
+ }
135
+ /** Optional at every level; functions stay whole. */
136
+ type DeepPartial<T> = T extends ((...args: never[]) => unknown) ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]>; } : T;
137
+ /** A complete language pack, like the built-in ones. */
138
+ interface Locale extends Messages {
139
+ /** BCP 47 tag: 'en', 'zh-TW', 'pt'… */
140
+ id: string;
141
+ /** The language's own name: 'Deutsch', '日本語'. */
142
+ name: string;
143
+ dir?: 'ltr' | 'rtl';
144
+ }
145
+ /** A pack for registerLocale(): anything left out comes from its fallback languages. */
146
+ interface LocalePack extends DeepPartial<Messages> {
147
+ id: string;
148
+ name?: string;
149
+ dir?: 'ltr' | 'rtl';
150
+ }
151
+ /** Messages to override, per language tag: { en: { ui: { help: 'Contact support' } } }. */
152
+ type MessageOverrides = {
153
+ [lang: string]: DeepPartial<Messages>;
154
+ };
155
+ /** Add language packs (or replace one with the same id). Pages that already chose that language switch to it. */
156
+ export declare function registerLocale(pack: LocalePack | LocalePack[]): void;
157
+ type ControlState = 'none' | 'observe' | 'agent' | 'user';
158
+ /**
159
+ * run({ style }): each field sets one --rwd-* custom property on #__rwd (see
160
+ * VARS). Colors take any CSS color; lengths a number of px or a CSS length.
161
+ */
162
+ interface StyleOptions {
163
+ /** --rwd-accent-rgb: buttons, switches, the agent's pointer and the edge glow. */
164
+ accent?: string;
165
+ /** --rwd-danger-rgb: the End button. */
166
+ danger?: string;
167
+ /** --rwd-warning-rgb: help, the user-in-control state. */
168
+ warning?: string;
169
+ /** --rwd-success-rgb: online dot, copied. */
170
+ success?: string;
171
+ /** --rwd-font */
172
+ font?: string;
173
+ /** --rwd-font-mono: device code, tags. */
174
+ monoFont?: string;
175
+ /** --rwd-radius: floating window (dialog +2px, task card −2px, smaller parts follow). */
176
+ radius?: number | string;
177
+ /** --rwd-button-radius: pill-shaped buttons and toasts. */
178
+ buttonRadius?: number | string;
179
+ /** --rwd-z-index of the whole UI (default 2147483647). */
180
+ zIndex?: number;
181
+ /** --rwd-bar-bottom: bottom bar distance from the bottom safe area (default 14px). */
182
+ barBottom?: number | string;
183
+ /** --rwd-task-top: task card distance from the top safe area (default 10px). */
184
+ taskTop?: number | string;
185
+ /** --rwd-toast-bottom: toast distance from the bottom safe area (default 84px). */
186
+ toastBottom?: number | string;
187
+ /** Where the idle pill starts until the user drags it: the screen edge and the height (0 top … 1 bottom). */
188
+ pill?: {
189
+ side?: 'left' | 'right';
190
+ top?: number;
191
+ };
192
+ }
193
+ interface AttachPending {
194
+ kind: 'attach';
195
+ requestId: string;
196
+ agent: {
197
+ name: string;
198
+ keyHint: string | null;
199
+ };
200
+ levels: Level[];
201
+ expiresAt: number;
202
+ }
203
+ interface ConfirmPending {
204
+ kind: 'confirm';
205
+ requestId: string;
206
+ action: string;
207
+ expiresAt: number;
208
+ }
209
+ type LinkState = 'connecting' | 'online' | 'polling' | 'stopped' | 'rejected' | 'quota';
210
+ interface ErudaOptions {
211
+ /** Show Remote Debugger as a tab inside eruda instead of the floating window. Default true. */
212
+ dock?: boolean;
213
+ /** Load eruda when the page has none (the latest release by default) and init it. Default false. */
214
+ load?: boolean;
215
+ /** Script URL for `load`. */
216
+ src?: string;
217
+ /** Name of the eruda tab. */
218
+ name?: string;
219
+ }
220
+ interface ErudaRemote {
221
+ dock?: boolean;
222
+ load?: boolean;
223
+ }
224
+ export declare const version: string;
225
+ export interface RunOptions {
226
+ userId?: string | null;
227
+ deviceId?: string;
228
+ helpButton?: boolean;
229
+ app?: {
230
+ name: string;
231
+ version: string;
232
+ } | null;
233
+ /**
234
+ * Secret chosen by a native host (iOS/Android) when it injects the SDK.
235
+ * Enables nativeControl() so the app can offer its own takeover / handback /
236
+ * end buttons. Page scripts never see it.
237
+ */
238
+ nativeKey?: string;
239
+ /**
240
+ * deviceToken the gateway issued to this deviceId (status().deviceToken),
241
+ * kept by the native host: localStorage is per origin.
242
+ */
243
+ deviceToken?: string;
244
+ /**
245
+ * The native host shows the attach / confirm questions itself: no page
246
+ * dialog; it reads status().pending and answers with nativeDecide().
247
+ */
248
+ nativeApproval?: boolean;
249
+ /**
250
+ * Work with eruda: `true` (or `{ dock: true }`) shows Remote Debugger as a
251
+ * tab inside eruda instead of the floating window; `load: true` loads the
252
+ * latest eruda when the page has none. Off by default; the project policy
253
+ * can turn it on remotely, these options win field by field.
254
+ */
255
+ eruda?: boolean | ErudaOptions;
256
+ /**
257
+ * Lock the page while an agent is attached (default true). The user can
258
+ * still change it in the floating window.
259
+ */
260
+ lockScreen?: boolean;
261
+ /** Our UI's look: 'auto' (default) follows the page background, 'system' the OS, or fixed 'light' / 'dark'. */
262
+ theme?: 'auto' | 'system' | 'light' | 'dark';
263
+ /**
264
+ * Colors, fonts, radii, z-index and positions of our UI, as --rwd-* CSS
265
+ * custom properties (pages can also set those in their own CSS).
266
+ */
267
+ style?: StyleOptions;
268
+ /**
269
+ * Language of the UI the phone user sees (pill, bottom bar, dialogs…): a
270
+ * language tag such as 'ja' or 'pt-BR'. Default: the browser's languages.
271
+ * Either way the first one with a pack wins, falling back tag by tag
272
+ * (zh-HK → zh-TW → zh) and finally to English. Built in: en, zh, zh-TW,
273
+ * fr, es, ru, ar, ja, ko, de, pt. What the agent reads follows the gateway
274
+ * (welcome.agentLang).
275
+ */
276
+ lang?: string;
277
+ /** Extra language packs, registered before the language is picked (see registerLocale). */
278
+ locales?: LocalePack[];
279
+ /** Messages to override per language: { en: { ui: { help: 'Contact support' } } }. */
280
+ messages?: MessageOverrides;
281
+ /**
282
+ * Requests left out of what the agent sees in the network list and the
283
+ * timeline (still recorded): URL substrings, `*` wildcards or /regex/,
284
+ * e.g. ['.ttf', 'WebTracks', '*beacon*']. Added to the project's rules.
285
+ */
286
+ networkExclude?: string[];
287
+ /**
288
+ * Keep the session log (default true): what happened since the app was
289
+ * launched, in IndexedDB on the device, for an attached agent to read. The
290
+ * project policy can turn it off for every page.
291
+ */
292
+ record?: boolean;
293
+ /**
294
+ * The host app's id for this launch (same for every webview until the app
295
+ * process ends). Without it the SDK infers the launch; a host can also
296
+ * define window.RWDLaunchId.
297
+ */
298
+ launchId?: string;
299
+ }
300
+ export type Status = 'idle' | LinkState;
301
+ /** welcome.config: the project policy the page applies (docs/protocol.md §3.4, §11). */
302
+ export interface RemoteConfig {
303
+ helpButton: boolean;
304
+ maskSelectors: string[];
305
+ maskPatterns: {
306
+ name: string;
307
+ regex: string;
308
+ }[];
309
+ confirmSelectors: string[];
310
+ networkExclude: string[];
311
+ /** Keep the session log (project policy). */
312
+ sessionLog: boolean;
313
+ eruda: ErudaRemote | null;
314
+ }
315
+ export interface RunResult {
316
+ deviceCode: string | null;
317
+ status: Status;
318
+ }
319
+ /**
320
+ * Bring this page online for remote debugging. Resolves with the device code
321
+ * once the gateway has answered (or after a few seconds with what is known).
322
+ * Calling it again is harmless.
323
+ */
324
+ export declare function run(gatewayUrl: string, appKey: string, opts?: RunOptions): Promise<RunResult>;
325
+ /** Current state: device code, link status, control state. */
326
+ export declare function getStatus(): {
327
+ deviceCode: string | null;
328
+ status: Status;
329
+ control: ControlState;
330
+ help: boolean;
331
+ label: string | null;
332
+ deviceId: string | null;
333
+ pageId: string | null;
334
+ version: string;
335
+ lang: string | null;
336
+ deviceToken: string | null;
337
+ level: Level | null;
338
+ config: RemoteConfig | null;
339
+ pending: AttachPending | ConfirmPending | null;
340
+ /** Id of the session log this page writes to; null when not recording. */
341
+ logSession: string | null;
342
+ };
343
+ /** Disconnect and remove the UI. Console / network collection continues (bounded). */
344
+ export declare function stop(): void;
345
+ /**
346
+ * Change the UI language at runtime (an app's own language switch): a tag
347
+ * like run({ lang }), or nothing to follow the browser again.
348
+ */
349
+ export declare function setLang(lang?: string | null): void;
350
+ /** The languages that ship with the SDK (all but en and zh load on demand). */
351
+ export declare const builtinLocales: string[];
352
+ /** Set or change the signed-in user. The gateway learns it through a new hello. */
353
+ export declare function setUser(userId: string | null): void;
354
+ /** Request assistance (the pill shows it; the console and agents see the device as assisting), or cancel the request. */
355
+ export declare function help(on?: boolean): void;
356
+ /**
357
+ * Take over, hand back or end from the native host's own UI. Requires the
358
+ * nativeKey given to run(): page scripts, including an agent's
359
+ * evaluate_script, cannot read it, so they cannot hand control to the agent.
360
+ */
361
+ export declare function nativeControl(key: string, action: 'takeover' | 'handback' | 'end'): boolean;
362
+ /**
363
+ * Answer status().pending from the native host's own dialog: a level (or null
364
+ * to refuse) for `attach`, 'allow' (or null) for `confirm`. Requires the
365
+ * nativeKey, like nativeControl(). False when the key, request or value is wrong.
366
+ */
367
+ export declare function nativeDecide(key: string, requestId: string, value: string | null): boolean;
368
+ export { type ActionMessages, type AgentMessages, type DeepPartial, type Locale, type LocalePack, type MessageOverrides, type Messages, type StyleOptions, type UiMessages, getStatus as status };