wulf-pulse/lib/services/llm/models.ts
lorentz 1112a06afe feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul
- RMM Overshell (migration 077): admin page, dispatch UI, executor/worker, target
  resolver, script registry (AD/DHCP/DNS/event-log/services/software/network/loglift)
- LogLift evidence pipeline (migration 078): upload webhook, B2 storage client,
  receiver/matcher, EventLogCollector PowerShell script
- IT Glue audit + write-back (migrations 075, 076): asset-audit runner, ticket
  xrefs, applications/configurations browse pages + apply/revert/audit endpoints
- Link-aware analyzer bundles (migration 073) + provider toggle (migration 074):
  link-discovery service, OpenRouter LLM provider, related-tickets/itglue-suggestion
  panels, analyze-bundle endpoint
- Endpoint data model + device-link reconciliation (migrations 079, 080): conflicts
  admin page, reconciler service, resolve endpoints
- Dashboard overhaul: integration-health service + alerts, overview/health endpoints
- Permissions: add itglue + rmm scopes; middleware: public /api/rmm/loglift route

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 07:13:18 -04:00

76 lines
2.4 KiB
TypeScript

/**
* Canonical model IDs for the AI Ticket Analyzer pipeline.
*
* Use these constants — never hardcode the strings elsewhere.
*
* Verify quarterly against https://docs.claude.com/en/docs/about-claude/models
* and OpenRouter's model list. Model IDs change rarely but pricing and
* capability tiers can shift.
*/
// Anthropic
export const HAIKU = 'claude-haiku-4-5' as const;
export const SONNET = 'claude-sonnet-4-6' as const;
export const OPUS = 'claude-opus-4-7' as const;
// OpenRouter / DeepSeek
export const DEEPSEEK_V4_FLASH = 'deepseek/deepseek-v4-flash' as const;
export const DEEPSEEK_V4_PRO = 'deepseek/deepseek-v4-pro' as const;
export const DEEPSEEK_R1 = 'deepseek/deepseek-r1-0528' as const;
export type AnthropicModelId = typeof HAIKU | typeof SONNET | typeof OPUS;
export type OpenRouterModelId =
| typeof DEEPSEEK_V4_FLASH
| typeof DEEPSEEK_V4_PRO
| typeof DEEPSEEK_R1;
export type ModelId = AnthropicModelId | OpenRouterModelId;
export type Provider = 'anthropic' | 'openrouter';
/**
* Per-stage model picks for each provider. The pipeline reads from this when
* the user picks a provider — every stage knows what model to call without
* the caller having to wire up four constants.
*/
export interface StageModels {
triage: ModelId;
deep_analysis: ModelId;
deep_reasoning: ModelId;
fingerprint: ModelId;
/** Aggregate-reduce step (cross-ticket bundle reports). */
aggregate_reduce: ModelId;
/** Haiku-suggested-links arm in link-discovery. */
link_suggest: ModelId;
}
export const ANTHROPIC_STAGE_MODELS: StageModels = {
triage: HAIKU,
deep_analysis: SONNET,
deep_reasoning: OPUS,
fingerprint: HAIKU,
aggregate_reduce: SONNET,
link_suggest: HAIKU,
};
export const OPENROUTER_STAGE_MODELS: StageModels = {
triage: DEEPSEEK_V4_FLASH,
deep_analysis: DEEPSEEK_V4_PRO,
deep_reasoning: DEEPSEEK_R1,
fingerprint: DEEPSEEK_V4_FLASH,
aggregate_reduce: DEEPSEEK_V4_PRO,
link_suggest: DEEPSEEK_V4_FLASH,
};
export function stageModelsFor(provider: Provider): StageModels {
return provider === 'openrouter'
? OPENROUTER_STAGE_MODELS
: ANTHROPIC_STAGE_MODELS;
}
/**
* Detect provider from a model id. Anthropic ids start with `claude-`;
* OpenRouter ids contain a `/`. Used by the LLM call layer to dispatch.
*/
export function providerForModel(model: ModelId): Provider {
return model.includes('/') ? 'openrouter' : 'anthropic';
}