MCPcopy Create free account
hub / github.com/codeaashu/claude-code / ruleSourceToOTelSource

Function ruleSourceToOTelSource

src/services/tools/toolExecution.ts:181–194  ·  view source on GitHub ↗

* Map a rule's origin to the documented OTel `source` vocabulary, matching * the interactive path's semantics (permissionLogging.ts:81): session-scoped * grants are temporary, on-disk grants are permanent, and user-authored * denies are user_reject regardless of persistence. Everything the user

(
  ruleSource: string,
  behavior: 'allow' | 'deny',
)

Source from the content-addressed store, hash-verified

179 * config.
180 */
181function ruleSourceToOTelSource(
182 ruleSource: string,
183 behavior: 'allow' | 'deny',
184): string {
185 switch (ruleSource) {
186 case 'session':
187 return behavior === 'allow' ? 'user_temporary' : 'user_reject'
188 case 'localSettings':
189 case 'userSettings':
190 return behavior === 'allow' ? 'user_permanent' : 'user_reject'
191 default:
192 return 'config'
193 }
194}
195
196/**
197 * Map a PermissionDecisionReason to the OTel `source` label for the

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected