@nodaro/prompts 1.33.0 → 1.35.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.d.cts CHANGED
@@ -1062,7 +1062,9 @@ declare function buildImagePromptSegments(config: BuildImagePromptConfig, bodySe
1062
1062
  * consistent identifier in both the bulleted list and the scene description.
1063
1063
  * Numeric indices match the user-typed slug format (`@kira:1:smile`).
1064
1064
  *
1065
- * Out-of-range indices are left untouched so they're visible in the output.
1065
+ * Out-of-range indices are left untouched by this helper. `buildImagePrompt`
1066
+ * then renders any such token by the unwired rule (`dropUnwiredImageTokens`):
1067
+ * its label, or nothing — never the raw token.
1066
1068
  */
1067
1069
  declare function expandImageRefTokens(prompt: string, imageCount: number): string;
1068
1070
  /** Build the combined per-identity directive intro for previews.
@@ -2701,19 +2703,22 @@ interface ReferenceCounts {
2701
2703
  * - `N < 1` or `N > counts[kind]` (out of range / no such reference) → drop to
2702
2704
  * the bare `label` (or empty if label-less). This is the legacy
2703
2705
  * `stripVideoImageTokens` strip behavior: drop the token, keep the label text.
2706
+ * The rendering is `unboundReferenceTokenText` — shared with the image prompt
2707
+ * builder, which applies the same rule to its own unwired `{image:N}` tokens.
2704
2708
  * - in range, label present → `REF_BINDING[kind](label, N)`
2705
2709
  * (e.g. `the person from @image_2`).
2706
2710
  * - in range, no label → the bare `@${kind}_${N}` (the ref-only default): the
2707
2711
  * binding lands with no descriptive wrapper.
2708
2712
  *
2709
2713
  * Runs of 2+ HORIZONTAL whitespace (left behind by a dropped label-less token)
2710
- * collapse to one space, the result is trimmed, and an empty result becomes
2711
- * `undefined` — matching the `stripVideoImageTokens` contract so this can replace
2712
- * it cleanly. The collapse class is `[^\S\r\n]` (NOT `\s`) on purpose: Task 2.4
2713
- * applies this to the FULLY-ASSEMBLED core prompt, which carries `\n\n` block
2714
- * separators between the "Use these characters:" directive block and the body —
2715
- * a `\s{2,}` collapse would silently merge those paragraphs. Horizontal-only
2716
- * collapse preserves newline structure while still tidying the dropped-token gap.
2714
+ * collapse to one space, the result is trimmed (`tidyReferenceTokenGaps`, also
2715
+ * shared with the image builder), and an empty result becomes `undefined` —
2716
+ * matching the `stripVideoImageTokens` contract so this can replace it cleanly.
2717
+ * The collapse class is `[^\S\r\n]` (NOT `\s`) on purpose: the core applies this
2718
+ * to the FULLY-ASSEMBLED prompt, which carries `\n\n` block separators between
2719
+ * the "Use these characters:" directive block and the body — a `\s{2,}` collapse
2720
+ * would silently merge those paragraphs. Horizontal-only collapse preserves
2721
+ * newline structure while still tidying the dropped-token gap.
2717
2722
  * The `kind` is lowercased before indexing `counts`/`REF_BINDING`, so a
2718
2723
  * case-variant token (`{Image:1}`) resolves to the same binding rather than
2719
2724
  * mis-classifying as out-of-range.
@@ -7837,8 +7842,12 @@ declare function getPromptTips(providerId: string): readonly string[];
7837
7842
  * Source of truth for the semantics documented here (verified 2026-08-25):
7838
7843
  * - `IMAGE_TOKEN_PATTERN` = `/\{image:(\d+)(?::([^}\n]+))?\}/gi`
7839
7844
  * - `expandImageRefTokens`: `{image:N:label}` → `Image N (label)`,
7840
- * `{image:N}` → `Image N`; out-of-range tokens are left untouched so the
7841
- * author can see and fix them.
7845
+ * `{image:N}` → `Image N`.
7846
+ * - A token with no reference at N follows the video resolver's rule
7847
+ * (`dropUnwiredImageTokens` in `prompt-builder.ts`): `{image:N:label}` →
7848
+ * `label`, a bare `{image:N}` is dropped. Two places keep a token as typed,
7849
+ * on purpose: a wired token in a hybrid `Avoid:` line, and the native
7850
+ * negative prompt of models with their own negative field (e.g. ideogram-v3).
7842
7851
  * - N is the reference's 1-based position in the assembled reference list
7843
7852
  * (connection order on the `references` handle).
7844
7853
  */
package/dist/index.d.ts CHANGED
@@ -1062,7 +1062,9 @@ declare function buildImagePromptSegments(config: BuildImagePromptConfig, bodySe
1062
1062
  * consistent identifier in both the bulleted list and the scene description.
1063
1063
  * Numeric indices match the user-typed slug format (`@kira:1:smile`).
1064
1064
  *
1065
- * Out-of-range indices are left untouched so they're visible in the output.
1065
+ * Out-of-range indices are left untouched by this helper. `buildImagePrompt`
1066
+ * then renders any such token by the unwired rule (`dropUnwiredImageTokens`):
1067
+ * its label, or nothing — never the raw token.
1066
1068
  */
1067
1069
  declare function expandImageRefTokens(prompt: string, imageCount: number): string;
1068
1070
  /** Build the combined per-identity directive intro for previews.
@@ -2701,19 +2703,22 @@ interface ReferenceCounts {
2701
2703
  * - `N < 1` or `N > counts[kind]` (out of range / no such reference) → drop to
2702
2704
  * the bare `label` (or empty if label-less). This is the legacy
2703
2705
  * `stripVideoImageTokens` strip behavior: drop the token, keep the label text.
2706
+ * The rendering is `unboundReferenceTokenText` — shared with the image prompt
2707
+ * builder, which applies the same rule to its own unwired `{image:N}` tokens.
2704
2708
  * - in range, label present → `REF_BINDING[kind](label, N)`
2705
2709
  * (e.g. `the person from @image_2`).
2706
2710
  * - in range, no label → the bare `@${kind}_${N}` (the ref-only default): the
2707
2711
  * binding lands with no descriptive wrapper.
2708
2712
  *
2709
2713
  * Runs of 2+ HORIZONTAL whitespace (left behind by a dropped label-less token)
2710
- * collapse to one space, the result is trimmed, and an empty result becomes
2711
- * `undefined` — matching the `stripVideoImageTokens` contract so this can replace
2712
- * it cleanly. The collapse class is `[^\S\r\n]` (NOT `\s`) on purpose: Task 2.4
2713
- * applies this to the FULLY-ASSEMBLED core prompt, which carries `\n\n` block
2714
- * separators between the "Use these characters:" directive block and the body —
2715
- * a `\s{2,}` collapse would silently merge those paragraphs. Horizontal-only
2716
- * collapse preserves newline structure while still tidying the dropped-token gap.
2714
+ * collapse to one space, the result is trimmed (`tidyReferenceTokenGaps`, also
2715
+ * shared with the image builder), and an empty result becomes `undefined` —
2716
+ * matching the `stripVideoImageTokens` contract so this can replace it cleanly.
2717
+ * The collapse class is `[^\S\r\n]` (NOT `\s`) on purpose: the core applies this
2718
+ * to the FULLY-ASSEMBLED prompt, which carries `\n\n` block separators between
2719
+ * the "Use these characters:" directive block and the body — a `\s{2,}` collapse
2720
+ * would silently merge those paragraphs. Horizontal-only collapse preserves
2721
+ * newline structure while still tidying the dropped-token gap.
2717
2722
  * The `kind` is lowercased before indexing `counts`/`REF_BINDING`, so a
2718
2723
  * case-variant token (`{Image:1}`) resolves to the same binding rather than
2719
2724
  * mis-classifying as out-of-range.
@@ -7837,8 +7842,12 @@ declare function getPromptTips(providerId: string): readonly string[];
7837
7842
  * Source of truth for the semantics documented here (verified 2026-08-25):
7838
7843
  * - `IMAGE_TOKEN_PATTERN` = `/\{image:(\d+)(?::([^}\n]+))?\}/gi`
7839
7844
  * - `expandImageRefTokens`: `{image:N:label}` → `Image N (label)`,
7840
- * `{image:N}` → `Image N`; out-of-range tokens are left untouched so the
7841
- * author can see and fix them.
7845
+ * `{image:N}` → `Image N`.
7846
+ * - A token with no reference at N follows the video resolver's rule
7847
+ * (`dropUnwiredImageTokens` in `prompt-builder.ts`): `{image:N:label}` →
7848
+ * `label`, a bare `{image:N}` is dropped. Two places keep a token as typed,
7849
+ * on purpose: a wired token in a hybrid `Avoid:` line, and the native
7850
+ * negative prompt of models with their own negative field (e.g. ideogram-v3).
7842
7851
  * - N is the reference's 1-based position in the assembled reference list
7843
7852
  * (connection order on the `references` handle).
7844
7853
  */