Global

Members

(constant) MAX_GROUP_DEPTH

Description:
  • Recursion cutoff for group-includes-group nesting.

Source:

Recursion cutoff for group-includes-group nesting.

(constant) NSFW_TOKEN :RegExp

Description:
  • Matches an nsfw token: a standalone word in a list name, delimited by a path separator, dash, dot, underscore, or the start/end of the string. So d/general-nsfw, clothes-nsfw, foo.nsfw.bar all match, but nsfwish does not.

Source:

Matches an nsfw token: a standalone word in a list name, delimited by a path separator, dash, dot, underscore, or the start/end of the string. So d/general-nsfw, clothes-nsfw, foo.nsfw.bar all match, but nsfwish does not.

Type:
  • RegExp

(constant) RESERVED_ANY :string

Description:
  • Reserved wildcard base: {#any} (and {#any-sfw} / {#any-nsfw}) is not a file — it runs one random generator drawn from the whole v2 catalog, mode-aware. Reserved like the lists' {keyword}.

Source:

Reserved wildcard base: {#any} (and {#any-sfw} / {#any-nsfw}) is not a file — it runs one random generator drawn from the whole v2 catalog, mode-aware. Reserved like the lists' {keyword}.

Type:
  • string

(constant) RESERVED_WILDCARD :string

Description:
  • Reserved wildcard base. {keyword} (and {keyword-sfw} / {keyword-nsfw}) are not files — they resolve to a random word drawn from ALL loaded vocabulary (mode-aware). The name is reserved: it always supersedes any list literally named keyword, silently (no error), the same way nsfw is a reserved filename token.

Source:

Reserved wildcard base. {keyword} (and {keyword-sfw} / {keyword-nsfw}) are not files — they resolve to a random word drawn from ALL loaded vocabulary (mode-aware). The name is reserved: it always supersedes any list literally named keyword, silently (no error), the same way nsfw is a reserved filename token.

Type:
  • string

(constant) RNG

Description:
  • Default randomness (Math.random-based, matching the v2 generators' lodash usage).

Source:

Default randomness (Math.random-based, matching the v2 generators' lodash usage).

(constant) SFW_SUFFIX

Description:
  • Suffix tokens that select an exclusive SFW or NSFW-inclusive variant.

Source:

Suffix tokens that select an exclusive SFW or NSFW-inclusive variant.

(constant) browserLoader :object

Description:
  • Browser data loader for the engine: Vite import.meta.glob bundles. Implements readExpansion, readListLines, listNames, expansionNames, loadDynamicPrompt, dynamicPromptNames, presetNames, loadPreset.

Source:

Browser data loader for the engine: Vite import.meta.glob bundles. Implements readExpansion, readListLines, listNames, expansionNames, loadDynamicPrompt, dynamicPromptNames, presetNames, loadPreset.

Type:
  • object

(constant) dynPromptTags :Object.<string, {category: (string|undefined), anime: (boolean|undefined), nsfw: (boolean|undefined)}>

Description:
  • Per-generator tag metadata (the analog of listTags): a category plus anime/nsfw flags, for UI badges and docs. The category is normally derivable from the folder; this map only needs entries that carry extra flags. Anything absent defaults to { anime:false, nsfw:false }.

Source:

Per-generator tag metadata (the analog of listTags): a category plus anime/nsfw flags, for UI badges and docs. The category is normally derivable from the folder; this map only needs entries that carry extra flags. Anything absent defaults to { anime:false, nsfw:false }.

Type:
  • Object.<string, {category: (string|undefined), anime: (boolean|undefined), nsfw: (boolean|undefined)}>

(constant) listTags :Object.<string, {category: (string|undefined), anime: (boolean|undefined), nsfw: (boolean|undefined)}>

Description:
  • Per-list metadata. Any list not listed here defaults to { anime:false, nsfw:false }. nsfw:true means the list as a whole leans adult (still drawn only when includeAdult is on if it is also gated).

Source:

Per-list metadata. Any list not listed here defaults to { anime:false, nsfw:false }. nsfw:true means the list as a whole leans adult (still drawn only when includeAdult is on if it is also gated).

Type:
  • Object.<string, {category: (string|undefined), anime: (boolean|undefined), nsfw: (boolean|undefined)}>

(constant) nodeLoader :object

Description:
  • Node data loader for the engine: filesystem reads + createRequire dynamic-prompt loading. Implements readExpansion, readListLines, listNames, expansionNames, loadDynamicPrompt, dynamicPromptNames.

Source:

Node data loader for the engine: filesystem reads + createRequire dynamic-prompt loading. Implements readExpansion, readListLines, listNames, expansionNames, loadDynamicPrompt, dynamicPromptNames.

Type:
  • object

Methods

_displayProgress(noBack, isUpscale, isAnim)

Description:
  • Display progress.

Source:
Parameters:
Name Type Description
noBack boolean
isUpscale boolean
isAnim boolean

_reIndexToUrl(url)

Description:
  • Re index to url.

Source:
Parameters:
Name Type Description
url string

_reindexHome()

Description:
  • Reindex home.

Source:

actionMenuSelection()

Description:
  • Action menu selection.

Source:

addRemoveButton()

Description:
  • Add remove button.

Source:

adultAllowed() → {boolean}

Source:
Returns:

Whether adult/explicit lists and prompts are enabled.

Type
boolean

allListNames(names) → {Array.<string>}

Source:
Parameters:
Name Type Description
names Array.<string>

The on-disk list + group names (no extension).

Returns:

De-duplicated, in the guaranteed natural order (compareNames).

Type
Array.<string>

artistRepeater(artist, alias, settings) → {string}

Description:
  • Emit a random number of artist tokens — gated by settings.includeArtist and a 50% coin flip — between settings.minArtist and settings.maxArtist.

Source:
Parameters:
Name Type Description
artist string

The repeat target.

alias boolean

Whether to resolve via the alias.

settings object

The merged generation settings.

Returns:

The joined artist tokens (possibly "").

Type
string

autoGroupListDirs(listNames, enableDirsopt, disableDirsopt) → {Array.<string>}

Description:
  • Folders that are IMPLIED groups: a folder with 2+ direct list files is auto-marked (referenceable as {folder} = union of its own lists). An enable-group-list marker forces a folder on (even with one list); a disable-group-list marker forces it off. Does NOT stack — only the folder's own direct lists count, not its subfolders.

Source:
Parameters:
Name Type Attributes Description
listNames Array.<string>

Logical LIST names (txt-derived; groups excluded).

enableDirs Array.<string> <optional>

Folders forced on (.enable-group-list).

disableDirs Array.<string> <optional>

Folders forced off (.disable-group-list).

Returns:

The implied-group folder paths.

Type
Array.<string>

breakdownData(txt, name, settings, imageSettings, upscaleSettings) → {object}

Description:
  • Parse the lines of an AUTOMATIC1111 parameters block into the JSON sidecar shape (prompt, negative prompt, steps, sampler, cfg, seed, size, model, denoising, …).

Source:
Parameters:
Name Type Description
txt Array.<string>

The metadata lines (prompt first, negative second).

name string

The file id (stored as job_timestamp).

settings object

The merged generation settings.

imageSettings object

The image settings.

upscaleSettings object

The upscale settings.

Returns:

The reconstructed sidecar JSON.

Type
object

buildIndexes(settings, directoryName) → {void}

Description:
  • Walk the output directory and index every sidecar file (non-recursive).

Source:
Parameters:
Name Type Description
settings object

The full settings.

directoryName string

The output directory.

Returns:
Type
void

buildTree(lines, depth, startopt) → {Object}

Description:
  • Recursively group depth-tagged lines into { line, children } nodes.

Source:
Parameters:
Name Type Attributes Default Description
lines Array

The (remaining) lexed lines.

depth number

The depth level being collected.

start number <optional>
0

Index to start from.

Returns:

Nodes at this depth and the next index.

Type
Object

charRank(ch) → {number}

Description:
  • Class rank for a single character: symbols (0) sort before digits (1) before letters (2). Gives a guaranteed, predictable ordering.

Source:
Parameters:
Name Type Description
ch string

A single character.

Returns:

0 symbol, 1 digit, 2 letter.

Type
number

check(name, imageSettings) → {boolean}

Source:
Parameters:
Name Type Description
name string

The image file id.

imageSettings object

The image settings (saveTo).

Returns:

Whether an unconverted <name>.txt sidecar exists.

Type
boolean

classifyRemoval(line, optsopt) → {Object|null}

Description:
  • Classify a single list line for removal.

Source:
Parameters:
Name Type Attributes Description
line string

Raw line.

opts object <optional>
Properties
Name Type Attributes Default Description
listType "proper" | "content" <optional>
"content"

Proper lists (cities, names, artists, parts of speech) get core slurs + minor-sexual matched EXACTLY (whole entry); content lists get the full set with token matching.

Returns:

Category + matched term, or null when clean.

Type
Object | null

clearImages()

Description:
  • Clear images.

Source:

compareNames(a, b) → {number}

Description:
  • Natural-order comparator giving a GUARANTEED load/precedence order: symbols first, then numbers in true numeric order (so 2 before 10), then letters alphabetically. Lets users engineer a deterministic default by prefixing a name with a symbol or number.

Source:
Parameters:
Name Type Description
a string

First name.

b string

Second name.

Returns:

Negative, zero, or positive.

Type
number

compileDpl(source, bridgeopt) → {Object}

Description:
  • Compile a .dpl source into a dynamic-prompt module object (same shape as a JS generator).

Source:
Parameters:
Name Type Attributes Description
source string

The .dpl file text.

bridge object <optional>

Optional JS bridge: { resolveJs(path, ctx) } for {js:} / insert js: / script.

Returns:

The module.

Type
Object

completePage()

Description:
  • Complete page.

Source:

computeButtonNames(names, forcedDirsopt) → {Object.<string, string>}

Description:
  • Compute the SHORTEST unambiguous display token for each list, for editor buttons. By default a list shows just its filename; a name only grows a folder prefix when it would otherwise be ambiguous.

    Two stages:

    1. Manual prefix (.force-prefix) — any name under a folder marked with a .force-prefix file shows its path from the highest such ancestor down (e.g. danbooru/d/generald/general). These are excluded from the auto step, so they never push a prefix onto anyone else.
    2. Auto prefix — the rest start at the bare filename; whenever two share a token they each step out one more folder until distinct.

    A final pass guarantees every token resolveName()s back to its own canonical name (lengthening if a forced/other name would otherwise shadow it).

Source:
Parameters:
Name Type Attributes Description
names Array.<string>

Canonical (logical) list names.

forcedDirs Array.<string> <optional>

Folders that contain a .force-prefix marker.

Returns:

Map of canonical name → display token.

Type
Object.<string, string>

configure(_loader) → {void}

Description:
  • Inject the data loader (fs in Node, glob in the browser). Call once before loadAll().

Source:
Parameters:
Name Type Description
_loader object

The loader implementation.

Returns:
Type
void

convert(name, txt, settings, imageSettings, upscaleSettings) → {object}

Description:
  • Convert a legacy .txt metadata sidecar to .json (replacing the file on disk), or parse provided text.

Source:
Parameters:
Name Type Description
name string

The image file id.

txt string | undefined

Raw metadata text, or undefined to read <name>.txt.

settings object

The merged generation settings.

imageSettings object

The image settings (saveTo).

upscaleSettings object

The upscale settings.

Returns:

The converted sidecar JSON.

Type
object

convertToPath(name) → {string}

Description:
  • Map a user--prefixed dynamic-prompt name to its user-submitted/ path.

Source:
Parameters:
Name Type Description
name string

The dynamic-prompt key.

Returns:

The resolved path key.

Type
string

copyPrompt()

Description:
  • Copy prompt.

Source:
Description:
  • Copy share link.

Source:

createEngine(loader) → {Object}

Description:
  • Create a framework-agnostic prompt engine that runs the same pipeline as the CLI.

Source:
Parameters:
Name Type Description
loader object

Data-access loader (Node fs or browser glob): readExpansion, readListLines, listNames, loadDynamicPrompt.

Returns:

The engine API.

Type
Object

createListStore(loader) → {Object}

Description:
  • Create a loader-backed list store with the original once-only depletion + alias behaviour.

Source:
Parameters:
Name Type Description
loader object

Data loader (readListLines, listNames).

Returns:

The store API.

Type
Object

danbooruReplacer(prompt, settings) → {string}

Description:
  • When an anime/danbooru keyword dict is active, rewrite a trailing , Person to {d-person} so the anime character list is used instead of the generic person list.

Source:
Parameters:
Name Type Description
prompt string

The prompt fragment.

settings object

The merged generation settings (keywordsFilename).

Returns:

The (possibly) substituted prompt.

Type
string

dataRefreshComplete(data)

Description:
  • Data refresh complete.

Source:
Parameters:
Name Type Description
data object
Description:
  • Record a deep link from one file to another under a link type, creating the placeholder/array as needed.

Source:
Parameters:
Name Type Description
fromName string

The parent file id.

toName string | object

The linked file (id or {name, imgPath}).

linkType string

The relation (upscales / variations / rerolls / animationFrames / animations).

Returns:
Type
void

dirOpen(dirPath) → {Buffer|undefined}

Description:
  • Open a folder in the OS file explorer (cross-platform).

Source:
Parameters:
Name Type Description
dirPath string

The directory to open.

Returns:

The execSync result, or undefined on (often benign) error.

Type
Buffer | undefined

displayProgress(noBack, isUpscale, isAnim)

Description:
  • Display progress.

Source:
Parameters:
Name Type Description
noBack boolean
isUpscale boolean
isAnim boolean

downloadLists()

Description:
  • Download lists.

Source:

downloadSettings()

Description:
  • Download settings.

Source:

dynGroupDirs(names, enableDirsopt, disableDirsopt) → {Array.<string>}

Description:
  • The category folders that are IMPLIED groups: a v2 folder with 2+ generators. Reuses the list rule (autoGroupListDirs) over the v2 names only (v1/ is excluded — it is reached via {#name-v1}, never grouped). Marker dirs force a folder on/off.

Source:
Parameters:
Name Type Attributes Description
names Array.<string>

All dynamic-prompt catalog names.

enableDirs Array.<string> <optional>

Folders forced on (_enable-group-list).

disableDirs Array.<string> <optional>

Folders forced off (_disable-group-list).

Returns:

The implied-group folder paths.

Type
Array.<string>

dynGroupMembers(dir, names) → {Array.<string>}

Description:
  • Direct-child generator names of a group folder (NOT descendants — groups don't stack).

Source:
Parameters:
Name Type Description
dir string

The folder path (e.g. "v2/scene").

names Array.<string>

All dynamic-prompt catalog names.

Returns:

The member generator keys.

Type
Array.<string>

editIn(settings, keyword) → {string}

Description:
  • Prompt-editing "edit-in": [kw:n] — kw appears after step n.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings (keywordEditingMin/Max).

keyword string

The keyword.

Returns:

The edit-in form.

Type
string

editOut(settings, keyword) → {string}

Description:
  • Prompt-editing "edit-out": [kw::n] — kw drops at step n.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings (keywordEditingMin/Max).

keyword string

The keyword.

Returns:

The edit-out form.

Type
string

epochToDateString(epochTimestamp) → {*}

Description:
  • Epoch to date string.

Source:
Parameters:
Name Type Description
epochTimestamp number
Returns:
Type
*

(async) execApp() → {Promise.<object>}

Description:
  • Spawn the CLI (node . --flags) with the current args to perform the actual generation, tracking execAppOngoing.

Source:
Returns:

The exec result ({stdout, stderr} on success, or {error}).

Type
Promise.<object>

(async) execMagick(argsopt, fileNamesopt, outputopt, silentopt) → {Promise.<object>}

Description:
  • Run an ImageMagick (magick) command, auto-quoting args that need it.

Source:
Parameters:
Name Type Attributes Description
args object <optional>

Flag→value map (rendered as -key value).

fileNames Array.<string> <optional>

Input filenames.

output string <optional>

Output filename.

silent boolean <optional>

Suppress logging.

Returns:

The exec result ({stdout, stderr} on success, or {error}).

Type
Promise.<object>

expandDynamicPromptV1(name, settings, imageSettings, upscaleSettings) → {string}

Description:
  • Load and run a frozen v1 dynamic-prompt plugin (#name-v1); v1 bakes in fx and artists, so auto-add is forced off.

Source:
Parameters:
Name Type Description
name string

The dynamic-prompt name (a trailing -v1 is stripped).

settings object

The merged generation settings.

imageSettings object

The image settings.

upscaleSettings object

The upscale settings.

Returns:

The generated prompt fragment.

Type
string

expandDynamicPromptV2(name, settings, imageSettings, upscaleSettings) → {string}

Description:
  • Load and run a v2 dynamic-prompt plugin (#name), applying danbooru substitution.

Source:
Parameters:
Name Type Description
name string

The dynamic-prompt name (a trailing -v2 is stripped).

settings object

The merged generation settings.

imageSettings object

The image settings.

upscaleSettings object

The upscale settings.

Returns:

The generated prompt fragment.

Type
string

expandExpansion(name, settings) → {string}

Description:
  • Read an expansion file's raw text.

Source:
Parameters:
Name Type Description
name string

The expansion name (file data/expansions/<name>.txt).

settings object

The merged generation settings (for expansionFiles).

Returns:

The file contents.

Type
string

extendAnim(isSelect)

Description:
  • Extend anim.

Source:
Parameters:
Name Type Description
isSelect boolean

fillListData(el)

Description:
  • Fill list data.

Source:
Parameters:
Name Type Description
el object

fillSettingValue(el)

Description:
  • Fill setting value.

Source:
Parameters:
Name Type Description
el object

find(regex, str, defopt) → {*}

Description:
  • Match a regex against a string and return its first capture group, or a default.

Source:
Parameters:
Name Type Attributes Description
regex RegExp

The pattern (capture group 1 is returned).

str string

The string to search.

def * <optional>

The fallback when there is no match.

Returns:

The captured value, or def.

Type
*

gatePool(names, isGated) → {Array.<string>}

Description:
  • Drop gated (adult) names from a pool unless includeAdult is on.

Source:
Parameters:
Name Type Description
names Array.<string>

The candidate names.

isGated function

Predicate: true if a name is adult-gated.

Returns:

The filtered pool.

Type
Array.<string>

generate()

Description:
  • Generate.

Source:

generationProgress()

Description:
  • Generation progress.

Source:

getGalleryEl(prompt, imgSrc, width, height, name) → {*}

Description:
  • Get gallery el.

Source:
Parameters:
Name Type Description
prompt string
imgSrc string
width number
height number
name string
Returns:
Type
*

getListFiles(settings) → {Array.<string>}

Description:
  • Recursively list every .txt under the list dir as a "/"-joined relative name (e.g. danbooru/general), so lists can be organized into nested folders.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings (listFiles dir).

Returns:

The list names (no extension), full relative paths.

Type
Array.<string>

(async) getProgress() → {Promise.<object>}

Description:
  • Get generation progress (from the CLI progress server, or a stopped-state default), with the server's own execOngoing flag merged in.

Source:
Returns:

The progress payload.

Type
Promise.<object>

(async) getProgressRequest() → {Promise.<(object|undefined)>}

Description:
  • Fetch generation progress from the CLI's progress server (port portProgress).

Source:
Returns:

The progress payload, or undefined if unreachable.

Type
Promise.<(object|undefined)>

getRndSalt() → {string}

Source:
Returns:

A fresh random salt token like [1234567890].

Type
string

getUrlParameters() → {*}

Description:
  • Get url parameters.

Source:
Returns:
Type
*

hasNsfwToken(name) → {boolean}

Source:
Parameters:
Name Type Description
name string

A list/group name.

Returns:

Whether the name carries an nsfw token.

Type
boolean

hasVariantSuffix(name) → {boolean}

Source:
Parameters:
Name Type Description
name string

A list/group name.

Returns:

Whether it ends in an explicit -sfw/-nsfw variant suffix.

Type
boolean

homeFeed()

Description:
  • Home feed.

Source:

imagesChanged()

Description:
  • Images changed.

Source:

impliedGroupMembers(dir, readers) → {Array.<string>}

Description:
  • Member reference lines for an IMPLIED group (a .force-group-list folder): the folder's OWN direct list files only (NOT descendants — implied groups don't stack), de-duplicated to base names (so -sfw/-nsfw pairs become one member resolved mode-aware), excluding real groups. The result feeds the normal group-union path.

Source:
Parameters:
Name Type Description
dir string

The folder path.

readers Object
Returns:

Member reference lines.

Type
Array.<string>

indexFile(settings, filePath) → {void}

Description:
  • Index one output/*.json sidecar: register its paths + keywords and wire up its deep links to parents (upscale / variation / reroll / animation). Upscales are linked to their original, not indexed as their own entry.

Source:
Parameters:
Name Type Description
settings object

The full settings (imageSettings.saveTo).

filePath string

The sidecar path.

Returns:
Type
void

init(_settings) → {void}

Description:
  • Provide the settings accessor used during suggestion cleanup.

Source:
Parameters:
Name Type Description
_settings function

The settings() accessor.

Returns:
Type
void

initiateReindex()

Description:
  • Initiate reindex.

Source:

insertSelected()

Description:
  • Insert selected.

Source:

insertSettings(obj, useAll)

Description:
  • Insert settings.

Source:
Parameters:
Name Type Description
obj object
useAll boolean

insertStoredPrompt()

Description:
  • Insert stored prompt.

Source:

isGatedDynPrompt(name) → {boolean}

Description:
  • Gate a dynamic prompt behind includeAdult AUTOMATICALLY by its name token — the same rule lists/expansions use (isGatedList) — so a generator named e.g. subject/nude-nsfw is hidden/empty when adult is off, with no hardcoded list to keep in sync. The legacy gatedDynPrompts array is still honored as an extra escape hatch.

Source:
Parameters:
Name Type Description
name string

A dynamic-prompt name (path or token).

Returns:

Whether the dynamic prompt is gated behind includeAdult.

Type
boolean

isGatedList(name) → {boolean}

Source:
Parameters:
Name Type Description
name string

A list/group name.

Returns:

Whether the list is gated behind includeAdult (by nsfw token).

Type
boolean

isNsfw(line) → {boolean}

Source:
Parameters:
Name Type Description
line string

Raw line.

Returns:

True if the line reads as ordinary NSFW (adult/nudity). Used for the SFW/NSFW split, NOT for removal.

Type
boolean

isReservedAny(name) → {boolean}

Source:
Parameters:
Name Type Description
name string

A dynamic-prompt reference (may carry a -sfw/-nsfw suffix).

Returns:

Whether it is the reserved {#any} wildcard (any variant).

Type
boolean

isReservedWildcard(name) → {boolean}

Source:
Parameters:
Name Type Description
name string

A reference (may carry a -sfw/-nsfw suffix).

Returns:

Whether it is the reserved keyword wildcard (any variant).

Type
boolean

joinPieces(pieces) → {string}

Description:
  • Weighted-sort a list of { weight, text } pieces (stable; ties keep document order) and join the non-empty ones with ", ".

Source:
Parameters:
Name Type Description
pieces Array.<{weight: number, text: string}>

The collected layer pieces.

Returns:

The joined layer text.

Type
string

keywordRepeater(keyword, alias, settings) → {string}

Description:
  • Emit a random number of keyword tokens, between settings.keywordCount and settings.keywordMaxCount.

Source:
Parameters:
Name Type Description
keyword string

The repeat target.

alias boolean

Whether to resolve via the alias.

settings object

The merged generation settings.

Returns:

The joined keyword tokens.

Type
string

labelSettings()

Description:
  • Label settings.

Source:

lazyReloadListFile(settings, name) → {void}

Description:
  • Mark a list slot empty so it is lazily re-read from disk on next pull.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

name string

The list name.

Returns:
Type
void

lexLines(body) → {Array.<{depth: number, text: string, raw: string}>}

Description:
  • Turn the body into indentation-tagged raw lines. The indent unit is the first indented line's leading whitespace (tab or N spaces), per the spec; depth = indent / unit.

Source:
Parameters:
Name Type Description
body string

The DPL body (front-matter removed).

Returns:

Non-blank logical lines.

Type
Array.<{depth: number, text: string, raw: string}>

loadAll() → {void}

Description:
  • Load the dynamic-prompt, expansion, and list catalogs.

Source:
Returns:
Type
void

loadData()

Description:
  • Load data.

Source:

loadDynPromptList() → {object}

Description:
  • Classify every dynamic prompt into full / partial (plus the v1 and user-submitted buckets) — the lists used by promptSuggestion() and the web file pickers.

Source:
Returns:

{fullRegular, partialRegular, userFiles, v1Files, all}.

Type
object

loadExpansionFileList() → {Array.<string>}

Source:
Returns:

The expansion names (cached).

Type
Array.<string>

loadImageFeed()

Description:
  • Load image feed.

Source:

loadListFileList() → {Array.<string>}

Description:
  • Load the list names (and cache the artist-excluded subset).

Source:
Returns:

The list names.

Type
Array.<string>

loadResults()

Description:
  • Load results.

Source:

loadSearchQuery(query)

Description:
  • Load search query.

Source:
Parameters:
Name Type Description
query string

logicalListNames(physical) → {Array.<string>}

Description:
  • Turn the physical on-disk names into the LOGICAL reference set, the names the rest of the app sees. A mixed list is stored as two files, <base>-sfw and <base>-nsfw, with NO <base> file — the bare {base} is implicit, and this exposes all three references (base, base-sfw, base-nsfw). A standalone <base>-nsfw with no <base>-sfw counterpart is exposed only by its gated -nsfw name (NSFW-only).

    Safety rule: a plain <p> file is only a normal SFW list when it has NO <p>-nsfw sibling; if such a sibling exists the plain file is IGNORED (not exposed, not loaded), to force the explicit -sfw/-nsfw split. Only <base>-sfw counts as an SFW source — a stray <base> next to <base>-nsfw does not.

Source:
Parameters:
Name Type Description
physical Array.<string>

The on-disk list + group names (no extension).

Returns:

Logical names, de-duplicated, in guaranteed natural order.

Type
Array.<string>

makeAnimations()

Description:
  • Make animations.

Source:

makeArt()

Description:
  • Make art.

Source:

makeArt()

Description:
  • Make art.

Source:

makeDynamicPromptStage(loader) → {function}

Description:
  • Build the #name dynamic-prompt stage bound to a loader (loader-injected port; suffix-resolved v2 / frozen v1, auto-fx/artists, danbooru substitution).

Source:
Parameters:
Name Type Description
loader object

The loader ({ loadDynamicPrompt, dynamicPromptNames }).

Returns:

The stage (prompt, settings, imageSettings, upscaleSettings) => string.

Type
function

makeExpansionStage(loader) → {function}

Description:
  • Build the <name> expansion stage bound to a loader (loader-injected port, LoRA-safe).

Source:
Parameters:
Name Type Description
loader object

The loader ({ readExpansion, expansionNames, expansionGroupDirs, readExpansionGroup }).

Returns:

The expansion stage (prompt, settings) => string.

Type
function

makeListStage(store) → {function}

Description:
  • Build the {name} list stage bound to a list store (loader-injected port).

Source:
Parameters:
Name Type Description
store object

The list store ({ pull }).

Returns:

The list stage (prompt, settings) => string.

Type
function

makeVariations()

Description:
  • Make variations.

Source:

module:web-app/components/Gallery(props) → {JSX.Element|null}

Source:
Parameters:
Name Type Description
props object
Properties
Name Type Description
images Array.<string>

The image URLs (data:/blob:) to show.

Returns:

The gallery, or null when there are no images.

Type
JSX.Element | null

module:web-app/components/Home(props) → {JSX.Element}

Description:
  • The compose workspace.

Source:
Parameters:
Name Type Description
props object
Properties
Name Type Description
settings object

The current settings.

setSettings function

Update the settings.

Returns:
Type
JSX.Element

module:web-app/components/Settings(props) → {JSX.Element}

Description:
  • The full settings form.

Source:
Parameters:
Name Type Description
props object
Properties
Name Type Description
settings object

The current settings.

setSettings function

Update the settings.

Returns:
Type
JSX.Element

module:web-app/components/WrapperFab(props) → {JSX.Element}

Source:
Parameters:
Name Type Description
props object
Properties
Name Type Description
settings object

Current settings (reads wrapper / wrapperName).

setSettings function

Update settings.

Returns:
Type
JSX.Element

nameToData(settings, name, skipAliasCheckopt) → {Object}

Description:
  • Resolve a list name (handling the keyword/artist aliases) to its in-memory array.

Source:
Parameters:
Name Type Attributes Description
settings object

The merged generation settings.

name string

The requested list name or alias.

skipAliasCheck boolean <optional>

Skip alias resolution (used after a reload).

Returns:

The resolved list handle.

Type
Object

nlpProcess(word) → {string}

Description:
  • Reduce a word to its noun-singular or verb-infinitive form via compromise. (Currently unused — kept for reference; too slow to run per keyword.)

Source:
Parameters:
Name Type Description
word string

The word.

Returns:

The normalized word (or the original).

Type
string

normalize(line) → {string}

Description:
  • Normalize a raw list line to a lowercase, single-spaced token string.

Source:
Parameters:
Name Type Description
line string

Raw line.

Returns:

Normalized form, e.g. "long hair".

Type
string

onMinusStepperClick(input)

Description:
  • On minus stepper click.

Source:
Parameters:
Name Type Description
input object

onMinusStepperClick(input)

Description:
  • On minus stepper click.

Source:
Parameters:
Name Type Description
input object

onNumberChangeWStep()

Description:
  • On number change wstep.

Source:

onNumberChangeWStep()

Description:
  • On number change wstep.

Source:

onPageButtonClick()

Description:
  • On page button click.

Source:

onPlusStepperClick(input)

Description:
  • On plus stepper click.

Source:
Parameters:
Name Type Description
input object

onPlusStepperClick(input)

Description:
  • On plus stepper click.

Source:
Parameters:
Name Type Description
input object

onPromptSelectionChange()

Description:
  • On prompt selection change.

Source:

onReindexButton()

Description:
  • On reindex button.

Source:

onReroll()

Description:
  • On reroll.

Source:

onRerollSelect()

Description:
  • On reroll select.

Source:

onSettingsDownload()

Description:
  • On settings download.

Source:

onVariationSelectionChange()

Description:
  • On variation selection change.

Source:

parseFrontMatter(source) → {Object}

Description:
  • Split a leading --- YAML-ish front-matter block from the body.

Source:
Parameters:
Name Type Description
source string

The raw .dpl text.

Returns:

Parsed key/value meta and the remaining body.

Type
Object

parseNode(node) → {object}

Description:
  • Parse one tree node's text into a typed descriptor (weight/gate/repeat/choice/ref/payload).

Source:
Parameters:
Name Type Description
node Object

A raw tree node.

Returns:

The typed node (with parsed children).

Type
object

parseSections(lines) → {object}

Description:
  • Parse the lexed lines into { sectionName: nodeTree }. A heading is a text line whose next line is ={3,}; Start is the entry section. Lines under a heading nest by depth.

Source:
Parameters:
Name Type Description
lines Array

Lexed lines from lexLines.

Returns:

Map of section name -> array of child nodes.

Type
object

performRandomGenerate()

Description:
  • Perform random generate.

Source:

performRandomSearch()

Description:
  • Perform random search.

Source:

performSearch()

Description:
  • Perform search.

Source:

pickerListNames() → {Array.<string>}

Description:
  • The list names to show in the web picker, honoring adult mode. When adult is off, every name carrying an nsfw token is hidden (the app behaves as if it doesn't exist). When on, each base that has a <base>-nsfw sibling also offers the explicit <base>-sfw reference, so the picker shows all three (default / SFW-only / NSFW).

Source:
Returns:

The picker-facing list names, in load order.

Type
Array.<string>

populateSettingsList()

Description:
  • Populate settings list.

Source:

postBuildIndexes() → {void}

Description:
  • Final pass: compute each animation's highest frame number from its frames.

Source:
Returns:
Type
void

presetSelected()

Description:
  • Preset selected.

Source:

(async) processBatch(index, total) → {Promise.<void>}

Description:
  • Build one prompt through the prompt-module pipeline and, when generateImages is on and mode is StableDiffusion, generate its image(s).

Source:
Parameters:
Name Type Description
index number

The 0-based prompt index in the batch.

total number

The total prompt count.

Returns:
Type
Promise.<void>

processGroup(settings, defSettings, groupName, diff) → {void}

Description:
  • Copy the keys of one settings group that differ from the defaults into diff.

Source:
Parameters:
Name Type Description
settings object

The live settings.

defSettings object

The default settings.

groupName string

The group ("settings", "imageSettings", …).

diff object

The accumulating diff object (mutated).

Returns:
Type
void

processImageFeed(files)

Description:
  • Process image feed.

Source:
Parameters:
Name Type Description
files object

processMdj(settings, lessEmphasis, keyword) → {string}

Description:
  • Midjourney emphasis: append ::factor, factor = 1.05·N up (or its reciprocal down); N is rolled by emphasisLevelChance up to emphasisMaxLevels.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

lessEmphasis boolean

De-emphasize rather than emphasize.

keyword string

The keyword to weight.

Returns:

The weighted keyword.

Type
string

processNAI(settings, lessEmphasis, keyword) → {string}

Description:
  • NovelAI emphasis: same nested-bracket leveling as SD (the list stage later rewrites () to {} for NovelAI).

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

lessEmphasis boolean

De-emphasize rather than emphasize.

keyword string

The keyword to wrap.

Returns:

The wrapped keyword.

Type
string

processRepeat(count, keyword, alias) → {string}

Description:
  • Build a comma-joined run of count list tokens.

Source:
Parameters:
Name Type Description
count number

How many tokens to emit (<= 0 yields "").

keyword string

The repeat target ("keyword" or "artist").

alias boolean

Whether to resolve via the keyword/artist alias.

Returns:

The joined {token}, {token}, … string.

Type
string

processSd(settings, lessEmphasis, keyword) → {string}

Description:
  • StableDiffusion emphasis: wrap the keyword in N nested () (emphasis) or [] (de-emphasis); N is rolled by emphasisLevelChance up to emphasisMaxLevels.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

lessEmphasis boolean

De-emphasize ([]) rather than emphasize (()).

keyword string

The keyword to wrap.

Returns:

The wrapped keyword.

Type
string

promptSuggestion(fullopt) → {string}

Description:
  • Build a random prompt suggestion (the engine behind #random): one to three full dynamic prompts, sometimes AND-weighted, with optional garnish, then cleaned up.

Source:
Parameters:
Name Type Attributes Description
full boolean <optional>

Use the richer multi-prompt form.

Returns:

The suggested prompt.

Type
string

pull(settings, name) → {string}

Description:
  • Pull a random entry from a list, with once-only depletion and auto-reload when the list empties. Artist lists return "" when includeArtist is off.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

name string

The list name or alias.

Returns:

A random list entry, or "".

Type
string

query(keywords) → {Array.<object>}

Description:
  • Search the index for images matching all query keywords (set intersection).

Source:
Parameters:
Name Type Description
keywords string

The search query.

Returns:

The matching file records (shuffled, de-duplicated by image).

Type
Array.<object>

randomName()

Description:
  • Random name.

Source:

reIndexToUrl(url)

Description:
  • Re index to url.

Source:
Parameters:
Name Type Description
url string

readListFile(settings, name) → {void}

Description:
  • Load a list file fully into memory (under the artist or keyword bucket).

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

name string

The list name.

Returns:
Type
void

readSfwBase(base, readers) → {Array.<string>|null}

Description:
  • Read a plain list's SFW base lines. Safety rule: when a <base>-nsfw sibling exists, a plain <base>.txt is IGNORED — the SFW source must be the explicit <base>-sfw.txt. This enforces the naming split so a stray <base>.txt can never leak as SFW alongside NSFW (a lone <base>.txt beside <base>-nsfw.txt is thus treated as NSFW-only). With no <base>-nsfw sibling, a plain <base>.txt is a normal SFW list (with <base>-sfw.txt as a fallback). Returns null when no SFW source exists, else an array (possibly empty).

Source:
Parameters:
Name Type Description
base string

Canonical base name (no sfw/nsfw suffix).

readers Object
Returns:
Type
Array.<string> | null

rebuildIndexes(settings) → {void}

Description:
  • Rebuild the whole index from output/*.json: build, validate, post-process, and re-index (up to 5×) while self-healing keeps changing the data.

Source:
Parameters:
Name Type Description
settings object

The full settings.

Returns:
Type
void

reindexHome()

Description:
  • Reindex home.

Source:

reindexProgress()

Description:
  • Reindex progress.

Source:

reloadListFiles(settings) → {void}

Description:
  • Lazily clear every list (forces a fresh draw set on the next prompt).

Source:
Parameters:
Name Type Description
settings object

The merged generation settings.

Returns:
Type
void

reloadPromptFunc(list) → {void}

Description:
  • Refill the per-pull pool of randomizers so each gets a turn before any repeats.

Source:
Parameters:
Name Type Description
list Array.<function()>

The mode-appropriate randomizer set to clone into the pool.

Returns:
Type
void

reloadSettings() → {void}

Description:
  • (Re)build the live settings object: clone the defaults, merge user-settings.json, and migrate a legacy user-settings.js if present.

Source:
Returns:
Type
void
Description:
  • Strip a now-invalid relationship field from a sidecar on disk (minimal rewrite) and flag that a re-index is needed.

Source:
Parameters:
Name Type Description
settings object

The full settings.

fileName string

The file id.

oneToOneName string

The field to remove (e.g. variationOf).

Returns:
Type
void

removeSettingOnClick()

Description:
  • Remove setting on click.

Source:

renderInlineBody()

Description:
  • Render the payload text of a node, substituting inline {js:path} via the bridge.

Source:

renderNode(node, ctx) → {string}

Description:
  • Render a single parsed node to a string (without its sibling gate, which the caller applied).

Source:
Parameters:
Name Type Description
node object

A parsed node.

ctx object

The render context.

Returns:

The node's text contribution.

Type
string

renderNodes(nodes, ctx) → {string}

Description:
  • Render an array of sibling nodes into one layer string (gates, choices, repeats, refs, weighted local sort). auto tracks the running auto-weight (starts at 1000).

Source:
Parameters:
Name Type Description
nodes Array

Parsed sibling nodes.

ctx object

The render context (settings, rng, bridge, sections).

Returns:

The layer's rendered, weight-sorted text.

Type
string

renderRef()

Description:
  • Resolve a reference node (call/insert/js-block) to a string.

Source:

requireLoader() → {object}

Source:
Throws:

If configure() has not been called.

Type
Error
Returns:

The configured loader.

Type
object

rerollPrompt(isSelect)

Description:
  • Reroll prompt.

Source:
Parameters:
Name Type Description
isSelect boolean

resetSavePreset()

Description:
  • Reset save preset.

Source:

resolveListLines(name, readers, includeAdultopt, forcedopt, depthopt, seenopt) → {Array.<string>|null}

Description:
  • Resolve a list/group reference to its lines, honoring the SFW/NSFW naming model and the includeAdult mode. No runtime content filtering — NSFW is a separate preprocessed <base>-nsfw.txt file that is simply included or not.

    Semantics (per reference):

    • {name} → SFW only when adult is off; SFW + <name>-nsfw when on.
    • {name-sfw} → SFW base only (always; the explicit SFW-exclusive reference).
    • {name-nsfw} → nothing when adult is off (acts as if it doesn't exist); SFW + <name>-nsfw when on (the SFW base is auto-tacked on).

    Groups propagate the resolved variant to their members, so {d} (off) is all-SFW, {d} (on) includes NSFW, and {d-sfw} is SFW even when on.

Source:
Parameters:
Name Type Attributes Description
name string

Canonical list/group name (may carry a -sfw/-nsfw suffix).

readers Object
includeAdult boolean <optional>

Whether adult/NSFW content is enabled.

forced "sfw" | "full" | null <optional>

Variant forced by a parent group (internal).

depth number <optional>

Current group-nesting depth (internal).

seen Set.<string> <optional>

Cycle guard (internal).

Returns:

Resolved lines, or null if a plain list is missing.

Type
Array.<string> | null

resolveName(ref, names) → {string}

Description:
  • Resolve a list reference to a canonical list name by PATH-SUFFIX matching, so a prompt can use a bare filename (general), a partial path (danbooru/general), or a full path — and folders can be nested arbitrarily deep. An exact match wins; otherwise any name whose path ends with /<ref> matches, and the shallowest (fewest folders), then alphabetically-first, match is chosen for determinism.

Source:
Parameters:
Name Type Description
ref string

The reference as written in the prompt.

names Array.<string>

All known canonical names (physical paths + virtual names).

Returns:

The resolved canonical name (or ref unchanged if nothing matches).

Type
string

resultsLoaded(results)

Description:
  • Results loaded.

Source:
Parameters:
Name Type Description
results object

returnValToSetting()

Description:
  • Return val to setting.

Source:

returnValToSetting()

Description:
  • Return val to setting.

Source:

(async) run() → {Promise.<void>}

Description:
  • Run the full generate loop: clear results, then build promptCount prompts (reloading lists between prompts as configured), awaiting each batch in turn.

Source:
Returns:
Type
Promise.<void>

sampleFile(name, settings, emphasisopt) → {string}

Description:
  • Pull one random entry from list name, optionally applying a single randomizer (emphasis / editing / alternating, chosen without replacement) and resolving any nested {list} tokens the randomizer leaves behind.

Source:
Parameters:
Name Type Attributes Default Description
name string

The list name to pull from.

settings object

The merged generation settings.

emphasis boolean <optional>
true

Whether this keyword is eligible for randomization.

Returns:

The (possibly randomized) keyword.

Type
string

saveExpansion()

Description:
  • Save expansion.

Source:

savePreset()

Description:
  • Save preset.

Source:

saveSetting(path, value)

Description:
  • Save setting.

Source:
Parameters:
Name Type Description
path string
value *

saveSetting(path, value)

Description:
  • Save setting.

Source:
Parameters:
Name Type Description
path string
value *

saveSettings() → {void}

Description:
  • Persist userSettings() to user-settings.json.

Source:
Returns:
Type
void

saveState()

Description:
  • Save state.

Source:

searchboxKeyPress(event)

Description:
  • Searchbox key press.

Source:
Parameters:
Name Type Description
event Event

selectAnimation()

Description:
  • Select animation.

Source:

selectUpscale()

Description:
  • Select upscale.

Source:

selectVariations()

Description:
  • Select variations.

Source:

sendLegacyTxtNotice() → {void}

Description:
  • Print the legacy-txt conversion notice once per process.

Source:
Returns:
Type
void

setValToSetting()

Description:
  • Set val to setting.

Source:

setupNumberSteppers()

Description:
  • Setup number steppers.

Source:

setupNumberSteppers()

Description:
  • Setup number steppers.

Source:

showSettingOnSelect()

Description:
  • Show setting on select.

Source:

startCase(text) → {*}

Description:
  • Start case.

Source:
Parameters:
Name Type Description
text string
Returns:
Type
*

startCase(text) → {*}

Description:
  • Start case.

Source:
Parameters:
Name Type Description
text string
Returns:
Type
*

startProgress() → {void}

Description:
  • Create the four cli-progress bars (sampler / batch / total / prompts), seed the imageSettings.progress* fields, and begin polling.

Source:
Returns:
Type
void

stopProgress() → {void}

Description:
  • Tear down the progress bars and clear the imageSettings.progress* fields.

Source:
Returns:
Type
void

swapOut(settings, keyword) → {string}

Description:
  • Prompt-editing "swap": [kw:kw:n] — re-assert the keyword at step n.

Source:
Parameters:
Name Type Description
settings object

The merged generation settings (keywordEditingMin/Max).

keyword string

The keyword.

Returns:

The swap form.

Type
string

toComparitiveKeywords(prompt) → {Array.<string>}

Description:
  • Tokenize a search query into comparison keywords (word-boundary only, so girl and 1girl both match), de-duplicated.

Source:
Parameters:
Name Type Description
prompt string

The query text.

Returns:

The query keywords.

Type
Array.<string>

toKeywords(prompt) → {Array.<string>}

Description:
  • Tokenize a prompt into the de-duplicated, sorted keyword list used for the index (splits on word and letter boundaries; drops 1-char and pure-digit tokens).

Source:
Parameters:
Name Type Description
prompt string

The prompt text.

Returns:

The keywords.

Type
Array.<string>

toggleDetailedProgress()

Description:
  • Toggle detailed progress.

Source:

updateFiles(directoryName) → {void}

Description:
  • Recursively copy legacy .txt output sidecars to .json and remove the .txt.

Source:
Parameters:
Name Type Description
directoryName string

The directory to walk.

Returns:
Type
void

(async) updateProgress() → {Promise.<void>}

Description:
  • Poll the SD WebUI /progress endpoint and push the numbers into the cli-progress bars and imageSettings.progress*; reschedules itself while a render is ongoing.

Source:
Returns:
Type
Promise.<void>

updateSearchSuggestion()

Description:
  • Update search suggestion.

Source:

updateStats()

Description:
  • Update stats.

Source:

(async) upscale(fileId) → {Promise.<void>}

Description:
  • Upscale an already-generated image by file id.

Source:
Parameters:
Name Type Description
fileId string | number

The image file id.

Returns:
Type
Promise.<void>

upscaleFile()

Description:
  • Upscale file.

Source:

userSettings() → {void}

Description:
  • Create user-settings.json from default-user-settings.json if it is missing.

Source:
Returns:
Type
void

userSettings() → {object}

Description:
  • Compute the settings that differ from defaults, with internal-only / runtime fields (progress, lastCmd, animation bookkeeping, …) stripped.

Source:
Returns:

The persistable user settings.

Type
object
Description:
  • Drop a deep link (and its on-disk field) when its target no longer exists.

Source:
Parameters:
Name Type Description
settings object

The full settings.

fileName string

The file id.

oneToOneName string

The relationship field to validate.

Returns:
Type
void

validateIndexes(settings) → {void}

Description:
  • Validate every indexed file: drop placeholders with no image, promote orphaned upscales, and prune dead deep links.

Source:
Parameters:
Name Type Description
settings object

The full settings.

Returns:
Type
void
Description:
  • Orphan an upscale whose parent vanished: rename <id>-upscaled<id> and strip its upscaleOf so it becomes a standalone index entry.

Source:
Parameters:
Name Type Description
settings object

The full settings.

fileName string

The parent file id.

Returns:
Type
void

weightOf()

Description:
  • A node's explicit weight, or null (used for refs that carry a weight).

Source:

weightedSampleN()

Description:
  • Pick n distinct options weighted by each option's leading gate %, else uniform.

Source: