The best way to control Claude Code, Codex and more from any computer or phone

main
ts 11 lines 411 Bytes
Raw
1 /** Per-load nonces avoid draft ID collisions; getRandomValues works on plain HTTP. */
2 export function createAnnotationIdSource(): (prefix: string) => string {
3 const pageLoad = Array.from(crypto.getRandomValues(new Uint32Array(2)), (part) =>
4 part.toString(36),
5 ).join("");
6 let sequence = 0;
7 return (prefix) => {
8 sequence += 1;
9 return `${prefix}_${pageLoad}_${sequence.toString(36)}`;
10 };
11 }