@phil65/demoreel 0.6.0 → 0.7.1

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.
Files changed (33) hide show
  1. package/README.md +8 -5
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/args.js +1 -1
  4. package/dist/cli.js +3 -3
  5. package/dist/compose.d.ts +9 -1
  6. package/dist/compose.js +34 -2
  7. package/dist/idle.js +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +2 -2
  10. package/dist/mcp.js +2 -2
  11. package/dist/project.d.ts +247 -11
  12. package/dist/project.js +244 -8
  13. package/dist/record.js +8 -0
  14. package/dist/renderer/assets/{CanvasPool-PBu3bHFZ.js → CanvasPool-SkgMbnEH.js} +1 -1
  15. package/dist/renderer/assets/{CanvasRenderer-HmF-4gyW.js → CanvasRenderer-CEGuSdsG.js} +1 -1
  16. package/dist/renderer/assets/{RenderTargetSystem-Dk1U4wDJ.js → RenderTargetSystem-um8Nv1HQ.js} +1 -1
  17. package/dist/renderer/assets/{WebGLRenderer-C0v9HBel.js → WebGLRenderer-BnY2xfDL.js} +1 -1
  18. package/dist/renderer/assets/{WebGPURenderer-Ce0-U9Q1.js → WebGPURenderer-D9KI_sD9.js} +1 -1
  19. package/dist/renderer/assets/{browserAll-DhvWQ7nM.js → browserAll-vQt6iTAv.js} +1 -1
  20. package/dist/renderer/assets/{canvasUtils-KRroregW.js → canvasUtils-CZLntkW8.js} +1 -1
  21. package/dist/renderer/assets/{getTexelRangeRects-D3pwCyRt.js → getTexelRangeRects-CRAnqulP.js} +1 -1
  22. package/dist/renderer/assets/{index-CE-lli1m.js → index-41-d13J1.js} +4 -4
  23. package/dist/renderer/assets/{init-DfmWKarH.js → init-D6nA7FlC.js} +1 -1
  24. package/dist/renderer/assets/webworkerAll-BEIrFubI.js +1 -0
  25. package/dist/renderer/index.html +1 -1
  26. package/dist/scene.d.ts +87 -1
  27. package/dist/scene.js +151 -1
  28. package/dist/types.d.ts +71 -1
  29. package/dist/voice.d.ts +8 -5
  30. package/dist/voice.js +43 -6
  31. package/package.json +2 -2
  32. package/skills/demoreel/SKILL.md +5 -1
  33. package/dist/renderer/assets/webworkerAll-B41hok0-.js +0 -1
