@vosjs/cli 0.9.1 → 0.10.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.
@@ -154,6 +154,8 @@ function validateActions(value) {
154
154
  errors.push(`${at}: wait needs ms`);
155
155
  if (s.do === "type" && typeof s.text !== "string")
156
156
  errors.push(`${at}: type needs text`);
157
+ if (s.do === "type" && s.focus !== void 0 && typeof s.focus !== "boolean")
158
+ errors.push(`${at}: type focus must be true or false`);
157
159
  if (s.do === "scroll" && typeof s.dy !== "number")
158
160
  errors.push(`${at}: scroll needs dy`);
159
161
  if (s.do === "move" && (typeof s.x !== "number" || typeof s.y !== "number")) {
@@ -364,6 +366,24 @@ function lintDoc(docIn) {
364
366
  `tiltStyle must be "off" | "subtle" | "medium" | "strong" (got ${String(doc.tiltStyle)})`
365
367
  );
366
368
  }
369
+ if (doc.rejected !== void 0 && !Array.isArray(doc.rejected)) {
370
+ problems.push("rejected must be an array of {id, lane, in, out}");
371
+ }
372
+ for (const r of entries(doc.rejected)) {
373
+ const name = spanName("rejected", r);
374
+ if (!["zoom", "tilt", "speed"].includes(r.lane)) {
375
+ problems.push(
376
+ `${name}: lane must be "zoom" | "tilt" | "speed" (got ${String(r.lane)})`
377
+ );
378
+ }
379
+ if (!isNum(r.in) || !isNum(r.out) || r.out <= r.in) {
380
+ problems.push(`${name}: needs SOURCE seconds in < out`);
381
+ } else if (r.in >= duration) {
382
+ problems.push(
383
+ `${name}: starts at ${r.in}s, past the footage (${duration.toFixed(2)}s) \u2014 nothing to reject there`
384
+ );
385
+ }
386
+ }
367
387
  if (doc.camMotion !== void 0 && !Array.isArray(doc.camMotion)) {
368
388
  problems.push("camMotion must be an array of spans");
369
389
  }
@@ -3426,7 +3446,7 @@ async function recordTake(browser, url, actions, paths, log, opts = {}) {
3426
3446
  case "type": {
3427
3447
  const rect = await boxOf(step.selector);
3428
3448
  if (rect) {
3429
- await clickAt(rect);
3449
+ if (step.focus !== false) await clickAt(rect);
3430
3450
  const delay = step.delayMs ?? 40;
3431
3451
  const ping = () => emit({
3432
3452
  x: Math.round(rect.x + rect.w / 2),
@@ -3655,6 +3675,7 @@ import { join as join9 } from "path";
3655
3675
  import {
3656
3676
  STYLE_FIELDS,
3657
3677
  copyStyle,
3678
+ isRejected,
3658
3679
  planAutoSpeed,
3659
3680
  planAutoZoom,
3660
3681
  projectFromArtifact
@@ -3822,7 +3843,20 @@ function retimeCut(prev, newSteps, newDurationMs) {
3822
3843
  newDuration,
3823
3844
  report
3824
3845
  );
3825
- return { segments, zoom, speed, tilt, report };
3846
+ const rejected = [];
3847
+ for (const lane of ["zoom", "tilt", "speed"]) {
3848
+ rejected.push(
3849
+ ...retimeSpans(
3850
+ `rejected ${lane}`,
3851
+ (prev.rejected ?? []).filter((r) => r.lane === lane),
3852
+ stepMap,
3853
+ newSteps,
3854
+ newDuration,
3855
+ report
3856
+ )
3857
+ );
3858
+ }
3859
+ return { segments, zoom, speed, tilt, rejected, report };
3826
3860
  }
3827
3861
 
3828
3862
  // src/plugin/plan.ts
@@ -3854,20 +3888,21 @@ async function planTake(dir, opts = {}) {
3854
3888
  doc = copyStyle(prev, doc);
3855
3889
  const rt = retimeCut(prev, meta.steps ?? [], meta.durationMs);
3856
3890
  doc.segments = rt.segments;
3891
+ if (rt.rejected.length) doc.rejected = rt.rejected;
3857
3892
  const manualZoom = rt.zoom;
3858
3893
  const autoZoom = planAutoZoom(doc.source.cursor, {
3859
3894
  width: doc.source.meta.width,
3860
3895
  height: doc.source.meta.height,
3861
3896
  style: doc.zoomStyle,
3862
3897
  params: doc.zoomParams
3863
- }).filter((z) => !manualZoom.some((m) => overlaps(z, m)));
3898
+ }).filter((z) => !manualZoom.some((m) => overlaps(z, m))).filter((z) => !isRejected("zoom", z, doc.rejected));
3864
3899
  doc.zoom = [...manualZoom, ...autoZoom].sort((a, b) => a.in - b.in);
3865
3900
  const manualSpeed = rt.speed;
3866
3901
  const autoSpeed = planAutoSpeed(doc.source.cursor, {
3867
3902
  durationMs: doc.source.meta.durationMs,
3868
3903
  params: doc.speedParams,
3869
3904
  activity
3870
- }).filter((s) => !manualSpeed.some((m) => s.in < m.out && s.out > m.in));
3905
+ }).filter((s) => !manualSpeed.some((m) => s.in < m.out && s.out > m.in)).filter((s) => !isRejected("speed", s, doc.rejected));
3871
3906
  doc.speed = [...manualSpeed, ...autoSpeed].sort((a, b) => a.in - b.in);
3872
3907
  if (rt.tilt.length) doc.tilt = rt.tilt;
3873
3908
  if (prev.overlays?.length) doc.overlays = prev.overlays;
@@ -3893,14 +3928,14 @@ async function planTake(dir, opts = {}) {
3893
3928
  height: doc.source.meta.height,
3894
3929
  style: doc.zoomStyle,
3895
3930
  params: doc.zoomParams
3896
- }).filter((z) => !manual.some((m) => overlaps(z, m)));
3931
+ }).filter((z) => !manual.some((m) => overlaps(z, m))).filter((z) => !isRejected("zoom", z, doc.rejected));
3897
3932
  doc.zoom = [...manual, ...auto].sort((a, b) => a.in - b.in);
