demoman 0.8.2 → 0.9.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.
@@ -22949,6 +22949,49 @@
22949
22949
  throw error;
22950
22950
  }
22951
22951
  }
22952
+ async function imagesDiff(urlsA, urlsB, sizeA, sizeB, windows, o) {
22953
+ const file = (size) => ({
22954
+ ...size,
22955
+ length: 0,
22956
+ frame: 0
22957
+ });
22958
+ const answer = {
22959
+ a: file(sizeA),
22960
+ b: file(sizeB),
22961
+ changed: []
22962
+ };
22963
+ if (sizeA.width !== sizeB.width || sizeA.height !== sizeB.height)
22964
+ return answer;
22965
+ const read = async (side, url) => {
22966
+ try {
22967
+ const res = await fetch(url);
22968
+ if (!res.ok)
22969
+ throw new Error(`answered ${res.status}`);
22970
+ const bitmap = await createImageBitmap(await res.blob());
22971
+ try {
22972
+ return drawnOf(bitmap, bitmap.width, bitmap.height, o.width);
22973
+ } finally {
22974
+ bitmap.close();
22975
+ }
22976
+ } catch (error) {
22977
+ throw new Unreadable(side, `${url}: ${error instanceof Error ? error.message : String(error)}`);
22978
+ }
22979
+ };
22980
+ try {
22981
+ for (const [i, urlA] of urlsA.entries()) {
22982
+ const da = await read("a", urlA);
22983
+ const gb = await read("b", urlsB[i]);
22984
+ const w = windows[i] ?? null;
22985
+ const db = w === null ? gb : insideOnly(da, gb, w, sizeB.width, o.inset);
22986
+ answer.changed.push(o.looks.map((look) => changedShare(da, db, look)));
22987
+ }
22988
+ } catch (error) {
22989
+ if (error instanceof Unreadable)
22990
+ return { unreadable: error.side, error: error.message };
22991
+ throw error;
22992
+ }
22993
+ return answer;
22994
+ }
22952
22995
  var Unreadable = class extends Error {
22953
22996
  side;
22954
22997
  constructor(side, cause) {
@@ -23007,6 +23050,7 @@
23007
23050
  }
23008
23051
  var entry = {
23009
23052
  screensDiff,
23053
+ imagesDiff,
23010
23054
  decodeFrame,
23011
23055
  readCrops,
23012
23056
  sampleFrames,
@@ -47606,11 +47606,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47606
47606
  const image = presentation.wallpaper;
47607
47607
  if (image === null || bg.kind === "solid" || bg.kind === "gradient")
47608
47608
  return;
47609
- const { sx, sy, sw, sh } = coverRect(image, target);
47610
47609
  ctx.imageSmoothingEnabled = true;
47611
47610
  ctx.imageSmoothingQuality = "high";
47611
+ const m = ctx.getTransform();
47612
+ if (m.a === 1 && m.d === 1 && m.b === 0 && m.c === 0) {
47613
+ ctx.drawImage(unzoomedCopy(image, target), 0, 0);
47614
+ return;
47615
+ }
47616
+ const { sx, sy, sw, sh } = coverRect(image, target);
47612
47617
  ctx.drawImage(image.image, sx, sy, sw, sh, 0, 0, target.width, target.height);
47613
47618
  }
47619
+ var unzoomedCopies = /* @__PURE__ */ new WeakMap();
47620
+ function unzoomedCopy(image, target) {
47621
+ const held = unzoomedCopies.get(image.image);
47622
+ if (held?.width === target.width && held.height === target.height) {
47623
+ return held;
47624
+ }
47625
+ const copy = new OffscreenCanvas(target.width, target.height);
47626
+ const g = copy.getContext("2d");
47627
+ if (g === null)
47628
+ throw new Error("the wallpaper's copy has no 2D context");
47629
+ const { sx, sy, sw, sh } = coverRect(image, target);
47630
+ g.imageSmoothingEnabled = true;
47631
+ g.imageSmoothingQuality = "high";
47632
+ g.drawImage(image.image, sx, sy, sw, sh, 0, 0, target.width, target.height);
47633
+ unzoomedCopies.set(image.image, copy);
47634
+ return copy;
47635
+ }
47614
47636
  function framePath(ctx, presentation) {
47615
47637
  const { frameRect: r, cornerRadius } = presentation;
47616
47638
  const radius = Math.min(cornerRadius, r.width / 2, r.height / 2);
@@ -48000,13 +48022,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48000
48022
  if (!sink) {
48001
48023
  throw new Error(`render target "${target.format}" needs a matching ${target.format === "mp4" ? "video sink" : `${target.format} sink`}`);
48002
48024
  }
48003
- const hints = target.format === "png" ? [] : await detectKeyframeMotion(bundle, ports.frames, plan.retiming.motionDiffThreshold);
48004
- const { resolved: composed, presentation, violations } = composeForTarget({
48025
+ const { resolved: composed, presentation, violations } = await composeLikeRender({
48005
48026
  plan,
48006
48027
  bundle,
48007
48028
  scene,
48008
48029
  target,
48009
- hints,
48030
+ ports,
48010
48031
  logo,
48011
48032
  wallpaper
48012
48033
  });
@@ -48047,24 +48068,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48047
48068
  }
48048
48069
  onFrame?.(i + 1, frameCount);
48049
48070
  }
48050
- const found = scene ? screenMoments(composed, scene, bundle) : { steps: 0, moments: [] };
48051
- const r = (v) => Math.round(v * 100) / 100;
48052
- const screens = {
48053
- ...found,
48054
- moments: found.moments.map((m) => {
48055
- const w = windowOnScreen(presentation, sceneCameraAt(composed, presentation, target, startMs + m.ms));
48056
- return {
48057
- ...m,
48058
- window: {
48059
- x: r(w.x),
48060
- y: r(w.y),
48061
- width: r(w.width),
48062
- height: r(w.height),
48063
- radius: r(w.radius)
48064
- }
48065
- };
48066
- })
48067
- };
48071
+ const screens = screensWithWindows(composed, presentation, target, scene, bundle, startMs);
48068
48072
  const bytes2 = await (async () => {
48069
48073
  if (target.format === "mp4" && ports.video)
48070
48074
  return ports.video.finish();
@@ -48089,6 +48093,88 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48089
48093
  deepestScale: composed.cameraKeys.reduce((m, k) => Math.max(m, k.scale), 1)
48090
48094
  };
48091
48095
  }
48096
+ async function composeLikeRender(args) {
48097
+ const { plan, bundle, scene, target, ports, logo, wallpaper } = args;
48098
+ const hints = target.format === "png" ? [] : await detectKeyframeMotion(bundle, ports.frames, plan.retiming.motionDiffThreshold);
48099
+ return composeForTarget({
48100
+ plan,
48101
+ bundle,
48102
+ scene,
48103
+ target,
48104
+ hints,
48105
+ logo,
48106
+ wallpaper
48107
+ });
48108
+ }
48109
+ function screensWithWindows(composed, presentation, target, scene, bundle, startMs) {
48110
+ const found = scene ? screenMoments(composed, scene, bundle) : { steps: 0, moments: [] };
48111
+ const r = (v) => Math.round(v * 100) / 100;
48112
+ return {
48113
+ ...found,
48114
+ moments: found.moments.map((m) => {
48115
+ const w = windowOnScreen(presentation, sceneCameraAt(composed, presentation, target, startMs + m.ms));
48116
+ return {
48117
+ ...m,
48118
+ window: {
48119
+ x: r(w.x),
48120
+ y: r(w.y),
48121
+ width: r(w.width),
48122
+ height: r(w.height),
48123
+ radius: r(w.radius)
48124
+ }
48125
+ };
48126
+ })
48127
+ };
48128
+ }
48129
+ async function renderScreens(args) {
48130
+ const { plan, bundle, scene, target, ports } = args;
48131
+ const { logo = null, wallpaper = null } = args;
48132
+ const sink = ports.images;
48133
+ if (!sink)
48134
+ throw new Error("renderScreens needs an image sink");
48135
+ const { resolved, presentation, violations } = await composeLikeRender({
48136
+ plan,
48137
+ bundle,
48138
+ scene,
48139
+ target,
48140
+ ports,
48141
+ logo,
48142
+ wallpaper
48143
+ });
48144
+ const { startMs } = resolved.range;
48145
+ const screens = screensWithWindows(resolved, presentation, target, scene, bundle, startMs);
48146
+ const canvas = ports.surface.create(target.width, target.height);
48147
+ const ctx = canvas.getContext("2d");
48148
+ for (const [i, m] of screens.moments.entries()) {
48149
+ const outputTimeMs = startMs + m.ms;
48150
+ const image = await ports.frames.at(toSourceMs(resolved.timeline, outputTimeMs));
48151
+ await renderFrame({
48152
+ resolved,
48153
+ target,
48154
+ presentation,
48155
+ frames: {
48156
+ at: async () => image,
48157
+ describe: () => ports.frames.describe()
48158
+ },
48159
+ ctx,
48160
+ outputTimeMs
48161
+ });
48162
+ await sink.add(canvas, `screen-${i}.png`);
48163
+ }
48164
+ const files = await sink.finish();
48165
+ if (files.length !== screens.moments.length) {
48166
+ throw new Error(`${screens.moments.length} screens drawn but the image sink returned ${files.length} files`);
48167
+ }
48168
+ return {
48169
+ screens,
48170
+ images: screens.moments.map((m, i) => ({
48171
+ step: m.step,
48172
+ bytes: files[i].bytes
48173
+ })),
48174
+ detailViolations: violations,
48175
+ unavailableSpans: ports.frames.unavailable?.() ?? []
48176
+ };
48177
+ }
48092
48178
  function stillSourceMs(bundle, marker) {
48093
48179
  const keyframe = bundle.keyframes.find((k) => k.actionId === marker.actionId);
48094
48180
  return keyframe ? keyframe.sourceTimeMs : marker.sourceTimeMs;
@@ -48475,8 +48561,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48475
48561
  return true;
48476
48562
  });
48477
48563
  }
