Back to MarketplaceDocumentation

Developer

Runtime APIs and Integration

Developer notes for extending the Freelee runtime, publishing bots from T1000 and preserving the narrative chat contract.

Narrative Chat

Runtime chat uses /api/chat with agentSlug, sessionId and responseContract. User mode controls are hidden; the backend resolves fast/smart/deep from audience and organization_ai_settings.

Internal Admin API

T1000 calls /api/internal/admin/freelee/* with a private service token. These endpoints are not browser-facing public APIs.

Publish Flow

T1000 stores draft master bots in freelee_control, then publishes selected bots into Freelee runtime agents through the internal API.

Runtime Stack

Freelee runs as a Next.js app behind nginx and PM2. The public runtime source is /var/www/freelee.cv.

Database

Freelee Control database contract

Freelee Control is split deliberately: T1000 designs and stages, while Freelee validates and runs. Keep new owner tools in T1000 and keep the public app focused on registration, dashboard and chat.

aigencydb

Runtime source of truth

freelee.cv

Stores users, sessions, preferences, categories, sectors, published agents, technical runtime defaults, chat threads and messages.

freelee_control

Owner planning inventory

T1000

Stores master instructor profiles, professional owner-facing voice, prompt versions, category links, future sector links and publish logs.

service-token API

Write boundary

Freelee internal API

T1000 writes to Freelee through /api/internal/admin/freelee/* using FREELEE_ADMIN_SERVICE_TOKEN. Public browser code never receives that token.

Implementation contracts

Technical settings

organization_ai_settings controls default audience, B2C/B2B/B2G mode mapping, deep sleep state and model configs.

Instructors

freelee_control.bot_profiles holds 60 master instructor records: 20 categories x B2C/B2B/B2G.

Professional voice

Each master instructor stores persona_json.professionalVoice and card_json.ownerBrief for owner-side testing and future bot design.

Runtime publishing

Publishing creates or updates aigencydb.agents plus taxonomy links through Freelee internal API validation.

Chat profile

agents.interaction_profile defines session options, category actions, accent color, risk level, suggestions and A/B/C behavior.

Developer Paths

Runtime

/var/www/freelee.cv

T1000 Backend

/var/www/admin-panel/backend/src/routes/freelee.ts

T1000 UI

/var/www/admin-panel/frontend/src/pages/FreeleeControl.tsx

Project Map

/var/www/freelee.cv/docs/freelee-control-plane.md