@@ -1,4 +1,4 @@
1
- import{B as e,Ct as t,Dt as n,Et as r,H as i,L as a,M as o,R as s,Z as c,b as l,ct as u,dt as d,ut as f,z as p}from"./index-CE-lli1m.js";import{t as m}from"./canvasUtils-KRroregW.js";import{t as h}from"./CanvasPool-PBu3bHFZ.js";var g=new t;function _(e,t){t.clear();let n=t.matrix;for(let n=0;n<e.length;n++){let r=e[n];if(r.globalDisplayStatus<7)continue;let i=r.renderGroup??r.parentRenderGroup;t.matrix=i?.isCachedAsTexture?g.copyFrom(i.textureOffsetInverseTransform).append(r.worldTransform):i?._parentCacheAsTextureRenderGroup?g.copyFrom(i._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(r.groupTransform):r.worldTransform,t.addBounds(r.bounds)}return t.matrix=n,t}var v=new f;function y(e,t,n,r,i=!1,a){let o=v;o.minX=0,o.minY=0,o.maxX=e.width/r|0,o.maxY=e.height/r|0;let s=c.getOptimalTexture({width:o.width,height:o.height,resolution:r,autoGenerateMipmaps:i,scaleMode:a});return s.source.uploadMethodId=`image`,s.source.resource=e,s.source.alphaMode=`premultiply-alpha-on-upload`,s.frame.width=t/r,s.frame.height=n/r,s.source.emit(`update`,s.source),s.updateUvs(),s}function b(e){return typeof e.getCanvasFilterString==`function`}var x=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new f,this.cssFilterString=``}},S=class{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){let t=this._pushFilterFrame(),n=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=n,t.container=e.container,t.cssFilterString=``,n.every(e=>!e.enabled)){t.skip=!0;return}let r=[];for(let e of n){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&r.push(t)}if(r.length===0){t.skip=!0;return}t.cssFilterString=r.join(` `),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;let i=this.renderer.canvasContext.activeContext,a=i.filter||`none`;if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){let e=this.renderer.canvasContext.activeResolution||1;i.save(),i.setTransform(1,0,0,1,0,0),i.beginPath(),i.rect(t.bounds.x*e,t.bounds.y*e,t.bounds.width*e,t.bounds.height*e),i.clip()}else t.useClip=!1;t.cssFilterString&&(i.filter=a===`none`?t.cssFilterString:`${a} ${t.cssFilterString}`)}pop(){let e=this._popFilterFrame();if(e.skip)return;let t=this._savedStates.pop();if(!t)return;let n=this.renderer.canvasContext.activeContext;e.useClip?n.restore():n.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(e=>!e.enabled))return e;let n=[];for(let e of t){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&n.push(t)}if(n.length===0)return e;let r=m.getCanvasSource(e);if(!r)return e;let i=e.frame,a=e.source._resolution??e.source.resolution??1,o=i.width,s=i.height,{canvas:c,context:l}=h.getOptimalCanvasAndContext(o,s,a);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,c.width,c.height),n.length&&(l.filter=n.join(` `));let u=i.x*a,d=i.y*a,f=o*a,p=s*a;return l.drawImage(r,u,d,f,p,0,0,f,p),l.filter=`none`,l.globalAlpha=1,y(c,o,s,a)}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup)?.cacheToLocalTransform;n&&t.applyMatrix(n)}}_warnUnsupportedFilter(e){let t=e?.constructor?.name||`Filter`;this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new x,this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}};S.extension={type:[r.CanvasSystem],name:`filter`};var C=`in vec2 aPosition;
1
+ import{B as e,Ct as t,Dt as n,Et as r,H as i,L as a,M as o,R as s,Z as c,b as l,ct as u,dt as d,ut as f,z as p}from"./index-41-d13J1.js";import{t as m}from"./canvasUtils-CZLntkW8.js";import{t as h}from"./CanvasPool-SkgMbnEH.js";var g=new t;function _(e,t){t.clear();let n=t.matrix;for(let n=0;n<e.length;n++){let r=e[n];if(r.globalDisplayStatus<7)continue;let i=r.renderGroup??r.parentRenderGroup;t.matrix=i?.isCachedAsTexture?g.copyFrom(i.textureOffsetInverseTransform).append(r.worldTransform):i?._parentCacheAsTextureRenderGroup?g.copyFrom(i._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(r.groupTransform):r.worldTransform,t.addBounds(r.bounds)}return t.matrix=n,t}var v=new f;function y(e,t,n,r,i=!1,a){let o=v;o.minX=0,o.minY=0,o.maxX=e.width/r|0,o.maxY=e.height/r|0;let s=c.getOptimalTexture({width:o.width,height:o.height,resolution:r,autoGenerateMipmaps:i,scaleMode:a});return s.source.uploadMethodId=`image`,s.source.resource=e,s.source.alphaMode=`premultiply-alpha-on-upload`,s.frame.width=t/r,s.frame.height=n/r,s.source.emit(`update`,s.source),s.updateUvs(),s}function b(e){return typeof e.getCanvasFilterString==`function`}var x=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new f,this.cssFilterString=``}},S=class{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){let t=this._pushFilterFrame(),n=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=n,t.container=e.container,t.cssFilterString=``,n.every(e=>!e.enabled)){t.skip=!0;return}let r=[];for(let e of n){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&r.push(t)}if(r.length===0){t.skip=!0;return}t.cssFilterString=r.join(` `),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;let i=this.renderer.canvasContext.activeContext,a=i.filter||`none`;if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){let e=this.renderer.canvasContext.activeResolution||1;i.save(),i.setTransform(1,0,0,1,0,0),i.beginPath(),i.rect(t.bounds.x*e,t.bounds.y*e,t.bounds.width*e,t.bounds.height*e),i.clip()}else t.useClip=!1;t.cssFilterString&&(i.filter=a===`none`?t.cssFilterString:`${a} ${t.cssFilterString}`)}pop(){let e=this._popFilterFrame();if(e.skip)return;let t=this._savedStates.pop();if(!t)return;let n=this.renderer.canvasContext.activeContext;e.useClip?n.restore():n.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(e=>!e.enabled))return e;let n=[];for(let e of t){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&n.push(t)}if(n.length===0)return e;let r=m.getCanvasSource(e);if(!r)return e;let i=e.frame,a=e.source._resolution??e.source.resolution??1,o=i.width,s=i.height,{canvas:c,context:l}=h.getOptimalCanvasAndContext(o,s,a);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,c.width,c.height),n.length&&(l.filter=n.join(` `));let u=i.x*a,d=i.y*a,f=o*a,p=s*a;return l.drawImage(r,u,d,f,p,0,0,f,p),l.filter=`none`,l.globalAlpha=1,y(c,o,s,a)}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup)?.cacheToLocalTransform;n&&t.applyMatrix(n)}}_warnUnsupportedFilter(e){let t=e?.constructor?.name||`Filter`;this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new x,this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}};S.extension={type:[r.CanvasSystem],name:`filter`};var C=`in vec2 aPosition;
2
2
  out vec2 vTextureCoord;
