@pixerate/editor 0.135.0 → 0.137.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.
Files changed (164) hide show
  1. package/dist/animation-editor/index.cjs +63 -55
  2. package/dist/animation-editor/index.cjs.map +1 -1
  3. package/dist/animation-editor/index.d.cts +8 -5
  4. package/dist/animation-editor/index.d.ts +8 -5
  5. package/dist/animation-editor/index.js +10 -2
  6. package/dist/animation-editor/index.js.map +1 -1
  7. package/dist/{bezier-J8i4uqSH.d.cts → bezier-CZ2AhjID.d.cts} +1 -1
  8. package/dist/{bezier-lNEOp0Jx.d.ts → bezier-Dywv3Bw8.d.ts} +1 -1
  9. package/dist/blending-D7jCmjO6.d.cts +1026 -0
  10. package/dist/blending-NgF3qo3d.d.ts +1026 -0
  11. package/dist/brushes-CnvZSYYU.d.cts +744 -0
  12. package/dist/brushes-DJmUbIgz.d.ts +744 -0
  13. package/dist/{brushstrokeRender-SII6MG4R.js → brushstrokeRender-2FAXA3XC.js} +13 -16
  14. package/dist/{brushstrokeRender-SII6MG4R.js.map → brushstrokeRender-2FAXA3XC.js.map} +1 -1
  15. package/dist/{brushstrokeRender-JNHVEUFG.cjs → brushstrokeRender-IMFY3FF6.cjs} +16 -19
  16. package/dist/brushstrokeRender-IMFY3FF6.cjs.map +1 -0
  17. package/dist/canvas/index.cjs +10 -10
  18. package/dist/canvas/index.cjs.map +1 -1
  19. package/dist/canvas/index.d.cts +10 -7
  20. package/dist/canvas/index.d.ts +10 -7
  21. package/dist/canvas/index.js +4 -4
  22. package/dist/{chunk-W4LNKTHT.cjs → chunk-2XS6LTUP.cjs} +63 -63
  23. package/dist/{chunk-W4LNKTHT.cjs.map → chunk-2XS6LTUP.cjs.map} +1 -1
  24. package/dist/{chunk-HHTCDFZC.js → chunk-3D77LOBM.js} +234 -136
  25. package/dist/chunk-3D77LOBM.js.map +1 -0
  26. package/dist/{chunk-BR7EKQUP.js → chunk-3G6J7UFV.js} +322 -2
  27. package/dist/chunk-3G6J7UFV.js.map +1 -0
  28. package/dist/{chunk-62XUO5LB.js → chunk-3X6IAJUQ.js} +2 -2
  29. package/dist/{chunk-EM3FMJWE.js → chunk-5FSRTP6E.js} +320 -3
  30. package/dist/chunk-5FSRTP6E.js.map +1 -0
  31. package/dist/{chunk-Z2H7KECK.cjs → chunk-5OOIUXNJ.cjs} +345 -247
  32. package/dist/chunk-5OOIUXNJ.cjs.map +1 -0
  33. package/dist/{chunk-7RJ6P7MI.js → chunk-6S6362D2.js} +2 -2
  34. package/dist/chunk-A3BVTI3G.js +150 -0
  35. package/dist/chunk-A3BVTI3G.js.map +1 -0
  36. package/dist/{chunk-24ATT2PE.cjs → chunk-AEAAN4AD.cjs} +120 -120
  37. package/dist/{chunk-24ATT2PE.cjs.map → chunk-AEAAN4AD.cjs.map} +1 -1
  38. package/dist/chunk-ECCXGELC.cjs +727 -0
  39. package/dist/chunk-ECCXGELC.cjs.map +1 -0
  40. package/dist/{chunk-SVYE5HIM.js → chunk-EQQMGO42.js} +2 -2
  41. package/dist/{chunk-FHPVDTI2.cjs → chunk-F2Y4E4GU.cjs} +22 -22
  42. package/dist/{chunk-FHPVDTI2.cjs.map → chunk-F2Y4E4GU.cjs.map} +1 -1
  43. package/dist/{chunk-OXSV64JX.js → chunk-G6IKY6PL.js} +4 -4
  44. package/dist/{chunk-UYQUPUR6.js → chunk-HUO3TI4C.js} +3 -3
  45. package/dist/chunk-I52DRGGJ.js +727 -0
  46. package/dist/chunk-I52DRGGJ.js.map +1 -0
  47. package/dist/{chunk-DDSO4HS7.cjs → chunk-KEENUAFN.cjs} +2 -2
  48. package/dist/{chunk-DDSO4HS7.cjs.map → chunk-KEENUAFN.cjs.map} +1 -1
  49. package/dist/{chunk-2HC4DRF4.js → chunk-LLFHCSU2.js} +2 -2
  50. package/dist/{chunk-J5BA3BQ6.cjs → chunk-O7LUD7MH.cjs} +323 -3
  51. package/dist/chunk-O7LUD7MH.cjs.map +1 -0
  52. package/dist/{chunk-ILYFOJUN.js → chunk-OIBIRXRG.js} +3 -3
  53. package/dist/{chunk-FWEO3HSL.js → chunk-PQQF5KOW.js} +8 -8
  54. package/dist/{chunk-T6TV6HY6.cjs → chunk-PRSRYHQD.cjs} +36 -36
  55. package/dist/{chunk-T6TV6HY6.cjs.map → chunk-PRSRYHQD.cjs.map} +1 -1
  56. package/dist/chunk-Q6OUXEK3.cjs +150 -0
  57. package/dist/chunk-Q6OUXEK3.cjs.map +1 -0
  58. package/dist/{chunk-6GFRKLLS.cjs → chunk-QBWEH3IM.cjs} +429 -112
  59. package/dist/chunk-QBWEH3IM.cjs.map +1 -0
  60. package/dist/{chunk-ESIWZMMK.js → chunk-SYT2TLQF.js} +35 -37
  61. package/dist/{chunk-ESIWZMMK.js.map → chunk-SYT2TLQF.js.map} +1 -1
  62. package/dist/{chunk-YT3JL7YM.cjs → chunk-TLCTTQFF.cjs} +53 -53
  63. package/dist/{chunk-YT3JL7YM.cjs.map → chunk-TLCTTQFF.cjs.map} +1 -1
  64. package/dist/{chunk-P3RQ5UJE.cjs → chunk-UTQKC66X.cjs} +4 -4
  65. package/dist/{chunk-P3RQ5UJE.cjs.map → chunk-UTQKC66X.cjs.map} +1 -1
  66. package/dist/{chunk-J3B45HTA.cjs → chunk-XB25WOC2.cjs} +6 -6
  67. package/dist/{chunk-J3B45HTA.cjs.map → chunk-XB25WOC2.cjs.map} +1 -1
  68. package/dist/{chunk-YAFS2QFZ.cjs → chunk-XN2NBLV5.cjs} +313 -315
  69. package/dist/chunk-XN2NBLV5.cjs.map +1 -0
  70. package/dist/effects/index.d.cts +7 -4
  71. package/dist/effects/index.d.ts +7 -4
  72. package/dist/{export-DMeG6E06.d.ts → export-41rL6Cne.d.ts} +1 -1
  73. package/dist/{export-AZSwX087.d.cts → export-CyJdfP_Z.d.cts} +5 -4
  74. package/dist/{export-KzubBKo7.d.cts → export-D9mXp05Q.d.cts} +1 -1
  75. package/dist/{export-BDkyDNM8.d.ts → export-DwnZ_hvQ.d.ts} +5 -4
  76. package/dist/extensions/index.cjs +3 -3
  77. package/dist/extensions/index.cjs.map +1 -1
  78. package/dist/extensions/index.js +2 -2
  79. package/dist/generation/index.cjs +150 -945
  80. package/dist/generation/index.cjs.map +1 -1
  81. package/dist/generation/index.d.cts +3 -423
  82. package/dist/generation/index.d.ts +3 -423
  83. package/dist/generation/index.js +59 -854
  84. package/dist/generation/index.js.map +1 -1
  85. package/dist/grammar/index.cjs +3 -3
  86. package/dist/grammar/index.cjs.map +1 -1
  87. package/dist/grammar/index.js +2 -2
  88. package/dist/{helpers-Coa4e2j_.d.ts → helpers-C-RgeyvH.d.ts} +25 -8
  89. package/dist/{helpers-DHl28yLO.d.cts → helpers-v6GMazzg.d.cts} +25 -8
  90. package/dist/image-editor/index.cjs +986 -986
  91. package/dist/image-editor/index.cjs.map +1 -1
  92. package/dist/image-editor/index.d.cts +15 -11
  93. package/dist/image-editor/index.d.ts +15 -11
  94. package/dist/image-editor/index.js +94 -94
  95. package/dist/index.cjs +28 -28
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.js +36 -36
  98. package/dist/{opentype-BWR7Qv8W.d.cts → opentype-KR_jj6b_.d.cts} +1 -1
  99. package/dist/{opentype-Dfcx6wFx.d.ts → opentype-a1KAW-qs.d.ts} +1 -1
  100. package/dist/paint/index.cjs +5 -8
  101. package/dist/paint/index.cjs.map +1 -1
  102. package/dist/paint/index.d.cts +4 -2
  103. package/dist/paint/index.d.ts +4 -2
  104. package/dist/paint/index.js +15 -18
  105. package/dist/paint-editor/index.cjs +405 -403
  106. package/dist/paint-editor/index.cjs.map +1 -1
  107. package/dist/paint-editor/index.d.cts +15 -748
  108. package/dist/paint-editor/index.d.ts +15 -748
  109. package/dist/paint-editor/index.js +79 -77
  110. package/dist/paint-editor/index.js.map +1 -1
  111. package/dist/{pathfinder-D8KQ6blQ.d.cts → pathfinder-BHS4vQNm.d.cts} +1 -1
  112. package/dist/{pathfinder-Celbi3e6.d.ts → pathfinder-BVvTIBMo.d.ts} +1 -1
  113. package/dist/{pool-8JZGWHvR.d.ts → pool-CZQOrSXZ.d.ts} +1 -1
  114. package/dist/{pool-BfuxBKTd.d.cts → pool-FjZZmZ80.d.cts} +1 -1
  115. package/dist/provenance-DmlcgdzT.d.cts +426 -0
  116. package/dist/provenance-uh5r2TQ8.d.ts +426 -0
  117. package/dist/rand-8xbUb6ur.d.ts +1118 -0
  118. package/dist/rand-Cw9VLrVC.d.cts +1118 -0
  119. package/dist/raster/index.cjs +17 -19
  120. package/dist/raster/index.cjs.map +1 -1
  121. package/dist/raster/index.js +9 -11
  122. package/dist/raster/index.js.map +1 -1
  123. package/dist/{svg-CxxqG3_W.d.ts → svg-CSz3mzkw.d.ts} +2 -2
  124. package/dist/{svg-pwXWq6s2.d.cts → svg-DTb40ICU.d.cts} +2 -2
  125. package/dist/{tools-y1M6O3UT.d.ts → tools-B0wXP5cF.d.ts} +1 -1
  126. package/dist/{tools-3EBjR91b.d.cts → tools-Ca0kI1qo.d.cts} +1 -1
  127. package/dist/vector/index.cjs +2698 -1674
  128. package/dist/vector/index.cjs.map +1 -1
  129. package/dist/vector/index.d.cts +390 -72
  130. package/dist/vector/index.d.ts +390 -72
  131. package/dist/vector/index.js +1665 -641
  132. package/dist/vector/index.js.map +1 -1
  133. package/dist/video-editor/index.d.cts +7 -4
  134. package/dist/video-editor/index.d.ts +7 -4
  135. package/dist/{warp-Ceqdz7kj.d.cts → warp-DTOp0lON.d.cts} +1 -1
  136. package/dist/{warp-C1gwu2G_.d.ts → warp-pd7hrH4T.d.ts} +1 -1
  137. package/package.json +1 -1
  138. package/skills/pixerate-vector/SKILL.md +22 -0
  139. package/dist/brushstrokeRender-JNHVEUFG.cjs.map +0 -1
  140. package/dist/chunk-64PYNEHJ.js +0 -340
  141. package/dist/chunk-64PYNEHJ.js.map +0 -1
  142. package/dist/chunk-6GFRKLLS.cjs.map +0 -1
  143. package/dist/chunk-7QN76ESJ.js +0 -323
  144. package/dist/chunk-7QN76ESJ.js.map +0 -1
  145. package/dist/chunk-BR7EKQUP.js.map +0 -1
  146. package/dist/chunk-DCLJNVZS.cjs +0 -323
  147. package/dist/chunk-DCLJNVZS.cjs.map +0 -1
  148. package/dist/chunk-EM3FMJWE.js.map +0 -1
  149. package/dist/chunk-HHTCDFZC.js.map +0 -1
  150. package/dist/chunk-J5BA3BQ6.cjs.map +0 -1
  151. package/dist/chunk-YAFS2QFZ.cjs.map +0 -1
  152. package/dist/chunk-Z2H7KECK.cjs.map +0 -1
  153. package/dist/chunk-Z6OUCS2K.cjs +0 -340
  154. package/dist/chunk-Z6OUCS2K.cjs.map +0 -1
  155. package/dist/rand-BszBST4s.d.ts +0 -2140
  156. package/dist/rand-DOH_aMvm.d.cts +0 -2140
  157. /package/dist/{chunk-62XUO5LB.js.map → chunk-3X6IAJUQ.js.map} +0 -0
  158. /package/dist/{chunk-7RJ6P7MI.js.map → chunk-6S6362D2.js.map} +0 -0
  159. /package/dist/{chunk-SVYE5HIM.js.map → chunk-EQQMGO42.js.map} +0 -0
  160. /package/dist/{chunk-OXSV64JX.js.map → chunk-G6IKY6PL.js.map} +0 -0
  161. /package/dist/{chunk-UYQUPUR6.js.map → chunk-HUO3TI4C.js.map} +0 -0
  162. /package/dist/{chunk-2HC4DRF4.js.map → chunk-LLFHCSU2.js.map} +0 -0
  163. /package/dist/{chunk-ILYFOJUN.js.map → chunk-OIBIRXRG.js.map} +0 -0
  164. /package/dist/{chunk-FWEO3HSL.js.map → chunk-PQQF5KOW.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { P as Point } from './brushTypes-C7N3EBK7.cjs';
2
- import { B as BezierPath, P as PolygonBooleanOperation, a as BezierPathInput, b as PolygonFillRule, c as BezierSegment, d as BezierContour } from './bezier-J8i4uqSH.cjs';
2
+ import { B as BezierPath, P as PolygonBooleanOperation, a as BezierPathInput, b as PolygonFillRule, c as BezierSegment, d as BezierContour } from './bezier-CZ2AhjID.cjs';
3
3
 
4
4
  /**
5
5
  * Curve-preserving boolean operations (union, intersection, difference, xor and divide) on
@@ -1,5 +1,5 @@
1
1
  import { P as Point } from './brushTypes-C7N3EBK7.js';
2
- import { B as BezierPath, P as PolygonBooleanOperation, a as BezierPathInput, b as PolygonFillRule, c as BezierSegment, d as BezierContour } from './bezier-lNEOp0Jx.js';
2
+ import { B as BezierPath, P as PolygonBooleanOperation, a as BezierPathInput, b as PolygonFillRule, c as BezierSegment, d as BezierContour } from './bezier-Dywv3Bw8.js';
3
3
 
4
4
  /**
5
5
  * Curve-preserving boolean operations (union, intersection, difference, xor and divide) on
@@ -1,4 +1,4 @@
1
- import { E as EffectProvider, a as EffectRenderRequest, b as EffectPixels } from './helpers-Coa4e2j_.js';
1
+ import { E as EffectProvider, a as EffectRenderRequest, b as EffectPixels } from './helpers-C-RgeyvH.js';
2
2
 
3
3
  /**
4
4
  * `EffectRendererPool`: keeps a few live renderers, reused per effect, size and depth.
@@ -1,4 +1,4 @@
1
- import { E as EffectProvider, a as EffectRenderRequest, b as EffectPixels } from './helpers-DHl28yLO.cjs';
1
+ import { E as EffectProvider, a as EffectRenderRequest, b as EffectPixels } from './helpers-v6GMazzg.cjs';
2
2
 
3
3
  /**
4
4
  * `EffectRendererPool`: keeps a few live renderers, reused per effect, size and depth.
@@ -0,0 +1,426 @@
1
+ import { S as SourceMapSegment } from './sourcemap-C8AH3MBQ.cjs';
2
+ import { P as PromptValues, T as Template } from './tokens-D7yXvUU6.cjs';
3
+
4
+ /**
5
+ * Declarative descriptions of generative models (what a model accepts) and of
6
+ * the requests sent to them. Everything here is plain data so capabilities can
7
+ * come from a server, be merged with local presentation overlays, and be
8
+ * turned into JSON Schema for agents.
9
+ */
10
+ type GenerationMediaKind = 'image' | 'video' | 'audio' | 'text';
11
+ /** The reference roles this library knows by name (labels, aliases, schema order). */
12
+ type BuiltinReferenceRole = 'start_frame' | 'end_frame' | 'style_ref' | 'character_ref' | 'background_ref' | 'mask' | 'image_ref' | 'video_ref' | 'audio_ref';
13
+ /**
14
+ * What a reference input (an asset) is used for. The built-in roles are
15
+ * listed in {@link REFERENCE_ROLES}; models may declare any other role name
16
+ * (e.g. `subject`, `pose`) in `references.roles`, which makes it valid for
17
+ * that model. Role names match {@link REFERENCE_ROLE_NAME_REGEX}.
18
+ */
19
+ type ReferenceRole = BuiltinReferenceRole | (string & {});
20
+ /** Valid role names: a letter, then letters, digits, `_` or `-`, not ending in `_` or `-`. */
21
+ declare const REFERENCE_ROLE_NAME_REGEX: RegExp;
22
+ /** True for a string usable as a role name. */
23
+ declare function isReferenceRoleName(value: unknown): value is ReferenceRole;
24
+ /** Every built-in reference role, in a stable display order. */
25
+ declare const REFERENCE_ROLES: readonly BuiltinReferenceRole[];
26
+ /** Human-readable default labels for reference roles. */
27
+ declare const REFERENCE_ROLE_LABELS: Readonly<Record<BuiltinReferenceRole, string>>;
28
+ /**
29
+ * Friendly role names accepted wherever a role is written by hand (asset
30
+ * mentions such as `@fox:style`, agent calls). A model that declares the
31
+ * alias itself (e.g. its own `style` role) keeps it; otherwise the alias maps
32
+ * to the built-in role. Keys are lower case.
33
+ */
34
+ declare const REFERENCE_ROLE_ALIASES: Readonly<Record<string, BuiltinReferenceRole>>;
35
+ /** Display label of a role: the model's label, the built-in label, or the name made readable. */
36
+ declare function referenceRoleLabel(role: ReferenceRole, caps?: ModelCapabilities): string;
37
+ /**
38
+ * Canonical role for a hand-written name: the name itself when the model
39
+ * declares it (or, without a model, when it is built in), else its alias
40
+ * ({@link REFERENCE_ROLE_ALIASES}, case-insensitive), else the trimmed name.
41
+ */
42
+ declare function normalizeReferenceRole(role: string, caps?: ModelCapabilities): ReferenceRole;
43
+ /**
44
+ * Whether `mediaType` (a MIME type such as `image/png`, or a media kind such
45
+ * as `image`) matches one of `accepts` (`image`, `image/*`, `image/png`).
46
+ * An empty or missing `accepts` accepts everything; an unknown media type
47
+ * only matches a missing `accepts`.
48
+ */
49
+ declare function mediaTypeMatches(mediaType: string | undefined, accepts: readonly string[] | undefined): boolean;
50
+ /** A choice from a fixed list. `options` order matters (low → high where it applies). */
51
+ interface EnumCapability<T extends string | number = string> {
52
+ options: readonly T[];
53
+ default?: T;
54
+ /** Display labels by option value. */
55
+ labels?: Readonly<Record<string, string>>;
56
+ }
57
+ interface TextFieldCapability {
58
+ maxLength?: number;
59
+ }
60
+ interface PromptCapability extends TextFieldCapability {
61
+ /**
62
+ * Count the resolved prompt (templates expanded, variables substituted)
63
+ * against `maxLength` rather than the raw template text. Default `true`.
64
+ * Pass the resolved text to the planner as `resolvedPrompt`.
65
+ */
66
+ countResolved?: boolean;
67
+ /** The prompt must be non-empty. */
68
+ required?: boolean;
69
+ }
70
+ interface CountCapability {
71
+ /** Largest number of outputs per request. */
72
+ max: number;
73
+ /** Predefined choices; when given, requests snap to one of them. */
74
+ options?: readonly number[];
75
+ default?: number;
76
+ }
77
+ interface DurationCapability {
78
+ /** Seconds. */
79
+ min?: number;
80
+ max?: number;
81
+ /** Predefined choices; when given, requests snap to one of them. */
82
+ options?: readonly number[];
83
+ default?: number;
84
+ step?: number;
85
+ }
86
+ interface SeedCapability {
87
+ min?: number;
88
+ max?: number;
89
+ }
90
+ interface ReferenceRoleCapability {
91
+ /** Most references of this role. */
92
+ max: number;
93
+ /** Fewest references of this role (e.g. an image-to-video model needs a `start_frame`). */
94
+ min?: number;
95
+ label?: string;
96
+ description?: string;
97
+ /**
98
+ * Media accepted for this role: kinds (`image`), wildcards (`image/*`) or
99
+ * MIME types (`image/png`). Absent: anything. References whose
100
+ * `mediaType` does not match are dropped or rejected by the planner.
101
+ */
102
+ accepts?: readonly string[];
103
+ }
104
+ interface ReferenceCapability {
105
+ /** Supported roles and their per-role limits. Roles not listed are unsupported. */
106
+ roles: Partial<Readonly<Record<ReferenceRole, ReferenceRoleCapability>>>;
107
+ /** Most references across all roles. */
108
+ maxTotal?: number;
109
+ }
110
+ interface NumberParamSpec {
111
+ type: 'number' | 'integer';
112
+ min?: number;
113
+ max?: number;
114
+ step?: number;
115
+ default?: number;
116
+ label?: string;
117
+ description?: string;
118
+ }
119
+ interface EnumParamSpec {
120
+ type: 'enum';
121
+ options: readonly (string | number)[];
122
+ default?: string | number;
123
+ label?: string;
124
+ description?: string;
125
+ }
126
+ interface BooleanParamSpec {
127
+ type: 'boolean';
128
+ default?: boolean;
129
+ label?: string;
130
+ description?: string;
131
+ }
132
+ /** A model-specific parameter (`guidance`, `motion_strength`, `style`, …). */
133
+ type ExtraParamSpec = NumberParamSpec | EnumParamSpec | BooleanParamSpec;
134
+ /** Rough timing used for progress estimates (`expectedDurationFor`). */
135
+ interface TimingCapability {
136
+ /** Fixed cost of one request in ms. */
137
+ baseMs: number;
138
+ /** Extra ms per output beyond the first. */
139
+ perItemMs?: number;
140
+ /** Extra ms per second of requested duration (video/audio). */
141
+ perSecondMs?: number;
142
+ /** Extra ms per megapixel of the requested resolution. */
143
+ perMegapixelMs?: number;
144
+ }
145
+ /** Presentation-only fields; overlays may set these (see `mergeCapabilities`). */
146
+ interface CapabilityPresentation {
147
+ name?: string;
148
+ description?: string;
149
+ badges?: readonly string[];
150
+ icon?: string;
151
+ group?: string;
152
+ }
153
+ /** Everything a generative model accepts. Absent sections mean "unsupported". */
154
+ interface ModelCapabilities extends CapabilityPresentation {
155
+ id: string;
156
+ media: GenerationMediaKind;
157
+ prompt?: PromptCapability;
158
+ /** Negative prompt support (`true` or limits). */
159
+ negativePrompt?: boolean | TextFieldCapability;
160
+ /** System prompt support (`true` or limits). */
161
+ systemPrompt?: boolean | TextFieldCapability;
162
+ /** E.g. `['1:1', '16:9', '9:16']`. */
163
+ aspectRatios?: EnumCapability<string>;
164
+ /** E.g. `['512x512', '1024x1024']`, `['720p', '1080p']` or `['1k', '2k', '4k']`, low → high. */
165
+ resolutions?: EnumCapability<string>;
166
+ /** Ordered low → high, e.g. `['draft', 'standard', 'high']`. */
167
+ quality?: EnumCapability<string>;
168
+ count?: CountCapability;
169
+ duration?: DurationCapability;
170
+ seed?: boolean | SeedCapability;
171
+ references?: ReferenceCapability;
172
+ /** Accepts a source to edit (`mode: 'edit'`). */
173
+ editing?: boolean;
174
+ /** Accepts a source plus a `mask` reference (`mode: 'inpaint'`). */
175
+ inpainting?: boolean;
176
+ params?: Readonly<Record<string, ExtraParamSpec>>;
177
+ timing?: TimingCapability;
178
+ }
179
+ interface GenerationReference {
180
+ /** Asset id (opaque to this library). */
181
+ id: string;
182
+ role: ReferenceRole;
183
+ url?: string;
184
+ /** MIME type or media kind, checked against the role's `accepts`. */
185
+ mediaType?: string;
186
+ /** Content hash of the asset when it was referenced (used by generation records). */
187
+ contentHash?: string;
188
+ }
189
+ type GenerationMode = 'generate' | 'edit' | 'inpaint';
190
+ type GenerationParamValue = string | number | boolean;
191
+ /** A request for one model. Every field is optional; the planner fills and fixes. */
192
+ interface GenerationRequest {
193
+ model?: string;
194
+ prompt?: string;
195
+ negativePrompt?: string;
196
+ systemPrompt?: string;
197
+ aspectRatio?: string;
198
+ resolution?: string;
199
+ quality?: string;
200
+ count?: number;
201
+ /** Seconds. */
202
+ duration?: number;
203
+ seed?: number;
204
+ mode?: GenerationMode;
205
+ references?: GenerationReference[];
206
+ params?: Record<string, GenerationParamValue>;
207
+ }
208
+ /** Fields of {@link GenerationRequest} the planner knows about, in planning order. */
209
+ declare const GENERATION_REQUEST_FIELDS: readonly ["model", "prompt", "negativePrompt", "systemPrompt", "aspectRatio", "resolution", "quality", "count", "duration", "seed", "mode", "references", "params"];
210
+ /** Text field limits normalized from `boolean | TextFieldCapability`. */
211
+ declare function textFieldCapability(value: boolean | TextFieldCapability | undefined): TextFieldCapability | null;
212
+ /** Seed limits normalized from `boolean | SeedCapability`. */
213
+ declare function seedCapability(value: boolean | SeedCapability | undefined): SeedCapability | null;
214
+ /**
215
+ * Supported reference roles of a model: built-in roles in
216
+ * {@link REFERENCE_ROLES} order, then custom roles in declaration order.
217
+ */
218
+ declare function supportedReferenceRoles(caps: ModelCapabilities): ReferenceRole[];
219
+ /** Supported generation modes of a model. */
220
+ declare function supportedModes(caps: ModelCapabilities): GenerationMode[];
221
+ /** A partial model entry used to decorate (or add) models locally. */
222
+ type CapabilityOverlay = Partial<ModelCapabilities> & {
223
+ id: string;
224
+ };
225
+ /**
226
+ * Merges server-reported capabilities with a local overlay. For models the
227
+ * server knows, every capability value comes from `remote`; the overlay only
228
+ * contributes presentation fields (`name`, `description`, `badges`, `icon`,
229
+ * `group`), filling in or replacing the remote ones. Overlay entries for
230
+ * models the server does not report are appended when they are complete
231
+ * (have a `media` kind). Remote order is kept; overlay-only models follow in
232
+ * overlay order.
233
+ */
234
+ declare function mergeCapabilities(remote: readonly ModelCapabilities[], overlay?: readonly CapabilityOverlay[]): ModelCapabilities[];
235
+
236
+ /**
237
+ * How the planner treats values the model does not support:
238
+ *
239
+ * - `error`: nothing is changed; every mismatch is an error.
240
+ * - `nearest`: snap to the closest supported value (ties go to the higher
241
+ * value), clamp ranges, truncate lists, drop unsupported fields and
242
+ * unsupported references.
243
+ * - `downgrade`: like `nearest`, but ties go to the lower value.
244
+ * - `upgrade`: like `nearest`, but never drops references the model cannot
245
+ * use (that would lose intent), so those are errors.
246
+ *
247
+ * "Lower" means a narrower aspect ratio, fewer pixels, an earlier quality
248
+ * option, a smaller number.
249
+ */
250
+ type PlanStrategy = 'error' | 'upgrade' | 'downgrade' | 'nearest';
251
+ type PlanAdjustmentKind = 'snapped' | 'clamped' | 'truncated' | 'dropped' | 'defaulted';
252
+ interface PlanAdjustment {
253
+ /** Request path, e.g. `aspectRatio`, `params.guidance`, `references.style_ref`. */
254
+ field: string;
255
+ from: unknown;
256
+ to: unknown;
257
+ reason: string;
258
+ kind: PlanAdjustmentKind;
259
+ }
260
+ interface PlanError {
261
+ field: string;
262
+ value: unknown;
263
+ message: string;
264
+ }
265
+ interface GenerationPlan {
266
+ /** `true` when there are no errors and `request` can be sent. */
267
+ ok: boolean;
268
+ /** The adjusted request (always a copy; the input is never mutated). */
269
+ request: GenerationRequest;
270
+ adjustments: PlanAdjustment[];
271
+ errors: PlanError[];
272
+ /** Model the plan was made for. */
273
+ model: string;
274
+ strategy: PlanStrategy;
275
+ }
276
+ interface PlanOptions {
277
+ /** Default `nearest`. */
278
+ strategy?: PlanStrategy;
279
+ /**
280
+ * The prompt with templates and variables resolved. Measured against
281
+ * `prompt.maxLength` when the model counts resolved text (the default).
282
+ */
283
+ resolvedPrompt?: string;
284
+ /** Fill missing fields that have a capability `default` (reported as `defaulted`). */
285
+ fillDefaults?: boolean;
286
+ /** Override whether references with unsupported roles may be dropped (default: `nearest` and `downgrade` only). */
287
+ dropUnsupportedReferences?: boolean;
288
+ /**
289
+ * Assets mentioned in the prompt (e.g. from `extractMentions(text, { details: true, roles: true })`
290
+ * joined with your asset library). They are appended to `request.references`
291
+ * and validated per role like any other reference. A mention without a role
292
+ * gets `defaultMentionRole`, or the first role of the model that accepts its
293
+ * media type (reported as `defaulted`).
294
+ */
295
+ mentions?: readonly PlanAssetMention[];
296
+ /** Role for mentions that have none (see `mentions`). */
297
+ defaultMentionRole?: ReferenceRole;
298
+ }
299
+ /** An asset mention handed to the planner (see {@link PlanOptions.mentions}). */
300
+ interface PlanAssetMention {
301
+ /** Asset id. */
302
+ id: string;
303
+ role?: ReferenceRole | null;
304
+ mediaType?: string;
305
+ contentHash?: string;
306
+ url?: string;
307
+ /** The mention text, used in messages (default: the id). */
308
+ label?: string;
309
+ }
310
+ /** Numeric rank of an aspect ratio such as `16:9` (log of width / height). */
311
+ declare function aspectRatioRank(value: string): number | undefined;
312
+ /**
313
+ * Numeric rank of a resolution: `1024x768` (pixels), `720p` (16:9 pixels at
314
+ * that height) or `2k` (square of that many kibi-pixels). Log scale.
315
+ */
316
+ declare function resolutionRank(value: string): number | undefined;
317
+ /** Megapixels of a resolution string, when it can be parsed. */
318
+ declare function resolutionMegapixels(value: string): number | undefined;
319
+ /** Common quality names, low → high. Used to compare values missing from a model's options. */
320
+ declare const QUALITY_LADDER: Readonly<Record<string, number>>;
321
+ declare function qualityRank(value: string): number | undefined;
322
+ /**
323
+ * Picks the option closest to `value` by `rank`. Ties go to the lower or
324
+ * higher rank. Returns `undefined` when `value` or no option can be ranked.
325
+ */
326
+ declare function snapToOption<T>(value: unknown, options: readonly T[], rank: (value: any) => number | undefined, tie: 'lower' | 'higher'): T | undefined;
327
+ /**
328
+ * Plans `request` against a model's capabilities before sending it: snaps
329
+ * enum values (aspect ratio, resolution, quality, count/duration choices) to
330
+ * the nearest supported option, clamps ranges, truncates text and reference
331
+ * lists over their limits, drops unsupported fields, and reports every change
332
+ * in `adjustments` and every unfixable problem in `errors`.
333
+ *
334
+ * Pure and deterministic: the input is not mutated and the same input always
335
+ * gives the same plan.
336
+ */
337
+ declare function planGenerationRequest(request: GenerationRequest, caps: ModelCapabilities, options?: PlanOptions): GenerationPlan;
338
+
339
+ declare const PROVENANCE_FORMAT = "pixerate.generation-provenance";
340
+ declare const PROVENANCE_VERSION = 1;
341
+ /** The exact template body a generation used. */
342
+ interface PinnedTemplate {
343
+ name: string;
344
+ templateId?: string;
345
+ /** Version id or version label the body came from (absent for unversioned templates). */
346
+ versionId?: string;
347
+ version?: string | number;
348
+ body: string;
349
+ }
350
+ /** Everything needed to explain and reproduce one generation. */
351
+ interface GenerationProvenance {
352
+ format: typeof PROVENANCE_FORMAT;
353
+ version: typeof PROVENANCE_VERSION;
354
+ /** Raw prompt as typed, with `{{templates}}` and `{variables}`. */
355
+ rawPrompt: string;
356
+ /** Every template the prompt reached (recursively), pinned to the body used. */
357
+ templates: PinnedTemplate[];
358
+ /** Version bindings in effect (`{ templateName: versionId }`) for every pinned versioned template. */
359
+ bindings: Record<string, string>;
360
+ /** Variable values, or `null` when variables were left unresolved. */
361
+ values: PromptValues | null;
362
+ resolvedPrompt: string;
363
+ sourceMap: SourceMapSegment[];
364
+ modelId: string;
365
+ /** The planned (adjusted) request that was sent. */
366
+ request: GenerationRequest;
367
+ adjustments: PlanAdjustment[];
368
+ references: {
369
+ id: string;
370
+ role: ReferenceRole;
371
+ }[];
372
+ /** ISO timestamps. */
373
+ createdAt: string;
374
+ startedAt?: string;
375
+ completedAt?: string;
376
+ /** Ids of the outputs this generation produced. */
377
+ outputIds?: string[];
378
+ meta?: Record<string, unknown>;
379
+ }
380
+ interface CreateProvenanceOptions {
381
+ rawPrompt: string;
382
+ templates?: Template[];
383
+ /** Template version bindings (`{ templateName: versionIdOrVersion }`). */
384
+ bindings?: Record<string, string>;
385
+ values?: PromptValues;
386
+ model: string | ModelCapabilities;
387
+ /** The plan the request came from (its request and adjustments are recorded) … */
388
+ plan?: GenerationPlan;
389
+ /** … or the request that was sent. */
390
+ request?: GenerationRequest;
391
+ adjustments?: PlanAdjustment[];
392
+ /** Creation time (default `Date.now()`). */
393
+ createdAt?: Date | number | string;
394
+ startedAt?: Date | number | string;
395
+ completedAt?: Date | number | string;
396
+ outputIds?: string[];
397
+ meta?: Record<string, unknown>;
398
+ maxDepth?: number;
399
+ }
400
+ declare class ProvenanceParseError extends Error {
401
+ constructor(message: string);
402
+ }
403
+ /** Templates that reproduce the pinned bodies exactly (one single-version template each). */
404
+ declare function pinnedTemplatesToTemplates(pinned: readonly PinnedTemplate[]): Template[];
405
+ /**
406
+ * Records what produced an output: the raw prompt, the exact template bodies
407
+ * and versions it reached, variable values, the resolved prompt and its
408
+ * source map, the model, the planned settings and adjustments, and the
409
+ * references by role.
410
+ */
411
+ declare function createProvenance(options: CreateProvenanceOptions): GenerationProvenance;
412
+ /** Versioned JSON for storage next to an output. */
413
+ declare function serializeProvenance(provenance: GenerationProvenance): string;
414
+ /** Parses and checks serialized provenance. Throws {@link ProvenanceParseError}. */
415
+ declare function parseProvenance(input: string | unknown): GenerationProvenance;
416
+ /**
417
+ * Re-resolves the raw prompt against the pinned template bodies and values,
418
+ * e.g. to check a record or to open it in an editor with its source map.
419
+ */
420
+ declare function replayProvenancePrompt(provenance: GenerationProvenance): {
421
+ text: string;
422
+ map: SourceMapSegment[];
423
+ matches: boolean;
424
+ };
425
+
426
+ export { replayProvenancePrompt as $, REFERENCE_ROLE_NAME_REGEX as A, type BooleanParamSpec as B, type CreateProvenanceOptions as C, type DurationCapability as D, type EnumCapability as E, type ReferenceCapability as F, type GenerationProvenance as G, type ReferenceRoleCapability as H, type TimingCapability as I, aspectRatioRank as J, createProvenance as K, isReferenceRoleName as L, type ModelCapabilities as M, type NumberParamSpec as N, mediaTypeMatches as O, type PlanStrategy as P, QUALITY_LADDER as Q, type ReferenceRole as R, type SeedCapability as S, type TextFieldCapability as T, mergeCapabilities as U, normalizeReferenceRole as V, parseProvenance as W, pinnedTemplatesToTemplates as X, planGenerationRequest as Y, qualityRank as Z, referenceRoleLabel as _, type GenerationPlan as a, resolutionMegapixels as a0, resolutionRank as a1, seedCapability as a2, serializeProvenance as a3, snapToOption as a4, supportedModes as a5, supportedReferenceRoles as a6, textFieldCapability as a7, type GenerationRequest as b, type PlanAssetMention as c, type GenerationReference as d, type BuiltinReferenceRole as e, type CapabilityOverlay as f, type CapabilityPresentation as g, type CountCapability as h, type EnumParamSpec as i, type ExtraParamSpec as j, GENERATION_REQUEST_FIELDS as k, type GenerationMediaKind as l, type GenerationMode as m, type GenerationParamValue as n, PROVENANCE_FORMAT as o, PROVENANCE_VERSION as p, type PinnedTemplate as q, type PlanAdjustment as r, type PlanAdjustmentKind as s, type PlanError as t, type PlanOptions as u, type PromptCapability as v, ProvenanceParseError as w, REFERENCE_ROLES as x, REFERENCE_ROLE_ALIASES as y, REFERENCE_ROLE_LABELS as z };