Expand description
Strict validation of caller-supplied values.
Everything the CoPilot API accepts ends up in a prompt, a SQL statement the agent is told to run, a filesystem path or a MemPalace wing, so each field is checked against a tight, allocation-free charset.
Constants§
- LESSON_
TYPES - MemPalace rooms a lesson may be filed under.
- MAX_
ALERT_ ID - Largest accepted alert id (JavaScript’s
Number.MAX_SAFE_INTEGER, so ids round-trip through CoPilot’s JSON without precision loss). - MAX_
ALERT_ ID_ DIGITS - Max digits in a string-form alert id.
- MAX_
CUSTOMER_ CODE_ LEN - Max length of a customer code (MySQL
VARCHAR(64)). - MAX_
DRAWER_ ID_ LEN - Max length of a MemPalace drawer id.
- MAX_
INVESTIGATION_ ID_ LEN - Max length of an investigation id.
- MAX_
LESSON_ CHARS - Max characters of a palace lesson.
- MAX_
QUERY_ CHARS - Max characters of a palace search query.
- MAX_
TEMPLATE_ NAME_ LEN - Max length of a template override filename.
- MAX_
TRIGGERED_ BY_ LEN - Max length of a
triggered_bylabel. - TRIGGERED_
BY_ VALUES - The
triggered_byvalues CoPilot’sai_analyst_jobaccepts.
Functions§
- is_
valid_ customer_ code ^[A-Za-z0-9_-]{1,64}$- is_
valid_ drawer_ id ^[A-Za-z0-9_.:-]{1,256}$- is_
valid_ investigation_ id ^[A-Za-z0-9_.:-]{1,128}$, not./...- is_
valid_ lesson_ type - Whether
snames a MemPalace room. - is_
valid_ template_ name - A plain
.txtfilename:^[A-Za-z0-9._-]+\.txt$, at most 128 bytes, no leading dot (hidden files) and no..anywhere. - is_
valid_ triggered_ by - One of
TRIGGERED_BY_VALUES. Anything else would make the agent’s job registration fail on the CoPilot side. - parse_
alert_ id - Parse a JSON alert id: a positive integer or a digit string.
- parse_
alert_ id_ str - Parse a string alert id: 1-16 ASCII digits, value in
1..=MAX_ALERT_ID. - sanitize_
label - Trim, drop control characters, and truncate to
max_charscharacters. Used for display labels (user_name,sender) that end up in group names and chat metadata. - truncate_
chars - Truncate to at most
max_charscharacters.