/** Token usage metrics for a session (M5-007). */
export interface SessionTokenMetrics {
  input: number;
  output: number;
  cacheRead: number;
  cacheWrite: number;
  total: number;
}

/** Per-session metrics tracked throughout the session lifetime (M5-007). */
export interface SessionMetrics {
  tokens: SessionTokenMetrics;
  modelSwitches: number;
  messageCount: number;
  lastActivityAt: string;
}

export interface SessionInfoDto {
  id: string;
  provider: string;
  modelId: string;
  /** M5-005: human-readable agent name when an agent config is applied. */
  agentName?: string;
  createdAt: string;
  promptCount: number;
  channels: string[];
  durationMs: number;
  /** M5-007: per-session metrics (token usage, model switches, etc.) */
  metrics: SessionMetrics;
}

export interface SessionListDto {
  sessions: SessionInfoDto[];
  total: number;
}

/**
 * Options accepted when creating an agent session.
 * All fields are optional; omitting them falls back to env-var or process defaults.
 */
export interface CreateSessionOptionsDto {
  /** Provider name (e.g. "anthropic", "openai"). */
  provider?: string;
  /** Model ID to use for this session. */
  modelId?: string;
  /**
   * Sandbox working directory for the session.
   * File, git, and shell tools will be restricted to this directory.
   * Defaults to AGENT_FILE_SANDBOX_DIR env var or process.cwd().
   */
  sandboxDir?: string;
  /**
   * Platform-level system prompt for this session.
   * Merged with skill prompt additions (platform prompt first, then skills).
   * Falls back to AGENT_SYSTEM_PROMPT env var when omitted.
   */
  systemPrompt?: string;
  /**
   * Explicit allowlist of tool names available in this session.
   * When provided, only listed tools are registered with the agent.
   * Admins receive all tools; regular users fall back to AGENT_USER_TOOLS
   * env var (comma-separated) when this field is not supplied.
   */
  allowedTools?: string[];
}
