2026-02-12 11:22:27 +01:00
|
|
|
export const NEWLINE = '\n';
|
2026-06-12 15:53:26 +02:00
|
|
|
export const TAB = '\t';
|
2026-02-12 11:22:27 +01:00
|
|
|
export const DEFAULT_LANGUAGE = 'text';
|
|
|
|
|
export const LANG_PATTERN = /^(\w*)\n?/;
|
|
|
|
|
export const AMPERSAND_REGEX = /&/g;
|
|
|
|
|
export const LT_REGEX = /</g;
|
|
|
|
|
export const GT_REGEX = />/g;
|
|
|
|
|
export const FENCE_PATTERN = /^```|\n```/g;
|
2026-07-15 20:31:45 +02:00
|
|
|
|
|
|
|
|
// Whitespace-only empty lines (between start of string and first non-empty line).
|
|
|
|
|
// Used by trimCodePadding to drop leading/trailing phantom blank rows from LLM
|
|
|
|
|
// payload wrappers without touching internal blank lines.
|
|
|
|
|
export const TRIM_LEADING_PADDING_REGEX = /^(?:[ \t]*\n)+/;
|
|
|
|
|
export const TRIM_TRAILING_PADDING_REGEX = /(?:\n[ \t]*)+$/;
|
|
|
|
|
|
|
|
|
|
// Matches either Unix or Windows path separators so `String.split(REGEX)` can
|
|
|
|
|
// recover the trailing file-name segment from either `/foo/bar.txt` or
|
|
|
|
|
// `C:\foo\bar.txt`. Used wherever a parameter accepts a user-supplied path.
|
|
|
|
|
export const FILE_PATH_SEPARATOR_REGEX = /[\\/]/;
|
|
|
|
|
|
|
|
|
|
// Matches the `text:` prefix that file-type identifiers use to denote a
|
|
|
|
|
// plain-text language (e.g. `text:typescript`). Used by tool-call renderers
|
|
|
|
|
// to recover the underlying highlight.js language.
|
|
|
|
|
export const TEXT_LANGUAGE_PREFIX_REGEX = /^text:/;
|