/** * AsyncLocalStorage-based propagation of senpi tracking context. * * Why: when a senpi runtime processes a signal it owns a runId that connects * all events for that flow (scanner → decision → action → position → DSL). If * that flow makes LLM calls, the spans those calls produce should carry the * same runId so events and spans can be joined downstream. * * AsyncLocalStorage is per-async-call-chain, so it is concurrency-safe even if * signal processing is parallelized later. Crossing process boundaries * (e.g. POST to OpenClaw's /tools/invoke) needs explicit propagation through * headers — see openclaw-llm-decision.ts. */ import { AsyncLocalStorage } from "node:async_hooks"; export interface TrackingContext { /** Per-scan-run id joining this flow's events and spans to the producing scanner run. */ runId: string; /** Strategy wallet (lowercased). May be empty when a runtime has no wallet (rare). */ address: string; /** Recipe name (the YAML `name:` field). User-meaningful label, e.g. "viper". */ recipeName: string; /** Stable UUID for this runtime install (from the plugin registry). */ runtimeId: string; /** Plugin version. */ runtimeVersion: string; /** UUID generated once at runtime startup; lets you group direct-path spans per process. */ runtimeBootId: string; /** * The runtime's `senpi.*` identity as a precomputed attribute bag, stamped onto logs * emitted within this flow. Same values the active span carries (built from one mapper), * so logs and traces join cleanly. Optional: a flow may run before identity resolves. */ identityAttributes?: Record; } export declare const trackingContext: AsyncLocalStorage; /** Returns the current tracking context, or null when running outside any signal flow. */ export declare function getTrackingContext(): TrackingContext | null; //# sourceMappingURL=context.d.ts.map