mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-11 01:36:04 +00:00
29 lines
946 B
TypeScript
29 lines
946 B
TypeScript
/** Stores active web-tool metadata for the secrets runtime snapshot. */
|
|
import type { RuntimeWebToolsMetadata } from "./runtime-web-tools.types.js";
|
|
|
|
let activeRuntimeWebToolsMetadata: RuntimeWebToolsMetadata | null = null;
|
|
|
|
/**
|
|
* Clears active web-tool metadata when the secrets runtime snapshot is reset.
|
|
*/
|
|
export function clearActiveRuntimeWebToolsMetadata(): void {
|
|
activeRuntimeWebToolsMetadata = null;
|
|
}
|
|
|
|
/**
|
|
* Stores web-tool metadata with clone isolation from caller-owned objects.
|
|
*/
|
|
export function setActiveRuntimeWebToolsMetadata(metadata: RuntimeWebToolsMetadata): void {
|
|
activeRuntimeWebToolsMetadata = structuredClone(metadata);
|
|
}
|
|
|
|
/**
|
|
* Returns active web-tool metadata without exposing mutable runtime state.
|
|
*/
|
|
export function getActiveRuntimeWebToolsMetadata(): RuntimeWebToolsMetadata | null {
|
|
if (!activeRuntimeWebToolsMetadata) {
|
|
return null;
|
|
}
|
|
return structuredClone(activeRuntimeWebToolsMetadata);
|
|
}
|