Skip to content

API Reference (tRPC)

Runeya expose deux routeurs tRPC : un sur le serveur local (port 9545) et un sur l'agent (port 9546).

Serveur local — Routeurs

Base URL : http://localhost:9545/api/trpc

health

ProcédureTypeDescription
health.checkQuerySanté du serveur (public)

service

ProcédureTypeDescription
service.listQueryListe tous les services
service.getQueryDétails d'un service
service.createMutationCrée un service
service.updateMutationMet à jour un service
service.deleteMutationSupprime un service

project

ProcédureTypeDescription
project.listQueryListe tous les projets
project.createMutationCrée un projet
project.updateMutationMet à jour un projet
project.deleteMutationSupprime un projet

process

ProcédureTypeDescription
process.startMutationDémarre un service
process.stopMutationArrête un service
process.restartMutationRedémarre un service
process.statusSubscriptionStatus temps réel
process.logsSubscriptionLogs temps réel

environment

ProcédureTypeDescription
environment.listQueryListe les environnements
environment.createMutationCrée un environnement
environment.updateMutationMet à jour un environnement
environment.deleteMutationSupprime un environnement
environment.setActiveMutationActive un environnement

agent

ProcédureTypeDescription
agent.listQueryListe les agents
agent.registerMutationEnregistre un agent
agent.healthSubscriptionSanté des agents temps réel

settings

ProcédureTypeDescription
settings.getQueryParamètres globaux
settings.updateMutationMet à jour les paramètres
settings.getNotificationPreferencesQueryPréférences de notifications
settings.updateNotificationPreferencesMutationMute granulaire des notifications
settings.listParsersQueryListe les parsers
settings.getParserQueryDétail d'un parser
settings.createParserMutationCrée un parser
settings.updateParserMutationMet à jour un parser
settings.deleteParserMutationSupprime un parser

chat

ProcedureTypeDescription
chat.conversations.listQueryList conversations
chat.conversations.getQueryGet a conversation
chat.conversations.createMutationCreate a conversation (optionally linked to a scenario or an enterprise)
chat.conversations.updateMutationUpdate conversation title/messages
chat.conversations.deleteMutationDelete a conversation
chat.conversations.archiveMutationArchive/unarchive a conversation
chat.listModelsQueryList available models for the active provider
chat.checkClaudeCodeQueryCheck whether local claude is available
chat.listClaudeCodeModelsQueryList supported Claude Code model aliases
chat.getClaudeUsageQueryRead local Claude usage stats
chat.getCodexUsageQueryRead local Codex usage stats
chat.streamingStatusQueryList active streaming sessions
chat.stopSessionMutationStop an active session
chat.sendViaClaudeCodeSubscriptionStream a response via Claude Code CLI
chat.sendSubscriptionStream a response via provider API

chat.conversations.create input

typescript
{
  title?: string
  isCli?: boolean
  scenarioId?: string
  enterpriseId?: string
  enterpriseInput?: string
}
  • scenarioId and enterpriseId are mutually exclusive.
  • When enterpriseId is set, the backend initializes a workspace in DATA_DIR/enterprise-runs/<conversationId>/.

scenario

ProcedureTypeDescription
scenario.listQueryList scenarios
scenario.getQueryGet a scenario
scenario.createMutationCreate a scenario
scenario.updateMutationUpdate a scenario
scenario.deleteMutationDelete a scenario
scenario.getRunStateQueryRead run state (per conversation)
scenario.getScenarioSnapshotQueryRead the executed scenario snapshot
scenario.getNodeOutputQueryRead a node output
scenario.getNodeMetaQueryRead node metadata
scenario.getNodePredecessorsQueryRead predecessor context links
scenario.getNodePromptQueryRead the resolved prompt for a node
scenario.getSystemContextQueryRead run system context
scenario.sendInputMutationSend user input to an ask_user node
scenario.isRunningQueryCheck whether a run is active
scenario.stopMutationStop an active run
scenario.runSubscriptionStream scenario execution events
scenario.generateWithAISubscriptionStream AI-generated scenario graph content
scenario.generateNameMutationGenerate a short run conversation title

ScenarioEdge schema (input for scenario.create / scenario.update)

typescript
interface ScenarioEdge {
  id: string           // UUID, max 128
  source: string       // source node ID, max 128
  target: string       // target node ID, max 128
  description: string  // branch description, max 500 (default: '')
}

The description field is used by the runner to inject numbered choices (PASS1, PASS2, …) into the AI prompt when a node has multiple outgoing edges. See Data Model — Scenarios for routing behavior.

scenario.generateName behavior

  • The backend sanitizes raw LLM output (quotes, bullets, multiline noise).
  • Generic names (scenario, scenario run, etc.) are rejected.
  • If needed, the server returns a deterministic fallback title derived from scenario data (name/labels/prompts), not an empty/generic value.

enterprise

ProcedureTypeDescription
enterprise.listQueryList enterprises
enterprise.getQueryGet an enterprise
enterprise.createMutationCreate an enterprise
enterprise.updateMutationUpdate an enterprise
enterprise.deleteMutationDelete an enterprise

Agent — Routeurs

Base URL : http://localhost:9546/api/trpc Auth : Authorization: Bearer <passphrase>

health

ProcédureTypeDescription
health.checkQuerySanté de l'agent (public)

process

ProcédureTypeDescription
process.deployMutationDéploie/met à jour la config d'un service
process.startMutationDémarre un processus
process.stopMutationArrête un processus (SIGTERM + grace)
process.restartMutationRedémarre un processus
process.statusSubscriptionStatus temps réel
process.logsSubscriptionLogs temps réel
process.metricsSubscriptionMétriques CPU/RAM temps réel
process.updateConfigMutationMet à jour la config (process arrêté)
process.clearLogsMutationEfface le buffer de logs
process.cancelMutationAnnule une opération en cours

Subscriptions — Format

Les subscriptions utilisent les async generators tRPC v11 :

typescript
// Client-side (Vue)
const subscription = trpc.process.logs.subscribe(
  { serviceId },
  {
    onData: (logLine) => {
      logs.value.push(logLine)
    },
    onError: (err) => {
      console.error('Subscription error', err)
    },
  }
)

// Cleanup
subscription.unsubscribe()

Schémas d'entrée communs

typescript
// Service
{
  id: string           // UUID
  name: string         // max 128
  command: string      // max 2048
  cwd: string          // max 2048
  shell: boolean
  description?: string // max 512
  projectId: string    // UUID
  agentId?: string     // UUID
  parserIds: string[]  // max 50 items
}

// LogLine (sortie des subscriptions)
{
  raw: string
  stream: 'stdout' | 'stderr'
  level: 'error' | 'warn' | 'info' | 'debug'
  message: string      // max 16KB
  hidden: boolean
  metadata: object     // max 100 keys
  json?: object
  timestamp: string    // ISO 8601
}

Erreurs tRPC

CodeDescription
UNAUTHORIZEDToken JWT manquant ou invalide
FORBIDDENPermissions insuffisantes
NOT_FOUNDRessource introuvable
BAD_REQUESTValidation Zod échouée
INTERNAL_SERVER_ERRORErreur serveur inattendue
CONFLICTOpération impossible dans l'état actuel

Released under the MIT License.