autoModeDenials.ts
utils/autoModeDenials.ts
27
Lines
720
Bytes
3
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with modes. It contains 27 lines, 1 detected imports, and 3 detected exports.
Important relationships
Detected exports
AutoModeDenialrecordAutoModeDenialgetAutoModeDenials
Keywords
automodedenialdenialsdeniedfeaturecommandreadonlymax_denialsdenialtrackscommands
Detected imports
bun:bundle
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* Tracks commands recently denied by the auto mode classifier.
* Populated from useCanUseTool.ts, read from RecentDenialsTab.tsx in /permissions.
*/
import { feature } from 'bun:bundle'
export type AutoModeDenial = {
toolName: string
/** Human-readable description of the denied command (e.g. bash command string) */
display: string
reason: string
timestamp: number
}
let DENIALS: readonly AutoModeDenial[] = []
const MAX_DENIALS = 20
export function recordAutoModeDenial(denial: AutoModeDenial): void {
if (!feature('TRANSCRIPT_CLASSIFIER')) return
DENIALS = [denial, ...DENIALS.slice(0, MAX_DENIALS - 1)]
}
export function getAutoModeDenials(): readonly AutoModeDenial[] {
return DENIALS
}