Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript
2.5 KB
Raw Blame
import type { ReactNode } from 'react'
import type { LlmPolicy, LlmProvider } from '@/lib/llm'

export type McpServer = {
  metadata?: { name?: string; namespace?: string }
  spec?: Record<string, unknown>
}

export type SecretMeta = {
  metadata?: { name?: string; namespace?: string }
  name?: string
  // Data-key names only; Secret values are never included in this response.
  keys?: string[]
  type?: string
}

export type ContextOption = {
  contextId: string
  mcpServers: string[]
  name: string
  namespace: string
}

export type ChannelOption = {
  name: string
  namespace: string
  spec: Record<string, unknown>
}

// A sibling resource this wizard run created via a create-only POST, tracked so
// a later failure (before the Host exists) can compensate it with an inverse
// DELETE. ONLY POSTs succeeded by THIS submit are recorded — never inferred from
// slug or label ownership. The channel `mode=existing` PUT is an edit of a
// pre-existing resource and is NEVER tracked here.
export type CreatedResource = {
  kind: 'secret' | 'context' | 'communication-channel'
  name: string
}

// LLM Secret mode for Host create. A broker-only chain hides this entirely
// and omits spec.secretRef; mixed/static chains still require an exact Secret.
export type HostLlmSecretMode = 'existing' | 'new'

// TASK-229: onCreated receives the created agent's identifier (metadata.name)
// so page hosts can route to the new agent's detail view. Optional payload
// keeps older no-arg consumers (tests, modal hosts) source-compatible.
export type HostWizardProps = {
  existingSecrets: SecretMeta[]
  mcpServers: McpServer[]
  mode?: 'modal' | 'page'
  onClose: () => void
  onCreated: (created?: { name: string }) => Promise<void>
  pageHeader?: ReactNode
}

export type WizardSelectOption = {
  group?: string
  label: ReactNode
  meta?: ReactNode
  providers?: { id: string; label: string }[]
  value: string
}

export type WizardSelectProps = {
  className?: string
  disabled?: boolean
  onChange: (value: string) => void
  options: WizardSelectOption[]
  placeholder: string
  value: string
}

export type HostWizardValidationState = {
  hostName: string
  secretMode: 'existing' | 'new'
  existingSecret: string
  existingLlmSecret: string
  newSecretName: string
  llmKeyDraft: Record<string, string>
  llmPolicy: LlmPolicy | undefined
  provider: LlmProvider
  modelName: string
  connectionRef: string
  /** Models the subscription picker offers for the selected connection. */
  brokerModelOptions: string[]
}