@nodaro/shared 2.8.0 → 2.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.
@@ -9,14 +9,12 @@
9
9
  * `buildVideoAnalysisCreditId` + `/v1/credits/model-cost`) all derive from
10
10
  * these.
11
11
  *
12
- * The measured-rate constants and the $-derived `videoAnalysisBucketCredits`
13
- * formula that GENERATE these numbers live PRIVATELY in the
14
- * `@nodaroai/cloud-plugins` package (`src/plugins/video-analysis/cost.ts`)
15
- * never in this public repo. They were first moved out of this package
16
- * (published Apache-2.0 on npm) per the 2026-07-06 public-flip IP audit S5,
17
- * then out of the app repo entirely alongside the rest of the video-analysis
18
- * node. A cross-check test in that private package guards this table so the
19
- * public numbers can't silently drift from the formula.
12
+ * The rate constants and the formula that GENERATE these numbers live
13
+ * PRIVATELY in the `@nodaroai/cloud-plugins` package never in this public
14
+ * repo. They were first moved out of this package (published Apache-2.0 on
15
+ * npm), then out of the app repo entirely alongside the rest of the
16
+ * video-analysis node. A cross-check test in that private package guards
17
+ * this table so the public numbers can't silently drift from the formula.
20
18
  *
21
19
  * `VIDEO_ANALYSIS_BUCKET_CREDITS` below is the precomputed OUTPUT of that
22
20
  * private formula for every (model × bucket) combination — a plain credit
@@ -24,9 +22,8 @@
24
22
  * `VIDEO_CLIP_CREDITS` uses in `film-pricing.ts`. It is what the frontend's
25
23
  * client-side cost preview (`estimateNodeCredits` in
26
24
  * workflow-editor/types.ts) reads instead of calling the formula directly.
27
- * The formula's own test in `@nodaroai/cloud-plugins`
28
- * (`src/plugins/video-analysis/__tests__/cost.test.ts`) cross-checks this table
29
- * against it and fails on drift. There is deliberately NO app-side formula to
25
+ * The formula's own test in `@nodaroai/cloud-plugins` cross-checks this
26
+ * table against it and fails on drift. There is deliberately NO app-side formula to
30
27
  * check against — it was moved private in 2026-07 and the old backend test
31
28
  * went with it.
32
29
  *
