@nodaro/prompts 1.30.0 → 1.33.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 +84 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +81 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/i18n-entry-completeness.test.ts +32 -0
- package/src/__tests__/node-send-text.test.ts +100 -0
- package/src/__tests__/transitions-blended-cut.test.ts +3 -1
- package/src/audio-tags.ts +36 -0
- package/src/index.ts +4 -0
- package/src/node-send-text.ts +125 -0
package/dist/index.cjs
CHANGED
|
@@ -22222,10 +22222,10 @@ function projectOptionFields(o, detail, imageUrl) {
|
|
|
22222
22222
|
function catalogSections(c, images) {
|
|
22223
22223
|
const source = catalogTopics(c.catalogId);
|
|
22224
22224
|
if (!source) return void 0;
|
|
22225
|
-
const
|
|
22225
|
+
const present3 = new Set((c.dimensions ?? []).map((d) => d.field));
|
|
22226
22226
|
return source.map((s) => {
|
|
22227
22227
|
const imageUrl = images ? pickerSectionImageUrl(s.label, images) : void 0;
|
|
22228
|
-
return { label: s.label, fields: s.fields.filter((f) =>
|
|
22228
|
+
return { label: s.label, fields: s.fields.filter((f) => present3.has(f)), ...imageUrl ? { imageUrl } : {} };
|
|
22229
22229
|
}).filter((s) => s.fields.length > 0);
|
|
22230
22230
|
}
|
|
22231
22231
|
function projectPickerCatalog(c, opts = {}) {
|
|
@@ -40852,13 +40852,13 @@ function applyPickerJson(current, pickerJson, mode, spec) {
|
|
|
40852
40852
|
const patch = {};
|
|
40853
40853
|
for (const d of spec.dimensions) {
|
|
40854
40854
|
const incoming = pickerJson[d.dimension];
|
|
40855
|
-
const
|
|
40855
|
+
const present3 = !isEmptyValue(incoming);
|
|
40856
40856
|
if (mode === "override") {
|
|
40857
|
-
patch[d.field] =
|
|
40857
|
+
patch[d.field] = present3 ? coerce(incoming, d.limit) : void 0;
|
|
40858
40858
|
} else if (mode === "overwrite-detected") {
|
|
40859
|
-
if (
|
|
40859
|
+
if (present3) patch[d.field] = coerce(incoming, d.limit);
|
|
40860
40860
|
} else {
|
|
40861
|
-
if (
|
|
40861
|
+
if (present3 && isEmptyValue(current[d.field])) patch[d.field] = coerce(incoming, d.limit);
|
|
40862
40862
|
}
|
|
40863
40863
|
}
|
|
40864
40864
|
spec.cleanup?.(patch, mode);
|
|
@@ -41928,6 +41928,28 @@ function computeScriptTopic(data, { override, wired, refMap }) {
|
|
|
41928
41928
|
return applyPromptAffixes(core === void 0 ? "" : rr(core, refMap), shared.readPromptAffixes(data), refMap);
|
|
41929
41929
|
}
|
|
41930
41930
|
|
|
41931
|
+
// src/audio-tags.ts
|
|
41932
|
+
function removeBracketTags(text) {
|
|
41933
|
+
let out = "";
|
|
41934
|
+
let from = 0;
|
|
41935
|
+
let open = text.indexOf("[");
|
|
41936
|
+
while (open !== -1) {
|
|
41937
|
+
const close = text.indexOf("]", open + 1);
|
|
41938
|
+
if (close === -1) break;
|
|
41939
|
+
if (close === open + 1) {
|
|
41940
|
+
open = text.indexOf("[", open + 1);
|
|
41941
|
+
continue;
|
|
41942
|
+
}
|
|
41943
|
+
out += text.slice(from, open);
|
|
41944
|
+
from = close + 1;
|
|
41945
|
+
open = text.indexOf("[", from);
|
|
41946
|
+
}
|
|
41947
|
+
return out + text.slice(from);
|
|
41948
|
+
}
|
|
41949
|
+
function stripAudioTags(text) {
|
|
41950
|
+
return removeBracketTags(text).replace(/\s{2,}/g, " ").trim();
|
|
41951
|
+
}
|
|
41952
|
+
|
|
41931
41953
|
// src/node-prompt-fields.ts
|
|
41932
41954
|
var NODE_PROMPT_FIELDS = {
|
|
41933
41955
|
// ── Image ──
|
|
@@ -47563,6 +47585,57 @@ ${input.body}`);
|
|
|
47563
47585
|
Analyst focus from the user: ${input.focus}`);
|
|
47564
47586
|
return lines.join("\n");
|
|
47565
47587
|
}
|
|
47588
|
+
var WIRED_OUTPUT_NODE_TYPES = /* @__PURE__ */ new Set(["webhook-output", ...shared.SOCIAL_POST_NODE_TYPES]);
|
|
47589
|
+
var TEXT_REQUIRED_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
47590
|
+
"llm-chat",
|
|
47591
|
+
"ai-writer",
|
|
47592
|
+
"generate-script",
|
|
47593
|
+
"text-to-speech",
|
|
47594
|
+
"generate-music",
|
|
47595
|
+
"text-to-audio",
|
|
47596
|
+
// Save to Collection refuses an empty record ("nothing to save"): a feed
|
|
47597
|
+
// with nothing new wired straight into it must skip it, not fail the run.
|
|
47598
|
+
"collection-write",
|
|
47599
|
+
// Generate Image: an empty prompt is a legal request in general (references
|
|
47600
|
+
// alone), but when the text it was WIRED produced nothing this run — the skip
|
|
47601
|
+
// rule's precondition — an empty prompt is a paid picture of nothing.
|
|
47602
|
+
"generate-image"
|
|
47603
|
+
]);
|
|
47604
|
+
var withoutAffixes = (data) => ({ ...data, promptPrefix: void 0, promptSuffix: void 0 });
|
|
47605
|
+
var present2 = (s) => typeof s === "string" && s.trim().length > 0;
|
|
47606
|
+
function computeAiWriterInput(data, { override, wired }) {
|
|
47607
|
+
return [override, wired, data.userInput, data.prompt].find(present2) ?? "";
|
|
47608
|
+
}
|
|
47609
|
+
function computeNodeSendText(nodeType, data, args) {
|
|
47610
|
+
const bare = withoutAffixes(data);
|
|
47611
|
+
switch (nodeType) {
|
|
47612
|
+
case "llm-chat":
|
|
47613
|
+
return computeLlmChatFields(bare, {
|
|
47614
|
+
override: args.override,
|
|
47615
|
+
wiredUserInput: args.wired,
|
|
47616
|
+
wiredSystemPrompt: args.wiredSystemPrompt,
|
|
47617
|
+
refMap: args.refMap
|
|
47618
|
+
}).userInput;
|
|
47619
|
+
case "ai-writer":
|
|
47620
|
+
return computeAiWriterInput(bare, args);
|
|
47621
|
+
case "generate-script":
|
|
47622
|
+
return computeScriptTopic(bare, { override: args.override, wired: args.wired, refMap: args.refMap });
|
|
47623
|
+
case "generate-music": {
|
|
47624
|
+
const prompt = computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap });
|
|
47625
|
+
return present2(prompt) ? prompt : present2(data.lyrics) ? data.lyrics : "";
|
|
47626
|
+
}
|
|
47627
|
+
case "text-to-speech":
|
|
47628
|
+
case "text-to-audio":
|
|
47629
|
+
case "generate-image":
|
|
47630
|
+
return computeNodePrompt(nodeType, bare, { override: args.override, wired: args.wired, refMap: args.refMap });
|
|
47631
|
+
case "collection-write": {
|
|
47632
|
+
const typed = [data.title, data.text, data.link].map((v) => typeof v === "string" ? shared.resolveNodeRefs(v, args.refMap) : v).find((v) => present2(v));
|
|
47633
|
+
return [args.override, args.wired, typed].find(present2) ?? "";
|
|
47634
|
+
}
|
|
47635
|
+
default:
|
|
47636
|
+
return void 0;
|
|
47637
|
+
}
|
|
47638
|
+
}
|
|
47566
47639
|
|
|
47567
47640
|
exports.ACTION_FX = ACTION_FX;
|
|
47568
47641
|
exports.ACTION_FX_CATEGORY_LABELS = ACTION_FX_CATEGORY_LABELS;
|
|
@@ -47804,6 +47877,7 @@ exports.TEMPORAL_CATEGORY_ORDER = TEMPORAL_CATEGORY_ORDER;
|
|
|
47804
47877
|
exports.TEMPORAL_FIELD_BY_CATEGORY = TEMPORAL_FIELD_BY_CATEGORY;
|
|
47805
47878
|
exports.TEMPORAL_IDS = TEMPORAL_IDS;
|
|
47806
47879
|
exports.TERM_MAX_CHARS = TERM_MAX_CHARS;
|
|
47880
|
+
exports.TEXT_REQUIRED_NODE_TYPES = TEXT_REQUIRED_NODE_TYPES;
|
|
47807
47881
|
exports.TEXT_WIZARD_CATEGORIES = TEXT_WIZARD_CATEGORIES;
|
|
47808
47882
|
exports.TRANSITIONS = TRANSITIONS;
|
|
47809
47883
|
exports.TRANSITION_CATEGORY_LABELS = TRANSITION_CATEGORY_LABELS;
|
|
@@ -47834,6 +47908,7 @@ exports.WARDROBE_DIMENSION_ORDER = WARDROBE_DIMENSION_ORDER;
|
|
|
47834
47908
|
exports.WARDROBE_FIELD_BY_DIMENSION = WARDROBE_FIELD_BY_DIMENSION;
|
|
47835
47909
|
exports.WHITE_FLASH_STYLE = WHITE_FLASH_STYLE;
|
|
47836
47910
|
exports.WIPE_DIRECTION = WIPE_DIRECTION;
|
|
47911
|
+
exports.WIRED_OUTPUT_NODE_TYPES = WIRED_OUTPUT_NODE_TYPES;
|
|
47837
47912
|
exports.__resetCatalogIdGuardForTests = __resetCatalogIdGuardForTests;
|
|
47838
47913
|
exports.appendField = appendField;
|
|
47839
47914
|
exports.appendMusicMeta = appendMusicMeta;
|
|
@@ -47937,8 +48012,10 @@ exports.composeVideoPromptText = composeVideoPromptText;
|
|
|
47937
48012
|
exports.composedHas = composedHas;
|
|
47938
48013
|
exports.composedOption = composedOption;
|
|
47939
48014
|
exports.composedOptionIndex = composedOptionIndex;
|
|
48015
|
+
exports.computeAiWriterInput = computeAiWriterInput;
|
|
47940
48016
|
exports.computeLlmChatFields = computeLlmChatFields;
|
|
47941
48017
|
exports.computeNodePrompt = computeNodePrompt;
|
|
48018
|
+
exports.computeNodeSendText = computeNodeSendText;
|
|
47942
48019
|
exports.computePackSidecarCoverage = computePackSidecarCoverage;
|
|
47943
48020
|
exports.computeScriptTopic = computeScriptTopic;
|
|
47944
48021
|
exports.containsMinorAgeHint = containsMinorAgeHint;
|
|
@@ -48228,6 +48305,7 @@ exports.setComposedCatalogResolver = setComposedCatalogResolver;
|
|
|
48228
48305
|
exports.soundArtFilePath = soundArtFilePath;
|
|
48229
48306
|
exports.soundArtPath = soundArtPath;
|
|
48230
48307
|
exports.splitStyleSection = splitStyleSection;
|
|
48308
|
+
exports.stripAudioTags = stripAudioTags;
|
|
48231
48309
|
exports.styleSectionFromClauses = styleSectionFromClauses;
|
|
48232
48310
|
exports.styleSlotFor = styleSlotFor;
|
|
48233
48311
|
exports.subjectFieldsForSurface = subjectFieldsForSurface;
|