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

Function buildPendingClassifierCheck

src/tools/BashTool/bashPermissions.ts:1460–1482  ·  view source on GitHub ↗

* 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,
)

Source from the content-addressed store, hash-verified

1458 * Returns undefined if classifier is disabled, in auto mode, or no allow descriptions exist.
1459 */
1460function 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
1484const speculativeChecks = new Map<string, Promise<ClassifierResult>>()
1485

Callers 1

bashToolHasPermissionFunction · 0.85

Calls 3

getCwdFunction · 0.85

Tested by

no test coverage detected