eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 835 B
JavaScript
const KEY_REGISTRY_GLOBAL_KEY=Symbol.for(`eve.context-key-registry`),globalKeyRegistryContainer=globalThis;globalKeyRegistryContainer[KEY_REGISTRY_GLOBAL_KEY]===void 0&&(globalKeyRegistryContainer[KEY_REGISTRY_GLOBAL_KEY]=new Map);const keyRegistry=globalKeyRegistryContainer[KEY_REGISTRY_GLOBAL_KEY];var ContextKey=class{name;codec;constructor(e,t={}){this.name=e,this.codec=t.codec;let n=keyRegistry.get(e);if(n!==void 0&&n.codec===void 0!=(this.codec===void 0))throw Error(`ContextKey name collision: "${e}" is already registered ${n.codec?`with`:`without`} a codec, but a key ${this.codec?`with`:`without`} a codec is being registered under the same name. This silently breaks context serialization — use a distinct name.`);keyRegistry.set(e,this)}};function resolveKey(e){return keyRegistry.get(e)}export{ContextKey,resolveKey};