@hona/strobe 0.2.0 → 0.3.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/bin/strobe.js CHANGED
@@ -13,7 +13,7 @@ if (!exe) {
13
13
  const dir = dirname(require.resolve(`@hona/strobe-${target}/package.json`))
14
14
  exe = join(dir, process.platform === "win32" ? "strobe.exe" : "strobe")
15
15
  } catch {
16
- console.error(`strobe: no build for ${target} is installed (@hona/strobe-${target}). strobe ships for win32-x64 so far.`)
16
+ console.error(`strobe: no build for ${target} is installed (@hona/strobe-${target}). strobe ships for win32-x64, darwin-arm64, darwin-x64, linux-x64 and linux-arm64.`)
17
17
  process.exit(1)
18
18
  }
19
19
  }
package/dist/index.d.ts CHANGED
@@ -10,15 +10,14 @@ export interface Options {
10
10
  until?: Until;
11
11
  /** Milliseconds before the call fails the block. Default 30000. */
12
12
  timeout?: number;
13
- /** Native targets: the surface (window or overlay) by its key; default the app's main window. */
13
+ /** Native targets: the window (a top-level window or overlay of the app) by its title, or part of it; default the main window first, then the app's other windows. */
14
14
  window?: string;
15
15
  }
16
16
  /**
17
- * Drives the target. On a native target the app's bridge does it (its UI toolkit built with strobe support):
18
- * `click`, `hover`, `move`, `type`, `press`, `scroll`, `wheel`, `waitFor`, `idle`, `wait`, `window` and `snapshot`
19
- * work there, with selectors as the toolkit's element keys (`"nav-history"`, `"slider/knob"`), `role=button`,
20
- * `text=General`, and a `:focus` suffix. `goto`, `eval`, `down` and `up` are page-only. Without the bridge a native
21
- * target takes `wait` only.
17
+ * Drives the target. On a native target strobe drives the app through the OS's accessibility tree and the app's
18
+ * own message loop (posted input; the app never takes focus): selectors are accessibility ids (an element key,
19
+ * `"nav-history"`, or a key path, `"slider/knob"`), `role=button`, `text=General`, with a `:focus` suffix.
20
+ * `goto` and `eval` are page-only; `act` and `query` are native-only.
22
21
  */
