@nodaro/shared 2.12.2 → 2.14.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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Prompt pre/post text ("affixes") — the PUBLIC node-data contract.
3
+ *
4
+ * Every AI prompt node may carry two optional strings that are wrapped around
5
+ * its run-time prompt: `promptPrefix` goes before, `promptSuffix` after. Both
6
+ * support `{Node Label}` references and plain-text snippets exactly like the
7
+ * main prompt. They are settings (edited in the node's config panel, captured
8
+ * by presets, settable through workflow JSON / `inputOverrides`), never shown
9
+ * on the node face or to published-app end users.
10
+ *
11
+ * Only the KEYS + TYPE live here (what the SDK/API contract needs). The wrap
12
+ * behaviour (`applyPromptAffixes`) lives in `@nodaro/prompts` next to
13
+ * `resolvePrompt` — see the spec's IP-placement note.
14
+ */
15
+ export const PROMPT_PREFIX_KEY = "promptPrefix" as const
16
+ export const PROMPT_SUFFIX_KEY = "promptSuffix" as const
17
+
18
+ export interface PromptAffixFields {
19
+ /** Text placed BEFORE the node's prompt at run time. Supports {Node Label} refs. */
20
+ readonly promptPrefix?: string
21
+ /** Text placed AFTER the node's prompt at run time. Supports {Node Label} refs. */
22
+ readonly promptSuffix?: string
23
+ }
24
+
25
+ /** The affix pair read off node data (blank / non-string values are omitted). */
26
+ export interface PromptAffixes {
27
+ readonly prefix?: string
28
+ readonly suffix?: string
29
+ }
30
+
31
+ function nonBlank(v: unknown): string | undefined {
32
+ return typeof v === "string" && v.trim().length > 0 ? v : undefined
33
+ }
34
+
35
+ /** Read `{ prefix, suffix }` off a node's `data`. Never throws; unknown shapes → `{}`. */
36
+ export function readPromptAffixes(data: Record<string, unknown>): PromptAffixes {
37
+ const prefix = nonBlank(data[PROMPT_PREFIX_KEY])
38
+ const suffix = nonBlank(data[PROMPT_SUFFIX_KEY])
39
+ return {
40
+ ...(prefix !== undefined ? { prefix } : {}),
41
+ ...(suffix !== undefined ? { suffix } : {}),
42
+ }
43
+ }
@@ -97,39 +97,47 @@ export const VIDEO_ANALYSIS_WINDOW = { LEN: WINDOW_LEN, STRIDE: WINDOW_STRIDE, O
97
97
  // (cloud-plugins 0.209.0). 12 of 20 analysis rows and 6 of 8 audit rows tick up
98
98
  // by 1–3 credits (~0.1–0.3%); the legacy `gemini-3-flash` family is unchanged.
99
99
  // Output of the plugin's `scripts/gen-va-buckets.mjs`, pasted verbatim.
100
+ //
101
+ // REGENERATED 2026-08-30 — transition vocabulary v2: the analyser's doctrine now
102
+ // DEFINES twelve named transition values (and says an absent transition asserts
103
+ // nothing), which grew the analyser's system prompt once more — the plugin's
104
+ // system-prompt token pin moved 8_706 → 9_082 (cloud-plugins 0.212.0). 15 of 20
105
+ // analysis rows and 6 of 8 audit rows tick up by 1–5 credits (~0.1–0.6%); unlike
106
+ // the 8_482 → 8_706 round, the legacy `gemini-3-flash` family moves too.
107
+ // Output of the plugin's `scripts/gen-va-buckets.mjs`, pasted verbatim.
100
108
  export const VIDEO_ANALYSIS_BUCKET_CREDITS: Record<string, number> = {
101
109
  // Legacy fast-tier model (pre-2026-07) — kept for stored raw-id configs.
102
- "video-analysis:gemini-3-flash:60s": 180,
110
+ "video-analysis:gemini-3-flash:60s": 181,
103
111
  "video-analysis:gemini-3-flash:180s": 185,
104
112
  "video-analysis:gemini-3-flash:360s": 515,
105
- "video-analysis:gemini-3-flash:600s": 847,
113
+ "video-analysis:gemini-3-flash:600s": 848,
106
114
  // Current fast tier — regenerated from the private formula for its backing
107
115
  // model; higher than the legacy fast schedule but still ≤ pro per bucket.
108
116
  "video-analysis:gemini-3.6-flash:60s": 204,
109
- "video-analysis:gemini-3.6-flash:180s": 218,
110
- "video-analysis:gemini-3.6-flash:360s": 600,
111
- "video-analysis:gemini-3.6-flash:600s": 990,
117
+ "video-analysis:gemini-3.6-flash:180s": 219,
118
+ "video-analysis:gemini-3.6-flash:360s": 602,
119
+ "video-analysis:gemini-3.6-flash:600s": 992,
112
120
  "video-analysis:gemini-3.1-pro:60s": 216,
113
121
  "video-analysis:gemini-3.1-pro:180s": 232,
114
- "video-analysis:gemini-3.1-pro:360s": 639,
115
- "video-analysis:gemini-3.1-pro:600s": 1053,
122
+ "video-analysis:gemini-3.1-pro:360s": 640,
123
+ "video-analysis:gemini-3.1-pro:600s": 1056,
116
124
  // Mixed tiers (`mixed` + `mixed-fast`) share ONE credit family — they are
117
125
  // variants of the same engine plan (plan internals live in the private
118
126
  // analysis plugin). Admin-tunable via model_pricing like every other row.
119
- "video-analysis:mixed:60s": 269,
120
- "video-analysis:mixed:180s": 290,
121
- "video-analysis:mixed:360s": 727,
122
- "video-analysis:mixed:600s": 1174,
127
+ "video-analysis:mixed:60s": 270,
128
+ "video-analysis:mixed:180s": 291,
129
+ "video-analysis:mixed:360s": 729,
130
+ "video-analysis:mixed:600s": 1177,
123
131
  // SMART — the accuracy tier, and since the 2026-08-03 re-plan a multi-roll
124
132
  // plan like the others, always refined (`selectionMode` does not apply
125
133
  // here — smart always refines; it never offers a cheaper "choose" path).
126
134
  // Priced above the economy tiers because it genuinely costs more to run;
127
135
  // the only tier whose accuracy is validated against a hand-counted edit
128
136
  // list, re-validated at the current plan before this schedule shipped.
129
- "video-analysis:smart:60s": 412,
130
- "video-analysis:smart:180s": 502,
131
- "video-analysis:smart:360s": 1264,
132
- "video-analysis:smart:600s": 2071,
137
+ "video-analysis:smart:60s": 413,
138
+ "video-analysis:smart:180s": 503,
139
+ "video-analysis:smart:360s": 1267,
140
+ "video-analysis:smart:600s": 2076,
133
141
  }
134
142
 
135
143
  /**
@@ -199,14 +207,14 @@ export function videoAnalysisNumWindows(bucketSec: number): number {
199
207
  * never hand computed. The plugin's cost test cross-checks every row.
200
208
  */
201
209
  export const VIDEO_AUDIT_BUCKET_CREDITS: Record<string, number> = {
202
- "video-audit:60s": 214,
210
+ "video-audit:60s": 215,
203
211
  "video-audit:180s": 290,
204
- "video-audit:360s": 661,
205
- "video-audit:600s": 1070,
206
- "video-audit:auto:60s": 394,
212
+ "video-audit:360s": 663,
213
+ "video-audit:600s": 1073,
214
+ "video-audit:auto:60s": 396,
207
215
  "video-audit:auto:180s": 475,
208
- "video-audit:auto:360s": 1176,
209
- "video-audit:auto:600s": 1917,
216
+ "video-audit:auto:360s": 1178,
217
+ "video-audit:auto:600s": 1921,
210
218
  }
211
219
 
212
220
  /**
@@ -84,8 +84,20 @@ export type VideoAnalysisVisualEffect = (typeof VIDEO_ANALYSIS_VISUAL_EFFECTS)[n
84
84
  * `dissolve` (a cross-fade from one image to the other) is distinct from `fade`
85
85
  * (through black or white). Collapsing both onto `fade` — as this enum did — makes
86
86
  * a recreation render the wrong edit, and the two look nothing alike.
87
+ *
88
+ * ABSENT means NOTHING ASSERTED (since v2): the analyser emits a value only
89
+ * when it can see the device; an unknown or uncertain edit is left out so the
90
+ * video model chooses. `cut` is itself an assertion (an instant change between
91
+ * two clearly different shots), never a default.
87
92
  */
88
- export const VIDEO_ANALYSIS_TRANSITIONS = ["cut", "fade", "dissolve", "wipe", "whip"] as const
93
+ export const VIDEO_ANALYSIS_TRANSITIONS = [
94
+ "cut", "fade", "dissolve", "wipe", "whip",
95
+ // v2 (2026-08-30, recast shot craft rev 1.5 Appendix F): the common edits a
96
+ // creator actually cuts with. `white-flash` / `digital-glitch` are spelled
97
+ // out because `flash` / `glitch` already name in-shot EFFECTS (the axis test
98
+ // below) — a device is the edit BETWEEN two shots, an effect is on one shot.
99
+ "zoom", "slide", "white-flash", "digital-glitch", "morph", "match", "jump",
100
+ ] as const
89
101
  export type VideoAnalysisTransition = (typeof VIDEO_ANALYSIS_TRANSITIONS)[number]
90
102
 
91
103
  /**