@farmslot/adapter-web 0.4.1 → 0.6.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/CHANGELOG.md +10 -0
- package/README.md +24 -1
- package/dist/launch-browser.d.cts +12 -0
- package/dist/web-dapp/cleanup.d.mts +15 -0
- package/dist/web-dapp/index.d.mts +123 -0
- package/dist/web-dapp/inject.d.mts +12 -0
- package/dist/web-dapp/launch.d.mts +56 -0
- package/dist/web-dapp/lib/blocked-hosts.d.mts +3 -0
- package/dist/web-dapp/lib/cdp-client.d.mts +8 -0
- package/dist/web-dapp/lib/display.d.mts +26 -0
- package/dist/web-dapp/lib/hud.d.mts +14 -0
- package/dist/web-dapp/lib/paths.d.mts +11 -0
- package/dist/web-dapp/lib/policy-fence.d.mts +18 -0
- package/dist/web-dapp/lib/policy.d.mts +4 -0
- package/dist/web-dapp/lib/processes.d.mts +57 -0
- package/dist/web-dapp/lib/readiness.d.mts +85 -0
- package/dist/web-dapp/lib/runtime.d.mts +29 -0
- package/dist/web-dapp/lib/signers.d.mts +13 -0
- package/dist/web-dapp/lib/viem.d.mts +1 -0
- package/dist/web-dapp/stop.d.mts +2 -0
- package/dist/web-dapp/verify.d.mts +2 -0
- package/dist/web-dapp/wallet-host.d.mts +2 -0
- package/package.json +17 -10
- package/src/launch-browser.cjs +20 -4
- package/src/web-dapp/cleanup.mjs +74 -0
- package/src/web-dapp/index.mjs +590 -0
- package/src/web-dapp/inject.mjs +100 -0
- package/src/web-dapp/launch.mjs +806 -0
- package/src/web-dapp/lib/blocked-hosts.mjs +24 -0
- package/src/web-dapp/lib/cdp-client.mjs +86 -0
- package/src/web-dapp/lib/display.mjs +169 -0
- package/src/web-dapp/lib/hud.mjs +156 -0
- package/src/web-dapp/lib/paths.mjs +55 -0
- package/src/web-dapp/lib/policy-fence.mjs +128 -0
- package/src/web-dapp/lib/policy.mjs +108 -0
- package/src/web-dapp/lib/processes.mjs +215 -0
- package/src/web-dapp/lib/readiness.mjs +438 -0
- package/src/web-dapp/lib/runtime.mjs +195 -0
- package/src/web-dapp/lib/signers.mjs +105 -0
- package/src/web-dapp/lib/viem.mjs +26 -0
- package/src/web-dapp/stop.mjs +44 -0
- package/src/web-dapp/verify.mjs +68 -0
- package/src/web-dapp/wallet-host.mjs +728 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ All notable changes to `@farmslot/adapter-web` are tracked here.
|
|
|
6
6
|
|
|
7
7
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
8
8
|
|
|
9
|
+
## 0.6.0 - 2026-10-08
|
|
10
|
+
|
|
11
|
+
- Add `web-dapp` (`@farmslot/adapter-web/web-dapp`, an ESM subpath): `createWebDappAdapter({ id, signerModule, cli, hooks })` returns an `@farmslot/adapter-sdk` `PlatformAdapter` for a web app under test whose dev server the slot owns, moved from mm-harness's Web Terminal adapter. It runs a slot browser and wallet host with the injected strict wallet or a host-supplied extension signer, held to the testnet venue of the adapter that extends it. See the adapter-web reference for the signer module, venue policy and hooks.
|
|
12
|
+
- Publish with adapter-sdk 0.7.1 and recipe-runner 0.27.0 so consumers share one adapter-sdk and one recipe-runner copy.
|
|
13
|
+
|
|
14
|
+
## 0.5.0 - 2026-10-08
|
|
15
|
+
|
|
16
|
+
- `launchBrowser` takes an optional `progress` callback for the caller's stage: starting the browser, waiting for the CDP listener (with the attempt count, about every 5 s), loading the extension over CDP and opening the start window. The `[launch]` log lines are unchanged.
|
|
17
|
+
- Publish with adapter-sdk 0.7.0 and recipe-runner 0.26.0 so consumers share one adapter-sdk copy.
|
|
18
|
+
|
|
9
19
|
## 0.4.1 - 2026-10-07
|
|
10
20
|
|
|
11
21
|
- `network-observer`: `createExtensionNetworkObserver` takes an optional `extensionId`, the extension to capture. Without it the observer still takes the first extension with a target, which in a branded Chrome can be a component or policy extension listed before the one under test.
|
package/README.md
CHANGED
|
@@ -29,8 +29,9 @@ Docs: https://farmslot.io/docs/reference/adapter-web
|
|
|
29
29
|
| `slot-title` | prefix the extension home tab's title with the farm slot id, kept across the page's own title resets |
|
|
30
30
|
| `validation-process-ownership` | find and stop the processes that own a slot profile |
|
|
31
31
|
| `validation-launch-supervisor` | supervised child for one validation launch: port lease, quarantine and cleanup |
|
|
32
|
+
| `web-dapp` | the generic web-dapp lifecycle as an adapter-sdk `PlatformAdapter` (ESM): slot browser, wallet host, readiness, stop |
|
|
32
33
|
|
|
33
|
-
Sources are CommonJS (`src/**/*.cjs`) and ship as is; `yarn build` emits `.d.cts` declarations. Every library subpath can be `require`d or `import`ed with named imports, except `validation-launch-supervisor`: it is a child-process entry (it runs when loaded), so hosts `require.resolve` it and fork it.
|
|
34
|
+
Sources are CommonJS (`src/**/*.cjs`) and ship as is; `yarn build` emits `.d.cts` declarations. `web-dapp` is the exception: its sources are ESM (`src/web-dapp/**/*.mjs`, declarations `.d.mts`), because its leaf scripts run as their own node processes. Every library subpath can be `require`d or `import`ed with named imports, except `validation-launch-supervisor`: it is a child-process entry (it runs when loaded), so hosts `require.resolve` it and fork it.
|
|
34
35
|
|
|
35
36
|
## Launching a browser
|
|
36
37
|
|
|
@@ -107,6 +108,28 @@ const binding = createWalletRequestBinding({
|
|
|
107
108
|
});
|
|
108
109
|
```
|
|
109
110
|
|
|
111
|
+
## Web-dapp adapter
|
|
112
|
+
|
|
113
|
+
`@farmslot/adapter-web/web-dapp` (ESM) is the lifecycle of a web app under test whose dev server the slot owns. `createWebDappAdapter({ id, signerModule, cli, hooks })` returns an `@farmslot/adapter-sdk` `PlatformAdapter`: launch, stop, runtime status, doctor checks, logs and the wallet request-log findings. It runs one slot browser per slot, and a wallet host attached to it over CDP that records the wallet requests (and, with `signer=injected`, answers them with the strict wallet from `dapp`).
|
|
114
|
+
|
|
115
|
+
- **Venue policy.** The app's venue (the hosts a testnet run blocks and serves, the typed data to refuse, the start page) comes from the adapter that `extends: 'web-dapp'`: its policy module goes to `RECIPE_WEB_DAPP_POLICY` through `bindWebDappPolicy(adapter)`. Bare web-dapp has no policy and refuses to launch. `fencePolicy` and `assertPolicyDigest` hold the module and what it imports to the files the plugin digest covers.
|
|
116
|
+
- **Served network.** A policy that declares served hosts (`venueHosts().served`) has the wallet host wait for the app to request one of them, which proves the dev server serves testnet. A policy for an app whose page makes no venue request of its own (such as test-dapp-multichain, whose wallet traffic goes through the extension) opts out explicitly: `venueHosts()` returns `served: []` with `servedCheck: 'not-applicable'`. The check is then skipped, and `networkEnforcement.served` in `browser.json` and the `network-enforcement` entry of the wallet request log say `not-applicable`. An empty `served` without that opt-out keeps the check, which fails closed, so a policy that computes its served hosts can't lose the check by finding none. Listing served hosts and opting out together is refused. Mainnet blocking is enforced either way.
|
|
117
|
+
- **Signers.** `signer=injected` needs nothing. `signer=extension` belongs to the host: a signer module exports `signers.extension` with `prepareProfile` (load the extension, seed the profile; returns `{ browserArgs, secrets, state }` and may carry an `afterBrowserStart` step; both steps get `trackSecret` for key-material files), `confirm` (required with `prepareProfile`: without it the wallet host would close the wallet's own windows) and `readinessChecks`. `signers.injected.identity` sets the EIP-6963 identity the injected strict wallet presents. The module path (`signerModule`, `--signer-module` or `RECIPE_WEB_DAPP_SIGNER_MODULE`) is the one source: readiness, launch, verify and the wallet host all load it, and `createWebDappAdapter` throws if given an in-process `signers` object. With no signer requested, the signer is `extension` when a module is configured and `injected` otherwise, so a host whose module exports only `injected` sets the signer explicitly (`--signer injected` or `TERMINAL_SIGNER=injected`).
|
|
118
|
+
- **Hooks.** The action set, console capture, and network and performance observation are the host's; pass them as `hooks`. `diagnostics`, `readiness` and `harness` merge over the generic members.
|
|
119
|
+
- **Leaves.** `webDappLeafPath('launch' | 'wallet-host' | 'inject' | 'verify' | 'stop' | 'cleanup')` names the CLI scripts.
|
|
120
|
+
- **Test fixture.** `test/fixtures/web-dapp-test-plugin` is a `test-dapp` adapter for MetaMask's test-dapp-multichain. That dapp needs `signer=extension` with a host signer module: it talks to the wallet through the Multichain API, which the injected EIP-1193 strict wallet cannot drive.
|
|
121
|
+
- **Kept for compatibility.** These generic-code names still carry the host's old product name, because renaming them needs both sides to change together: the `TERMINAL_*` environment names (`TERMINAL_CHROME_BIN`, `TERMINAL_APP_PORT`, `TERMINAL_SIGNER`, `TERMINAL_ACCOUNT`, `TERMINAL_HEADLESS`, `TERMINAL_SLOW_MO`, `TERMINAL_WINDOW`, `TERMINAL_SCREEN`); `MM_HARNESS_SERVED_TIMEOUT_MS`, `MM_HARNESS_APP_COMMIT_TIMEOUT_MS` and `MM_HARNESS_FOCUS_SETTLE_MS`; the `--mm-harness-owner` process marker (process ownership is matched on argv); the `mm-harness-probe=1` probe marker; and the `mm-harness-hud` overlay element.
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
import { createWebDappAdapter } from '@farmslot/adapter-web/web-dapp';
|
|
125
|
+
|
|
126
|
+
const adapter = createWebDappAdapter({
|
|
127
|
+
id: 'web-dapp',
|
|
128
|
+
signerModule: '/path/to/signers.mjs', // exports { signers: { extension, injected } }; omit for injected-only
|
|
129
|
+
hooks: { actions },
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
110
133
|
## Resolver CLI
|
|
111
134
|
|
|
112
135
|
`browser-resolver.cjs` is also a command, for hosts that need a bounded child process (a hung CDP call can't stall the caller). Every command finishes within 120 s, exits 0 on success and 1 with the error message on stderr otherwise. Hosts can keep their own script path by calling `runCli(argv)`.
|
|
@@ -56,6 +56,16 @@ export type LaunchBrowserOptions = {
|
|
|
56
56
|
* Progress lines (default stderr).
|
|
57
57
|
*/
|
|
58
58
|
log?: ((line: string) => void) | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* What the launch is waiting for, for a caller's stage handle (`stage.progress`).
|
|
61
|
+
*/
|
|
62
|
+
progress?: ((progress: {
|
|
63
|
+
message?: string;
|
|
64
|
+
waitingFor?: string;
|
|
65
|
+
current?: number;
|
|
66
|
+
total?: number;
|
|
67
|
+
unit?: string;
|
|
68
|
+
}) => void) | undefined;
|
|
59
69
|
};
|
|
60
70
|
/**
|
|
61
71
|
* @typedef {object} LaunchBrowserOptions
|
|
@@ -77,6 +87,8 @@ export type LaunchBrowserOptions = {
|
|
|
77
87
|
* @property {string} [rerunCommand] Command named in "Next:" hints.
|
|
78
88
|
* @property {number} [focusSettleMs] macOS: wait before the one focus check (default 1000).
|
|
79
89
|
* @property {(line: string) => void} [log] Progress lines (default stderr).
|
|
90
|
+
* @property {(progress: { message?: string, waitingFor?: string, current?: number, total?: number, unit?: string }) => void} [progress]
|
|
91
|
+
* What the launch is waiting for, for a caller's stage handle (`stage.progress`).
|
|
80
92
|
*/
|
|
81
93
|
/**
|
|
82
94
|
* @param {LaunchBrowserOptions} options
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export function cleanupWebDappRuntime({ target, cdpPort, resetProfile }: {
|
|
3
|
+
target: any;
|
|
4
|
+
cdpPort: any;
|
|
5
|
+
resetProfile?: boolean | undefined;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
status: string;
|
|
8
|
+
target: string;
|
|
9
|
+
stopped: {
|
|
10
|
+
name: string;
|
|
11
|
+
pid: number;
|
|
12
|
+
}[];
|
|
13
|
+
cdpPortFree: any;
|
|
14
|
+
removed: string[];
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The absolute path of a leaf script (`launch`, `wallet-host`, `inject`,
|
|
3
|
+
* `verify`, `stop` or `cleanup`).
|
|
4
|
+
* @param {'launch' | 'wallet-host' | 'inject' | 'verify' | 'stop' | 'cleanup'} name
|
|
5
|
+
*/
|
|
6
|
+
export function webDappLeafPath(name: "launch" | "wallet-host" | "inject" | "verify" | "stop" | "cleanup"): string;
|
|
7
|
+
/**
|
|
8
|
+
* A file in the slot's runtime directory (the realpath of the target, as the
|
|
9
|
+
* launcher uses): <checkout>/<runtime>/<adapter id>/<name>.
|
|
10
|
+
* @param {string} target
|
|
11
|
+
* @param {string} name
|
|
12
|
+
*/
|
|
13
|
+
export function webDappRuntimeFile(target: string, name: string): string;
|
|
14
|
+
/** @param {Record<string, string | boolean>} options */
|
|
15
|
+
export function webDappOnlyLaunchFlags(options: Record<string, string | boolean>): ("--signer" | "--account" | "--fresh-profile" | "--headless" | "--headful" | "--slow-mo" | "--network" | "--mainnet-confirmation")[];
|
|
16
|
+
/**
|
|
17
|
+
* The leaf prints one JSON document (compact with --json, indented without).
|
|
18
|
+
* Parse it whole; fall back to the last line for any log noise before it.
|
|
19
|
+
* @param {string} output
|
|
20
|
+
* @returns {Record<string, unknown>}
|
|
21
|
+
*/
|
|
22
|
+
export function parseWebDappLauncherOutput(output: string): Record<string, unknown>;
|
|
23
|
+
export function webDappAppPort(): number | undefined;
|
|
24
|
+
export function webDappCdpPort(): number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Bind the venue policy of an adapter that extends web-dapp: its module path
|
|
27
|
+
* goes to RECIPE_WEB_DAPP_POLICY, which web-dapp's members, leaf processes and
|
|
28
|
+
* live actions read for this command. Called when the host adopts the adapter.
|
|
29
|
+
* @template {{ extends?: string, policy?: { module?: unknown } }} T
|
|
30
|
+
* @param {T} adapter
|
|
31
|
+
* @returns {T}
|
|
32
|
+
*/
|
|
33
|
+
export function bindWebDappPolicy<T extends {
|
|
34
|
+
extends?: string;
|
|
35
|
+
policy?: {
|
|
36
|
+
module?: unknown;
|
|
37
|
+
};
|
|
38
|
+
}>(adapter: T): T;
|
|
39
|
+
/**
|
|
40
|
+
* @param {readonly string[]} lines
|
|
41
|
+
* @returns {import('@farmslot/adapter-sdk').AdapterLogFinding[]}
|
|
42
|
+
*/
|
|
43
|
+
export function walletRequestFindings(lines: readonly string[]): import("@farmslot/adapter-sdk").AdapterLogFinding[];
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {Partial<Omit<import('@farmslot/adapter-sdk').PlatformAdapter, 'id' | 'sdkVersion' | 'harness'>> & {
|
|
46
|
+
* harness?: Partial<import('@farmslot/adapter-sdk').AdapterHarness>,
|
|
47
|
+
* }} WebDappAdapterHooks
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {object} WebDappAdapterOptions
|
|
51
|
+
* @property {string} [id] The adapter id; web-dapp by default.
|
|
52
|
+
* @property {string} [signerModule] Absolute path of the ESM module exporting
|
|
53
|
+
* `signers` (see lib/signers.mjs). The one source of the signer hooks: readiness
|
|
54
|
+
* loads it in this process and launch, verify and the wallet host load it in theirs.
|
|
55
|
+
* @property {string} [cli] The host's bin name, for `Next:` lines. farmslot-recipe by default.
|
|
56
|
+
* @property {WebDappAdapterHooks} [hooks]
|
|
57
|
+
* Anything of the PlatformAdapter the host supplies or replaces. `actions` is
|
|
58
|
+
* required in practice (web-dapp ships no action manifest); `diagnostics`,
|
|
59
|
+
* `readiness` and `harness` merge over the generic members, the rest replace.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* @param {WebDappAdapterOptions} [factoryOptions]
|
|
63
|
+
* @returns {import('@farmslot/adapter-sdk').PlatformAdapter}
|
|
64
|
+
*/
|
|
65
|
+
export function createWebDappAdapter(factoryOptions?: WebDappAdapterOptions): import("@farmslot/adapter-sdk").PlatformAdapter;
|
|
66
|
+
export { cleanupWebDappRuntime } from "./cleanup.mjs";
|
|
67
|
+
export { installWebDappRuntime } from "./inject.mjs";
|
|
68
|
+
export const WEB_DAPP_CONSOLE_FILES: Readonly<{
|
|
69
|
+
app: "app-console.log";
|
|
70
|
+
extension: "extension-console.log";
|
|
71
|
+
collectorLog: "console-tail.log";
|
|
72
|
+
pidFile: "console-tail.pid";
|
|
73
|
+
}>;
|
|
74
|
+
export const WEB_DAPP_ONLY_LAUNCH_OPTIONS: Readonly<{
|
|
75
|
+
signer: "--signer";
|
|
76
|
+
account: "--account";
|
|
77
|
+
freshProfile: "--fresh-profile";
|
|
78
|
+
headless: "--headless";
|
|
79
|
+
headful: "--headful";
|
|
80
|
+
slowMo: "--slow-mo";
|
|
81
|
+
network: "--network";
|
|
82
|
+
mainnetConfirmation: "--mainnet-confirmation";
|
|
83
|
+
}>;
|
|
84
|
+
export type WebDappAdapterHooks = Partial<Omit<import("@farmslot/adapter-sdk").PlatformAdapter, "id" | "sdkVersion" | "harness">> & {
|
|
85
|
+
harness?: Partial<import("@farmslot/adapter-sdk").AdapterHarness>;
|
|
86
|
+
};
|
|
87
|
+
export type WebDappAdapterOptions = {
|
|
88
|
+
/**
|
|
89
|
+
* The adapter id; web-dapp by default.
|
|
90
|
+
*/
|
|
91
|
+
id?: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Absolute path of the ESM module exporting
|
|
94
|
+
* `signers` (see lib/signers.mjs). The one source of the signer hooks: readiness
|
|
95
|
+
* loads it in this process and launch, verify and the wallet host load it in theirs.
|
|
96
|
+
*/
|
|
97
|
+
signerModule?: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* The host's bin name, for `Next:` lines. farmslot-recipe by default.
|
|
100
|
+
*/
|
|
101
|
+
cli?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Anything of the PlatformAdapter the host supplies or replaces. `actions` is
|
|
104
|
+
* required in practice (web-dapp ships no action manifest); `diagnostics`,
|
|
105
|
+
* `readiness` and `harness` merge over the generic members, the rest replace.
|
|
106
|
+
*/
|
|
107
|
+
hooks?: WebDappAdapterHooks | undefined;
|
|
108
|
+
};
|
|
109
|
+
import { loadSigners } from './lib/signers.mjs';
|
|
110
|
+
import { POLICY_ENV } from './lib/policy.mjs';
|
|
111
|
+
import { check } from './lib/readiness.mjs';
|
|
112
|
+
import { SIGNER_MODULE_ENV } from './lib/signers.mjs';
|
|
113
|
+
import { webDappAdapterId } from './lib/policy.mjs';
|
|
114
|
+
import { webDappPolicy } from './lib/policy.mjs';
|
|
115
|
+
export { loadSigners, POLICY_ENV, check as readinessCheck, SIGNER_MODULE_ENV, webDappAdapterId, webDappPolicy };
|
|
116
|
+
export { backgroundWindowParams, checkFocusAfterLaunch, chromeForTestingCandidates, LAUNCH_SERVICES, LAUNCH_TIMEOUTS, launchMethodFor, launchWebDappBrowser, macApplicationForExecutable, parseLaunchArgs, resolveBrowser, SPAWN, spawnDetached } from "./launch.mjs";
|
|
117
|
+
export { hostOf, hostResolverRules, isBlockedUrl } from "./lib/blocked-hosts.mjs";
|
|
118
|
+
export { browserWebSocketUrl, CdpClient } from "./lib/cdp-client.mjs";
|
|
119
|
+
export { recipeHarnessPath, recipeRuntimeDir, recipeRuntimePath, shellQuote, walletFixturePath } from "./lib/paths.mjs";
|
|
120
|
+
export { assertPolicyDigest, fencePolicy, POLICY_DIGEST_ENV, PolicyFenceError } from "./lib/policy-fence.mjs";
|
|
121
|
+
export { cdpListenerPids, ownedBrowserPids, OWNER_FLAG, OWNER_KINDS, ownerMarker, ownsProcess, pidAlive, portFree, stopConsoleCollector, stopWebDappBrowser, terminate } from "./lib/processes.mjs";
|
|
122
|
+
export { assertLaunchNetwork, DEV_SERVER_PID_FILE, devServerTestnetDiagnostic, pythonFor, webDappReadiness } from "./lib/readiness.mjs";
|
|
123
|
+
export { accountName, appOrigin, appPort, canonicalPath, cdpPort, DEFAULT_ACCOUNT, fixtureAccount, fixtureEntry, fixturePath, loadWalletFixture, readBrowserState, readJsonFile, resolveAccountAddress, resolveSigner, SIGNER_MODES, viemAccountFromEntry, webDappRuntimeDir, webDappRuntimePath, writePrivateJson } from "./lib/runtime.mjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export function installWebDappRuntime({ target, fixture, force }: {
|
|
3
|
+
target: any;
|
|
4
|
+
fixture: any;
|
|
5
|
+
force?: boolean | undefined;
|
|
6
|
+
}): {
|
|
7
|
+
status: string;
|
|
8
|
+
target: string;
|
|
9
|
+
fixture: string;
|
|
10
|
+
fixturePath: string;
|
|
11
|
+
accounts: any;
|
|
12
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export function parseLaunchArgs(argv: any, env?: NodeJS.ProcessEnv): {
|
|
3
|
+
account: string;
|
|
4
|
+
'fresh-profile': boolean;
|
|
5
|
+
headless: boolean;
|
|
6
|
+
headful: boolean;
|
|
7
|
+
json: boolean;
|
|
8
|
+
} | {
|
|
9
|
+
help: boolean;
|
|
10
|
+
};
|
|
11
|
+
export function chromeForTestingCandidates(home?: string, platform?: NodeJS.Platform, arch?: NodeJS.Architecture): string[];
|
|
12
|
+
export function resolveBrowser(env?: NodeJS.ProcessEnv, candidates?: string[]): Promise<{
|
|
13
|
+
bin: string;
|
|
14
|
+
version: string | null;
|
|
15
|
+
source: string;
|
|
16
|
+
}>;
|
|
17
|
+
export function macApplicationForExecutable(executable: any): string | null;
|
|
18
|
+
export function launchMethodFor(executable: any, { platform }?: {
|
|
19
|
+
platform?: NodeJS.Platform | undefined;
|
|
20
|
+
}): "launch-services" | "spawn";
|
|
21
|
+
export function checkFocusAfterLaunch(runtime: any, previous: any, { ourPids, focus }?: {
|
|
22
|
+
ourPids?: number[] | undefined;
|
|
23
|
+
focus?: any;
|
|
24
|
+
}): any;
|
|
25
|
+
export function backgroundWindowParams(url: any, placement: any): {
|
|
26
|
+
left?: any;
|
|
27
|
+
top?: any;
|
|
28
|
+
width?: any;
|
|
29
|
+
height?: any;
|
|
30
|
+
url: any;
|
|
31
|
+
newWindow: boolean;
|
|
32
|
+
background: boolean;
|
|
33
|
+
};
|
|
34
|
+
export function spawnDetached(command: any, args: any, { logFile, pidFile, env }: {
|
|
35
|
+
logFile: any;
|
|
36
|
+
pidFile: any;
|
|
37
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
export function writePrivateFile(file: any, text: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* @param {Record<string, any>} args the parsed launch flags (see `parseLaunchArgs`)
|
|
42
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
43
|
+
* @param {{ timeouts?: { browserStartMs: number, hostReadyMs: number } }} [options]
|
|
44
|
+
*/
|
|
45
|
+
export function launchWebDappBrowser(args: Record<string, any>, env?: NodeJS.ProcessEnv, { timeouts }?: {
|
|
46
|
+
timeouts?: {
|
|
47
|
+
browserStartMs: number;
|
|
48
|
+
hostReadyMs: number;
|
|
49
|
+
};
|
|
50
|
+
}): Promise<any>;
|
|
51
|
+
export const SPAWN: "spawn";
|
|
52
|
+
export const LAUNCH_SERVICES: "launch-services";
|
|
53
|
+
export const LAUNCH_TIMEOUTS: Readonly<{
|
|
54
|
+
browserStartMs: 90000;
|
|
55
|
+
hostReadyMs: 180000;
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function browserWebSocketUrl(port: any, timeoutMs?: number): Promise<any>;
|
|
2
|
+
export class CdpClient {
|
|
3
|
+
static connect(url: any): Promise<CdpClient>;
|
|
4
|
+
on(method: any, handler: any): () => any;
|
|
5
|
+
send(method: any, params?: {}, sessionId?: undefined): Promise<any>;
|
|
6
|
+
close(): void;
|
|
7
|
+
#private;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function resolveHeadless({ headless, headful, nodeHeadless, nodeHeadful, env, }?: {
|
|
2
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
3
|
+
}): boolean;
|
|
4
|
+
export function resolveSlowMo({ flag, node, env }?: {
|
|
5
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
6
|
+
}): number;
|
|
7
|
+
export function detectScreen(env?: NodeJS.ProcessEnv): any;
|
|
8
|
+
export function windowPlacement({ cdpPort, env, screen }?: {
|
|
9
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
10
|
+
screen?: null | undefined;
|
|
11
|
+
}): {
|
|
12
|
+
zoom: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
source: any;
|
|
18
|
+
};
|
|
19
|
+
export function zoomLevel(zoom: any): number;
|
|
20
|
+
export function writeProfileZoom(profile: any, zoom: any): void;
|
|
21
|
+
export function browserDisplayArgs({ headless, placement }: {
|
|
22
|
+
headless: any;
|
|
23
|
+
placement: any;
|
|
24
|
+
}): string[];
|
|
25
|
+
export const MIN_LAYOUT_WIDTH: 1460;
|
|
26
|
+
export const MIN_ZOOM: 0.5;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function nextHudState(prior: any, node?: {}, nodeId?: string): {
|
|
2
|
+
seq: any;
|
|
3
|
+
title: any;
|
|
4
|
+
current: any;
|
|
5
|
+
last: any;
|
|
6
|
+
finished: null;
|
|
7
|
+
};
|
|
8
|
+
export function hudFile(runtimeDir: any): string;
|
|
9
|
+
export function readHudState(runtimeDir: any): any;
|
|
10
|
+
export function writeHudState(runtimeDir: any, state: any): void;
|
|
11
|
+
export function clearHudState(runtimeDir: any): void;
|
|
12
|
+
export function hudRenderExpression(state: any, appOrigin: any): string;
|
|
13
|
+
export const HUD_ELEMENT: "mm-harness-hud";
|
|
14
|
+
export const HUD_FILE: "hud.json";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function validateRelativeRecipePath(name: any, value: any): any;
|
|
2
|
+
/** The checkout-relative runtime directory: `RECIPE_RUNTIME_DIR`, else the default. */
|
|
3
|
+
export function recipeRuntimeDir(): any;
|
|
4
|
+
/** The checkout-relative overlay directory: `RECIPE_HARNESS_ROOT`, else the default. */
|
|
5
|
+
export function recipeHarnessRoot(): any;
|
|
6
|
+
export function recipeRuntimePath(projectRoot: any, ...segments: any[]): string;
|
|
7
|
+
export function recipeHarnessPath(projectRoot: any, ...segments: any[]): string;
|
|
8
|
+
export function walletFixturePath(projectRoot: any): string;
|
|
9
|
+
export function shellQuote(value: any): string;
|
|
10
|
+
export const DEFAULT_RECIPE_RUNTIME_DIR: "temp/recipe/runtime";
|
|
11
|
+
export const DEFAULT_RECIPE_HARNESS_ROOT: "temp/recipe/harness";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check a policy module against `covered`, the real paths of the files the
|
|
3
|
+
* plugin digest covers, and return the digest of the policy's files. Throws
|
|
4
|
+
* PolicyFenceError when one of them is not covered.
|
|
5
|
+
*/
|
|
6
|
+
export function fencePolicy({ file, covered, scope }: {
|
|
7
|
+
file: any;
|
|
8
|
+
covered: any;
|
|
9
|
+
scope: any;
|
|
10
|
+
}): string;
|
|
11
|
+
/** Refuse a policy whose files changed since mm-harness bound it (`digest`). */
|
|
12
|
+
export function assertPolicyDigest(file: any, digest: any): void;
|
|
13
|
+
export const POLICY_DIGEST_ENV: "RECIPE_WEB_DAPP_POLICY_DIGEST";
|
|
14
|
+
export class PolicyFenceError extends Error {
|
|
15
|
+
constructor(message: any);
|
|
16
|
+
code: string;
|
|
17
|
+
userAction: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function pidAlive(pid: any): boolean;
|
|
2
|
+
export function processCommand(pid: any): string;
|
|
3
|
+
export function ownerMarker(kind: any, runtimeDir: any): string;
|
|
4
|
+
export function ownsProcess(kind: any, pid: any, runtimeDir: any, command?: string): boolean;
|
|
5
|
+
export function portFree(port: any): Promise<any>;
|
|
6
|
+
export function terminate(pid: any, graceMs?: number): Promise<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} target
|
|
9
|
+
* @param {{ log?: (message: string) => void, runtimeDir?: string }} [options]
|
|
10
|
+
*/
|
|
11
|
+
export function stopConsoleCollector(target: string, { log, runtimeDir }?: {
|
|
12
|
+
log?: (message: string) => void;
|
|
13
|
+
runtimeDir?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
stopped: null;
|
|
16
|
+
foreign?: undefined;
|
|
17
|
+
stale?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
stopped: number;
|
|
20
|
+
foreign?: undefined;
|
|
21
|
+
stale?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
stopped: null;
|
|
24
|
+
foreign: number;
|
|
25
|
+
stale?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
stopped: null;
|
|
28
|
+
stale: number;
|
|
29
|
+
foreign?: undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export function ownedBrowserPids(runtimeDir: any): number[];
|
|
32
|
+
export function cdpListenerPids(port: any): number[];
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} target
|
|
35
|
+
* @param {{ cdpPort?: number, log?: (message: string) => void, runtimeDir?: string }} [options]
|
|
36
|
+
*/
|
|
37
|
+
export function stopWebDappBrowser(target: string, { cdpPort, log, runtimeDir }?: {
|
|
38
|
+
cdpPort?: number;
|
|
39
|
+
log?: (message: string) => void;
|
|
40
|
+
runtimeDir?: string;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
stopped: {
|
|
43
|
+
name: string;
|
|
44
|
+
pid: number;
|
|
45
|
+
}[];
|
|
46
|
+
stale: {
|
|
47
|
+
name: string;
|
|
48
|
+
pid: number;
|
|
49
|
+
}[];
|
|
50
|
+
foreign: {
|
|
51
|
+
name: string;
|
|
52
|
+
pid: number;
|
|
53
|
+
}[];
|
|
54
|
+
cdpPortFree: any;
|
|
55
|
+
}>;
|
|
56
|
+
export const OWNER_FLAG: "--mm-harness-owner";
|
|
57
|
+
export const OWNER_KINDS: readonly string[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} id
|
|
3
|
+
* @param {boolean} ok
|
|
4
|
+
* @param {string} detail
|
|
5
|
+
* @param {{ required?: boolean, status?: 'pass' | 'fail' | 'warn' }} [options]
|
|
6
|
+
*/
|
|
7
|
+
export function check(id: string, ok: boolean, detail: string, { required, status }?: {
|
|
8
|
+
required?: boolean;
|
|
9
|
+
status?: "pass" | "fail" | "warn";
|
|
10
|
+
}): {
|
|
11
|
+
id: string;
|
|
12
|
+
status: "fail" | "pass" | "warn";
|
|
13
|
+
required: boolean;
|
|
14
|
+
detail: string;
|
|
15
|
+
};
|
|
16
|
+
export function pythonFor({ found, platform, developerDir }: {
|
|
17
|
+
found: any;
|
|
18
|
+
platform?: NodeJS.Platform | undefined;
|
|
19
|
+
developerDir: any;
|
|
20
|
+
}): any;
|
|
21
|
+
export function environmentValue(env: any, name: any): any;
|
|
22
|
+
export function nextServerMode(argv: any): any;
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} target
|
|
25
|
+
* @param {{ appPort?: number, variable?: string, probe?: typeof systemProbe }} [options]
|
|
26
|
+
*/
|
|
27
|
+
export function devServerTestnetDiagnostic(target: string, { appPort, variable, probe }?: {
|
|
28
|
+
appPort?: number;
|
|
29
|
+
variable?: string;
|
|
30
|
+
probe?: typeof systemProbe;
|
|
31
|
+
}): {
|
|
32
|
+
known: boolean;
|
|
33
|
+
forced: boolean;
|
|
34
|
+
detail: any;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} _target
|
|
38
|
+
* @param {{ network?: string | null, mainnetConfirmation?: string }} [options]
|
|
39
|
+
* @returns {'testnet' | 'mainnet'}
|
|
40
|
+
*/
|
|
41
|
+
export function assertLaunchNetwork(_target: string, { network, mainnetConfirmation }?: {
|
|
42
|
+
network?: string | null;
|
|
43
|
+
mainnetConfirmation?: string;
|
|
44
|
+
}): "testnet" | "mainnet";
|
|
45
|
+
/**
|
|
46
|
+
* @param {{
|
|
47
|
+
* policy?: any,
|
|
48
|
+
* signers?: Record<string, any>,
|
|
49
|
+
* target: string,
|
|
50
|
+
* appPort?: number,
|
|
51
|
+
* cdpPort?: number,
|
|
52
|
+
* signer?: string,
|
|
53
|
+
* account?: string,
|
|
54
|
+
* env?: NodeJS.ProcessEnv,
|
|
55
|
+
* probeBrowser?: (env: NodeJS.ProcessEnv) => Promise<{ bin: string, version: string | null, source: string }>,
|
|
56
|
+
* }} options
|
|
57
|
+
*/
|
|
58
|
+
export function webDappReadiness({ policy, signers, target, appPort, cdpPort, signer, account, env, probeBrowser, }: {
|
|
59
|
+
policy?: any;
|
|
60
|
+
signers?: Record<string, any>;
|
|
61
|
+
target: string;
|
|
62
|
+
appPort?: number;
|
|
63
|
+
cdpPort?: number;
|
|
64
|
+
signer?: string;
|
|
65
|
+
account?: string;
|
|
66
|
+
env?: NodeJS.ProcessEnv;
|
|
67
|
+
probeBrowser?: (env: NodeJS.ProcessEnv) => Promise<{
|
|
68
|
+
bin: string;
|
|
69
|
+
version: string | null;
|
|
70
|
+
source: string;
|
|
71
|
+
}>;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
status: string;
|
|
74
|
+
checks: any[];
|
|
75
|
+
failed: any[];
|
|
76
|
+
browser: any;
|
|
77
|
+
}>;
|
|
78
|
+
export const DEV_SERVER_PID_FILE: "temp/farmslot/next-dev.pid";
|
|
79
|
+
export const systemProbe: Readonly<{
|
|
80
|
+
listeners: (port: any) => any;
|
|
81
|
+
parents: () => Map<any, any>;
|
|
82
|
+
cwd: (pid: any) => any;
|
|
83
|
+
procArgs: (pid: any) => any;
|
|
84
|
+
}>;
|
|
85
|
+
export const MAINNET_CONFIRMATION: "REAL_FUNDS";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function canonicalPath(target: any): string;
|
|
2
|
+
export function webDappRuntimeDir(projectRoot: any): string;
|
|
3
|
+
export function webDappRuntimePath(projectRoot: any, ...segments: any[]): string;
|
|
4
|
+
export function appPort(input?: {}, env?: NodeJS.ProcessEnv): number;
|
|
5
|
+
export function appOrigin(input?: {}, env?: NodeJS.ProcessEnv): string;
|
|
6
|
+
export function cdpPort(input?: {}, env?: NodeJS.ProcessEnv): number;
|
|
7
|
+
export function readJsonFile(file: any): Promise<any>;
|
|
8
|
+
export function writePrivateJson(file: any, value: any): Promise<void>;
|
|
9
|
+
export function readBrowserState(projectRoot: any): Promise<any>;
|
|
10
|
+
export function resolveSigner(raw: any, fallback?: string): string;
|
|
11
|
+
export function accountName(input?: {}, browserState?: null): any;
|
|
12
|
+
export function fixturePath(projectRoot: any, env?: NodeJS.ProcessEnv): string;
|
|
13
|
+
export function loadWalletFixture(projectRoot: any, env?: NodeJS.ProcessEnv): Promise<{
|
|
14
|
+
file: string;
|
|
15
|
+
fixture: any;
|
|
16
|
+
}>;
|
|
17
|
+
export function fixtureEntry(fixture: any, name: any): any;
|
|
18
|
+
export function viemAccountFromEntry(entry: any, projectRoot: any): any;
|
|
19
|
+
export function fixtureAccount(projectRoot: any, name: any, env?: NodeJS.ProcessEnv): Promise<any>;
|
|
20
|
+
export function resolveAccountAddress(input: any, env?: NodeJS.ProcessEnv): Promise<{
|
|
21
|
+
name: any;
|
|
22
|
+
address: any;
|
|
23
|
+
}>;
|
|
24
|
+
export const SIGNER_MODES: readonly string[];
|
|
25
|
+
export const DEFAULT_ACCOUNT: "dev1";
|
|
26
|
+
import { POLICY_ENV } from './policy.mjs';
|
|
27
|
+
import { webDappAdapterId } from './policy.mjs';
|
|
28
|
+
import { webDappPolicy } from './policy.mjs';
|
|
29
|
+
export { POLICY_ENV, webDappAdapterId, webDappPolicy };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function defaultSigner(signerModule: any, env?: NodeJS.ProcessEnv): "extension" | "injected";
|
|
2
|
+
export function loadSigners(env?: NodeJS.ProcessEnv): Promise<any>;
|
|
3
|
+
export function injectedWalletIdentity(signers?: {}): any;
|
|
4
|
+
export const SIGNER_MODULE_ENV: "RECIPE_WEB_DAPP_SIGNER_MODULE";
|
|
5
|
+
export const GENERIC_INJECTED_IDENTITY: Readonly<{
|
|
6
|
+
info: Readonly<{
|
|
7
|
+
uuid: "5d1e5b4e-e2e0-4c3f-9a1d-000000000001";
|
|
8
|
+
name: "Strict test wallet";
|
|
9
|
+
icon: "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>";
|
|
10
|
+
rdns: "io.farmslot.strict-wallet";
|
|
11
|
+
}>;
|
|
12
|
+
isMetaMask: false;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function loadViemAccounts(projectRoot: any): any;
|