* Builds the pending classifier check metadata if classifier is enabled and has allow descriptions. * Returns undefined if classifier is disabled, in auto mode, or no allow descriptions exist.
( command: string, toolPermissionContext: ToolPermissionContext, )
| 1457 | * Returns undefined if classifier is disabled, in auto mode, or no allow descriptions exist. |
| 1458 | */ |
| 1459 | function buildPendingClassifierCheck( |
| 1460 | command: string, |
| 1461 | toolPermissionContext: ToolPermissionContext, |
| 1462 | ): { command: string; cwd: string; descriptions: string[] } | undefined { |
| 1463 | if (!isClassifierPermissionsEnabled()) { |
| 1464 | return undefined |
| 1465 | } |
| 1466 | // Skip in auto mode - auto mode classifier handles all permission decisions |
| 1467 | if (feature('TRANSCRIPT_CLASSIFIER') && toolPermissionContext.mode === 'auto') |
| 1468 | return undefined |
| 1469 | if (toolPermissionContext.mode === 'bypassPermissions') return undefined |
| 1470 | |
| 1471 | const allowDescriptions = getBashPromptAllowDescriptions( |
| 1472 | toolPermissionContext, |
| 1473 | ) |
| 1474 | if (allowDescriptions.length === 0) return undefined |
| 1475 | |
| 1476 | return { |
| 1477 | command, |
| 1478 | cwd: getCwd(), |
| 1479 | descriptions: allowDescriptions, |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | const speculativeChecks = new Map<string, Promise<ClassifierResult>>() |
| 1484 |
no test coverage detected