Task: Build the core of the agents and dialogs service

Build the core of the agents and dialogs service

Central storage for websites, agents, dialogs, and messages.

Implement the core entities and API of the central service: our websites, associated agents, dialogs, and messages. The website agent should operate through this service rather than as a separate independent system.

Ворклоги

Server Foundation and LLM/API

Based on the actual project state, the core server layer of the agents center has been implemented:

  • added GraphQL operations llmChatCompletion, llmCompletion, llmImageGeneration, llmSpeechGeneration;
  • the common LLM client supports Local and OpenRouter, keys remain on the server;
  • added a shared execution context and GraphQL WebSocket transport;
  • GraphQL LLM operations are currently protected by active user authorization;
  • implemented PostgreSQL/Prisma and the server-side account layer (User, Token, registration, login, profile, sessions, JWT + stored session verification, bcrypt, session revocation);
  • added DB bootstrap and fixed production startup/build.

Related commits recorded in the audit: d3bea97, ea2c78e, b8ce41b, bc95738.

Re-verified locally: TypeScript checks successful, DB compliance with Prisma contract successful, connection to agents-center from the host and from the container successful, the new server on port 3001 responds with HTTP 200, via the proxy on 8080 also HTTP 200.

Important: persistent storage of conversations and full-fledged entities for sites/agents/dialogs/messages as a product layer are not yet completed.

HTTP chat and minimal agent event reaction

Server contracts have been implemented upon which the central dialog service can be built:

  • POST /api/chat supports standard JSON and streaming NDJSON;
  • a unified ExecutionContext carries the execution id, response mode, abort signal, and event dispatch;
  • start, sequential delta, successful completion, error, and cancellation are supported;
  • explicit cancellation via DELETE, cancellation on disconnect/timeout/shutdown, and independence of parallel runs are provided;
  • the Agent class and POST /api/agent with the message.received → Agent.react → message.publish chain have been implemented;
  • actions are linked to the stimulus via stimulusId, and fragments of a single response share a common actionId;
  • the reaction mock has already been replaced with a real call to the existing runChat/LLM.

Re-checks from the audit: HTTP chat 8/8 tests, agent reactions 2/2 tests.

This is the foundation of the dialog component, but so far without persistent conversation memory, event deduplication, and a general model of sites/visitors/dialogs.