@nodaro/shared 2.17.0 → 2.18.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.
package/dist/index.cjs CHANGED
@@ -2590,6 +2590,13 @@ var NATIVE_NEGATIVE_VIDEO_PROVIDERS = /* @__PURE__ */ new Set([
2590
2590
  // Wan speech-to-video
2591
2591
  "wan-s2v"
2592
2592
  ]);
2593
+ var STYLE_SECTION_HEADER_LINE = "[style]:\n";
2594
+ function videoNegativeSuffix(negativePrompt, base) {
2595
+ const gapAt = base?.lastIndexOf("\n\n") ?? -1;
2596
+ const lastBlock = base === void 0 ? void 0 : gapAt >= 0 ? base.slice(gapAt + 2) : base;
2597
+ const separator = lastBlock === void 0 || lastBlock.startsWith(STYLE_SECTION_HEADER_LINE) ? "\n\n" : "\n";
2598
+ return `${separator}Avoid: ${negativePrompt}`;
2599
+ }
2593
2600
  function applyVideoNegativePrompt(prompt, negativePrompt, provider) {
2594
2601
  const promptMax = getMaxVideoPromptChars(provider);
2595
2602
  const clamp = (p) => p != null && p.length > promptMax ? p.slice(0, promptMax) : p;
@@ -2600,8 +2607,7 @@ function applyVideoNegativePrompt(prompt, negativePrompt, provider) {
2600
2607
  }
2601
2608
  const base = prompt && prompt.trim().length > 0 ? prompt : "";
2602
2609
  if (!base) return { prompt: `Avoid: ${neg}`.slice(0, promptMax), nativeNegativePrompt: void 0 };
2603
- const avoid = `
2604
- Avoid: ${neg}`;
2610
+ const avoid = videoNegativeSuffix(neg, base);
2605
2611
  const room = Math.max(0, promptMax - avoid.length);
2606
2612
  const injected = `${base.slice(0, room)}${avoid}`.slice(0, promptMax);
2607
2613
  return { prompt: injected, nativeNegativePrompt: void 0 };
@@ -14633,6 +14639,7 @@ exports.videoAnalysisResultSchema = videoAnalysisResultSchema;
14633
14639
  exports.videoAuditCreditsForBucket = videoAuditCreditsForBucket;
14634
14640
  exports.videoModelCanSpeakDialogue = videoModelCanSpeakDialogue;
14635
14641
  exports.videoModelSupportsAudio = videoModelSupportsAudio;
14642
+ exports.videoNegativeSuffix = videoNegativeSuffix;
14636
14643
  exports.videoProviderRequiresImage = videoProviderRequiresImage;
14637
14644
  exports.windowAnalysisSchema = windowAnalysisSchema;
14638
14645
  exports.zipMergeLists = zipMergeLists;