MCPcopy Create free account
hub / github.com/Noumena-Network/code / ruleSourceToOTelSource

Function ruleSourceToOTelSource

src/services/tools/toolExecution.ts:182–195  ·  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

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected