π File detail
utils/statusNoticeHelpers.ts
π§© .tsπ 21 linesπΎ 673 bytesπ text
β Back to All Filesπ― Use case
This file lives under βutils/β, which covers cross-cutting helpers (shell, tempfiles, settings, messages, process input, β¦). On the API surface it exposes AGENT_DESCRIPTIONS_THRESHOLD and getAgentDescriptionsTotalTokens β mainly functions, hooks, or classes. It composes internal code from services and tools (relative imports).
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { roughTokenCountEstimation } from '../services/tokenEstimation.js' import type { AgentDefinitionsResult } from '../tools/AgentTool/loadAgentsDir.js' export const AGENT_DESCRIPTIONS_THRESHOLD = 15_000
π€ Exports (heuristic)
AGENT_DESCRIPTIONS_THRESHOLDgetAgentDescriptionsTotalTokens
π₯οΈ Source preview
import { roughTokenCountEstimation } from '../services/tokenEstimation.js'
import type { AgentDefinitionsResult } from '../tools/AgentTool/loadAgentsDir.js'
export const AGENT_DESCRIPTIONS_THRESHOLD = 15_000
/**
* Calculate cumulative token estimate for agent descriptions
*/
export function getAgentDescriptionsTotalTokens(
agentDefinitions?: AgentDefinitionsResult,
): number {
if (!agentDefinitions) return 0
return agentDefinitions.activeAgents
.filter(a => a.source !== 'built-in')
.reduce((total, agent) => {
const description = `${agent.agentType}: ${agent.whenToUse}`
return total + roughTokenCountEstimation(description)
}, 0)
}