48564
+ function screenImageName(step) {
48565
+ return step === null ? "final.png" : `step-${step}.png`;
48566
+ }
48567
+ async function scaledPng(bytes2, width) {
48568
+ const bitmap = await createImageBitmap(new Blob([bytes2]));
48569
+ try {
48570
+ const canvas = new OffscreenCanvas(width, Math.round(bitmap.height * width / bitmap.width));
48571
+ canvas.getContext("2d").drawImage(bitmap, 0, 0, canvas.width, canvas.height);
48572
+ const blob = await canvas.convertToBlob({ type: "image/png" });
48573
+ return new Uint8Array(await blob.arrayBuffer());
48574
+ } finally {
48575
+ bitmap.close();
48576
+ }
48577
+ }
48478
48578
  async function renderOutput(input) {
48479
48579
  const { fileType, target, scene, bundle, frames, onFrame } = input;
48580
+ if (input.screensOnly !== void 0 && fileType === "stills") {
48581
+ throw new Error("screensOnly applies to an mp4 or gif output, not stills");
48582
+ }
48480
48583
  const logoAt = async (at2) => {
48481
48584
  if (input.logo === null)
48482
48585
  return { logo: null, logoWarning: null };
@@ -48640,6 +48743,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48640
48743
  }
48641
48744
  };
