@vosjs/cli 0.46.1 → 0.47.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.
@@ -21,6 +21,18 @@ function pointerTravelMs(dist) {
21
21
  Math.max(POINTER_MIN_MS, Math.round(dist * POINTER_MS_PER_PX))
22
22
  );
23
23
  }
24
+ var RESPONSE_MS = 400;
25
+ var QUIET_MS = 250;
26
+ var SETTLE_CAP_MS = 1200;
27
+ function settleVerdict(t, c = { response: RESPONSE_MS, quiet: QUIET_MS, cap: SETTLE_CAP_MS }) {
28
+ if (t.sincePress >= c.cap) return "settled";
29
+ if (t.sinceChange === null)
30
+ return t.sincePress >= c.response ? "settled" : "wait";
31
+ return t.sinceChange >= c.quiet ? "settled" : "wait";
32
+ }
33
+ function holdLeftMs(holdMs, sinceChange) {
34
+ return Math.max(0, holdMs - (sinceChange ?? 0));
35
+ }
24
36
  function settleMs(step) {
25
37
  if (typeof step.ms === "number" && step.ms >= 0) return step.ms;
26
38
  const d = step.do;
@@ -55,6 +67,9 @@ function askedMs(step) {
55
67
  switch (step.do) {
56
68
  case "wait":
57
69
  return step.ms ?? 0;
70
+ // A click's ms is the read after the page settled: the author's.
71
+ case "click":
72
+ return step.ms ?? SETTLE_MS.click;
58
73
  case "hover":
59
74
  return step.ms ?? 700;
60
75
  case "drag":
@@ -154,6 +169,8 @@ export {
154
169
  SCROLL_SETTLE_MS,
155
170
  TRAILING_HOLD_MS,
156
171
  pointerTravelMs,
172
+ settleVerdict,
173
+ holdLeftMs,
157
174
  settleMs,
158
175
  clockMotion,
159
176
  clockTyping,
@@ -164,4 +181,4 @@ export {
164
181
  deadWarns,
165
182
  deadLine
166
183
  };
167
- //# sourceMappingURL=chunk-ID4OUS5L.js.map
184
+ //# sourceMappingURL=chunk-AUPGJJTL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/pace.ts"],"sourcesContent":["/**\n * The recorder's pace — the pure parts.\n *\n * A take of a scripted flow should run as long as the script asks, plus the\n * gestures a person makes between the asks (the pointer's travel, the press,\n * the settle after it) and no more. Measured before this module (§4.5 of\n * the utility-clip retrospective), hovers ran 2× their ask, drags 4.8× and\n * a 25 s script recorded 42 s, for two reasons the numbers here answer:\n *\n * - The motion loops counted STEPS (one per 16 ms of the asked duration)\n * and awaited a `mouse.move` round trip per step, so a page that\n * re-renders per move (a slider) stretched every gesture by the round\n * trip. A gesture is now driven by the CLOCK: its position is a function\n * of the elapsed time, and it ends when the asked duration has elapsed,\n * however many samples the page allowed.\n * - The settles after a gesture were fixed sleeps (500 ms after a click,\n * 250 after every selector lookup). A settle is DATA: `ms` on the step\n * overrides a small default, and the script's own `wait` steps carry\n * the intended pauses.\n */\n\n/** Pointer travel: ms per CSS px, floor and ceiling — a person's hand. */\nexport const POINTER_MS_PER_PX = 0.7\nexport const POINTER_MIN_MS = 250\nexport const POINTER_MAX_MS = 800\n/** The sample cadence a motion loop aims for. */\nexport const MOTION_TICK_MS = 16\n\n/** The settle after a gesture when the step names none, by verb. */\nexport const SETTLE_MS = {\n click: 150,\n type: 150,\n scroll: 200,\n drag: 80,\n} as const\n\n/** The press: the pause before the button goes down, and the hold. */\nexport const PRESS_LEAD_MS = 80\nexport const PRESS_HOLD_MS = 70\n/** The pause between a selector lookup that scrolled the page and the move. */\nexport const SCROLL_SETTLE_MS = 120\n/** The hold after the last step, so the take does not cut on a press. */\nexport const TRAILING_HOLD_MS = 400\n\n/** How long the pointer takes to travel `dist` CSS px. */\nexport function pointerTravelMs(dist: number): number {\n return Math.min(\n POINTER_MAX_MS,\n Math.max(POINTER_MIN_MS, Math.round(dist * POINTER_MS_PER_PX)),\n )\n}\n\n/**\n * A click's `ms` is READING time, held from the page's last visual change,\n * and the recorder pays the settle itself: the same `ms` was read on one\n * run and dead on the next because the hold started at the press and the\n * page's settle varied run to run (0.3 s to 0.7 s on the same step).\n *\n * The settle is watched on the screencast, which emits only on change:\n * after the press, a change that arrives within RESPONSE_MS says the page\n * is answering, and it has settled once QUIET_MS pass with no new frame.\n * No change within RESPONSE_MS means the page did not change (a click that\n * only moves state) and the settle is over. SETTLE_CAP_MS bounds a page\n * that never stops changing (a playing preview), which is a page nothing\n * is dead on, so the hold simply starts.\n */\nexport const RESPONSE_MS = 400\nexport const QUIET_MS = 250\nexport const SETTLE_CAP_MS = 1200\n\n/**\n * Is the page settled? Pure: the recorder feeds it what it knows at each\n * tick since the press.\n */\nexport function settleVerdict(\n t: {\n /** ms since the press. */\n sincePress: number\n /** ms since the last screencast frame, or null when none arrived since the press. */\n sinceChange: number | null\n },\n c = { response: RESPONSE_MS, quiet: QUIET_MS, cap: SETTLE_CAP_MS },\n): 'wait' | 'settled' {\n if (t.sincePress >= c.cap) return 'settled'\n if (t.sinceChange === null)\n return t.sincePress >= c.response ? 'settled' : 'wait'\n return t.sinceChange >= c.quiet ? 'settled' : 'wait'\n}\n\n/**\n * What is left of a hold once the settle is detected: the hold is measured\n * from the last change, so the quiet already spent counts toward it.\n */\nexport function holdLeftMs(holdMs: number, sinceChange: number | null): number {\n return Math.max(0, holdMs - (sinceChange ?? 0))\n}\n\n/** The settle after a step: its own `ms` when it names one, else the verb's. */\nexport function settleMs(step: { do: string; ms?: number }): number {\n if (typeof step.ms === 'number' && step.ms >= 0) return step.ms\n const d = step.do as keyof typeof SETTLE_MS\n return SETTLE_MS[d] ?? 0\n}\n\nexport const easeInOutCubic = (u: number): number =>\n u < 0.5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2\n\n/**\n * Drive a motion by the clock: `at(u)` is called with the eased progress\n * for each sample, and the loop ends when `dur` ms have elapsed, with the\n * last call at u = 1 exactly. Between samples it sleeps to the next tick\n * only when the sample came back early; a slow sample (a page busy\n * re-rendering) is followed at once, so the gesture keeps its length and\n * loses samples, never the other way round.\n */\nexport async function clockMotion(\n dur: number,\n at: (u: number) => Promise<void>,\n clock: { now: () => number; sleep: (ms: number) => Promise<void> },\n): Promise<number> {\n const start = clock.now()\n let samples = 0\n for (;;) {\n const elapsed = clock.now() - start\n if (elapsed >= dur) break\n await at(easeInOutCubic(Math.min(1, elapsed / dur)))\n samples++\n const next =\n start + Math.ceil((clock.now() - start) / MOTION_TICK_MS) * MOTION_TICK_MS\n const wait = Math.min(next, start + dur) - clock.now()\n if (wait > 0) await clock.sleep(wait)\n }\n await at(1)\n return samples + 1\n}\n\n/**\n * Typing paced by the clock: the i-th character is due at `start + i·delay`;\n * after each keystroke the loop sleeps to the next due time only if the\n * keystroke came back early. A slow field (an editor re-rendering per key)\n * types as fast as it can and says so in the pace report.\n */\nexport async function clockTyping(\n chars: readonly string[],\n delay: number,\n type: (ch: string, index: number) => Promise<void>,\n clock: { now: () => number; sleep: (ms: number) => Promise<void> },\n): Promise<void> {\n const start = clock.now()\n for (let i = 0; i < chars.length; i++) {\n await type(chars[i], i)\n const due = start + (i + 1) * delay\n const wait = due - clock.now()\n if (wait > 0 && i < chars.length - 1) await clock.sleep(wait)\n }\n}\n\n/** One step's pace: what the script asked for it and what it took. */\nexport interface StepPace {\n step: number\n do: string\n /** The script's own ask: a wait's ms, a hover's dwell, a drag's ms, typing's chars × delay, a click's read after the settle; 0 for a scroll. */\n askedMs: number\n /** The gesture the recorder adds by design: pointer travel, the press, the settle. */\n gestureMs: number\n wallMs: number\n}\n\nexport interface PaceReport {\n askedMs: number\n gestureMs: number\n wallMs: number\n /** Wall time neither asked nor a gesture: what the page and the round trips cost. */\n overheadMs: number\n overheadPct: number\n /** The steps whose wall ran past their ask plus gesture by more than a third. */\n slow: { step: number; do: string; askedMs: number; wallMs: number }[]\n}\n\n/** What a script asks of a step, in ms: the part of its wall time that is the author's. */\nexport function askedMs(step: {\n do: string\n ms?: number\n text?: string\n delayMs?: number\n}): number {\n switch (step.do) {\n case 'wait':\n return step.ms ?? 0\n // A click's ms is the read after the page settled: the author's.\n case 'click':\n return step.ms ?? SETTLE_MS.click\n case 'hover':\n return step.ms ?? 700\n case 'drag':\n return step.ms ?? 700\n case 'type':\n return (step.text?.length ?? 0) * (step.delayMs ?? 40)\n default:\n return 0\n }\n}\n\nexport function paceReport(steps: readonly StepPace[]): PaceReport {\n const askedMs = steps.reduce((a, s) => a + s.askedMs, 0)\n const gestureMs = steps.reduce((a, s) => a + s.gestureMs, 0)\n const wallMs = steps.reduce((a, s) => a + s.wallMs, 0)\n const overheadMs = Math.max(0, wallMs - askedMs - gestureMs)\n const slow = steps\n .filter((s) => s.wallMs > (s.askedMs + s.gestureMs) * 1.34 + 60)\n .map((s) => ({\n step: s.step,\n do: s.do,\n askedMs: s.askedMs,\n wallMs: s.wallMs,\n }))\n return {\n askedMs,\n gestureMs,\n wallMs,\n overheadMs,\n overheadPct: wallMs > 0 ? Math.round((overheadMs / wallMs) * 100) : 0,\n slow,\n }\n}\n\n/** The pace in one line for the log. */\nexport function paceLine(r: PaceReport): string {\n const s = (ms: number) => `${(ms / 1000).toFixed(1)} s`\n const slow = r.slow.length\n ? `; slow: ${r.slow.map((x) => `#${x.step} ${x.do} ${s(x.wallMs)} for ${s(x.askedMs)} asked`).join(', ')}`\n : ''\n return `pace: the script asked ${s(r.askedMs)}, the gestures added ${s(r.gestureMs)}, the take ran ${s(r.wallMs)} (${r.overheadPct} % overhead${slow})`\n}\n\n/**\n * DEAD TIME, the smoothness fact that replaces the freeze share as the\n * warning. A still frame is not a defect: a page the viewer is reading is\n * content, and a workspace tour is mostly still. What is dead is a still\n * frame under a PARKED cursor past the beat it takes to read what changed:\n * after that the picture, the pointer and the camera all hold and nothing\n * is being said. So the derivation reads, per step, when the page settled\n * after the step's act, how long the settled frame was held, and whether\n * the cursor moved in that hold; a hold past the reading beat is dead.\n *\n * The beat is longer after a page changed (a navigation shows a whole new\n * page to take in) than after a control changed (one thing to see).\n */\nexport const READ_BEAT_MS = { page: 1000, control: 600 } as const\n/** A dead stretch this long is a warning on its own, whatever the share. */\nexport const DEAD_STRETCH_WARN_MS = 1500\n/** The share of the take past which dead time is a warning. */\nexport const DEAD_SHARE_WARN_PCT = 20\n\nexport interface DeadStep {\n step: number\n id?: string\n do: string\n /** ms from the step's act (its press, else its start) to the last frame change in the step. */\n settledMs: number\n /** ms the settled frame was held before the step ended. */\n heldMs: number\n /** the hold past the reading beat, while the cursor was parked; 0 when the hold was read or the pointer moved. */\n deadMs: number\n}\n\nexport interface DeadReport {\n ms: number\n pct: number\n /** the steps that carried any dead time, in order. */\n steps: DeadStep[]\n /** the longest single dead hold. */\n longestMs: number\n}\n\nexport function deadTime(\n steps: readonly {\n step: number\n id?: string\n do: string\n tStart: number\n tEnd: number\n navigated?: boolean\n }[],\n frames: readonly { tMs: number }[],\n events: readonly { t: number; type: string }[],\n durationMs: number,\n): DeadReport {\n const out: DeadStep[] = []\n let ms = 0\n let longestMs = 0\n for (const s of steps) {\n const t0 = s.tStart * 1000\n const t1 = s.tEnd * 1000\n if (!(t1 > t0)) continue\n // The act: the step's first press, else its start (a wait, a move).\n const press = events.find(\n (e) => e.type === 'down' && e.t >= t0 && e.t <= t1,\n )\n const act = press ? press.t : t0\n // The last visual change inside the step, after the act.\n let last = act\n for (const f of frames) {\n if (f.tMs > act && f.tMs <= t1) last = f.tMs\n }\n const settledMs = Math.round(last - act)\n const heldMs = Math.round(t1 - last)\n // Parked: no pointer motion while the settled frame was held.\n const moved = events.some(\n (e) =>\n (e.type === 'move' || e.type === 'scroll') && e.t > last && e.t <= t1,\n )\n // The opening step shows a page the viewer has not seen: a page beat.\n const beat =\n s.navigated || s.step === 0 ? READ_BEAT_MS.page : READ_BEAT_MS.control\n const deadMs = moved ? 0 : Math.max(0, heldMs - beat)\n if (deadMs > 0) {\n out.push({\n step: s.step,\n ...(s.id ? { id: s.id } : {}),\n do: s.do,\n settledMs,\n heldMs,\n deadMs,\n })\n ms += deadMs\n longestMs = Math.max(longestMs, deadMs)\n }\n }\n return {\n ms,\n pct: durationMs > 0 ? Math.round((ms / durationMs) * 100) : 0,\n steps: out,\n longestMs,\n }\n}\n\n/** Whether a dead report earns a warning: the share, or one long hold. */\nexport function deadWarns(r: DeadReport): boolean {\n return r.pct >= DEAD_SHARE_WARN_PCT || r.longestMs >= DEAD_STRETCH_WARN_MS\n}\n\n/** The dead time in words, naming the steps and what to cut. */\nexport function deadLine(r: DeadReport): string {\n const s = (ms: number) => `${(ms / 1000).toFixed(1)} s`\n if (!r.steps.length) return 'dead time: none'\n const parts = r.steps.map(\n (d) =>\n `#${d.step}${d.id ? ` (${d.id})` : ''} ${d.do} held ${s(d.heldMs)} after it settled, ${s(d.deadMs)} past the beat`,\n )\n return `dead time: ${s(r.ms)} (${r.pct} %), a still frame under a parked cursor past the reading beat: ${parts.join('; ')}. Cut those steps' ms; a hold is what it takes to read what changed.`\n}\n"],"mappings":";;;AAsBO,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAEvB,IAAM,iBAAiB;AAGvB,IAAM,YAAY;AAAA,EACvB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AACR;AAGO,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AAEtB,IAAM,mBAAmB;AAEzB,IAAM,mBAAmB;AAGzB,SAAS,gBAAgB,MAAsB;AACpD,SAAO,KAAK;AAAA,IACV;AAAA,IACA,KAAK,IAAI,gBAAgB,KAAK,MAAM,OAAO,iBAAiB,CAAC;AAAA,EAC/D;AACF;AAgBO,IAAM,cAAc;AACpB,IAAM,WAAW;AACjB,IAAM,gBAAgB;AAMtB,SAAS,cACd,GAMA,IAAI,EAAE,UAAU,aAAa,OAAO,UAAU,KAAK,cAAc,GAC7C;AACpB,MAAI,EAAE,cAAc,EAAE,IAAK,QAAO;AAClC,MAAI,EAAE,gBAAgB;AACpB,WAAO,EAAE,cAAc,EAAE,WAAW,YAAY;AAClD,SAAO,EAAE,eAAe,EAAE,QAAQ,YAAY;AAChD;AAMO,SAAS,WAAW,QAAgB,aAAoC;AAC7E,SAAO,KAAK,IAAI,GAAG,UAAU,eAAe,EAAE;AAChD;AAG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;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA,KAAK,aAAa,IAAI,KAAK,MAAO,KAAK,aAAc,GAAG,IAAI;AAAA,IAC5D,OAAO;AAAA,IACP;AAAA,EACF;AACF;AAGO,SAAS,UAAU,GAAwB;AAChD,SAAO,EAAE,OAAO,uBAAuB,EAAE,aAAa;AACxD;AAGO,SAAS,SAAS,GAAuB;AAC9C,QAAM,IAAI,CAAC,OAAe,IAAI,KAAK,KAAM,QAAQ,CAAC,CAAC;AACnD,MAAI,CAAC,EAAE,MAAM,OAAQ,QAAO;AAC5B,QAAM,QAAQ,EAAE,MAAM;AAAA,IACpB,CAAC,MACC,IAAI,EAAE,IAAI,GAAG,EAAE,KAAK,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,sBAAsB,EAAE,EAAE,MAAM,CAAC;AAAA,EACtG;AACA,SAAO,cAAc,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,mEAAmE,MAAM,KAAK,IAAI,CAAC;AAC3H;","names":["askedMs"]}
@@ -17,11 +17,13 @@ import {
17
17
  deadLine,
18
18
  deadTime,
19
19
  deadWarns,
20
+ holdLeftMs,
20
21
  paceLine,
21
22
  paceReport,
22
23
  pointerTravelMs,
23
- settleMs
24
- } from "./chunk-ID4OUS5L.js";
24
+ settleMs,
25
+ settleVerdict
26
+ } from "./chunk-AUPGJJTL.js";
25
27
 
26
28
  // src/plugin/run.ts
27
29
  import { mkdir as mkdir10, readFile as readFile15, rm as rm5 } from "fs/promises";
@@ -7194,6 +7196,19 @@ async function recordTake(browser, url, actions, paths, log, opts = {}) {
7194
7196
  rect
7195
7197
  });
7196
7198
  };
7199
+ const waitSettled = async () => {
7200
+ if (dry) return null;
7201
+ const pressAt = now();
7202
+ const before = frames.length;
7203
+ for (; ; ) {
7204
+ const t = now();
7205
+ const last = frames.length > before ? frames[frames.length - 1] : null;
7206
+ const sinceChange = last ? t - last.tMs : null;
7207
+ if (settleVerdict({ sincePress: t - pressAt, sinceChange }) === "settled")
7208
+ return sinceChange;
7209
+ await sleep(40);
7210
+ }
7211
+ };
7197
7212
  const skipped = [];
7198
7213
  const stepSpans = [];
7199
7214
  const paces = [];
@@ -7238,7 +7253,8 @@ async function recordTake(browser, url, actions, paths, log, opts = {}) {
7238
7253
  if (rect) {
7239
7254
  await gesture(() => clickAt(rect));
7240
7255
  log(`click ${step.selector}`);
7241
- await gesture(() => sleep(settleMs(step)));
7256
+ const sinceChange = await gesture(() => waitSettled());
7257
+ await sleep(holdLeftMs(settleMs(step), sinceChange));
7242
7258
  } else
7243
7259
  skipped.push({ step: stepIdx, do: step.do, selector: step.selector });
7244
7260
  break;
@@ -7911,6 +7927,7 @@ function planOtherMedia(doc, activity) {
7911
7927
  ...planAutoZoom(m.cursor, {
7912
7928
  width: m.meta.width,
7913
7929
  height: m.meta.height,
7930
+ duration: m.meta.durationMs / 1e3,
7914
7931
  style: doc.zoomStyle,
7915
7932
  params: doc.zoomParams
7916
7933
  }).filter((z) => !manualZoom.some((x) => overlaps(z, x))).filter((z) => !isRejected("zoom", z, rejected)).map((z) => ({ ...z, id: `${z.id}-${m.id}`, media: m.id }))
@@ -7953,6 +7970,7 @@ async function planTake(dir, opts = {}) {
7953
7970
  const autoZoom = planAutoZoom(doc.source.cursor, {
7954
7971
  width: doc.source.meta.width,
7955
7972
  height: doc.source.meta.height,
7973
+ duration: doc.source.meta.durationMs / 1e3,
7956
7974
  style: doc.zoomStyle,
7957
7975
  params: doc.zoomParams
7958
7976
  }).filter((z) => !manualZoom.some((m) => overlaps(z, m))).filter((z) => !isRejected("zoom", z, doc.rejected));
@@ -8005,6 +8023,7 @@ async function planTake(dir, opts = {}) {
8005
8023
  const auto = planAutoZoom(doc.source.cursor, {
8006
8024
  width: doc.source.meta.width,
8007
8025
  height: doc.source.meta.height,
8026
+ duration: doc.source.meta.durationMs / 1e3,
8008
8027
  style: doc.zoomStyle,
8009
8028
  params: doc.zoomParams
8010
8029
  }).filter((z) => !manual.some((m) => overlaps(z, m))).filter((z) => !isRejected("zoom", z, doc.rejected));
@@ -8044,6 +8063,7 @@ async function planTake(dir, opts = {}) {
8044
8063
  doc.zoom = planAutoZoom(doc.source.cursor, {
8045
8064
  width: doc.source.meta.width,
8046
8065
  height: doc.source.meta.height,
8066
+ duration: doc.source.meta.durationMs / 1e3,
8047
8067
  style: doc.zoomStyle,
8048
8068
  params: doc.zoomParams
8049
8069
  });
@@ -10734,7 +10754,7 @@ function summary(result) {
10734
10754
  async function cmdActionsScript(input, flags) {
10735
10755
  const r = createReporter(flags.json === true);
10736
10756
  const { readFile: readFile16 } = await import("fs/promises");
10737
- const { shotList, formatShotList } = await import("./shotList-JC4A3FBT.js");
10757
+ const { shotList, formatShotList } = await import("./shotList-7F2FE3RU.js");
10738
10758
  const raw = JSON.parse(await readFile16(resolve8(input), "utf8"));
10739
10759
  const errors = validateActions(raw);
10740
10760
  if (errors.length) throw new UsageError(`${input}:
@@ -12676,4 +12696,4 @@ export {
12676
12696
  verbHelp,
12677
12697
  run
12678
12698
  };
12679
- //# sourceMappingURL=chunk-UE66DC2K.js.map
12699
+ //# sourceMappingURL=chunk-E42NCNWP.js.map