Function: toUniqueSlug()
toUniqueSlug(
value,options?):string
Slugify value (using the standard toIdentifierWithOptions
tokenizer + delimiter rules) and always suffix a short
deterministic hash. Use when you need a stable, slugified id that
is guaranteed to be unique across descriptions sharing the same
leading tokens (tool ids, cache keys, etc.).
Behaviour differs from toIdentifierWithOptions({ maxLength, truncateStrategy: "hash" }): that helper only appends a hash when
the slug overflows maxLength. This helper appends a hash
unconditionally so the result is collision-resistant even for
short inputs. The hash is computed over the raw value so two
descriptions producing the same slug still get different ids.
Parameters
Section titled “Parameters”string
Source string (typically a tool/agent description).
options?
Section titled “options?”delimiter?
Section titled “delimiter?”string
Token separator (default "_").
fallbackPrefix?
Section titled “fallbackPrefix?”string
Prefix used when the slug is empty
(e.g. punctuation-only input). Default "id".
hashLength?
Section titled “hashLength?”number
Length of the suffix produced by fnvHashWithOptions (Crockford-style base-32 alphabet, max 7 chars). Default 6.
slugMaxLength?
Section titled “slugMaxLength?”number
Cap on the slug portion (the part before the hash). Default 32.
Returns
Section titled “Returns”string