fix: match SET_TRACED_PROCESSORS payload to agent protocol
Payload now sends {processors: {id: "BOTH"}} map instead of
{routeId, processorIds[]} array. Tracing state keyed by application
name (global, not per-route) matching agent behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
type CaptureMode = 'NONE' | 'INPUT' | 'OUTPUT' | 'BOTH'
|
||||
|
||||
interface TracingState {
|
||||
tracedProcessors: Record<string, Set<string>>
|
||||
isTraced: (appRoute: string, processorId: string) => boolean
|
||||
toggleProcessor: (appRoute: string, processorId: string) => Set<string>
|
||||
/** Key: applicationName → { processorId: captureMode } */
|
||||
tracedProcessors: Record<string, Record<string, CaptureMode>>
|
||||
isTraced: (app: string, processorId: string) => boolean
|
||||
/** Toggle processor tracing (BOTH on, remove on off). Returns the full map for the app. */
|
||||
toggleProcessor: (app: string, processorId: string) => Record<string, CaptureMode>
|
||||
}
|
||||
|
||||
export const useTracingStore = create<TracingState>((set, get) => ({
|
||||
tracedProcessors: {},
|
||||
|
||||
isTraced: (appRoute, processorId) =>
|
||||
get().tracedProcessors[appRoute]?.has(processorId) ?? false,
|
||||
isTraced: (app, processorId) =>
|
||||
processorId in (get().tracedProcessors[app] ?? {}),
|
||||
|
||||
toggleProcessor: (appRoute, processorId) => {
|
||||
const current = new Set(get().tracedProcessors[appRoute] ?? [])
|
||||
if (current.has(processorId)) current.delete(processorId)
|
||||
else current.add(processorId)
|
||||
toggleProcessor: (app, processorId) => {
|
||||
const current = { ...(get().tracedProcessors[app] ?? {}) }
|
||||
if (processorId in current) delete current[processorId]
|
||||
else current[processorId] = 'BOTH'
|
||||
set((state) => ({
|
||||
tracedProcessors: { ...state.tracedProcessors, [appRoute]: current },
|
||||
tracedProcessors: { ...state.tracedProcessors, [app]: current },
|
||||
}))
|
||||
return current
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user