23
22
  export interface Page {
24
23
  /** Opens `url`; a relative path resolves against the current page. */
@@ -32,8 +31,10 @@ export interface Page {
32
31
  type(selector: string, text: string, opts?: Options & {
33
32
  delay?: number;
34
33
  }): Promise<void>;
35
- /** A key or chord: `"Enter"`, `"Control+a"`, `"ControlOrMeta+Shift+P"`. */
36
- press(key: string, opts?: Options): Promise<void>;
34
+ /** A key or chord: `"Enter"`, `"Control+a"`, `"ControlOrMeta+Shift+P"`. Native targets: `opts.selector` sends it to that element (clicked into focus first, as `type` does). */
35
+ press(key: string, opts?: Options & {
36
+ selector?: string;
37
+ }): Promise<void>;
37
38
  /** Presses one key and holds it across other calls until `up`: a game's `"w"`, or `"Shift"` (held modifiers mark later keys). */
38
39
  down(key: string, opts?: Options): Promise<void>;
39
40
  /** Lets go of a key `down` pressed. */
@@ -54,8 +55,27 @@ export interface Page {
54
55
  dx?: number;
55
56
  dy?: number;
56
57
  }, opts?: Options): Promise<void>;
57
- /** Native targets: shows, hides, focuses or closes a window (`opts.window`, default the main one), through the app's own path. */
58
- window(action: "show" | "hide" | "focus" | "close", opts?: Options): Promise<void>;
58
+ /** Native targets: shows, hides, minimizes, focuses or closes a window (`opts.window`, default the main one). `close` is the title bar's close (the app's own close path). */
59
+ window(action: "show" | "hide" | "minimize" | "focus" | "close", opts?: Options): Promise<void>;
60
+ /**
61
+ * Native targets: an accessibility action on an element (UI Automation's patterns): `invoke`, `toggle`, `setValue`
62
+ * (`opts.value`), `expand`, `collapse`, `select`, `scrollIntoView`, `focus`. It skips hit testing and pointer
63
+ * handling, so it is never an input latency (`interaction.*` refuses a run that only acted).
64
+ */
65
+ act(selector: string, action: string, opts?: Options & {
66
+ value?: string;
67
+ }): Promise<void>;
68
+ /** Native targets: the visible elements `selector` matches now: key, path, role, name, value, rect (screen pixels), focused, enabled. */
69
+ query(selector: string, opts?: Options): Promise<{
70
+ key: string;
71
+ path: string;
72
+ role: string;
73
+ name: string;
74
+ value?: string;
75
+ rect: number[];
76
+ focused: boolean;
77
+ enabled: boolean;
78
+ }[]>;
59
79
  /** Resolves when a visible element matches `selector` (holding `text`, if given). Re-checked on every DOM and focus change, so `:focus` works. */
60
80
  waitFor(selector: string, opts?: {
61
81
  text?: string;
@@ -162,7 +182,7 @@ export interface MilestoneUntil {
162
182
  milestone: string;
163
183
  }
164
184
  export interface Launch<P> {
165
- /** The launch is ready when this is visible in any of its windows. The primary is `launch.ready`. A native target without its bridge times to a window condition instead. */
185
+ /** The launch is ready when this is visible in any of its windows. The primary is `launch.ready`. A native target: the screen time of the frame that first showed the element in its accessibility tree (OS present events), or a window condition. */
166
186
  until: Selector | WindowUntil | MilestoneUntil;
167
187
  /** Named points on the way, each a metric `launch.<name>`. One a case declares must appear in every launch. */
168
188
  milestones?: Record<string, Milestone>;
@@ -240,11 +260,7 @@ export type Target<P> = ({
240
260
  kind: "native";
241
261
  app?: string;
242
262
  path?: string;
243
- } & NativeOptions) | ({
244
- kind: "headless";
245
- app?: string;
246
- path?: string;
247
- } & HeadlessOptions);
263
+ } & NativeOptions);
248
264
  export interface Viewport {
249
265
  width: number;
250
266
  height: number;
@@ -288,11 +304,6 @@ export interface NativeOptions {
288
304
  args?: string[];
289
305
  /** Extra environment after the profile's; `{home}` and `{port}` are filled in. */
290
306
  env?: Record<string, string>;
291
- /**
292
- * The app's bridge (`STROBE_BRIDGE`): by default strobe offers it and uses it once a page call, a `ui.*` or frame
293
- * metric, or `--pixels` needs it. `true` requires it in every block; `false` measures the app from outside only.
294
- */
295
- bridge?: boolean;
296
307
  /**
297
308
  * `false`: the app shows no window (a tray app). strobe neither waits for one nor places or checks it, launches end
298
309
  * on a milestone (`until: { milestone }`), and cases whose metrics are all CPU, memory, IO, counters and milestones
@@ -300,7 +311,6 @@ export interface NativeOptions {
300
311
  */
301
312
  window?: false;
302
313
  }
303
- export type HeadlessOptions = Omit<NativeOptions, "viewport" | "bridge" | "window">;
304
314
  /** A parameter's values: all run, or `run` by default and `more` with `--params all`. */
305
315
  export type ParamValues = readonly unknown[] | {
306
316
  readonly run: readonly unknown[];
@@ -353,15 +363,10 @@ export declare function script<P = any>(entry: string, opts?: Omit<ScriptOptions
353
363
  /**
354
364
  * A native app (no browser engine): by its profile in strobe.json `apps` (`kind: "native"`), or an executable path.
355
365
  * Each block launches it in a fresh isolated home and measures it from outside: CPU in cycles, thread wakes
356
- * (`cpu.wakes`), IO, GPU, memory, and for launch cases its window. A directory or git-ref variant runs strobe.json's
357
- * `build` and launches its `output`.
366
+ * (`cpu.wakes`), the UI thread (`ui.cpu`), IO, GPU, memory, what reached the screen (`frames.*`, `interaction.*`), and
367
+ * for launch cases its window. `page` drives it through its accessibility tree. A directory or git-ref variant runs
368
+ * strobe.json's `build` and launches its `output`.
358
369
  */
359
370
  export declare function native<P = any>(appOrPath: string, opts?: NativeOptions): Target<P>;
360
- /**
361
- * The same native app in its toolkit's headless mode: offscreen, on a virtual clock, driven through its bridge. The
362
- * app profile's `headless` object holds the `args` and `env` that select it. Only `ui.*`, `count.*`, `cpu.*` and
363
- * `--pixels` are measured there: no display, no presentation, no launch.
364
- */
365
- export declare function headless<P = any>(appOrPath: string, opts?: HeadlessOptions): Target<P>;
366
371
  export declare function bench<const Params extends Record<string, ParamValues> = {}>(spec: Bench<Params>): Bench<Params>;
367
372
  export {};
package/dist/index.js CHANGED
@@ -21,10 +21,6 @@ function native(appOrPath, opts = {}) {
21
21
  const path = /[\\/]|\.exe$/i.test(appOrPath);
22
22
  return { kind: "native", ...path ? { path: appOrPath } : { app: appOrPath }, ...opts };
23
23
  }
24
- function headless(appOrPath, opts = {}) {
25
- const path = /[\\/]|\.exe$/i.test(appOrPath);
26
- return { kind: "headless", ...path ? { path: appOrPath } : { app: appOrPath }, ...opts };
27
- }
28
24
  function bench(spec) {
29
25
  return spec;
30
26
  }
@@ -33,7 +29,6 @@ export {
33
29
  bench,
34
30
  command,
35
31
  exe,
36
- headless,
37
32
  native,
38
33
  script,
39
34
  url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hona/strobe",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Measure and explain performance: the strobe CLI and the types and helpers for its bench files",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,11 @@
21
21
  "build": "bun build src/index.ts --outdir dist --target node --format esm && tsc -p tsconfig.json"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@hona/strobe-win32-x64": "0.2.0"
24
+ "@hona/strobe-darwin-arm64": "0.3.0",
25
+ "@hona/strobe-darwin-x64": "0.3.0",
26
+ "@hona/strobe-linux-arm64": "0.3.0",
27
+ "@hona/strobe-linux-x64": "0.3.0",
28
+ "@hona/strobe-win32-x64": "0.3.0"
25
29
  },
26
30
  "devDependencies": {
27
31
  "typescript": "^5.9.0"