managarten/packages/shared-research/src/ids.ts
Till JS f10a95e842 feat(mana-research): add Gemini 3.1 Pro Deep Research async providers
- New providers gemini-deep-research + gemini-deep-research-max on the
  Interactions API (preview-04-2026). Submit/poll split, tier parameter
  selects between standard (~minutes, $1–3) and max (up to 60 min, $3–7).
- Parser matches the real response shape: flat `outputs` array of
  thought|text|image items, url_citation annotations without title,
  `usage.total_input_tokens` / `total_output_tokens`.
- Route generalisation: /v1/research/async accepts `provider` with
  default 'openai-deep-research' (backward compatible) and dispatches
  to the right submit/poll pair.
- New internal service-to-service endpoint /v1/internal/research/async
  gated by X-Service-Key + X-User-Id for credit accounting. Enables
  mana-ai to drive deep-research jobs on the mission owner's wallet
  without requiring a user JWT.
- Pricing: 300 credits (standard) / 1500 credits (max). Conservative
  markup over the ~$3/$7 ceiling so the first runs can't surprise us.
- Docs: AGENT_PROVIDER_IDS + pricing + env map + auto-router stay in
  sync; CLAUDE.md Phase 3b now current; API_KEYS.md references the
  new providers under GOOGLE_GENAI_API_KEY.

Verified with a real smoke test against the Gemini API: submit + poll
both succeed, completed response parsed cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 17:55:30 +02:00

40 lines
1.1 KiB
TypeScript

export const SEARCH_PROVIDER_IDS = [
'searxng',
'brave',
'tavily',
'exa',
'serper',
'duckduckgo',
] as const;
export const EXTRACT_PROVIDER_IDS = [
'readability',
'jina-reader',
'firecrawl',
'scrapingbee',
] as const;
export const AGENT_PROVIDER_IDS = [
'perplexity-sonar',
'claude-web-search',
'openai-responses',
'gemini-grounding',
'openai-deep-research',
'gemini-deep-research',
'gemini-deep-research-max',
] as const;
export type SearchProviderId = (typeof SEARCH_PROVIDER_IDS)[number];
export type ExtractProviderId = (typeof EXTRACT_PROVIDER_IDS)[number];
export type AgentProviderId = (typeof AGENT_PROVIDER_IDS)[number];
export type ProviderId = SearchProviderId | ExtractProviderId | AgentProviderId;
export type ProviderCategory = 'search' | 'extract' | 'agent';
export type BillingMode = 'server-key' | 'byo-key' | 'free';
export function providerCategory(id: ProviderId): ProviderCategory {
if ((SEARCH_PROVIDER_IDS as readonly string[]).includes(id)) return 'search';
if ((EXTRACT_PROVIDER_IDS as readonly string[]).includes(id)) return 'extract';
return 'agent';
}