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

export const IWorkstreamService: ServiceContract = {
  id: 'workstream',
  description: 'Generic durable workstream actor surface for status, requests, plans, and child agents',
  ops: {
    'workstream.status': {
      description: 'Get current workstream summary and mission state',
      payload: {},
      response: {
        ok: { type: 'boolean' },
        name: { type: 'string' },
        purpose: { type: 'string' },
        regime: { type: 'string' },
        promptable: { type: 'boolean' },
        pendingRequests: { type: 'number' },
        activeAgentCount: { type: 'number' },
      },
    },
    'workstream.request': {
      description: 'Submit an external request into the workstream inbox',
      payload: {
        text: { type: 'string', required: true, description: 'Request text or instruction' },
        from: { type: 'string', required: false, description: 'Requesting actor or operator' },
        priority: { type: 'string', required: false, description: 'Optional priority label' },
      },
      response: {
        ok: { type: 'boolean' },
        requestId: { type: 'string' },
        status: { type: 'string' },
      },
    },
    'workstream.plan': {
      description: 'Get the active plan for the workstream',
      payload: {},
      response: {
        ok: { type: 'boolean' },
        plan: { type: 'object', required: false },
      },
    },
    'workstream.agents': {
      description: 'List the workstream actor and any visible child agents or executions',
      payload: {},
      response: {
        ok: { type: 'boolean' },
        agents: { type: 'array' },
      },
    },
  },
};
