MCPcopy
hub / github.com/codeaashu/claude-code / isPolicyAllowed

Function isPolicyAllowed

src/services/policyLimits/index.ts:510–526  ·  view source on GitHub ↗
(policy: string)

Source from the content-addressed store, hash-verified

508 * essential-traffic-only mode is active and the cache is unavailable.
509 */
510export function isPolicyAllowed(policy: string): boolean {
511 const restrictions = getRestrictionsFromCache()
512 if (!restrictions) {
513 if (
514 isEssentialTrafficOnly() &&
515 ESSENTIAL_TRAFFIC_DENY_ON_MISS.has(policy)
516 ) {
517 return false
518 }
519 return true // fail open
520 }
521 const restriction = restrictions[policy]
522 if (!restriction) {
523 return true // unknown policy = allowed
524 }
525 return restriction.allowed
526}
527
528/**
529 * Get restrictions synchronously from session cache or file

Callers 15

runFunction · 0.85
isEnabledFunction · 0.85
useFeedbackSurveyFunction · 0.85
useMemorySurveyFunction · 0.85
initReplBridgeFunction · 0.85
index.tsFile · 0.85
isHiddenFunction · 0.85
index.tsFile · 0.85
isHiddenFunction · 0.85
checkBridgePrerequisitesFunction · 0.85

Calls 3

getRestrictionsFromCacheFunction · 0.85
isEssentialTrafficOnlyFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected