// AdaptivePromptRouter.js\n\nimport { readWorkspaceFile } from '../utils/workspace';\nimport { Tooling } from '../types/tools';\n\n// Tier 1: Reflex - Identity Only\nconst reflexPrompt = (identity) => `Yo, I'm ${identity}. What's up?`;\n\n// Tier 2: Essential - Identity + Core Tools (max 5 tools, e.g., file I/O, search, HTTP)\nconst essentialPrompt = (identity, tools) => {\n  const toolSections = tools.map((tool) => {\n    return `\n## ${tool.name}\n${tool.description}\n`;\n  }).join('');\n  return `\n${reflexPrompt(identity)}\n${toolSections}\n`;\n};\n\n// Tier 3: Standard - Identity + Most Tools (all core tools + up to 5 additional)\nconst standardPrompt = (identity, tools, additionalTools) => {\n  const allTools = [...tools, ...additionalTools];\n  const toolSections = allTools.map((tool) => {\n    return `\n## ${tool.name}\n${tool.description}\n`;\n  }).join('');\n  return `\n${reflexPrompt(identity)}\n${toolSections}\n`;\n};\n\n// Tier 4: Extended - All Tools + Large Context (rarely needed, e.g., large codebases)\nconst extendedPrompt = (identity, allTools, largeContext) => {\n  const toolSections = allTools.map((tool) => {\n    return `\n## ${tool.name}\n${tool.description}\n`;\n  }).join('');\n  return `\n${reflexPrompt(identity)}\n${toolSections}\n\n${largeContext}\n`;\n};\n\n// Auto-Classification based on task complexity\nconst autoClassifyTask = (task) => {\n  if (task.complexity <= 2) return 'reflex';\n  if (task.complexity <= 5) return 'essential';\n  if (task.complexity <= 10) return 'standard';\n  return 'extended';\n};\n\n// Adaptive Prompt Router\nconst adaptivePromptRouter = (task, identity, tools) => {\n  const tier = autoClassifyTask(task);\n  switch (tier) {\n    case 'reflex':\n      return reflexPrompt(identity);\n    case 'essential':\n      return essentialPrompt(identity, tools.slice(0, 5));\n    case 'standard':\n      return standardPrompt(identity, tools.slice(0, 5), tools.slice(5, 10));\n    case 'extended':\n      return extendedPrompt(identity, tools, 'This is a large context.');\n    default:\n      throw new Error(`Invalid tier: ${tier}`);\n  }\n};\n\nexport { adaptivePromptRouter };\n