import type { ServiceContract } from '../ServiceContract';

export const IInferenceService: ServiceContract = {
  id: 'inference',
  description: 'Inference provider routing — LLM completion, streaming, credential management',
  ops: {
    'infer': {
      description: 'Single-turn LLM completion',
      payload: {
        prompt: { type: 'string', required: true, description: 'Prompt text' },
        model: { type: 'string', required: false, description: 'Model override' },
        maxTokens: { type: 'number', required: false },
      },
      response: {
        ok: { type: 'boolean' },
        text: { type: 'string' },
        model: { type: 'string' },
        usage: { type: 'object' },
      },
    },
    'infer.stream': {
      description: 'Streaming LLM completion',
      payload: {
        prompt: { type: 'string', required: true },
        model: { type: 'string', required: false },
      },
      response: {
        ok: { type: 'boolean' },
        streamId: { type: 'string' },
      },
    },
    'infer.messages': {
      description: 'Multi-turn chat completion',
      payload: {
        messages: { type: 'Message[]', required: true },
        model: { type: 'string', required: false },
      },
      response: {
        ok: { type: 'boolean' },
        message: { type: 'Message' },
        usage: { type: 'object' },
      },
    },
  },
};
