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