MCPcopy Index your code
hub / github.com/codeaashu/claude-code / persistDenialState

Function persistDenialState

src/utils/permissions/permissions.ts:963–978  ·  view source on GitHub ↗

* Persist denial tracking state. For async subagents with localDenialTracking, * mutate the local state in place (since setAppState is a no-op). Otherwise, * write to appState as usual.

(
  context: ToolUseContext,
  newState: DenialTrackingState,
)

Source from the content-addressed store, hash-verified

961 * write to appState as usual.
962 */
963function persistDenialState(
964 context: ToolUseContext,
965 newState: DenialTrackingState,
966): void {
967 if (context.localDenialTracking) {
968 Object.assign(context.localDenialTracking, newState)
969 } else {
970 context.setAppState(prev => {
971 // recordSuccess returns the same reference when state is
972 // unchanged. Returning prev here lets store.setState's Object.is check
973 // skip the listener loop entirely.
974 if (prev.denialTracking === newState) return prev
975 return { ...prev, denialTracking: newState }
976 })
977 }
978}
979
980/**
981 * Check if a denial limit was exceeded and return an 'ask' result

Callers 2

hasPermissionsToUseToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected