Download src/plugins/runtime/generation-state.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 957 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugins/runtime/generation-state.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/plugins/runtime/generation-state.ts
-
curl -L -o generation-state.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugins/runtime/generation-state.ts
957 Bytes
| // Keep retained registry reads independent of metadata discovery and plugin loading. | |
| import { AsyncLocalStorage } from "node:async_hooks"; | |
| import { resolveGlobalSingleton } from "../../shared/global-singleton.js"; | |
| import type { PluginRegistry } from "../registry-types.js"; | |
| const registryScope = resolveGlobalSingleton<AsyncLocalStorage<PluginRegistry>>( | |
| Symbol.for("openclaw.pluginRuntimeGenerationRegistryScope"), | |
| () => new AsyncLocalStorage<PluginRegistry>(), | |
| ); | |
| export function withPluginRuntimeGenerationRegistryScope<T>( | |
| registry: PluginRegistry, | |
| run: () => T, | |
| ): T { | |
| return registryScope.run(registry, run); | |
| } | |
| /** Exact registry owned by the prepared generation, including empty selections. */ | |
| export function getPluginRuntimeGenerationRegistry(): PluginRegistry | undefined { | |
| return registryScope.getStore(); | |
| } | |
| export function runOutsidePluginRuntimeGenerationRegistryScope<T>(run: () => T): T { | |
| return registryScope.exit(run); | |
| } | |