3
3
 
4
4
  uniform vec4 uInputSize;
@@ -0,0 +1 @@
1
+ import"./index-41-d13J1.js";import"./init-D6nA7FlC.js";
@@ -1,6 +1,6 @@
1
1
  <!doctype html>
2
2
  <html>
3
- <head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-CE-lli1m.js"></script>
3
+ <head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-41-d13J1.js"></script>
4
4
  </head>
5
5
  <body style="margin:0;background:#111;color:#ddd;font:14px sans-serif">
6
6
  <div id="status">demoreel headless renderer</div>
package/dist/scene.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Locator, Page } from "playwright";
2
2
  import { type Point } from "./motion.ts";
3
- import type { ActionRecord, Caption, CursorSample, Depth, Viewport, VoiceCue, ZoomHint } from "./types.ts";
3
+ import type { ActionRecord, ArrowAnnotation, ArrowDirection, BlurAnnotation, Caption, CaptionAnimation, CursorSample, Depth, ImageAnnotation, Viewport, VoiceCue, ZoomHint } from "./types.ts";
4
4
  import { type SayDeliveryOptions, type VoiceConfig, type VoiceSynthesizer } from "./voice.ts";
5
5
  /** Minimal recording clock (satisfied by ScreencastRecorder and dry-run clocks). */