48642
48745
  }
48746
+ if (input.screensOnly !== void 0) {
48747
+ const { width } = input.screensOnly;
48748
+ const { logo, logoWarning: logoWarning2 } = await logoAt(target);
48749
+ const wallpaper = await wallpaperAt(target);
48750
+ let result2;
48751
+ try {
48752
+ result2 = await renderScreens({
48753
+ plan,
48754
+ bundle,
48755
+ scene,
48756
+ target,
48757
+ ports: { frames, surface, images: createPngSink() },
48758
+ logo,
48759
+ wallpaper: wallpaper.image
48760
+ });
48761
+ } finally {
48762
+ release(wallpaper.image, wallpaper.held ?? null);
48763
+ }
48764
+ const deepest = input.wallpaper?.ok !== true ? 1 : composeForTarget({
48765
+ plan,
48766
+ bundle,
48767
+ scene,
48768
+ target
48769
+ }).resolved.cameraKeys.reduce((m, k) => Math.max(m, k.scale), 1);
48770
+ const files = [];
48771
+ for (const image of result2.images) {
48772
+ files.push({
48773
+ name: screenImageName(image.step),
48774
+ bytes: await scaledPng(image.bytes, width)
48775
+ });
48776
+ }
48777
+ return {
48778
+ files,
48779
+ facts: {
48780
+ detailViolations: result2.detailViolations,
48781
+ unavailableSpans: [...result2.unavailableSpans, ...reclaimed],
48782
+ unplacedStills: [],
48783
+ loweredZooms: [],
48784
+ logoWarning: logoWarning2,
48785
+ wallpaperWarning: wallpaperWarning(target, deepest, wallpaper.failed),
48786
+ clampedRanges: [],
48787
+ // The target's own size: the screens' windows are measured in it.
48788
+ rendered: {
48789
+ width: target.width,
48790
+ height: target.height,
48791
+ fps: target.fps
48792
+ },
48793
+ screens: result2.screens
48794
+ }
48795
+ };
48796
+ }
48643
48797
  const renderAt = async (at2, maxBytes, saysWidth = false, pass) => {
48644
48798
  const { logo, logoWarning: logoWarning2 } = await logoAt(at2);
48645
48799
  const wallpaper = await wallpaperAt(at2);
@@ -49035,6 +49189,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
49035
49189
  },
49036
49190
  ...manifest.stills === void 0 ? {} : { stills: manifest.stills },
49037
49191
  ...manifest.outputTimesMs === void 0 ? {} : { outputTimesMs: manifest.outputTimesMs },
49192
+ ...manifest.screensOnly === void 0 ? {} : { screensOnly: manifest.screensOnly },
49038
49193
  onFrame: wholePercent((done, total, width, pass) => width === void 0 ? report?.(done, total) : pass === void 0 ? report?.(done, total, width) : report?.(done, total, width, pass))
49039
49194
  // The decoded image is freed once every output is rendered: the GIF
49040
49195
  // ladder and the MP4 cap re-render inside this call.
package/dist/recipe.md CHANGED
@@ -8,11 +8,7 @@ user; section 7 lists every reason.
8
8
 
9
9
  ## 1. Preflight
10
10
 