3898
3933
  const manualSpeed = (doc.speed ?? []).filter((s) => s.source !== "auto");
3899
3934
  const autoSpeed = planAutoSpeed(doc.source.cursor, {
3900
3935
  durationMs: doc.source.meta.durationMs,
3901
3936
  params: doc.speedParams,
3902
3937
  activity
3903
- }).filter((s) => !manualSpeed.some((m) => s.in < m.out && s.out > m.in));
3938
+ }).filter((s) => !manualSpeed.some((m) => s.in < m.out && s.out > m.in)).filter((s) => !isRejected("speed", s, doc.rejected));
3904
3939
  doc.speed = [...manualSpeed, ...autoSpeed].sort((a, b) => a.in - b.in);
3905
3940
  } else {
3906
3941
  const artifact = {
@@ -6150,7 +6185,12 @@ function convertAgentBrowser(records, opts = {}) {
6150
6185
  case "key": {
6151
6186
  const key = args.at(0);
6152
6187
  if (key === "Enter" && lastTarget) {
6153
- emit(n, { do: "type", selector: lastTarget, text: "\n" });
6188
+ emit(n, {
6189
+ do: "type",
6190
+ selector: lastTarget,
6191
+ text: "\n",
6192
+ focus: false
6193
+ });
6154
6194
  notes.push(
6155
6195
  `line ${n}: press Enter became a newline typed into the last field`
6156
6196
  );
@@ -7434,4 +7474,4 @@ export {
7434
7474
  convertAgentBrowser,
7435
7475
  run
7436
7476
  };
7437
- //# sourceMappingURL=chunk-74MSNLT2.js.map
7477
+ //# sourceMappingURL=chunk-CJPWZVHQ.js.map