πŸ“„ File detail

utils/model/aliases.ts

🧩 .tsπŸ“ 26 linesπŸ’Ύ 793 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 MODEL_ALIASES, ModelAlias, isModelAlias, MODEL_FAMILY_ALIASES, and isModelFamilyAlias β€” mainly types, interfaces, or factory objects.

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

export const MODEL_ALIASES = [ 'sonnet', 'opus', 'haiku', 'best',

πŸ“€ Exports (heuristic)

  • MODEL_ALIASES
  • ModelAlias
  • isModelAlias
  • MODEL_FAMILY_ALIASES
  • isModelFamilyAlias

πŸ–₯️ Source preview

export const MODEL_ALIASES = [
  'sonnet',
  'opus',
  'haiku',
  'best',
  'sonnet[1m]',
  'opus[1m]',
  'opusplan',
] as const
export type ModelAlias = (typeof MODEL_ALIASES)[number]

export function isModelAlias(modelInput: string): modelInput is ModelAlias {
  return MODEL_ALIASES.includes(modelInput as ModelAlias)
}

/**
 * Bare model family aliases that act as wildcards in the availableModels allowlist.
 * When "opus" is in the allowlist, ANY opus model is allowed (opus 4.5, 4.6, etc.).
 * When a specific model ID is in the allowlist, only that exact version is allowed.
 */
export const MODEL_FAMILY_ALIASES = ['sonnet', 'opus', 'haiku'] as const

export function isModelFamilyAlias(model: string): boolean {
  return (MODEL_FAMILY_ALIASES as readonly string[]).includes(model)
}