char-slop/berry
multipurpose self-modifiable agentic harness
git clone https://git.t4t.associates/char-slop/berry
e6df845
main
1// atproto timestamp identifiers: 53 bits of microseconds and a 10-bit clock id, as sortable base32. 2 3const ALPHABET = "234567abcdefghijklmnopqrstuvwxyz" ; 4const CLOCK_ID = BigInt ( Math . floor ( Math . random () * 1024 )); 5 6export const TID_PATTERN = / ^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$ / ; 7 8let last = 0 ; 9 10export function tid ( now = Date . now ()) :string { 11last = Math . max ( now * 1000 , last + 1 ); 12let n = ( BigInt ( last ) << 10n ) | CLOCK_ID ; 13let out = "" ; 14for ( let i = 0 ; i < 13 ; i ++ , n >>= 5n ) out = ALPHABET [ Number ( n & 31n )] + out ; 15return out ; 16}