@pixerate/editor 0.234.0 → 0.235.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.
@@ -12,10 +12,14 @@ import {
12
12
  effectLayerInput,
13
13
  effectLayerOffered,
14
14
  effectLayerRole,
15
+ effectLayerSpan,
15
16
  effectSequenceEffects,
16
17
  effectSequenceSlots,
18
+ effectSequenceTiming,
17
19
  effectSubjectKind,
18
20
  effectSubjectProblem,
21
+ effectTemplateTools,
22
+ fillEffectTemplate,
19
23
  isSubjectTemplateSlot,
20
24
  searchTemplateSummaries,
21
25
  templateDefaultValues,
@@ -24,7 +28,7 @@ import {
24
28
  templateSlotTakes,
25
29
  templateValueProblem,
26
30
  templateValuesSchema
27
- } from "../chunk-I277KJLQ.js";
31
+ } from "../chunk-G3RUKJ5C.js";
28
32
  import {
29
33
  EffectRendererPool
30
34
  } from "../chunk-EHLOCVWB.js";
@@ -1574,16 +1578,20 @@ export {
1574
1578
  effectLayerInput,
1575
1579
  effectLayerOffered,
1576
1580
  effectLayerRole,
1581
+ effectLayerSpan,
1577
1582
  effectOffered,
1578
1583
  effectParameterFields,
1579
1584
  effectSampleInputs,
1580
1585
  effectSamplePicture,
1581
1586
  effectSequenceEffects,
1582
1587
  effectSequenceSlots,
1588
+ effectSequenceTiming,
1583
1589
  effectSubjectKind,
1584
1590
  effectSubjectProblem,
1591
+ effectTemplateTools,
1585
1592
  effectValueErrors,
1586
1593
  encodeEffectFloat,
1594
+ fillEffectTemplate,
1587
1595
  groupEffectsByCategory,
1588
1596
  hasEffectTags,
1589
1597
  isCameraView,
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Agent tools for the provider's sequence templates, shared by the editors that can load an
3
+ * `EffectSequence`: `list_templates`, `describe_template` and `fill_template`. An editor gives
4
+ * them to its effect tool provider (`extraTools`) with an `EffectTemplateToolHost` that says what
5
+ * filling makes there and does it as one undo step.
6
+ */
7
+ import type { AgentTool } from '../tools/registry.cjs';
8
+ import type { JsonSchema } from '../tools/schema.cjs';
9
+ import type { EffectToolContext } from './tools.cjs';
10
+ import type { EffectProvider } from './types.cjs';
11
+ export interface EffectTemplateToolHost {
12
+ /** The current provider, or `null`. */
13
+ provider(): EffectProvider | null;
14
+ /** Added to `fill_template`'s description: what filling makes in this editor and what it returns. */
15
+ fillDetails: string;
16
+ /** Arguments `fill_template` takes in this editor besides `template`, `values` and `name`. */
17
+ fillOptions?: Record<string, JsonSchema>;
18
+ /** Fills the template and loads it as one undo step; returns what it made. Throws a sentence when it cannot. */
19
+ fill(template: string, values: Record<string, unknown>, options: {
20
+ name?: string;
21
+ [option: string]: unknown;
22
+ }): Promise<Record<string, unknown>>;
23
+ }
24
+ /** The template tools (see the module comment). */
25
+ export declare function effectTemplateTools(host: EffectTemplateToolHost, ctx: EffectToolContext): AgentTool[];
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Agent tools for the provider's sequence templates, shared by the editors that can load an
3
+ * `EffectSequence`: `list_templates`, `describe_template` and `fill_template`. An editor gives
4
+ * them to its effect tool provider (`extraTools`) with an `EffectTemplateToolHost` that says what
5
+ * filling makes there and does it as one undo step.
6
+ */
7
+ import type { AgentTool } from '../tools/registry.js';
8
+ import type { JsonSchema } from '../tools/schema.js';
9
+ import type { EffectToolContext } from './tools.js';
10
+ import type { EffectProvider } from './types.js';
11
+ export interface EffectTemplateToolHost {
12
+ /** The current provider, or `null`. */
13
+ provider(): EffectProvider | null;
14
+ /** Added to `fill_template`'s description: what filling makes in this editor and what it returns. */
15
+ fillDetails: string;
16
+ /** Arguments `fill_template` takes in this editor besides `template`, `values` and `name`. */
17
+ fillOptions?: Record<string, JsonSchema>;
18
+ /** Fills the template and loads it as one undo step; returns what it made. Throws a sentence when it cannot. */
19
+ fill(template: string, values: Record<string, unknown>, options: {
20
+ name?: string;
21
+ [option: string]: unknown;
22
+ }): Promise<Record<string, unknown>>;
23
+ }
24
+ /** The template tools (see the module comment). */
25
+ export declare function effectTemplateTools(host: EffectTemplateToolHost, ctx: EffectToolContext): AgentTool[];
@@ -4,7 +4,7 @@
4
4
  * a sequence before loading it, and which input a layer's subject feeds. Dependency-free.
5
5
  */
6
6
  import type { JsonSchema } from '../tools/schema.cjs';
7
- import { type EffectDescription, type EffectLayer, type EffectLayerRole, type EffectSequence, type EffectSubjectKind, type EffectSummary, type EffectTemplateSearchOptions, type EffectTemplateSlot, type EffectTemplateSummary } from './types.cjs';
7
+ import { type EffectDescription, type EffectProvider, type EffectTemplateDescription, type EffectTemplateOptions, type EffectLayer, type EffectLayerRole, type EffectSequence, type EffectSubjectKind, type EffectSummary, type EffectTemplateSearchOptions, type EffectTemplateSlot, type EffectTemplateSummary } from './types.cjs';
8
8
  export declare const EFFECT_SEQUENCE_NAME: RegExp;
9
9
  /** True for a subject slot (`image`, `video`, `svg`). */
10
10
  export declare const isSubjectTemplateSlot: (slot: Pick<EffectTemplateSlot, "type">) => boolean;
@@ -54,3 +54,32 @@ export declare function checkEffectSequence(sequence: unknown, catalog?: readonl
54
54
  export declare function effectSequenceEffects(sequence: EffectSequence): string[];
55
55
  /** Subject slots a sequence leaves for the host (`{ slot }` subjects), each once. */
56
56
  export declare function effectSequenceSlots(sequence: EffectSequence): string[];
57
+ /** A filled template, checked and ready for an editor to load. */
58
+ export interface FilledEffectTemplate {
59
+ template: EffectTemplateDescription;
60
+ sequence: EffectSequence;
61
+ openSlots: string[];
62
+ notes: string[];
63
+ }
64
+ /**
65
+ * Fills a provider template for an editor: checks the provider has templates, checks `values`
66
+ * against the slots first (every problem at once, as sentences), fills it, and checks the
67
+ * sequence against the provider's catalog before anything is loaded. Throws an `Error` whose
68
+ * message says what is wrong and what to call instead; never returns a sequence that names
69
+ * effects the provider does not list.
70
+ */
71
+ export declare function fillEffectTemplate(provider: EffectProvider | null | undefined, id: string, values?: unknown, options?: EffectTemplateOptions): Promise<FilledEffectTemplate>;
72
+ /** Where a layer of a sequence shows, in ms from the sequence's start, given each shot's start and the total length. */
73
+ export declare function effectLayerSpan(layer: Pick<EffectLayer, 'from' | 'until'>, shotIndex: number, shotStarts: readonly number[], total: number): {
74
+ start: number;
75
+ end: number;
76
+ };
77
+ /**
78
+ * When each shot of a sequence starts and how long it all lasts (ms): a shot plays its lead-in (the
79
+ * longer of its transition and its camera move in, when the move says its `ms`) and then holds.
80
+ */
81
+ export declare function effectSequenceTiming(sequence: EffectSequence): {
82
+ starts: number[];
83
+ leadIns: number[];
84
+ total: number;
85
+ };
@@ -4,7 +4,7 @@
4
4
  * a sequence before loading it, and which input a layer's subject feeds. Dependency-free.
5
5
  */
6
6
  import type { JsonSchema } from '../tools/schema.js';
7
- import { type EffectDescription, type EffectLayer, type EffectLayerRole, type EffectSequence, type EffectSubjectKind, type EffectSummary, type EffectTemplateSearchOptions, type EffectTemplateSlot, type EffectTemplateSummary } from './types.js';
7
+ import { type EffectDescription, type EffectProvider, type EffectTemplateDescription, type EffectTemplateOptions, type EffectLayer, type EffectLayerRole, type EffectSequence, type EffectSubjectKind, type EffectSummary, type EffectTemplateSearchOptions, type EffectTemplateSlot, type EffectTemplateSummary } from './types.js';
8
8
  export declare const EFFECT_SEQUENCE_NAME: RegExp;
9
9
  /** True for a subject slot (`image`, `video`, `svg`). */
10
10
  export declare const isSubjectTemplateSlot: (slot: Pick<EffectTemplateSlot, "type">) => boolean;
@@ -54,3 +54,32 @@ export declare function checkEffectSequence(sequence: unknown, catalog?: readonl
54
54
  export declare function effectSequenceEffects(sequence: EffectSequence): string[];
55
55
  /** Subject slots a sequence leaves for the host (`{ slot }` subjects), each once. */
56
56
  export declare function effectSequenceSlots(sequence: EffectSequence): string[];
57
+ /** A filled template, checked and ready for an editor to load. */
58
+ export interface FilledEffectTemplate {
59
+ template: EffectTemplateDescription;
60
+ sequence: EffectSequence;
61
+ openSlots: string[];
62
+ notes: string[];
63
+ }
64
+ /**
65
+ * Fills a provider template for an editor: checks the provider has templates, checks `values`
66
+ * against the slots first (every problem at once, as sentences), fills it, and checks the
67
+ * sequence against the provider's catalog before anything is loaded. Throws an `Error` whose
68
+ * message says what is wrong and what to call instead; never returns a sequence that names
69
+ * effects the provider does not list.
70
+ */
71
+ export declare function fillEffectTemplate(provider: EffectProvider | null | undefined, id: string, values?: unknown, options?: EffectTemplateOptions): Promise<FilledEffectTemplate>;
72
+ /** Where a layer of a sequence shows, in ms from the sequence's start, given each shot's start and the total length. */
73
+ export declare function effectLayerSpan(layer: Pick<EffectLayer, 'from' | 'until'>, shotIndex: number, shotStarts: readonly number[], total: number): {
74
+ start: number;
75
+ end: number;
76
+ };
77
+ /**
78
+ * When each shot of a sequence starts and how long it all lasts (ms): a shot plays its lead-in (the
79
+ * longer of its transition and its camera move in, when the move says its `ms`) and then holds.
80
+ */
81
+ export declare function effectSequenceTiming(sequence: EffectSequence): {
82
+ starts: number[];
83
+ leadIns: number[];
84
+ total: number;
85
+ };
@@ -52,6 +52,22 @@ export interface VideoEditorOptions {
52
52
  }
53
53
  /** What `applyClipEffect` and the other effect edits return: the edit result plus what they made or changed. */
54
54
  /** What setting or clearing a clip's camera move did: its camera now, the keys baked per property, any cuts and when each move plays (clip ms). */
55
+ /** What filling a template did (see `fillTemplate`). */
56
+ export type VideoTemplateResult = {
57
+ ok: true;
58
+ template: string;
59
+ tracks: string[];
60
+ clips: string[];
61
+ assets: string[];
62
+ start: number;
63
+ end: number;
64
+ placeholders: Record<string, string[]>;
65
+ openSlots: string[];
66
+ notes: string[];
67
+ } | {
68
+ ok: false;
69
+ error: string;
70
+ };
55
71
  export type VideoCameraMoveResult = {
56
72
  ok: true;
57
73
  clip: string;
@@ -257,6 +273,16 @@ export declare class VideoEditorController {
257
273
  useEffects(provider: EffectProvider): () => void;
258
274
  /** The provider's description of an effect, checked for `place` (rejects without a provider or for an unknown id). */
259
275
  describeEffect(effect: string, place?: VideoEffectPlace): Promise<EffectDescription>;
276
+ /**
277
+ * Fills a provider sequence template and puts it on the timeline at `at` (default the end), on
278
+ * new tracks above the others (see `videoEditsFromSequence`). Values are checked first and every
279
+ * problem is refused at once. One undo step. Returns the new tracks, clips and assets, where it
280
+ * starts and ends, the placeholder clips standing in for open slots, and notes.
281
+ */
282
+ fillTemplate(template: string, values?: Record<string, unknown>, options?: {
283
+ name?: string;
284
+ at?: number;
285
+ }): Promise<VideoTemplateResult>;
260
286
  private refused;
261
287
  private effectEdit;
262
288
  private clipOrThrow;
@@ -52,6 +52,22 @@ export interface VideoEditorOptions {
52
52
  }
53
53
  /** What `applyClipEffect` and the other effect edits return: the edit result plus what they made or changed. */
54
54
  /** What setting or clearing a clip's camera move did: its camera now, the keys baked per property, any cuts and when each move plays (clip ms). */
55
+ /** What filling a template did (see `fillTemplate`). */
56
+ export type VideoTemplateResult = {
57
+ ok: true;
58
+ template: string;
59
+ tracks: string[];
60
+ clips: string[];
61
+ assets: string[];
62
+ start: number;
63
+ end: number;
64
+ placeholders: Record<string, string[]>;
65
+ openSlots: string[];
66
+ notes: string[];
67
+ } | {
68
+ ok: false;
69
+ error: string;
70
+ };
55
71
  export type VideoCameraMoveResult = {
56
72
  ok: true;
57
73
  clip: string;
@@ -257,6 +273,16 @@ export declare class VideoEditorController {
257
273
  useEffects(provider: EffectProvider): () => void;
258
274
  /** The provider's description of an effect, checked for `place` (rejects without a provider or for an unknown id). */
259
275
  describeEffect(effect: string, place?: VideoEffectPlace): Promise<EffectDescription>;
276
+ /**
277
+ * Fills a provider sequence template and puts it on the timeline at `at` (default the end), on
278
+ * new tracks above the others (see `videoEditsFromSequence`). Values are checked first and every
279
+ * problem is refused at once. One undo step. Returns the new tracks, clips and assets, where it
280
+ * starts and ends, the placeholder clips standing in for open slots, and notes.
281
+ */
282
+ fillTemplate(template: string, values?: Record<string, unknown>, options?: {
283
+ name?: string;
284
+ at?: number;
285
+ }): Promise<VideoTemplateResult>;
260
286
  private refused;
261
287
  private effectEdit;
262
288
  private clipOrThrow;