@@ -65,27 +62,20 @@ export const VIDEO_ANALYSIS_WINDOW = { LEN: WINDOW_LEN, STRIDE: WINDOW_STRIDE, O
65
62
  // not 110). The plugin's cost test now covers sentinels as well, so this class
66
63
  // of drift fails CI instead of shipping.
67
64
  // REGENERATED 2026-07-31 with the smart-tier re-base (formula inputs moved in
68
- // the plugin: sampling 24→6 fps after a 43-run measurement found 6 equal on
69
- // content and strictly better on cast stability; the system-prompt and
70
- // per-window output-token constants trued-up to directly measured values).
71
- // Net effect: smart drops 27–47% per bucket — the 24 fps token spend was also
72
- // partly paying for media tokens the provider clamped and never counted — and
73
- // the economy rows tick up 3–6% from the prompt-token true-up.
65
+ // the plugin: sampling 24→6 fps, which proved equal on content and better on
66
+ // cast stability; system-prompt and per-window output-token constants updated).
67
+ // Net effect: smart drops 27–47% per bucket, and the economy rows tick up 3–6%.
74
68
  //
75
- // REGENERATED 2026-08-03 — V1 hybrid-smart reprice (task A3), from the
76
- // plugin's own generator (`scripts/gen-va-buckets.mjs`) at
77
- // nodaroai/nodaro-cloud-plugins commit eef077d (branch fix/va-cost-trueup).
78
- // This is the V1 true-up of task P6's provisional judge/refine/frame-judge
79
- // constants, re-derived from a 2026-08-03 staging measurement and approved by
80
- // Tal (the constants themselves, like the rest of the $-derived formula, stay
81
- // private in the plugin repo never in this public package). `smart` is now
82
- // a HYBRID plan — one native 6fps skeleton pass plus 2 fast + 2 pro donor
83
- // rolls, always refined (`selectionMode` does not apply to `smart`; it always
84
- // refines) and every multi-roll tier now carries its own explicit
85
- // judge/refine terms instead of an implicit share of a single-pass budget.
86
- // This is the full, honest reprice Tal approved, including the economy tiers
87
- // (fast 33->185 @180s ends a below-cost combine exposure that existed at the
88
- // old price). Net effect, per bucket (every row rises):
69
+ // REGENERATED 2026-08-03 — V1 hybrid-smart reprice, from the plugin's own
70
+ // generator. This is the V1 true-up of the earlier provisional
71
+ // judge/refine/frame-judge constants (the constants themselves, like the rest
72
+ // of the formula, stay private in the plugin repo never in this public
73
+ // package). `smart` is now a multi-roll plan that always refines its merged
74
+ // result (`selectionMode` does not apply to it), and every multi-roll tier
75
+ // now carries its own explicit judge/refine terms instead of an implicit
76
+ // share of a single-pass budget.
77
+ // The economy tiers rise too (fast 33->185 @180s).
78
+ // Net effect, per bucket (every row rises):
89
79
  //
90
80
  // gemini-3-flash 60s 24->180 180s 33->185 360s 86-> 514 600s 143-> 846
91
81
  // gemini-3.6-flash 60s 65->203 180s 92->218 360s 237-> 598 600s 395-> 986
@@ -119,9 +109,8 @@ export const VIDEO_ANALYSIS_BUCKET_CREDITS: Record<string, number> = {
119
109
  "video-analysis:mixed:180s": 289,
120
110
  "video-analysis:mixed:360s": 724,
121
111
  "video-analysis:mixed:600s": 1169,
122
- // SMART — the accuracy tier, and since the 2026-08-03 hybrid re-plan a
123
- // multi-roll plan like the others: one native 6fps skeleton pass plus 2
124
- // fast + 2 pro donor rolls, always refined (`selectionMode` does not apply
112
+ // SMART — the accuracy tier, and since the 2026-08-03 re-plan a multi-roll
113
+ // plan like the others, always refined (`selectionMode` does not apply
125
114
  // here — smart always refines; it never offers a cheaper "choose" path).
126
115
  // Priced above the economy tiers because it genuinely costs more to run;
127
116
  // the only tier whose accuracy is validated against a hand-counted edit
@@ -168,7 +157,7 @@ export function videoAnalysisNumWindows(bucketSec: number): number {
168
157
  * Precomputed credit cost for the `video-audit` node ("AI Audit") — the same
169
158
  * pattern as `VIDEO_ANALYSIS_BUCKET_CREDITS` above: the OUTPUT of the private
170
159
  * `videoAuditBucketCredits` formula in `@nodaroai/cloud-plugins`
171
- * (`src/plugins/video-analysis/cost.ts`), a plain lookup table never a
160
+ * (in the plugin repo), a plain lookup table never a
172
161
  * formula, cross-checked against that package's own cost test. Shares the
173
162
  * SAME duration-bucket ladder as video-analysis (`VIDEO_ANALYSIS_DURATION_BUCKETS`
174
163
  * / `pickVideoAnalysisBucket`) — the audit re-watches the same clip, so it
@@ -195,7 +184,7 @@ export function videoAnalysisNumWindows(bucketSec: number): number {
195
184
  * `buildVideoAnalysisCreditId`.
196
185
  *
197
186
  * Values pasted verbatim from the plugin generator's output
198
- * (`scripts/gen-va-buckets.mjs`) at `@nodaroai/cloud-plugins` v0.102.0
187
+ * (the plugin repo's bucket generator)
199
188
  * never hand computed. The plugin's cost test cross-checks every row.
200
189
  */
201
190
  export const VIDEO_AUDIT_BUCKET_CREDITS: Record<string, number> = {
@@ -74,6 +74,45 @@ export interface WorkflowExportLocation {
74
74
  styleLock?: boolean | null
75
75
  }
76
76
 
77
+ /** A media URL referenced from a node's data, located by node + field path. */
78
+ export interface WorkflowMediaRef {
79
+ nodeId: string
80
+ nodeLabel?: string
81
+ /** Dot/bracket path inside `node.data`, e.g. `imageUrl` or `referenceImageUrls[1]`. */
82
+ field: string
83
+ url: string
84
+ }
85
+
86
+ /**
87
+ * Export-time portability analysis (#866). A bundle exported from a private
88
+ * host carries media URLs only that host can serve (`http://localhost:3000/
89
+ * storage/…`, a LAN address, a `.internal` name); imported anywhere else, the
90
+ * nodes fail at Run time with an opaque provider fetch error. The exporter
91
+ * lists those URLs here so the person exporting is told BEFORE sharing, and
92
+ * an importer can explain what will not load. Absent when every media URL is
93
+ * publicly routable.
94
+ */
95
+ export interface WorkflowPortability {
96
+ unreachableMedia: WorkflowMediaRef[]
97
+ }
98
+
99
+ /**
100
+ * What the importer did about the bundle's media (#866). Publicly reachable
101
+ * media that is not already on the importing instance's own storage is
102
+ * copied there (`rehosted`) so the workflow runs from local copies; media on
103
+ * a host the importer cannot reach is left as-is and listed (`unreachable`);
104
+ * anything declined for another reason (too large, not a media type, over
105
+ * the per-import cap, upload failed) is listed with the reason (`skipped`).
106
+ */
107
+ export interface WorkflowImportReport {
108
+ rehosted: number
109
+ unreachable: WorkflowMediaRef[]
110
+ skipped: Array<WorkflowMediaRef & { reason: string }>
111
+ /** Anything else the importer should know, e.g. copies were made but the
112
+ * workflow could not be updated to use them. */
113
+ notes?: string[]
114
+ }
115
+
77
116
  export interface WorkflowExport {
78
117
  version: 1
79
118
  exportedAt: string
@@ -87,6 +126,8 @@ export interface WorkflowExport {
87
126
  creatures?: WorkflowExportCreature[]
88
127
  locations: WorkflowExportLocation[]
89
128
  }
129
+ /** Present only when the bundle references media another instance cannot fetch. */
130
+ portability?: WorkflowPortability
90
131
  }
91
132
 
92
133
  /**