@ait-co/devtools 0.1.144 → 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.
- package/README.en.md +33 -217
- package/README.md +33 -246
- package/dist/in-app/auto.d.ts +1 -138
- package/dist/in-app/auto.js +28 -1102
- package/dist/in-app/auto.js.map +1 -1
- package/dist/in-app/index.d.ts +38 -547
- package/dist/in-app/index.d.ts.map +1 -1
- package/dist/in-app/index.js +62 -939
- package/dist/in-app/index.js.map +1 -1
- package/dist/mcp/cli.d.ts +1 -54
- package/dist/mcp/cli.js +33 -9720
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -88
- package/dist/mcp/server.js +36 -1076
- package/dist/mcp/server.js.map +1 -1
- package/dist/mock/index.d.ts +19 -20
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js.map +1 -1
- package/dist/panel/index.js +1 -103
- package/dist/panel/index.js.map +1 -1
- package/dist/relay-url-store-CPZAn-T5.js +107 -0
- package/dist/relay-url-store-CPZAn-T5.js.map +1 -0
- package/dist/relay-url-store-DLjlvMSA.cjs +108 -0
- package/dist/relay-url-store-DLjlvMSA.cjs.map +1 -0
- package/dist/stubs/bin-devtools-mcp.js +58 -0
- package/dist/stubs/bin-devtools-mcp.js.map +1 -0
- package/dist/stubs/bin-devtools-test.d.ts +2 -0
- package/dist/stubs/bin-devtools-test.js +55 -0
- package/dist/stubs/bin-devtools-test.js.map +1 -0
- package/dist/test-runner/config.d.ts +1 -231
- package/dist/test-runner/config.js +41 -45
- package/dist/test-runner/config.js.map +1 -1
- package/dist/{tunnel-BGT9Curk.cjs → tunnel-BKZkOyQp.cjs} +1 -1
- package/dist/{tunnel-BGT9Curk.cjs.map → tunnel-BKZkOyQp.cjs.map} +1 -1
- package/dist/{tunnel-BOKmLzBO.js → tunnel-CqSCIrdU.js} +1 -1
- package/dist/{tunnel-BOKmLzBO.js.map → tunnel-CqSCIrdU.js.map} +1 -1
- package/dist/unplugin/index.cjs +9 -18
- package/dist/unplugin/index.cjs.map +1 -1
- package/dist/unplugin/index.d.cts +22 -3
- package/dist/unplugin/index.d.cts.map +1 -1
- package/dist/unplugin/index.d.ts +23 -4
- package/dist/unplugin/index.d.ts.map +1 -1
- package/dist/unplugin/index.js +10 -19
- package/dist/unplugin/index.js.map +1 -1
- package/package.json +10 -25
- package/dist/attach-orchestrator-0F0m_UqQ.js +0 -1845
- package/dist/attach-orchestrator-0F0m_UqQ.js.map +0 -1
- package/dist/attach-orchestrator-D65KxFy_.js +0 -1831
- package/dist/attach-orchestrator-D65KxFy_.js.map +0 -1
- package/dist/attach-orchestrator-DL3NQ9ca.js +0 -1846
- package/dist/attach-orchestrator-DL3NQ9ca.js.map +0 -1
- package/dist/bundle-C796JIwG.d.ts +0 -159
- package/dist/bundle-C796JIwG.d.ts.map +0 -1
- package/dist/capture-DsP525OZ.d.ts +0 -58
- package/dist/capture-DsP525OZ.d.ts.map +0 -1
- package/dist/cdp-connection-rP1WdnH5.d.ts +0 -287
- package/dist/cdp-connection-rP1WdnH5.d.ts.map +0 -1
- package/dist/cell-BaLvusOl.js +0 -68
- package/dist/cell-BaLvusOl.js.map +0 -1
- package/dist/cell-CBUS3-nT.js +0 -274
- package/dist/cell-CBUS3-nT.js.map +0 -1
- package/dist/cell-EBKKpAAT.js +0 -307
- package/dist/cell-EBKKpAAT.js.map +0 -1
- package/dist/chii-relay-B3ZhjGMi.js +0 -304
- package/dist/chii-relay-B3ZhjGMi.js.map +0 -1
- package/dist/chii-relay-CGMlePMd.cjs +0 -304
- package/dist/chii-relay-CGMlePMd.cjs.map +0 -1
- package/dist/debug-server-B3ABDrRI.js +0 -456
- package/dist/debug-server-B3ABDrRI.js.map +0 -1
- package/dist/debug-server-BWhwrVXa.js +0 -1158
- package/dist/debug-server-BWhwrVXa.js.map +0 -1
- package/dist/debug-server-CfQNxxGW.js +0 -600
- package/dist/debug-server-CfQNxxGW.js.map +0 -1
- package/dist/devtools-opener-3Drge_RJ.js +0 -75
- package/dist/devtools-opener-3Drge_RJ.js.map +0 -1
- package/dist/devtools-opener-CJpEsXXQ.js +0 -76
- package/dist/devtools-opener-CJpEsXXQ.js.map +0 -1
- package/dist/devtools-opener-CxtryS8c.js +0 -75
- package/dist/devtools-opener-CxtryS8c.js.map +0 -1
- package/dist/in-app/auto.d.ts.map +0 -1
- package/dist/mcp/cli.d.ts.map +0 -1
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/pool-DcaaOwUq.d.ts +0 -14761
- package/dist/pool-DcaaOwUq.d.ts.map +0 -1
- package/dist/qr-http-server-C_lqOrgc.js +0 -1644
- package/dist/qr-http-server-C_lqOrgc.js.map +0 -1
- package/dist/qr-http-server-CopuMbub.js +0 -1644
- package/dist/qr-http-server-CopuMbub.js.map +0 -1
- package/dist/qr-http-server-DrbIVDjO.js +0 -1645
- package/dist/qr-http-server-DrbIVDjO.js.map +0 -1
- package/dist/relay-factory-N9QobQxG.js +0 -206
- package/dist/relay-factory-N9QobQxG.js.map +0 -1
- package/dist/relay-secret-store-BR0YIkNv.cjs +0 -241
- package/dist/relay-secret-store-BR0YIkNv.cjs.map +0 -1
- package/dist/relay-secret-store-Bmyleu0A.js +0 -154
- package/dist/relay-secret-store-Bmyleu0A.js.map +0 -1
- package/dist/relay-secret-store-CQenfcSL.js +0 -154
- package/dist/relay-secret-store-CQenfcSL.js.map +0 -1
- package/dist/relay-secret-store-CYM8CBIF.js +0 -240
- package/dist/relay-secret-store-CYM8CBIF.js.map +0 -1
- package/dist/relay-secret-store-DKxs7zwq.js +0 -153
- package/dist/relay-secret-store-DKxs7zwq.js.map +0 -1
- package/dist/relay-secret-store-WJ8EGkIl.js +0 -153
- package/dist/relay-secret-store-WJ8EGkIl.js.map +0 -1
- package/dist/relay-url-store-BR2XodiO.js +0 -123
- package/dist/relay-url-store-BR2XodiO.js.map +0 -1
- package/dist/relay-url-store-C1as_m5G.cjs +0 -115
- package/dist/relay-url-store-C1as_m5G.cjs.map +0 -1
- package/dist/relay-url-store-CH63fVCm.js +0 -122
- package/dist/relay-url-store-CH63fVCm.js.map +0 -1
- package/dist/relay-url-store-CzFo_84F.js +0 -114
- package/dist/relay-url-store-CzFo_84F.js.map +0 -1
- package/dist/relay-url-store-DaY1QPes.js +0 -123
- package/dist/relay-url-store-DaY1QPes.js.map +0 -1
- package/dist/relay-url-store-xmUuTjXA.js +0 -122
- package/dist/relay-url-store-xmUuTjXA.js.map +0 -1
- package/dist/relay-worker-B5HKkGUY.js +0 -832
- package/dist/relay-worker-B5HKkGUY.js.map +0 -1
- package/dist/relay-worker-YdlpZQl9.d.ts +0 -214
- package/dist/relay-worker-YdlpZQl9.d.ts.map +0 -1
- package/dist/rolldown-runtime-DGkTqVfb.js +0 -15
- package/dist/rolldown-runtime-DUslC3ob.js +0 -14
- package/dist/runtime-kn9DxOeg.d.ts +0 -249
- package/dist/runtime-kn9DxOeg.d.ts.map +0 -1
- package/dist/test-runner/bin.js +0 -2584
- package/dist/test-runner/bin.js.map +0 -1
- package/dist/test-runner/bridge-stub.d.ts +0 -125
- package/dist/test-runner/bridge-stub.d.ts.map +0 -1
- package/dist/test-runner/bridge-stub.js +0 -92
- package/dist/test-runner/bridge-stub.js.map +0 -1
- package/dist/test-runner/bundle.d.ts +0 -2
- package/dist/test-runner/bundle.js +0 -439
- package/dist/test-runner/bundle.js.map +0 -1
- package/dist/test-runner/capture.d.ts +0 -2
- package/dist/test-runner/capture.js +0 -44
- package/dist/test-runner/capture.js.map +0 -1
- package/dist/test-runner/config.d.ts.map +0 -1
- package/dist/test-runner/method-pace.d.ts +0 -82
- package/dist/test-runner/method-pace.d.ts.map +0 -1
- package/dist/test-runner/method-pace.js +0 -120
- package/dist/test-runner/method-pace.js.map +0 -1
- package/dist/test-runner/pool.d.ts +0 -2
- package/dist/test-runner/pool.js +0 -136
- package/dist/test-runner/pool.js.map +0 -1
- package/dist/test-runner/relay-factory.d.ts +0 -11245
- package/dist/test-runner/relay-factory.d.ts.map +0 -1
- package/dist/test-runner/relay-factory.js +0 -206
- package/dist/test-runner/relay-factory.js.map +0 -1
- package/dist/test-runner/relay-worker.d.ts +0 -2
- package/dist/test-runner/relay-worker.js +0 -2
- package/dist/test-runner/report.d.ts +0 -163
- package/dist/test-runner/report.d.ts.map +0 -1
- package/dist/test-runner/report.js +0 -198
- package/dist/test-runner/report.js.map +0 -1
- package/dist/test-runner/rpc.d.ts +0 -56
- package/dist/test-runner/rpc.d.ts.map +0 -1
- package/dist/test-runner/rpc.js +0 -98
- package/dist/test-runner/rpc.js.map +0 -1
- package/dist/test-runner/runtime.d.ts +0 -2
- package/dist/test-runner/runtime.js +0 -659
- package/dist/test-runner/runtime.js.map +0 -1
- package/dist/test-runner/task-graph.d.ts +0 -38
- package/dist/test-runner/task-graph.d.ts.map +0 -1
- package/dist/test-runner/task-graph.js +0 -182
- package/dist/test-runner/task-graph.js.map +0 -1
- package/dist/throttle-DKKzX1qC.js +0 -59
- package/dist/throttle-DKKzX1qC.js.map +0 -1
- package/dist/totp-BqmCLSNA.js +0 -189
- package/dist/totp-BqmCLSNA.js.map +0 -1
- package/dist/totp-CMHR5lsW.cjs +0 -191
- package/dist/totp-CMHR5lsW.cjs.map +0 -1
- package/dist/totp-CZLLKfOC.js +0 -200
- package/dist/totp-CZLLKfOC.js.map +0 -1
- package/dist/totp-DAxys-r0.js +0 -199
- package/dist/totp-DAxys-r0.js.map +0 -1
- package/dist/totp-DfekTBk3.js +0 -211
- package/dist/totp-DfekTBk3.js.map +0 -1
- package/dist/totp-Dwft0Kz7.js +0 -3
- package/dist/totp-WY6l0ysP.js +0 -190
- package/dist/totp-WY6l0ysP.js.map +0 -1
- /package/dist/{test-runner/bin.d.ts → stubs/bin-devtools-mcp.d.ts} +0 -0
package/dist/in-app/index.d.ts
CHANGED
|
@@ -1,554 +1,45 @@
|
|
|
1
|
-
//#region src/in-app
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* import
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* (mock SDK, the developer's own dev server) — see {@link
|
|
31
|
-
* isTrycloudflareHost}.
|
|
32
|
-
* B2 — entry query: `_deploymentId` must be present and non-empty. Applies to
|
|
33
|
-
* the Toss path only; the env 2 tunnel has no deployed bundle, so B2 is
|
|
34
|
-
* skipped for `*.trycloudflare.com` hosts.
|
|
35
|
-
*
|
|
36
|
-
* Layer C — opt-in + relay + optional TOTP auth:
|
|
37
|
-
* C1 — opt-in: `debug=1` must be present.
|
|
38
|
-
* C2 — relay URL: `relay=<wss-url>` must be a valid `wss:` URL.
|
|
39
|
-
* C3 — TOTP auth: When `verifyTotpCode` is provided (consumer injected the
|
|
40
|
-
* baked secret at build time via `__DEBUG_TOTP_SECRET__`),
|
|
41
|
-
* `at=<code>` is checked. Invalid or absent code → BLOCKED.
|
|
42
|
-
* When no verifier is provided (TOTP disabled), `at` is
|
|
43
|
-
* ignored (backward compatible).
|
|
44
|
-
*
|
|
45
|
-
* Security note on baked secrets:
|
|
46
|
-
* The TOTP secret baked in via `__DEBUG_TOTP_SECRET__` is present in the
|
|
47
|
-
* dogfood bundle and is extractable by a determined reverse engineer.
|
|
48
|
-
* The practical bar raised is: "URL leak" (Slack paste, QR screenshot) →
|
|
49
|
-
* blocked; "URL + bundle extraction + live TOTP code" → not blocked.
|
|
50
|
-
* This is the intended threat model. Do not overpromise on this guarantee.
|
|
51
|
-
*
|
|
52
|
-
* SECRET-HANDLING: `verifyTotpCode` is a black-box predicate. This module
|
|
53
|
-
* does NOT log the secret, any code value, or pass/fail details beyond the
|
|
54
|
-
* `'auth'` reason enum.
|
|
55
|
-
*
|
|
56
|
-
* Decision matrix (gate only runs in a debug build — Layer A already passed):
|
|
57
|
-
*
|
|
58
|
-
* host | _deploymentId | debug=1 | relay ok | TOTP ok* | result
|
|
59
|
-
* neither | (any) | (any) | (any) | (any) | BLOCKED (host)
|
|
60
|
-
* private-apps| absent | (any) | (any) | (any) | BLOCKED (entry)
|
|
61
|
-
* private-apps| present | absent | (any) | (any) | BLOCKED (opt-in)
|
|
62
|
-
* private-apps| present | present | invalid | (any) | BLOCKED (invalid-relay)
|
|
63
|
-
* private-apps| present | present | valid | fail* | BLOCKED (auth)
|
|
64
|
-
* private-apps| present | present | valid | pass/n/a | ATTACH
|
|
65
|
-
* trycloudflare| (skipped) | absent | (any) | (any) | BLOCKED (opt-in)
|
|
66
|
-
* trycloudflare| (skipped) | present | invalid | (any) | BLOCKED (invalid-relay)
|
|
67
|
-
* trycloudflare| (skipped) | present | valid | fail* | BLOCKED (auth)
|
|
68
|
-
* trycloudflare| (skipped) | present | valid | pass/n/a | ATTACH
|
|
69
|
-
* tossmini(3.0)| (reported) | absent | (any) | (any) | BLOCKED (opt-in)
|
|
70
|
-
* tossmini(3.0)| (reported) | present | invalid | (any) | BLOCKED (invalid-relay)
|
|
71
|
-
* tossmini(3.0)| (reported) | present | valid | at absent| BLOCKED (auth — TOTP mandatory, #760)
|
|
72
|
-
* tossmini(3.0)| (reported) | present | valid | pass/at present | ATTACH
|
|
73
|
-
*
|
|
74
|
-
* * "TOTP ok" column only applies when `verifyTotpCode` is provided.
|
|
75
|
-
* When no verifier is injected, TOTP check is skipped entirely — EXCEPT
|
|
76
|
-
* on tossmini(3.0) hosts (non-private-apps), where a missing `at=` code
|
|
77
|
-
* blocks with 'auth' even without a verifier (devtools#760; the relay
|
|
78
|
-
* side remains the authoritative verifier).
|
|
79
|
-
*
|
|
80
|
-
* tossmini(3.0) = `*.tossmini.com` hosts that are not
|
|
81
|
-
* `*.private-apps.tossmini.com` — the 3.0 unified serving family. The 3.0
|
|
82
|
-
* loader consumes `_deploymentId` natively, so B2 reports it when present
|
|
83
|
-
* but never requires it there (devtools#760).
|
|
84
|
-
* For trycloudflare (env 2 tunnel) hosts B1 is bypassed and B2 is skipped;
|
|
85
|
-
* C1/C2/C3 still apply identically. The ATTACH result carries
|
|
86
|
-
* `deploymentId: ''` for tunnel hosts.
|
|
87
|
-
*/
|
|
88
|
-
/** Shape returned when the gate allows attachment. */
|
|
89
|
-
interface GateResultAttach {
|
|
90
|
-
readonly attach: true;
|
|
91
|
-
/** The validated `wss:` relay URL from the `relay` query param. */
|
|
92
|
-
readonly relayUrl: string;
|
|
93
|
-
/** The deployment ID extracted from the `_deploymentId` query param. */
|
|
94
|
-
readonly deploymentId: string;
|
|
95
|
-
}
|
|
96
|
-
/** Shape returned when the gate blocks attachment, with a reason code. */
|
|
97
|
-
interface GateResultBlocked {
|
|
98
|
-
readonly attach: false;
|
|
99
|
-
/**
|
|
100
|
-
* - `'host'` Layer B1: `hostname` is not a `*.private-apps.tossmini.com` host.
|
|
101
|
-
* - `'entry'` Layer B2: `_deploymentId` param is absent or empty.
|
|
102
|
-
* - `'opt-in'` Layer C1: `debug=1` param is absent.
|
|
103
|
-
* - `'invalid-relay'` Layer C2: `relay` param is absent, empty, or not a `wss:` URL.
|
|
104
|
-
* - `'auth'` Layer C3: TOTP `at=` code is absent, invalid, or expired
|
|
105
|
-
* (only when a `verifyTotpCode` predicate is injected).
|
|
106
|
-
*
|
|
107
|
-
* There is no `'build'` reason: Layer A is enforced by the consumer's
|
|
108
|
-
* `if (__DEBUG_BUILD__)` guard, not by this function.
|
|
109
|
-
*
|
|
110
|
-
* SECRET-HANDLING: `'auth'` is the only value surfaced for auth failures —
|
|
111
|
-
* no code value, expected value, or secret fragment is ever exposed.
|
|
112
|
-
*/
|
|
113
|
-
readonly reason: 'host' | 'entry' | 'opt-in' | 'invalid-relay' | 'auth';
|
|
114
|
-
}
|
|
115
|
-
type GateResult = GateResultAttach | GateResultBlocked;
|
|
116
|
-
/**
|
|
117
|
-
* Input for {@link evaluateDebugGate}.
|
|
118
|
-
*
|
|
119
|
-
* All fields are explicit so the function is trivially testable without
|
|
120
|
-
* touching `window`.
|
|
121
|
-
*/
|
|
122
|
-
interface GateInput {
|
|
123
|
-
/**
|
|
124
|
-
* The host the page is served from — `window.location.hostname`.
|
|
125
|
-
*
|
|
126
|
-
* This is the Layer B1 security signal. Why hostname and not the entry
|
|
127
|
-
* scheme: the Toss SDK normalises `intoss-private://` to `intoss://` in
|
|
128
|
-
* `getSchemeUri()`, and `getOperationalEnvironment()` / `getWebViewType()`
|
|
129
|
-
* return the same value (`"toss"` / `"partner"`) for both dogfood and
|
|
130
|
-
* production entries — none of them distinguish a dogfood entry. The host
|
|
131
|
-
* does: a dogfood / private-apps entry is served from
|
|
132
|
-
* `*.private-apps.tossmini.com`, a production entry is not. This was
|
|
133
|
-
* confirmed live over CDP against mini-app 31146 (see spec open question 2).
|
|
134
|
-
*/
|
|
135
|
-
readonly hostname: string;
|
|
136
|
-
/**
|
|
137
|
-
* The URL search params to inspect for gate signals (Layers B2 and C).
|
|
138
|
-
*
|
|
139
|
-
* Prefer `URLSearchParams` so callers can pass `new URLSearchParams(location.search)`
|
|
140
|
-
* without coupling the pure function to `window`.
|
|
141
|
-
*/
|
|
142
|
-
readonly searchParams: URLSearchParams;
|
|
143
|
-
/**
|
|
144
|
-
* Optional TOTP code verifier for Layer C3 auth gate.
|
|
145
|
-
*
|
|
146
|
-
* When provided, `evaluateDebugGate` reads the `at` query param and passes
|
|
147
|
-
* it to this predicate. Return `true` to allow, `false` to block with
|
|
148
|
-
* `reason: 'auth'`.
|
|
149
|
-
*
|
|
150
|
-
* Inject via the consumer's build define, e.g.:
|
|
151
|
-
* ```ts
|
|
152
|
-
* // dogfood build entry — consumer's build injects __DEBUG_TOTP_SECRET__
|
|
153
|
-
* declare const __DEBUG_TOTP_SECRET__: string | undefined;
|
|
154
|
-
* const verifyTotpCode = typeof __DEBUG_TOTP_SECRET__ !== 'undefined'
|
|
155
|
-
* ? (code: string) => verifyTotp(__DEBUG_TOTP_SECRET__, code)
|
|
156
|
-
* : undefined;
|
|
157
|
-
* maybeAttach(evaluateDebugGate({ ...params, verifyTotpCode }));
|
|
158
|
-
* ```
|
|
159
|
-
*
|
|
160
|
-
* Security note: this predicate is a black-box from the gate's perspective.
|
|
161
|
-
* The gate only surfaces pass/fail and the `'auth'` reason code — no code
|
|
162
|
-
* value or secret fragment is ever logged or returned.
|
|
163
|
-
*
|
|
164
|
-
* When `undefined` (TOTP disabled), `at=` is silently ignored and the gate
|
|
165
|
-
* proceeds to ATTACH if all other layers pass.
|
|
166
|
-
*/
|
|
167
|
-
readonly verifyTotpCode?: (code: string) => boolean;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Returns whether `hostname` is a `*.private-apps.tossmini.com` subdomain —
|
|
171
|
-
* the host the Toss app reserves for dogfood / private mini-app entries.
|
|
172
|
-
*
|
|
173
|
-
* The match is an exact suffix check, not a substring `.includes()`: a
|
|
174
|
-
* substring test would also accept an attacker-controlled host like
|
|
175
|
-
* `private-apps.tossmini.com.evil.example`, which ends in `.example`, not in
|
|
176
|
-
* `.tossmini.com`. Requiring the string to END with the suffix closes that.
|
|
177
|
-
* The leading `.` in the suffix also forces a real subdomain label, so a
|
|
178
|
-
* bare `private-apps.tossmini.com` (no mini-app subdomain) does not match.
|
|
179
|
-
*/
|
|
180
|
-
declare function isPrivateAppsHost(hostname: string): boolean;
|
|
181
|
-
/**
|
|
182
|
-
* Returns whether `hostname` is any `*.tossmini.com` subdomain — the host
|
|
183
|
-
* family the Toss app serves mini-app pages from. Includes the 2.x
|
|
184
|
-
* `*.private-apps.tossmini.com` dogfood hosts and the 3.0 unified serving
|
|
185
|
-
* hosts (devtools#760).
|
|
186
|
-
*/
|
|
187
|
-
declare function isTossminiHost(hostname: string): boolean;
|
|
188
|
-
/**
|
|
189
|
-
* The host suffix Cloudflare quick-tunnels use — the env 2 (PWA) entry.
|
|
190
|
-
*
|
|
191
|
-
* Env 2 serves the local Vite dev server through a `*.trycloudflare.com` quick
|
|
192
|
-
* tunnel (`src/unplugin/tunnel.ts`). It has no Toss app, no `intoss-private://`
|
|
193
|
-
* scheme, and — critically — no production runtime: the SDK is the devtools
|
|
194
|
-
* mock, and the page is the developer's own dev build. The Layer B1 safety net
|
|
195
|
-
* (which stops a dogfood build that lands on a Toss *production* host from
|
|
196
|
-
* attaching) has nothing to protect against here, because env 2 has no
|
|
197
|
-
* production host. So a trycloudflare host is allowed past B1 — but ONLY past
|
|
198
|
-
* B1: the remaining layers (C1 opt-in, C2 relay, C3 TOTP) still apply, so a
|
|
199
|
-
* leaked tunnel URL is still blocked by TOTP exactly as on the Toss path.
|
|
200
|
-
*
|
|
201
|
-
* The match is the same exact-suffix `endsWith` check as
|
|
202
|
-
* {@link isPrivateAppsHost} — never a substring `.includes()`, which would
|
|
203
|
-
* accept an attacker-controlled `evil.trycloudflare.com.example.com`. The
|
|
204
|
-
* leading `.` forces a real subdomain label, so a bare `trycloudflare.com`
|
|
205
|
-
* (no tunnel subdomain) does not match.
|
|
206
|
-
*/
|
|
207
|
-
declare function isTrycloudflareHost(hostname: string): boolean;
|
|
208
|
-
/**
|
|
209
|
-
* Pure function that evaluates the runtime debug activation layers (B and C).
|
|
210
|
-
*
|
|
211
|
-
* Has no side effects. The input is explicit. Returns a discriminated union
|
|
212
|
-
* so callers can pattern-match on `result.attach`.
|
|
213
|
-
*
|
|
214
|
-
* Layer A (build-time) is intentionally not evaluated here — see the file-level
|
|
215
|
-
* comment. By the time this function runs, the consumer's `if (__DEBUG_BUILD__)`
|
|
216
|
-
* guard has already passed; this function only decides B and C.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* ```ts
|
|
220
|
-
* const result = evaluateDebugGate({
|
|
221
|
-
* hostname: window.location.hostname,
|
|
222
|
-
* searchParams: new URLSearchParams(window.location.search),
|
|
223
|
-
* });
|
|
224
|
-
* if (result.attach) {
|
|
225
|
-
* // Proceed to load Chii client
|
|
226
|
-
* }
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
declare function evaluateDebugGate(input: GateInput): GateResult;
|
|
230
|
-
//#endregion
|
|
231
|
-
//#region src/in-app/attach.d.ts
|
|
232
|
-
/**
|
|
233
|
-
* Converts a validated `wss:` relay URL into the Chii `target.js` script URL.
|
|
234
|
-
*
|
|
235
|
-
* Scheme is mapped `wss:` → `https:`. Host and port are preserved.
|
|
236
|
-
* Pathname is set to `/target.js` (or `/at/<code>/target.js` when a TOTP code
|
|
237
|
-
* is given) regardless of the relay path. Query params and hash from the
|
|
238
|
-
* relay URL are dropped — the target script URL is a static asset path on the
|
|
239
|
-
* same host.
|
|
240
|
-
*
|
|
241
|
-
* TOTP path-prefix transport (issue #466): chii's stock `target.js` derives
|
|
242
|
-
* its WS endpoint from the script `src` (`scriptEl.src.replace('target.js',
|
|
243
|
-
* '')`), so embedding the current TOTP code in the script URL *path* is the
|
|
244
|
-
* only way the phone-side WS upgrade can carry it — both the script fetch and
|
|
245
|
-
* the derived `wss://<host>/at/<code>/target/<id>` dial inherit the prefix,
|
|
246
|
-
* and the relay verifies + strips it before chii parses the URL. The
|
|
247
|
-
* `window.ChiiServerUrl` + query alternative does NOT work: chii appends
|
|
248
|
-
* `target/<id>` to the serverUrl string, which would land after a `?`.
|
|
249
|
-
*
|
|
250
|
-
* SECRET-HANDLING: `atCode` rides only inside the returned URL (the intended
|
|
251
|
-
* transport — same exposure grade as the daemon client's `at=` query). It is
|
|
252
|
-
* never logged here.
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
* deriveTargetScriptUrl('wss://abc.trycloudflare.com/relay')
|
|
256
|
-
* // → 'https://abc.trycloudflare.com/target.js'
|
|
257
|
-
*
|
|
258
|
-
* deriveTargetScriptUrl('wss://h.example.com:9100/', '123456')
|
|
259
|
-
* // → 'https://h.example.com:9100/at/123456/target.js'
|
|
260
|
-
*
|
|
261
|
-
* @param relayUrl - Validated `wss:` relay URL from the gate result.
|
|
262
|
-
* @param atCode - Current TOTP code from the page URL's `at` query param, or
|
|
263
|
-
* `null`/`undefined`/`''` to keep the legacy un-prefixed URL.
|
|
264
|
-
*/
|
|
265
|
-
declare function deriveTargetScriptUrl(relayUrl: string, atCode?: string | null): string;
|
|
266
|
-
declare global {
|
|
267
|
-
interface Window {
|
|
268
|
-
/**
|
|
269
|
-
* Set once {@link installRelayWsObserver} has wrapped `window.WebSocket`
|
|
270
|
-
* (#730). The bare CDP-injected indicator (`buildIndicatorExpression`)
|
|
271
|
-
* checks this flag to decide whether it can piggy-back on the
|
|
272
|
-
* `ait:relay-ws-state` CustomEvent this module broadcasts, instead of
|
|
273
|
-
* installing a second competing `Proxy` on `window.WebSocket`.
|
|
274
|
-
*/
|
|
275
|
-
__ait_relay_ws_observed?: boolean;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Idempotent, non-throwing teardown of the in-app debug surface (issue #748).
|
|
280
|
-
*
|
|
281
|
-
* Removes every debug-surface element WE injected and restores the one side
|
|
282
|
-
* effect WE applied:
|
|
283
|
-
* 1. The CDP-injected `#__ait_debug_indicator` badge (the persistent
|
|
284
|
-
* "Debugger Disconnected" element). Its live heartbeat/pending-call timer
|
|
285
|
-
* (#749) is stopped first via the badge controller's `stop()` so no 1 Hz
|
|
286
|
-
* interval leaks past detach; `buildIndicatorExpression` also
|
|
287
|
-
* self-dismisses the node — this is the in-app hard guarantee, idempotent,
|
|
288
|
-
* a no-op if it is already gone.
|
|
289
|
-
* 2. The eruda in-page console (floating button + any open panel).
|
|
290
|
-
* 3. The native-bridge call observer (#749) — its `callAsyncMethod` /
|
|
291
|
-
* `postMessage` / emitter wraps are restored and `window.__ait_bridge` is
|
|
292
|
-
* removed, so nothing we wrapped survives the run's end.
|
|
293
|
-
* 4. keepAwake — forced on at attach; restored here so a run that ends
|
|
294
|
-
* WITHOUT a page unload does not leave the screen pinned awake (the
|
|
295
|
-
* existing `beforeunload` restore only covers the unload path).
|
|
296
|
-
*
|
|
297
|
-
* Deliberately NOT touched: the `window.WebSocket` observer proxy (kept so the
|
|
298
|
-
* #478 post-4401 fail-fast survives; it is non-blocking and never absorbs
|
|
299
|
-
* input), and any NATIVE overlay (out of our layer — see the block comment
|
|
300
|
-
* above and issue #748 hypothesis (a)).
|
|
301
|
-
*
|
|
302
|
-
* Never throws into the host app — every step is individually guarded.
|
|
303
|
-
* Exported for unit tests and for a consumer that wants to force a clean detach.
|
|
304
|
-
*/
|
|
1
|
+
//#region src/stubs/in-app.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* TRANSITION STUB — REMOVE IN 1.0.0.
|
|
4
|
+
*
|
|
5
|
+
* `@ait-co/devtools/in-app` moved to `@ait-co/debug-console` (#818).
|
|
6
|
+
*
|
|
7
|
+
* **This stub must never throw.** Unlike the `/mcp/*` and `/test-runner`
|
|
8
|
+
* subpaths, the in-app attach surface is the one piece of the old debug
|
|
9
|
+
* surface that legitimately ends up inside a shipped mini-app bundle. A
|
|
10
|
+
* consumer who built and deployed against `@ait-co/devtools@0.1.x` has this
|
|
11
|
+
* import (or an unplugin-injected equivalent) sitting in production code; if
|
|
12
|
+
* upgrading the package turned that import into a throw, their app would die
|
|
13
|
+
* on a real user's phone over a developer-tools concern. So every export here
|
|
14
|
+
* is an inert no-op that says its piece through `console.error` once and
|
|
15
|
+
* returns the shape the old API returned.
|
|
16
|
+
*
|
|
17
|
+
* The surface below mirrors the pre-split `src/in-app/index.ts` exports so a
|
|
18
|
+
* stale call site still type-checks and still runs; it simply does nothing.
|
|
19
|
+
*/
|
|
20
|
+
/** Gate decision shape the pre-split module returned. */
|
|
21
|
+
interface GateResult {
|
|
22
|
+
/** Always `false` here — this stub never attaches anything. */
|
|
23
|
+
attach: boolean;
|
|
24
|
+
/** Why the gate did not open. */
|
|
25
|
+
reason: string;
|
|
26
|
+
}
|
|
27
|
+
/** No-op. The real attach lives in `@ait-co/debug-console`. */
|
|
28
|
+
declare function maybeAttach(): void;
|
|
29
|
+
/** No-op — there is nothing attached to detach. */
|
|
305
30
|
declare function detachDebugSurface(): void;
|
|
306
|
-
/**
|
|
307
|
-
* Self-report the mini-app's webViewType to the parent launcher shell, ONCE
|
|
308
|
-
* (#580).
|
|
309
|
-
*
|
|
310
|
-
* The mini-app's type is the build constant `__WEB_VIEW_TYPE__`, injected by
|
|
311
|
-
* the devtools unplugin from `granite.config.ts`'s `webViewProps.type`. The
|
|
312
|
-
* launcher (env-2 PWA) is cross-origin and cannot read it directly, so the
|
|
313
|
-
* framed page posts it to `window.parent`; the launcher switches to game mode
|
|
314
|
-
* automatically (no manual `?navBarType=game` URL edit).
|
|
315
|
-
*
|
|
316
|
-
* Defensive by construction — must NEVER break attach:
|
|
317
|
-
* - `__WEB_VIEW_TYPE__` is a CONSUMER-build define; it does not exist in
|
|
318
|
-
* devtools' own build or where the unplugin did not inject it. The `typeof`
|
|
319
|
-
* guard avoids a ReferenceError; an absent constant is a silent no-op.
|
|
320
|
-
* - Only posts when inside an iframe (`window.parent !== window`) — a
|
|
321
|
-
* top-level load has no launcher shell to receive the message.
|
|
322
|
-
* - The SDK's deprecated `'external'` alias of `partner` (web-framework 2.6.1)
|
|
323
|
-
* is mapped to `'partner'`; the launcher only emulates `partner` | `game`.
|
|
324
|
-
* - Wrapped in try/catch so any postMessage/iframe edge case is swallowed.
|
|
325
|
-
*
|
|
326
|
-
* SECRET-HANDLING: the payload carries ONLY the webViewType enum — no host,
|
|
327
|
-
* relay URL, code, or secret.
|
|
328
|
-
*/
|
|
31
|
+
/** No-op — the WebView type self-report moved with the attach surface. */
|
|
329
32
|
declare function reportWebViewType(): void;
|
|
330
|
-
/**
|
|
331
|
-
* Evaluates the 3-layer debug gate and, if the gate passes, injects the Chii
|
|
332
|
-
* `target.js` script into `document.head`.
|
|
333
|
-
*
|
|
334
|
-
* Idempotent — calling more than once is safe. The second call is a no-op if
|
|
335
|
-
* a script with the same `src` is already present in the document, and the
|
|
336
|
-
* module-level `attached` flag prevents redundant DOM queries after the first
|
|
337
|
-
* successful injection.
|
|
338
|
-
*
|
|
339
|
-
* Safe to call even if `document` is somehow unavailable (defensive boundary
|
|
340
|
-
* guard — in practice this always runs in a real WebView).
|
|
341
|
-
*
|
|
342
|
-
* **keepAwake side effect**: on a successful attach, `setScreenAwakeMode({
|
|
343
|
-
* enabled: true })` is called so the phone screen stays awake during the debug
|
|
344
|
-
* session. A `beforeunload` handler restores normal sleep on page unload.
|
|
345
|
-
* Opt out by adding `noKeepAwake=1` to the page URL query string — the check
|
|
346
|
-
* reads `window.location.search` directly, consistent with other guards in
|
|
347
|
-
* this file.
|
|
348
|
-
*
|
|
349
|
-
* @param gateResult - Optional pre-evaluated gate result for testability.
|
|
350
|
-
* Defaults to `checkDebugGate()` which reads the current page URL. Passing a
|
|
351
|
-
* custom value avoids the need to manipulate `window.location` in tests.
|
|
352
|
-
*/
|
|
353
|
-
declare function maybeAttach(gateResult?: GateResult): void;
|
|
354
|
-
//#endregion
|
|
355
|
-
//#region src/in-app/bridge-observer.d.ts
|
|
356
|
-
/**
|
|
357
|
-
* In-app native-bridge call observer (issue #749).
|
|
358
|
-
*
|
|
359
|
-
* WHY THIS EXISTS — the mock's `observe()` (`src/mock/observe.ts` → `aitState.
|
|
360
|
-
* sdkCallLog`) only wraps the MOCK SDK. In the on-device debug context (env 3,
|
|
361
|
-
* real Toss WebView, run7) the REAL `@apps-in-toss/web-framework` is loaded, so
|
|
362
|
-
* that groundwork sees nothing. The in-app debug surface needs its own
|
|
363
|
-
* observation point at the one place every real async bridge call funnels
|
|
364
|
-
* through, so the on-phone indicator can answer run7's question: is a spinner a
|
|
365
|
-
* pending native call, the app's own UI, or a wedged JS main thread?
|
|
366
|
-
*
|
|
367
|
-
* OBSERVATION POINTS (version-agnostic — both SDK lines route through one of
|
|
368
|
-
* these; picked so a GA flip 2.x↔3.0 does not break the signal):
|
|
369
|
-
*
|
|
370
|
-
* - 3.0 line — `window.__appsInTossNativeBridge.callAsyncMethod(name, params)`
|
|
371
|
-
* is the single async dispatcher; it returns the native Promise. Wrapping
|
|
372
|
-
* it gives the COMPLETE lifecycle (pending on call, settle on resolve/
|
|
373
|
-
* reject) from ONE hook, with no reliance on how native calls back.
|
|
374
|
-
* - 2.x line — there is no single dispatcher method (each async bridge is an
|
|
375
|
-
* independent `createAsyncBridge` closure). The universal START choke point
|
|
376
|
-
* is `window.ReactNativeWebView.postMessage(json)`; the matching SETTLE
|
|
377
|
-
* signal is `window.__GRANITE_NATIVE_EMITTER.emit('<method>/resolve|reject/
|
|
378
|
-
* <eventId>')`. We wrap both.
|
|
379
|
-
*
|
|
380
|
-
* The observer publishes a read-only snapshot on `window.__ait_bridge` (an
|
|
381
|
-
* id→pending map + a last-call record) and fires a payload-less
|
|
382
|
-
* {@link BRIDGE_CALL_EVENT} CustomEvent on every change, so the CDP-injected
|
|
383
|
-
* indicator badge (`buildIndicatorExpression`) can render the pending list +
|
|
384
|
-
* last-call stamp without polling — the same pub/sub decoupling the relay-WS
|
|
385
|
-
* observer uses for `ait:relay-ws-state` (#730).
|
|
386
|
-
*
|
|
387
|
-
* SECRET-HANDLING: this module records API METHOD NAMES + timestamps + a
|
|
388
|
-
* correlation id ONLY. It NEVER reads, stores, or forwards call arguments
|
|
389
|
-
* (`params`/`args`) or results — those may carry tokens, URLs, or user data.
|
|
390
|
-
* The outbound-message parser reads `type`/`name`/`functionName`/`callbackId`/
|
|
391
|
-
* `eventId` and deliberately never touches `params`/`args`.
|
|
392
|
-
*
|
|
393
|
-
* Lives in the in-app graph (reached only via {@link maybeAttach}); a release
|
|
394
|
-
* consumer build DCEs it with the rest of the debug surface (§check:debug-
|
|
395
|
-
* surface-absent). Never throws into the host app — every hook is guarded.
|
|
396
|
-
*/
|
|
397
|
-
/** Name of the API being called (never its arguments). */
|
|
398
|
-
interface BridgePendingCall {
|
|
399
|
-
method: string;
|
|
400
|
-
/** `Date.now()` epoch ms when the call was dispatched. */
|
|
401
|
-
startedAt: number;
|
|
402
|
-
}
|
|
403
|
-
/** The most-recent bridge activity — API name + wall-clock + settle status. */
|
|
404
|
-
interface BridgeLastCall {
|
|
405
|
-
method: string;
|
|
406
|
-
/** `Date.now()` epoch ms of the start or settle that produced this record. */
|
|
407
|
-
at: number;
|
|
408
|
-
status: 'pending' | 'resolved' | 'rejected';
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* The snapshot exposed on `window.__ait_bridge`. `pending` is keyed by
|
|
412
|
-
* correlation id so a settle is an O(1) delete; the indicator reads
|
|
413
|
-
* `Object.values(pending)` and computes each call's live elapsed itself.
|
|
414
|
-
*/
|
|
415
|
-
interface BridgeObserverState {
|
|
416
|
-
pending: Record<string, BridgePendingCall>;
|
|
417
|
-
last: BridgeLastCall | null;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* CustomEvent fired (no detail) on every start/settle so the indicator badge
|
|
421
|
-
* re-renders promptly. SECRET-HANDLING: carries no detail payload at all — the
|
|
422
|
-
* badge reads the enum-only `window.__ait_bridge` snapshot on receipt.
|
|
423
|
-
*/
|
|
424
|
-
declare const BRIDGE_CALL_EVENT = "ait:bridge-call";
|
|
425
|
-
declare global {
|
|
426
|
-
interface Window {
|
|
427
|
-
/**
|
|
428
|
-
* Read-only bridge-call snapshot published by {@link installBridgeObserver}
|
|
429
|
-
* (#749). The CDP-injected indicator badge reads this to render the pending
|
|
430
|
-
* native-call list + last-call stamp. Absent when no debug attach ran or in
|
|
431
|
-
* a context with no observable bridge (env 2 mock). SECRET-HANDLING: holds
|
|
432
|
-
* API names + timings only — never arguments or results.
|
|
433
|
-
*/
|
|
434
|
-
__ait_bridge?: BridgeObserverState;
|
|
435
|
-
/**
|
|
436
|
-
* 3.0-line native bridge (`@apps-in-toss/webview-bridge`
|
|
437
|
-
* `injectNativeBridge`). `callAsyncMethod` is the single async dispatcher
|
|
438
|
-
* the observer wraps.
|
|
439
|
-
*/
|
|
440
|
-
__appsInTossNativeBridge?: {
|
|
441
|
-
callAsyncMethod?: (name: string, params?: unknown) => unknown;
|
|
442
|
-
[key: string]: unknown;
|
|
443
|
-
};
|
|
444
|
-
/** 2.x-line native call transport (`ReactNativeWebView.postMessage`). */
|
|
445
|
-
ReactNativeWebView?: {
|
|
446
|
-
postMessage?: (message: string) => void;
|
|
447
|
-
[key: string]: unknown;
|
|
448
|
-
};
|
|
449
|
-
/** 2.x-line native→JS settle emitter (`@apps-in-toss/bridge-core`). */
|
|
450
|
-
__GRANITE_NATIVE_EMITTER?: {
|
|
451
|
-
emit?: (event: string, args?: unknown) => void;
|
|
452
|
-
[key: string]: unknown;
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Installs the native-bridge call observer (#749). Idempotent per page
|
|
458
|
-
* lifecycle. Called by {@link maybeAttach} after the gate passes (debug builds
|
|
459
|
-
* only). Prefers the 3.0 single-dispatcher wrap; falls back to the universal
|
|
460
|
-
* 2.x postMessage-start + emitter-settle pair. A context with no observable
|
|
461
|
-
* bridge (env 2 mock) leaves `window.__ait_bridge` as an empty snapshot — the
|
|
462
|
-
* badge then shows the heartbeat only, which is correct.
|
|
463
|
-
*
|
|
464
|
-
* Never throws into the host app — a wrapped hook that somehow fails is caught
|
|
465
|
-
* and the original behavior is always preserved.
|
|
466
|
-
*/
|
|
467
|
-
declare function installBridgeObserver(): void;
|
|
468
|
-
/**
|
|
469
|
-
* Restores every wrapped bridge hook and removes `window.__ait_bridge` (#749).
|
|
470
|
-
* Idempotent; safe to call when nothing was installed. Wired into
|
|
471
|
-
* {@link detachDebugSurface} (#748) so no bridge wrap survives a run's end.
|
|
472
|
-
*/
|
|
473
|
-
declare function uninstallBridgeObserver(): void;
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region src/in-app/eruda-overlay.d.ts
|
|
476
|
-
/**
|
|
477
|
-
* In-app eruda console overlay for the debug attach flow.
|
|
478
|
-
*
|
|
479
|
-
* Spec: docs/superpowers/specs/2026-05-18-in-app-debug-mcp.md
|
|
480
|
-
*
|
|
481
|
-
* This module mounts the eruda in-page console (https://github.com/liriliri/eruda)
|
|
482
|
-
* on the phone screen when a debug session attaches. It is the mobile-only
|
|
483
|
-
* counterpart to the Chii `target.js` injection in {@link attach.ts}: Chii is a
|
|
484
|
-
* REMOTE CDP transport (phone → relay → PC DevTools frontend), whereas eruda is
|
|
485
|
-
* a LOCAL in-page view — a floating button + console/network/DOM/storage panels
|
|
486
|
-
* rendered directly on the phone, with no relay or second device. The two are
|
|
487
|
-
* orthogonal and coexist (eruda opens no WebSocket, mounts into its own
|
|
488
|
-
* `#eruda` shadow host — it cannot collide with the relay WS or the Chii DOM).
|
|
489
|
-
*
|
|
490
|
-
* Build-time absence (the security contract): this module lives in the
|
|
491
|
-
* `@ait-co/devtools/in-app` graph. A consumer wraps its
|
|
492
|
-
* `import('@ait-co/devtools/in-app')` call site in `if (__DEBUG_BUILD__) { … }`;
|
|
493
|
-
* a release build folds that constant to `false` and dead-code-eliminates the
|
|
494
|
-
* whole module — so eruda (and its dynamic `import('eruda')` chunk) is simply
|
|
495
|
-
* absent from release bundles, exactly like the Chii target.js injection. The
|
|
496
|
-
* `import('eruda')` here is a dynamic import precisely so the bundler emits it
|
|
497
|
-
* as a separate chunk that the dead branch never pulls in.
|
|
498
|
-
*
|
|
499
|
-
* Runtime gate: `mountEruda()` is called only from `maybeAttach()` AFTER the
|
|
500
|
-
* full Layer B/C gate has passed (`gateResult.attach === true`) — host
|
|
501
|
-
* allowlist, `debug=1`, relay URL, and TOTP. So eruda inherits the same
|
|
502
|
-
* four-layer defence as the Chii injection, byte-for-byte, with no eruda-
|
|
503
|
-
* specific gate of its own.
|
|
504
|
-
*
|
|
505
|
-
* SECRET-HANDLING: this module reads no secret, TOTP code, relay URL, or host
|
|
506
|
-
* value, and logs none. eruda observes only the page it is mounted on.
|
|
507
|
-
*/
|
|
508
|
-
/**
|
|
509
|
-
* Mounts the eruda in-page console once.
|
|
510
|
-
*
|
|
511
|
-
* Idempotent: repeated calls after a successful mount are no-ops, mirroring the
|
|
512
|
-
* `attached` guard in {@link attach.ts}. Fail-silent: if the dynamic import or
|
|
513
|
-
* `eruda.init()` throws (eruda absent, or a runtime that rejects it), the Chii
|
|
514
|
-
* debug session is unaffected — eruda is an additive convenience, not a
|
|
515
|
-
* dependency of the relay path.
|
|
516
|
-
*
|
|
517
|
-
* `eruda.init()` mounts eruda's own floating entry button on the phone screen;
|
|
518
|
-
* tapping it opens the console. We do not add a separate button.
|
|
519
|
-
*/
|
|
33
|
+
/** No-op — the eruda overlay moved with the attach surface. */
|
|
520
34
|
declare function mountEruda(): Promise<void>;
|
|
521
|
-
/**
|
|
522
|
-
* Unmounts the eruda in-page console (#748 graceful detach).
|
|
523
|
-
*
|
|
524
|
-
* Calls `eruda.destroy()`, which removes eruda's floating entry button, any
|
|
525
|
-
* open panel, and its `#eruda` shadow host — returning the phone screen to a
|
|
526
|
-
* clean, non-debug state when a debug session ends. After a successful unmount
|
|
527
|
-
* the guard is reset so a later {@link mountEruda} (a fresh attach) can
|
|
528
|
-
* re-mount.
|
|
529
|
-
*
|
|
530
|
-
* Idempotent: a call when eruda was never mounted (or already unmounted) is a
|
|
531
|
-
* no-op. Fail-silent: a `destroy()` throw is swallowed — teardown must never
|
|
532
|
-
* throw into the host app.
|
|
533
|
-
*/
|
|
35
|
+
/** No-op counterpart to {@link mountEruda}. */
|
|
534
36
|
declare function unmountEruda(): void;
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
*
|
|
541
|
-
* Returns the gate result. Callers can check `result.attach` to decide whether
|
|
542
|
-
* to proceed with debug surface attachment.
|
|
543
|
-
*
|
|
544
|
-
* This function reads `window.location` only — both the hostname (Layer B1
|
|
545
|
-
* host allowlist) and the search params (Layers B2 and C). Layer A
|
|
546
|
-
* (build-time) is enforced by the consumer's `if (__DEBUG_BUILD__)` guard
|
|
547
|
-
* around the import site, not here — see the file-level comment. Consumers
|
|
548
|
-
* call this with no arguments, so the Layer B1 host check is picked up with
|
|
549
|
-
* no change at the call site.
|
|
550
|
-
*/
|
|
37
|
+
/** No-op — the bridge observer moved with the attach surface. */
|
|
38
|
+
declare function installBridgeObserver(): void;
|
|
39
|
+
/** No-op counterpart to {@link installBridgeObserver}. */
|
|
40
|
+
declare function uninstallBridgeObserver(): void;
|
|
41
|
+
/** Always reports a closed gate — nothing can attach from this package. */
|
|
551
42
|
declare function checkDebugGate(): GateResult;
|
|
552
43
|
//#endregion
|
|
553
|
-
export {
|
|
44
|
+
export { GateResult, checkDebugGate, detachDebugSurface, installBridgeObserver, maybeAttach, mountEruda, reportWebViewType, uninstallBridgeObserver, unmountEruda };
|
|
554
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/stubs/in-app.ts"],"mappings":";;AA2CA;;;;;AAQA;;;;;AAKA;;;;;AAKA;;;UAlBiB,UAAA;EAkBgB;EAhB/B,MAAA;EAqB8B;EAnB9B,MAAA;AAAA;;iBAIc,WAAA,CAAA;;iBAKA,kBAAA,CAAA;;iBAKA,iBAAA,CAAA;AAehB;AAAA,iBAVsB,UAAA,CAAA,GAAc,OAAA;;iBAKpB,YAAA,CAAA;;iBAKA,qBAAA,CAAA;;iBAKA,uBAAA,CAAA;;iBAKA,cAAA,CAAA,GAAkB,UAAA"}
|