11
- 1. Call `status`. It answers `executor` (`"cli"`), `version`,
12
- `browserInstalled`, `browserRunning`, `runnerVersion`, `runPage` (the
13
- latest run's report or its progress, or null), `sessions`, `accounts`,
14
- `secretsFile`, `expiry` and `update`.
15
- `sessions` is `[{site, savedAt, refreshedAt, signInUrl}]`; it and
11
+ 1. Call `status`; its description lists what it answers. `sessions` and
16
12
  `display` can be `{unreadable}`: tell the user why. `accounts` and
17
13
  `secretsFile` are the demo accounts below.
18
14
  2. The browser is signed in only where the user ran `npx demoman signin <url>`
@@ -183,10 +179,8 @@ targets, leaving the page open. Each entry is
183
179
  - Iframe and shadow-root elements are not listed.
184
180
  - A snapshot sees only the page as it loads: hidden content in the
185
181
  page is listed; content a click creates (a menu, dialog, results, a new row) is not. To list it, `probe` your script
186
- cut off after the step that opens it, and copy targets from that answer. A probe acts on the app for real: "Add item" adds one per
187
- probe and again in the run, so a unique target can turn ambiguous;
188
- a delete deletes; in the Studio an edit saves into the video. Server data
189
- carries into the run; browser storage does not (a signed-in site's does). Prefer demo data. `stopped`: a step did not play; fix it as a
182
+ cut off after the step that opens it, and copy targets from that answer. A probe acts on the app for real, as its description says: an "Add item"
183
+ in it can make a unique target ambiguous in the run; in the Studio an edit saves into the video. `stopped`: a step did not play; fix it as a
190
184
  run's stop with that reason says, and probe again.
191
185
 
192
186
  ### Recording a phone demo
@@ -246,7 +240,7 @@ run toward the three. Refused with `unfilledHoles` when the video kept no
246
240
  value: `derive`, fill, `run`. `invalidScript` (`field` `steps.<i>.do`): a
247
241
  verb was changed by hand: `derive`, check it, `run` the draft.
248
242
 
249
- A flow in the repo (.demoman/flows) is rewritten by each run: commit that file with the change. To add one, run `npx demoman add <flow> --to <path>` in the repo.
243
+ A flow in the repo (.demoman/flows) is rewritten by each run: commit that file with the change. To add one: section 8.
250
244
 
251
245
  ## 4. Run and read
252
246
 
@@ -484,34 +478,34 @@ Studio exports go to `~/Downloads`.
484
478
 
485
479
  ## 7. Every reason
486
480
 
487
- `probe` can answer any reason `snapshot` can, and `run`'s `refusedBeforeRun` ones.
481
+ `probe` can answer any reason `snapshot` can, and `run`'s `refusedBeforeRun` ones. Where: ¹ in `refusedBeforeRun`, `refusedBeforeExport` or `refusedBeforeAttach`; ² in `stopped.reason`, or `notAttached` for `attach`.
488
482
 
489
483
  | Reason | Where | What it means, and the move |
490
484
  | --- | --- | --- |
491
- | `browserMissing` | `snapshot`, `run` (`refusedBeforeRun`), `studio` | Demoman's browser or libraries are missing; `detail` gives the command. Ask the user to run it, then call again. |
485
+ | `browserMissing` | `snapshot`, `run`¹, `studio` | Demoman's browser or libraries are missing; `detail` gives the command. Ask the user to run it, then call again. |
492
486
  | `unsupportedPlatform` | `snapshot`, `run`, `export` | This machine cannot record (arm64 Linux, or another OS); quote `detail`. |
493
- | `sessionUnreadable` | `snapshot`, `run` (`refusedBeforeRun`) | A saved session file or folder could not be read, or is readable by others; `detail` names the fix. Tell the user. |
494
- | `sessionNotLoaded` | `snapshot`, `run` (`refusedBeforeRun`) | The browser refused the saved sessions; `detail` says why. Tell the user to run `npx demoman signin` again there. |
495
- | `signInFailed` | `snapshot`, `run` (`refusedBeforeRun`) | Demoman signed in as the account and the page still showed a sign-in page, or a step could not run; `detail` says where. It tried once. Fix the account's steps or secret, or tell the user; do not rerun unchanged. |
496
- | `secretMissing` | `snapshot`, `run` (`refusedBeforeRun`) | A `{secret:NAME}` has no `DEMOMAN_SECRET_NAME` and no line in `.demoman/secrets.env`; `detail` names both. Through `project` the environment is unused. Write one (section 1), or ask the user. |
497
- | `secretTooShort` | `snapshot`, `run` (`refusedBeforeRun`) | The secret `NAME` is under 8 characters. Write a longer one. |
498
- | `secretUnbound` | `snapshot`, `run` (`refusedBeforeRun`) | `DEMOMAN_SECRET_NAME` has no `DEMOMAN_SECRET_NAME_ORIGIN` beside it, or one that is no origin; `detail` names the line and site. Nothing typed. Add it to `secrets.env` for an account you made; else tell the user. |
499
- | `secretOffOrigin` | `snapshot`, `run` (`refusedBeforeRun`) | A secret was about to be typed off its site: a sign-in step's page is not the site's origin, or the `_ORIGIN` names another site; `detail` names both. Nothing typed. Check the account's site and `goto`, then tell the user. |
500
- | `secretsFileNotIgnored` | `snapshot`, `run` (`refusedBeforeRun`) | Git does not ignore `.demoman/secrets.env`, so Demoman did not read it. Add it to `.gitignore` (`detail` says the line), or untrack it. |
501
- | `secretsFileInvalid` | `snapshot`, `run` (`refusedBeforeRun`) | A line of `.demoman/secrets.env` is not `DEMOMAN_SECRET_NAME=value`, a comment or blank; `detail` gives the line. Fix it. |
502
- | `accountsInvalid` | `snapshot`, `run` (`refusedBeforeRun`) | `.demoman/accounts.json` is malformed or breaks a rule; `detail` names the field and the rule. Fix the file. |
503
- | `unknownAccount` | `snapshot`, `run` (`refusedBeforeRun`) | The script names an account the site lacks, or none and the site has no `default`; `detail` lists the accounts. Name one, or add it (section 1). |
504
- | `invalidProject` | `snapshot`, `run` (`refusedBeforeRun`), `attach` | `project` is not an absolute path to a folder. Pass one, or leave it out. |
505
- | `ghMissing`, `ghOutdated`, `ghSignedOut`, `notGitHub`, `prNotFound`, `prUnreadable` | `attach` (`refusedBeforeAttach`) | `gh` is missing, too old or signed out; not a GitHub remote; no such PR, or GitHub did not answer. Nothing posted; do as `detail` says. |
506
- | `invalidAttach` | `attach` (`refusedBeforeAttach`) | The call is malformed; `detail` says how. Fix it. |
507
- | `uploadRefused` | `attach` (`notAttached`) | GitHub refused the video. Retry as the Pull requests text says. |
508
- | `partial` | `attach` (`notAttached`) | `gh` failed but the video is on the PR; do not post again. |
509
- | `unconfirmed` | `attach` (`notAttached`) | Unknown what landed. Do not post again; tell the user to look at the PR. |
510
- | `copyFailed` | `attach` (`notAttached`) | The video could not be copied; nothing posted. Hand the user the capped export's file. |
511
- | `windowDidNotOpen` | `snapshot`; `run` (`refusedBeforeRun`); `studio` | The window would not open; try once more. |
487
+ | `sessionUnreadable` | `snapshot`, `run`¹ | A saved session file or folder could not be read, or is readable by others; `detail` names the fix. Tell the user. |
488
+ | `sessionNotLoaded` | `snapshot`, `run`¹ | The browser refused the saved sessions; `detail` says why. Tell the user to run `npx demoman signin` again there. |
489
+ | `signInFailed` | `snapshot`, `run`¹ | Signed in as the account, the page still showed a sign-in page, or a step could not run; `detail` says where. It tried once. Fix the account's steps or secret, or tell the user; do not rerun unchanged. |
490
+ | `secretMissing` | `snapshot`, `run`¹, `ci` | No `DEMOMAN_SECRET_NAME` for a `{secret:NAME}` in the environment (unused through `project`) or `.demoman/secrets.env`; `detail` names both. Write one (section 1) or ask the user; `ci`: give the person `command`. |
491
+ | `secretTooShort` | `snapshot`, `run`¹, `ci` | The secret `NAME` is under 8 characters. Write a longer one; `ci`: give the person `command`. |
492
+ | `secretUnbound` | `snapshot`, `run`¹ | `DEMOMAN_SECRET_NAME` has no `DEMOMAN_SECRET_NAME_ORIGIN` beside it, or one that is no origin; `detail` names the line and site. Nothing typed. Add it to `secrets.env` for an account you made; else tell the user. |
493
+ | `secretOffOrigin` | `snapshot`, `run`¹ | A secret was about to be typed off its site: a sign-in step's page is not the site's origin, or the `_ORIGIN` names another site; `detail` names both. Nothing typed. Check the account's site and `goto`, then tell the user. |
494
+ | `secretsFileNotIgnored` | `snapshot`, `run`¹ | Git does not ignore `.demoman/secrets.env`, so Demoman did not read it. Add it to `.gitignore` (`detail` says the line), or untrack it. |
495
+ | `secretsFileInvalid` | `snapshot`, `run`¹ | A line of `.demoman/secrets.env` is not `DEMOMAN_SECRET_NAME=value`, a comment or blank; `detail` gives the line. Fix it. |
496
+ | `accountsInvalid` | `snapshot`, `run`¹ | `.demoman/accounts.json` is malformed or breaks a rule; `detail` names the field and the rule. Fix the file. |
497
+ | `unknownAccount` | `snapshot`, `run`¹ | The script names an account the site lacks, or none and the site has no `default`; `detail` lists the accounts. Name one, or add it (section 1). |
498
+ | `invalidProject` | `snapshot`, `run`¹, `attach` | `project` is not an absolute path to a folder. Pass one, or leave it out. |
499
+ | `ghMissing`, `ghOutdated`, `ghSignedOut`, `notGitHub`, `prNotFound`, `prUnreadable` | `attach`¹, `ci` | `gh` is missing, too old or signed out; not a GitHub remote; no such PR, or GitHub did not answer. Nothing posted; do as `detail` says. |
500
+ | `invalidAttach` | `attach`¹ | The call is malformed; `detail` says how. Fix it. |
501
+ | `uploadRefused` | `attach`² | GitHub refused the video. Retry as the Pull requests text says. |
502
+ | `partial` | `attach`² | `gh` failed but the video is on the PR; do not post again. |
503
+ | `unconfirmed` | `attach`² | Unknown what landed. Do not post again; tell the user to look at the PR. |
504
+ | `copyFailed` | `attach`² | The video could not be copied; nothing posted. Hand the user the capped export's file. |
505
+ | `windowDidNotOpen` | `snapshot`; `run`¹; `studio` | The window would not open; try once more. |
512
506
  | `studioDidNotStart` | `studio` | The Studio did not start; `detail` quotes the end of `~/.demoman/studio.log`. Tell the user, quoting it. |
513
507
  | `alreadyRunning` | `snapshot`, `probe`, `run`, `derive` | A run, probe, snapshot or export is in progress. Call `report(id)` on it; retry when it settles. |
514
- | `busy` | `export` (`refusedBeforeExport`) | A run, probe or snapshot is in progress. `report(id)` it first. |
508
+ | `busy` | `export`¹ | A run, probe or snapshot is in progress. `report(id)` it first. |
515
509
  | `browserSilent` | `status`, `flows`, `derive`, `report` | The browser did not answer in about 50 s. Call `status` once; if again, tell the user. From `report` the run may still be going: call `report(id)` again. |
516
510
  | `libraryUnreadable` | `flows`, `studio` | Unreadable; report it. |
517
511
  | `libraryUnwritable` | `run` (in `notStored`) | Not a `reason`: the report has a `notStored` entry `{ "what": "video", "error": … }` and a null `provenance.videoId`. Nothing saved; quote the `error`. |
@@ -520,39 +514,47 @@ Studio exports go to `~/Downloads`.
520
514
  | `notAnObject` | `run` | The script is not a JSON object. |
521
515
  | `invalidScript` | `run` | The schema refused the script; `field` names where. |
522
516
  | `unfilledHoles` | `run` | A derived draft still has holes (section 3); also a re-film of a video that did not keep a value. |
523
- | `flowRequired` | `run` (`refusedBeforeRun`) | No `flow` was given. Find one (section 4), or pass `{ new }`. |
524
- | `possibleDuplicate`, `nameTaken` | `run` (`refusedBeforeRun`) | A similar flow exists (`matches`) or the name is taken (`holder`). Section 4. |
525
- | `repoFlowNameTaken`, `duplicateFlow`, `repoFlowUnreadable` | `run` (`refusedBeforeRun`); the first two also `flows` with `file` | Repo flows: this library has another flow with that name (`detail` gives the `join-flow` command to tell the user); two files in `.demoman/flows` or the old folder before it name one flow (delete one); a file there will not read (`detail` names it; fix or remove it). |
526
- | `flowNotFound` | `run` (`refusedBeforeRun`) | No flow has that `id`; call `flows`. |
517
+ | `flowRequired` | `run`¹ | No `flow` was given. Find one (section 4), or pass `{ new }`. |
518
+ | `possibleDuplicate`, `nameTaken` | `run`¹ | A similar flow exists (`matches`) or the name is taken (`holder`). Section 4. |
519
+ | `repoFlowNameTaken`, `duplicateFlow`, `repoFlowUnreadable` | `run`¹; the first two also `flows` with `file` | Repo flows: this library has another flow with that name (`detail` gives the `join-flow` command to tell the user); two files in `.demoman/flows` or the old folder before it name one flow (delete one); a file there will not read (`detail` names it; fix or remove it). |
520
+ | `flowNotFound` | `run`¹ | No flow has that `id`; call `flows`. |
527
521
  | `wrongIdKind` | any | Wrong kind of id; see `detail`. |
528
- | `flowUnreadable`, `flowUnwritable` | `run` (`refusedBeforeRun`), `flows` | The flow records could not be read or written; quote `detail`. Nothing recorded. |
522
+ | `flowUnreadable`, `flowUnwritable` | `run`¹, `flows` | The flow records could not be read or written; quote `detail`. Nothing recorded. |
529
523
  | `noTag`, `unknownFlow`, `fileNotFound` | `flows` | The file has no Demoman tag; its flow is not in this library; no file there. Use `query` instead. |
530
524
  | `invalidArgs` | any | `file` with `query`, not absolute; an old name (`video`, `takeId`): `detail` gives the new. |
531
- | `videoExpired` | `export` (`refusedBeforeExport`) | The video's frames expired: `run({ flow: { id } })`, then export. |
525
+ | `videoExpired` | `export`¹ | The video's frames expired: `run({ flow: { id } })`, then export. |
532
526
  | `failed` | `status` (`expiry`) | Not a refusal: `expiry` is the last cleanup. Say nothing unless it is `{ failed }` or `{ unreadable }`: quote it. |
533
- | `nothingToRerecord` | `run` (`refusedBeforeRun`) | The video has no step left that acts; tell the user. |
534
- | `unknownKit` | `run` (`refusedBeforeRun`) | `look.kit` names no kit, or an unreadable one; `detail` lists the kits. Fix it from `snapshot`'s `kits`, or ask the user. |
535
- | `kitsUnreadable` | `run` (`refusedBeforeRun`) | The kits file would not read, so `look.kit` went unchecked. Quote `detail`; keep the name. |
536
- | `wallpaperUnreadable` | `run` (`refusedBeforeRun`) | The image would not open. Quote `detail`; fix or drop `look.branding`/`look.kit`. |
527
+ | `nothingToRerecord` | `run`¹ | The video has no step left that acts; tell the user. |
528
+ | `unknownKit` | `run`¹ | `look.kit` names no kit, or an unreadable one; `detail` lists the kits. Fix it from `snapshot`'s `kits`, or ask the user. |
529
+ | `kitsUnreadable` | `run`¹ | The kits file would not read, so `look.kit` went unchecked. Quote `detail`; keep the name. |
530
+ | `wallpaperUnreadable` | `run`¹ | The image would not open. Quote `detail`; fix or drop `look.branding`/`look.kit`. |
537
531
  | `invalidDevice` | `snapshot` | `device` is no phone or tablet Demoman has; `detail` lists them. |
538
532
  | `deviceFailed` | `snapshot`, `run` | The browser would not emulate the device; nothing was listed or recorded. Tell the user `detail`; do not run again. |
539
533
  | `nonHttpTarget` | `run`, `snapshot` | The target or url is not `http(s)`, or its host contains `*`. |
540
- | `invalidFileType` | `export` (`refusedBeforeExport`) | Not answered here: the schema takes only `mp4`, `gif`, `stills`. |
541
- | `invalidStillsOptions` | `export` (`refusedBeforeExport`) | `stills` was given for an MP4 or GIF, or breaks section 5's width or zoom; `detail` says which. Fix the call. |
542
- | `invalidQuality`, `invalidMaxMB` | `export` (`refusedBeforeExport`), `attach` | Through these tools, only `quality` or `maxMB` given for a GIF or stills; the schema rejects a bad value first. |
543
- | `noVideoId`, `noFrames` | `export` (`refusedBeforeExport`) | No video id; no frames to render. |
544
- | `videoNotFound`, `videoUnreadable` | `export` (`refusedBeforeExport`), `run` re-film (`refusedBeforeRun`), `studio` (`videoNotFound`: call `flows`) | No such video; it could not be read (or, for `run`, built into a script). |
545
- | `unresolvedAnchor`, `anchorNotRendered`, `waitTimeout` | `run` (`stopped.reason`) | The target was not there in the 10 s a step waits, or a `waitFor`/`waitForLoad` timed out. Check it against a `snapshot` and the step before; `scrollTo` first in a long list. |
546
- | `ambiguousAnchor` | `run` (`stopped.reason`) | Several elements matched; name the target more exactly. |
547
- | `anchorFrameMismatch`, `anchorUnreachable`, `occlusionTimeout` | `run` (`stopped.reason`) | `anchorFrameMismatch`: its frame changed; pick another target. The others are not the script (unmeasurable, or window covered): run again once. |
548
- | `pageWentElsewhere`, `unperformableStep` | `run` (`stopped.reason`) | The app left the page unasked (sign-in expired, or a missing `waitForLoad`); or the step asks the impossible. |
549
- | `dragEndOutOfView`, `dragNoDistance` | `run` (`stopped.reason`) | A drag's end was off screen (a drag cannot scroll), or on its start. Fix the script. |
550
- | `clickNotDelivered` | `run` (`stopped.reason`) | The browser put a click elsewhere than sent; `stopped.detail` says where. Not the script's fault: run again (it counts); tell the user if it repeats. |
551
- | `signedOut` | `run` (`stopped.reason`) | The app sent this browser to its sign-in page. Nothing kept; not a script fault. Give the user the command in `stopped.detail`; run again only after they ran it. As an account there is no command: the detail says whether Demoman signed in again; repeat only if it does. |
552
- | `windowClosed` | `run` (`stopped.reason`) | `--headed` only: the window closed mid-run; the script is fine. Ask the user to leave it open; run once more. In an export it answers `renderFailed`; export again. |
534
+ | `invalidFileType` | `export`¹ | Not answered: the schema takes only `mp4`, `gif`, `stills`. |
535
+ | `invalidStillsOptions` | `export`¹ | `stills` was given for an MP4 or GIF, or breaks section 5's width or zoom; `detail` says which. Fix the call. |
536
+ | `invalidQuality`, `invalidMaxMB` | `export`¹, `attach` | Through these tools, only `quality` or `maxMB` given for a GIF or stills; the schema rejects a bad value first. |
537
+ | `noVideoId`, `noFrames` | `export`¹ | No video id; no frames to render. |
538
+ | `videoNotFound`, `videoUnreadable` | `export`¹, `run` re-film ¹, `studio` (`videoNotFound`: call `flows`) | No such video; it could not be read (or, for `run`, built into a script). |
539
+ | `unresolvedAnchor`, `anchorNotRendered`, `waitTimeout` | `run`² | The target was not there in the 10 s a step waits, or a `waitFor`/`waitForLoad` timed out. Check it against a `snapshot` and the step before; `scrollTo` first in a long list. |
540
+ | `ambiguousAnchor` | `run`² | Several elements matched; name the target more exactly. |
541
+ | `anchorFrameMismatch`, `anchorUnreachable`, `occlusionTimeout` | `run`² | `anchorFrameMismatch`: its frame changed; pick another target. The others are not the script (unmeasurable, or window covered): run again once. |
542
+ | `pageWentElsewhere`, `unperformableStep` | `run`² | The app left the page unasked (sign-in expired, or a missing `waitForLoad`); or the step asks the impossible. |
543
+ | `dragEndOutOfView`, `dragNoDistance` | `run`² | A drag's end was off screen (a drag cannot scroll), or on its start. Fix the script. |
544
+ | `clickNotDelivered` | `run`² | The browser put a click elsewhere than sent; `stopped.detail` says where. Not the script's fault: run again (it counts); tell the user if it repeats. |
545
+ | `signedOut` | `run`² | The app sent this browser to its sign-in page. Nothing kept; not a script fault. Give the user the command in `stopped.detail`; run again only after they ran it. As an account there is no command: the detail says whether Demoman signed in again; repeat only if it does. |
546
+ | `windowClosed` | `run`² | `--headed` only: the window closed mid-run; the script is fine. Ask the user to leave it open; run once more. In an export it answers `renderFailed`; export again. |
553
547
  | `pageDidNotLoad` | `snapshot`, `probe` stop | The url did not load. Ask whether the app runs at that address; spend no run. |
554
548
  | `pageSilent` | `snapshot` | The page never answered. Call once more; if again, the page blocked Demoman's script: tell the user. |
555
- | `pageFaulted` | `snapshot` | The page's code threw; quote `detail`. |
556
- | `snapshotThrew` | `snapshot` | A snapshot fault; quote `detail`. |
557
- | `probeThrew` | `probe` | A probe fault; quote `detail`. |
549
+ | `pageFaulted`, `snapshotThrew`, `probeThrew` | `snapshot`, `probe` | The page's code threw, or a fault; quote `detail`. |
558
550
  | `portFailure` | `probe` | The browser gave way; not the script's fault. Probe once more; quote `detail` if it repeats. |
551
+ | `notInRepo`, `outsideRepo`, `outputTaken`, `logoUnreadable`, `handSignIn`, `cannotRefilm`, `keepRefused`, `exportFailed`, `repoFlowUnwritable` | `add`, `ci` | `detail` says what was written and the fix. |
552
+ | `appInvalid`, `appOriginMismatch`, `appUnknown`, `appHoles`, `appInstallFailed`, `appStartExited`, `appNeverAnswered`, `appServiceFailed`, `appPortTaken`, `appDockerMissing`, `checkoutFailed`, `noRepoFlow`, `refreshFailed`, `checkThrew`, `alreadySetUp`, `setupPrOpen`, `setupBranchExists`, `noRepoFlows`, `noRelease`, `noDeployment`, `routeRefused`, `githubUnreadable`, `noSetupBranch`, `secretsUnknown`, `secretsUnreadable`, `workflowRefused`, `filesUnreadable`, `setupUnreadable`, `secretRefused`, `actionsRefused`, `actionsUnknown`, `prFailed` | `ci` | `detail` says what was done and the fix. |
553
+
554
+ ## 8. Repo flows and CI
555
+
556
+ `add({ flow, to })` puts a flow in the repo; commit what it wrote. `ci`
557
+ sets up CI for them, acting only on `confirmed: true` after the person
558
+ agreed to the plan's `lines`. Never ask for a secret: give the person
559
+ `command`. After pushing a fix to `demoman/setup`, `ci({ watch: true })`;
560
+ at `gaveUp`, hand back.