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

Function tryClassifier

src/hooks/toolPermission/PermissionContext.ts:176–213  ·  view source on GitHub ↗
(
            pendingClassifierCheck: PendingClassifierCheck | undefined,
            updatedInput: Record<string, unknown> | undefined,
          )

Source from the content-addressed store, hash-verified

174 ...(feature('BASH_CLASSIFIER')
175 ? {
176 async tryClassifier(
177 pendingClassifierCheck: PendingClassifierCheck | undefined,
178 updatedInput: Record<string, unknown> | undefined,
179 ): Promise<PermissionDecision | null> {
180 if (tool.name !== BASH_TOOL_NAME || !pendingClassifierCheck) {
181 return null
182 }
183 const classifierDecision = await awaitClassifierAutoApproval(
184 pendingClassifierCheck,
185 toolUseContext.abortController.signal,
186 toolUseContext.options.isNonInteractiveSession,
187 )
188 if (!classifierDecision) {
189 return null
190 }
191 if (
192 feature('TRANSCRIPT_CLASSIFIER') &&
193 classifierDecision.type === 'classifier'
194 ) {
195 const matchedRule = classifierDecision.reason.match(
196 /^Allowed by prompt rule: "(.+)"$/,
197 )?.[1]
198 if (matchedRule) {
199 setClassifierApproval(toolUseID, matchedRule)
200 }
201 }
202 logPermissionDecision(
203 { tool, input, toolUseContext, messageId, toolUseID },
204 { decision: 'accept', source: { type: 'classifier' } },
205 undefined,
206 )
207 return {
208 behavior: 'allow' as const,
209 updatedInput: updatedInput ?? input,
210 userModified: false,
211 decisionReason: classifierDecision,
212 }
213 },
214 }
215 : {}),
216 async runHooks(

Callers

nothing calls this directly

Calls 4

featureFunction · 0.85
setClassifierApprovalFunction · 0.85
logPermissionDecisionFunction · 0.85

Tested by

no test coverage detected