Download packages/context/session-reference/src/serialization.ts from SaylorTwift/deepseek-harness: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/SaylorTwift/deepseek-harness/resolve/main/packages/context/session-reference/src/serialization.ts
- Command line
-
hf download hf://SaylorTwift/deepseek-harness/packages/context/session-reference/src/serialization.ts
-
curl -L -o serialization.ts https://huggingface.co/SaylorTwift/deepseek-harness/resolve/main/packages/context/session-reference/src/serialization.ts
584 Bytes
| /** Tag-safe JSON serialization for the model-visible reference envelope. */ | |
| /** | |
| * Serialize JSON while preventing source data from spelling an XML-like opening tag. | |
| * @param value - JSON-compatible reference data. | |
| * @returns JSON whose parse result is unchanged and whose data contains no literal `<`. | |
| */ | |
| export function stringifyTagSafeJson(value: unknown): string { | |
| const serialized: unknown = JSON.stringify(value) | |
| if (typeof serialized !== 'string') throw new TypeError('session-reference data is not JSON-serializable') | |
| return serialized.replaceAll('<', '\\u003c') | |
| } | |