6
6
  export interface SceneClock {
@@ -101,6 +101,55 @@ export interface HighlightOptions {
101
101
  wait?: boolean;
102
102
  label?: string;
103
103
  }
104
+ export interface BlurOptions {
105
+ /** How long the blur stays active (ms, or `"end"` to blur until the end of the video; default `"end"`). */
106
+ duration?: number | "end";
107
+ /** `"blur"` (Gaussian, default) or `"mosaic"` (pixelated blocks). */
108
+ type?: "blur" | "mosaic";
109
+ /** `"rectangle"` (default) or `"oval"`. */
110
+ shape?: "rectangle" | "oval";
111
+ /** Blur tint (`"black"` default, or `"white"`). */
112
+ color?: "black" | "white";
113
+ /** Blur intensity (`2..40`, default `14`). */
114
+ intensity?: number;
115
+ /** Mosaic block size (`4..48`, default `12`, used when `type: "mosaic"`). */
116
+ blockSize?: number;
117
+ /** Extra px padding around a DOM target box (default `4`). */
118
+ padding?: number;
119
+ /** Block until `duration` elapses (ignored when `duration === "end"`, default `false`). */
120
+ wait?: boolean;
121
+ label?: string;
122
+ }
123
+ export interface ArrowOptions {
124
+ /** Direction the arrow points (default `"down-right"`). */
125
+ direction?: ArrowDirection;
126
+ /** Stroke colour (default `"#ffcc00"`). */
127
+ color?: string;
128
+ /** Stroke thickness in px (default `4`). */
129
+ strokeWidth?: number;
130
+ /** Arrow box size in percent of canvas width/height (default `9`). */
131
+ size?: number;
132
+ /** How long the arrow stays visible (ms, default `2200`). */
133
+ duration?: number;
134
+ /** Block until the arrow disappears (default `false`). */
135
+ wait?: boolean;
136
+ label?: string;
137
+ }
138
+ export interface ImageOptions {
139
+ /** Stage-percent left coordinate (`0..100`, default `68`). */
140
+ x?: number;
141
+ /** Stage-percent top coordinate (`0..100`, default `10`). */
142
+ y?: number;
143
+ /** Stage-percent width (`1..100`, default `26`). */
144
+ width?: number;
145
+ /** Stage-percent height (`1..100`, default `26`). */
146
+ height?: number;
147
+ /** Duration in ms, or `"end"` to remain until the end of the recording (default `2600`). */
148
+ duration?: number | "end";
149
+ /** Block until `duration` elapses (default `false`). */
150
+ wait?: boolean;
151
+ label?: string;
152
+ }
104
153
  export interface PressOptions {
105
154
  label?: string;
106
155
  /** Show a keycap HUD overlay for this key press (overrides `look.showKeys`). */
@@ -139,6 +188,9 @@ export declare class Scene {
139
188
  readonly samples: CursorSample[];
140
189
  readonly actions: ActionRecord[];
141
190
  readonly captions: Caption[];
191
+ readonly blurs: BlurAnnotation[];
192
+ readonly arrows: ArrowAnnotation[];
193
+ readonly images: ImageAnnotation[];
142
194
  readonly voiceCues: VoiceCue[];
143
195
  private cursor;
144
196
  private cursorKind;
@@ -246,7 +298,41 @@ export declare class Scene {
246
298
  caption(text: string, opts?: {
247
299
  duration?: number;
248
300
  wait?: boolean;
301
+ animation?: CaptionAnimation;
249
302
  }): Promise<void>;
303
+ /**
304
+ * Blurs or pixelates (`type: "mosaic"`) a DOM element or stage-percent rect (`{ x, y, width, height }`)
305
+ * using OpenScreen's native blur annotation — ideal for redacting API keys, emails, or account IDs.
306
+ * Defaults to staying blurred until the end of the recording (`duration: "end"`).
307
+ */
308
+ blur(target: Target | {
309
+ x: number;
310
+ y: number;
311
+ width: number;
312
+ height: number;
313
+ }, opts?: BlurOptions): Promise<void>;
314
+ /** Readable alias for `scene.blur(target, opts)` (redacting sensitive UI elements). */
315
+ redact(target: Target | {
316
+ x: number;
317
+ y: number;
318
+ width: number;
319
+ height: number;
320
+ }, opts?: BlurOptions): Promise<void>;
321
+ /**
322
+ * Draws a crisp OpenScreen vector arrow pointing at a DOM element (or inside a stage-percent rect).
323
+ * Non-blocking unless `wait` is set.
324
+ */
325
+ arrow(target: Target | {
326
+ x: number;
327
+ y: number;
328
+ width: number;
329
+ height: number;
330
+ }, opts?: ArrowOptions): Promise<void>;
331
+ /**
332
+ * Overlays an image/logo (local PNG/JPG/SVG/WebP path or `data:image/...` URL) on the rendered
333
+ * canvas at stage-percent coordinates (`0..100`). Non-blocking unless `wait` is set.
334
+ */
335
+ image(src: string, opts?: ImageOptions): Promise<void>;
250
336
  private getVoiceSynthesizer;
251
337
  /**
252
338
  * Speaks a voiceover line (synthesized & cached via `@phil65/anyvoice`), automatically synced
package/dist/scene.js CHANGED
@@ -118,6 +118,9 @@ export class Scene {
118
118
  samples = [];
119
119
  actions = [];
120
120
  captions = [];
121
+ blurs = [];
122
+ arrows = [];
123
+ images = [];
121
124
  voiceCues = [];
122
125
  cursor;
123
126
  cursorKind = "arrow";
@@ -712,10 +715,157 @@ export class Scene {
712
715
  await this.ensureRecording();
713
716
  const duration = this.ms(opts.duration ?? 2600);
714
717
  const startMs = this.now();
715
- this.captions.push({ text, startMs, endMs: startMs + duration });
718
+ this.captions.push({
719
+ text,
720
+ startMs,
721
+ endMs: startMs + duration,
722
+ ...(opts.animation ? { animation: opts.animation } : {}),
723
+ });
724
+ if (opts.wait && !this.fast)
725
+ await sleep(duration);
726
+ }
727
+ /**
728
+ * Blurs or pixelates (`type: "mosaic"`) a DOM element or stage-percent rect (`{ x, y, width, height }`)
729
+ * using OpenScreen's native blur annotation — ideal for redacting API keys, emails, or account IDs.
730
+ * Defaults to staying blurred until the end of the recording (`duration: "end"`).
731
+ */
732
+ async blur(target, opts = {}) {
733
+ await this.ensureRecording();
734
+ const startMs = this.now();
735
+ const dur = opts.duration ?? "end";
736
+ const endMs = dur === "end" ? "end" : startMs + this.ms(dur);
737
+ const isStageRect = typeof target === "object" &&
738
+ target !== null &&
739
+ !isLocator(target) &&
740
+ "x" in target &&
741
+ "y" in target &&
742
+ "width" in target &&
743
+ "height" in target;
744
+ let box;
745
+ let rect;
746
+ let label = opts.label;
747
+ if (isStageRect) {
748
+ rect = target;
749
+ label ??= "blur rect";
750
+ }
751
+ else {
752
+ const inspected = await this.inspect(this.locate(target), target);
753
+ box = inspected.box;
754
+ label ??= describeTarget(target);
755
+ }
756
+ this.blurs.push({
757
+ startMs,
758
+ endMs,
759
+ ...(box ? { box } : {}),
760
+ ...(rect ? { rect } : {}),
761
+ padding: opts.padding,
762
+ type: opts.type,
763
+ shape: opts.shape,
764
+ color: opts.color,
765
+ intensity: opts.intensity,
766
+ blockSize: opts.blockSize,
767
+ label,
768
+ });
769
+ this.record({
770
+ kind: "blur",
771
+ startMs,
772
+ arriveMs: startMs,
773
+ endMs: typeof endMs === "number" ? endMs : startMs,
774
+ ...(box ? { box } : {}),
775
+ zoom: false,
776
+ label,
777
+ });
778
+ if (opts.wait && typeof endMs === "number" && !this.fast) {
779
+ await sleep(Math.max(0, endMs - this.now()));
780
+ }
781
+ }
782
+ /** Readable alias for `scene.blur(target, opts)` (redacting sensitive UI elements). */
783
+ async redact(target, opts = {}) {
784
+ return this.blur(target, opts);
785
+ }
786
+ /**
787
+ * Draws a crisp OpenScreen vector arrow pointing at a DOM element (or inside a stage-percent rect).
788
+ * Non-blocking unless `wait` is set.
789
+ */
790
+ async arrow(target, opts = {}) {
791
+ await this.ensureRecording();
792
+ const startMs = this.now();
793
+ const duration = this.ms(opts.duration ?? 2200);
794
+ const endMs = startMs + duration;
795
+ const isStageRect = typeof target === "object" &&
796
+ target !== null &&
797
+ !isLocator(target) &&
798
+ "x" in target &&
799
+ "y" in target &&
800
+ "width" in target &&
801
+ "height" in target;
802
+ let box;
803
+ let rect;
804
+ let label = opts.label;
805
+ if (isStageRect) {
806
+ rect = target;
807
+ label ??= "arrow";
808
+ }
809
+ else {
810
+ const inspected = await this.prepare(target);
811
+ box = inspected.box;
812
+ label ??= describeTarget(target);
813
+ }
814
+ this.arrows.push({
815
+ startMs,
816
+ endMs,
817
+ ...(box ? { box } : {}),
818
+ ...(rect ? { rect } : {}),
819
+ direction: opts.direction ?? "down-right",
820
+ color: opts.color,
821
+ strokeWidth: opts.strokeWidth,
822
+ size: opts.size,
823
+ label,
824
+ });
825
+ this.record({
826
+ kind: "arrow",
827
+ startMs,
828
+ arriveMs: startMs,
829
+ endMs,
830
+ ...(box ? { box } : {}),
831
+ zoom: false,
832
+ label,
833
+ });
716
834
  if (opts.wait && !this.fast)
717
835
  await sleep(duration);
718
836
  }
837
+ /**
838
+ * Overlays an image/logo (local PNG/JPG/SVG/WebP path or `data:image/...` URL) on the rendered
839
+ * canvas at stage-percent coordinates (`0..100`). Non-blocking unless `wait` is set.
840
+ */
841
+ async image(src, opts = {}) {
842
+ await this.ensureRecording();
843
+ const startMs = this.now();
844
+ const dur = opts.duration ?? 2600;
845
+ const endMs = dur === "end" ? "end" : startMs + this.ms(dur);
846
+ const label = opts.label ?? (src.startsWith("data:") ? "image" : path.basename(src));
847
+ this.images.push({
848
+ startMs,
849
+ endMs,
850
+ src,
851
+ x: opts.x ?? 68,
852
+ y: opts.y ?? 10,
853
+ width: opts.width ?? 26,
854
+ height: opts.height ?? 26,
855
+ label,
856
+ });
857
+ this.record({
858
+ kind: "image",
859
+ startMs,
860
+ arriveMs: startMs,
861
+ endMs: typeof endMs === "number" ? endMs : startMs,
862
+ zoom: false,
863
+ label,
864
+ });
865
+ if (opts.wait && typeof endMs === "number" && !this.fast) {
866
+ await sleep(Math.max(0, endMs - this.now()));
867
+ }
868
+ }
719
869
  getVoiceSynthesizer() {
720
870
  if (!this.voiceSynthesizer) {
721
871
  this.voiceSynthesizer = createVoiceSynthesizer(this.voiceConfig);
package/dist/types.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface CursorSample {
21
21
  interactionType?: "move" | "click" | "mouseup";
22
22
  assetId?: string | null;
23
23
  }
24
- export type ActionKind = "goto" | "click" | "select" | "drag" | "type" | "hover" | "scroll" | "pause" | "caption" | "press" | "move" | "zoom" | "highlight" | "say";
24
+ export type ActionKind = "goto" | "click" | "select" | "drag" | "type" | "hover" | "scroll" | "pause" | "caption" | "press" | "move" | "zoom" | "highlight" | "blur" | "arrow" | "image" | "say";
25
25
  /** One scripted step, as it actually happened during recording. */
26
26
  export interface ActionRecord {
27
27
  kind: ActionKind;
@@ -77,6 +77,73 @@ export interface Caption {
77
77
  endMs: number;
78
78
  /** Resolved placement (set by demoreel when the look's captionPosition is "auto"). */
79
79
  position?: "top" | "bottom";
80
+ /** Per-caption text animation override (defaults to `look.captionAnimation`). */
81
+ animation?: CaptionAnimation;
82
+ }
83
+ export type CaptionAnimation = "none" | "fade" | "rise" | "pop" | "slide-left" | "typewriter" | "pulse";
84
+ export type ArrowDirection = "up" | "down" | "left" | "right" | "up-right" | "up-left" | "down-right" | "down-left";
85
+ export interface CropRegion {
86
+ /** Normalized left offset (0..1). */
87
+ x: number;
88
+ /** Normalized top offset (0..1). */
89
+ y: number;
90
+ /** Normalized width (0..1). */
91
+ width: number;
92
+ /** Normalized height (0..1). */
93
+ height: number;
94
+ }
95
+ export interface BlurAnnotation {
96
+ startMs: number;
97
+ /** End time in ms, or `"end"` to stay blurred until the end of the recording. */
98
+ endMs: number | "end";
99
+ /** Target DOM element box in viewport CSS px (mapped through stage padding + camera). */
100
+ box?: Box;
101
+ /** Explicit stage-percent rect (`0..100`) if not targeting a DOM element. */
102
+ rect?: {
103
+ x: number;
104
+ y: number;
105
+ width: number;
106
+ height: number;
107
+ };
108
+ padding?: number;
109
+ type?: "blur" | "mosaic";
110
+ shape?: "rectangle" | "oval";
111
+ color?: "black" | "white";
112
+ intensity?: number;
113
+ blockSize?: number;
114
+ label?: string;
115
+ }
116
+ export interface ArrowAnnotation {
117
+ startMs: number;
118
+ endMs: number;
119
+ /** Target DOM element box in viewport CSS px to point at. */
120
+ box?: Box;
121
+ /** Explicit stage-percent rect (`0..100`) if not targeting a DOM element. */
122
+ rect?: {
123
+ x: number;
124
+ y: number;
125
+ width: number;
126
+ height: number;
127
+ };
128
+ direction: ArrowDirection;
129
+ color?: string;
130
+ strokeWidth?: number;
131
+ /** Arrow box size in percent of canvas width/height (default `9`). */
132
+ size?: number;
133
+ label?: string;
134
+ }
135
+ export interface ImageAnnotation {
136
+ startMs: number;
137
+ endMs: number | "end";
138
+ /** Data URL (`data:image/...`) or local file path (resolved & embedded when building the project). */
139
+ src: string;
140
+ /** Stage-percent position (`0..100`). */
141
+ x: number;
142
+ y: number;
143
+ /** Stage-percent size (`1..100`). */
144
+ width: number;
145
+ height: number;
146
+ label?: string;
80
147
  }
81
148
  /** OpenScreen trim region: the range is cut from the output. */
82
149
  export interface TrimRegion {
@@ -125,6 +192,9 @@ export interface RecordingResult {
125
192
  samples: CursorSample[];
126
193
  actions: ActionRecord[];
127
194
  captions: Caption[];
195
+ blurs?: BlurAnnotation[];
196
+ arrows?: ArrowAnnotation[];
197
+ images?: ImageAnnotation[];
128
198
  voiceCues?: VoiceCue[];
129
199
  /** Recording-clock times (ms) of every captured screencast frame (= a visual change). */
130
200
  frameTimes: number[];
package/dist/voice.d.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import type { SpeedRegion, TrimRegion, VoiceCue, WordTiming } from "./types.ts";
2
- export type VoiceProviderName = "edge" | "openai" | "elevenlabs";
2
+ export type VoiceProviderName = "edge" | "openai" | "elevenlabs" | "gemini" | "cartesia" | "deepgram";
3
+ export declare const VOICE_PROVIDERS: readonly VoiceProviderName[];
3
4
  export interface VoiceConfig {
4
5
  /** TTS provider (default `"edge"` — free, no API key required). */
5
6
  provider?: VoiceProviderName;
6
- /** Provider voice ID (e.g. `"en-US-AndrewMultilingualNeural"`, `"nova"`). */
7
+ /** Provider voice ID (e.g. `"en-US-AndrewMultilingualNeural"`, `"nova"`, `"Kore"`, `"aura-2-thalia-en"`). */
7
8
  voice?: string;
8
- /** Provider model (e.g. `"gpt-4o-mini-tts"`, `"tts-1"`, `"eleven_flash_v2_5"`). */
9
+ /** Provider model (e.g. `"gpt-4o-mini-tts"`, `"gemini-2.5-flash-preview-tts"`, `"sonic-3"`, `"eleven_flash_v2_5"`). */
9
10
  model?: string;
10
- /** API key override (defaults to `OPENAI_API_KEY` / `ELEVENLABS_API_KEY`). */
11
+ /** API key override (defaults to provider env var: `OPENAI_API_KEY`, `ELEVENLABS_API_KEY`, `GEMINI_API_KEY`, `CARTESIA_API_KEY`, `DEEPGRAM_API_KEY`). */
11
12
  apiKey?: string;
12
- /** Custom base URL for OpenAI-compatible servers (e.g. local Kokoro/Speaches) or ElevenLabs. */
13
+ /** Custom base URL (e.g. local Kokoro/Speaches server for `openai`). */
13
14
  baseUrl?: string;
15
+ /** Optional language/locale hint (BCP-47 for `gemini` e.g. `"en-US"`, ISO-639-1 for `cartesia` e.g. `"en"`). */
16
+ language?: string;
14
17
  /** Default speech speed multiplier (`1.0` = normal). */
15
18
  speed?: number;
16
19
  /** Default pitch offset in Hz (`0` = neutral). */
package/dist/voice.js CHANGED
@@ -7,6 +7,14 @@ import path from "node:path";
7
7
  import { VoiceClient } from "@phil65/anyvoice";
8
8
  import { DemoreelError, ffmpegBin, run } from "./env.js";
9
9
  import { sourceToOutputMs } from "./idle.js";
10
+ export const VOICE_PROVIDERS = [
11
+ "edge",
12
+ "openai",
13
+ "elevenlabs",
14
+ "gemini",
15
+ "cartesia",
16
+ "deepgram",
17
+ ];
10
18
  export const DEFAULT_VOICE_GAP_MS = 250;
11
19
  export const DEFAULT_VOICE_PAD_MS = 220;
12
20
  /** Creates a cached `@phil65/anyvoice` synthesizer from a `VoiceConfig`. */
@@ -33,18 +41,47 @@ export function createVoiceSynthesizer(config = {}, defaultCacheDir = path.resol
33
41
  voice: config.voice,
34
42
  });
35
43
  }
44
+ else if (provider === "gemini") {
45
+ client = VoiceClient.gemini({
46
+ apiKey: config.apiKey,
47
+ baseUrl: config.baseUrl,
48
+ model: config.model,
49
+ voice: config.voice,
50
+ languageCode: config.language,
51
+ });
52
+ }
53
+ else if (provider === "cartesia") {
54
+ client = VoiceClient.cartesia({
55
+ apiKey: config.apiKey,
56
+ baseUrl: config.baseUrl,
57
+ model: config.model,
58
+ voice: config.voice,
59
+ language: config.language,
60
+ });
61
+ }
62
+ else if (provider === "deepgram") {
63
+ client = VoiceClient.deepgram({
64
+ apiKey: config.apiKey,
65
+ baseUrl: config.baseUrl,
66
+ voice: config.voice,
67
+ });
68
+ }
36
69
  else {
37
- throw new DemoreelError(`unknown voice provider: ${String(provider)}`, "use edge, openai, or elevenlabs");
70
+ throw new DemoreelError(`unknown voice provider: ${String(provider)}`, `use ${VOICE_PROVIDERS.join(", ")}`);
38
71
  }
39
72
  }
40
73
  catch (e) {
41
74
  if (e instanceof DemoreelError)
42
75
  throw e;
43
- throw new DemoreelError(`failed to initialise voice provider "${provider}": ${e.message}`, provider === "openai"
44
- ? "set OPENAI_API_KEY or switch to provider: 'edge' (free)"
45
- : provider === "elevenlabs"
46
- ? "set ELEVENLABS_API_KEY or switch to provider: 'edge' (free)"
47
- : undefined);
76
+ const envHint = {
77
+ openai: "OPENAI_API_KEY",
78
+ elevenlabs: "ELEVENLABS_API_KEY",
79
+ gemini: "GEMINI_API_KEY",
80
+ cartesia: "CARTESIA_API_KEY",
81
+ deepgram: "DEEPGRAM_API_KEY",
82
+ };
83
+ const envVar = envHint[provider];
84
+ throw new DemoreelError(`failed to initialise voice provider "${provider}": ${e.message}`, envVar ? `set ${envVar} or switch to provider: 'edge' (free)` : undefined);
48
85
  }
49
86
  const cacheDir = path.resolve(config.cacheDir ?? defaultCacheDir);
50
87
  const cached = client.withCache(cacheDir);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@phil65/demoreel",
3
3
  "mcpName": "io.github.phil65/demoreel",
4
- "version": "0.6.0",
4
+ "version": "0.7.1",
5
5
  "private": false,
6
6
  "description": "Scripted product demo videos (videos as code): Playwright scenarios with auto cursor + auto zoom, rendered headless by OpenScreen's exporter.",
7
7
  "keywords": [
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@modelcontextprotocol/server": "^2.4.0",
82
- "@phil65/anyvoice": "^0.2.0",
82
+ "@phil65/anyvoice": "^0.3.0",
83
83
  "zod": "^4.6.7"
84
84
  }
85
85
  }
@@ -57,6 +57,10 @@ export default defineScenario({
57
57
  renders crisp shortcut keycap pills (`Ctrl + K`, `Esc`) as OpenScreen annotations (also toggleable via `demoreel rezoom --show-keys`).
58
58
  - `clickRipple: true` (or `{ color, size, durationMs }`) adds an expanding translucent ring at each click.
59
59
  - `scene.highlight(target, { dim: true, badge: "..." })` adds a spotlight backdrop dim and optional callout pill.
60
+ - `scene.blur(target, { type: "blur" | "mosaic" })` (alias `scene.redact()`) blurs sensitive API keys, emails, or account IDs on the rendered video (defaults to staying blurred until video end).
61
+ - `scene.arrow(target, { direction: "down-right", color: "#ffcc00" })` draws a crisp vector arrow pointing at an element.
62
+ - `scene.image("./badge.png", { x, y, width, height })` and `look: { watermark: { src: "./logo.png", position: "bottom-right" } }` render image/logo overlays.
63
+ - `look: { captionAnimation: "fade" | "rise" | "pop" | "typewriter", showBlur: true, crop: { x, y, width, height } }` tune caption animations, blurred wallpaper backdrop, and frame crop.
60
64
  - `cursor: { size, clickBounce, smoothing, motionBlur, show }` tunes OpenScreen's rendered cursor per scenario.
61
65
  - `depth` is an **integer tier `1..6`**, not a raw zoom multiplier:
62
66
  `1 = 1.25x`, `2 = 1.5x`, `3 = 1.8x`, `4 = 2.2x`, `5 = 3x`, `6 = 5x`.
@@ -76,7 +80,7 @@ export default defineScenario({
76
80
  - **Dark UIs**: set `colorScheme: "dark"` and pair with a deep slate/indigo `look.wallpaper`
77
81
  gradient (e.g. `linear-gradient(135deg, #0b1022 0%, #1d2d5c 52%, #3a2368 100%)`) rather than
78
82
  bright default gradients.
79
- - **Voiceover narration (`scene.say`)**: backed by `@phil65/anyvoice` (defaults to free `edge` TTS with SHA-256 disk caching; also supports `openai` with `instructions` and `elevenlabs`).
83
+ - **Voiceover narration (`scene.say`)**: backed by `@phil65/anyvoice` (defaults to free `edge` TTS with SHA-256 disk caching; also supports `openai` and `gemini` with delivery `instructions`, `cartesia` and `elevenlabs` with native word timestamps, and `deepgram` Aura-2).
80
84
  - Set `voice: { provider: "edge", voice: "en-US-AndrewMultilingualNeural", speed: 1.05 }` on the scenario.
81
85
  - Chain short beats (`await scene.say("Welcome.")`) or narrate *while* acting (`await scene.say("Pick Bracket and orbit.", async (cue) => { await scene.click(...); await cue.at("orbit", -150); await scene.drag(...); })`) — `demoreel` automatically holds if actions finish faster than speech, prevents overlapping cues, protects voice cues from `trimIdle`, muxes AAC audio into the rendered MP4, and writes `<name>.vtt` subtitles (opt-in `captions: "burned"` to also draw on-video).
82
86
  - Always run `--dry-run` first so the SHA-256 voice cache is warmed (<1ms hits during real recording), and check the printed **voice lint** findings (`voice-overlap`, `voice-clipped-end`, `voice-longer-than-action`, `voice-long-cue`) alongside `framesheet` — that's how you verify audio pacing without listening to the MP4.
@@ -1 +0,0 @@
1
- import"./index-CE-lli1m.js";import"./init-DfmWKarH.js";