πŸ“„ 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_THRESHOLD
  • getAgentDescriptionsTotalTokens

πŸ–₯️ 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)
}