Files
DECNET/decnet/realism/__init__.py
anti 0b9873982d refactor(realism): move emailgen LLM/personas/prompt into shared library
Lift the format-agnostic pieces from decnet/orchestrator/emailgen/
into the new decnet/realism/ library so file-class content generation
(stage 3 of the realism migration) can reuse them. Email-specific
delivery (RFC 2822 EML, IMAP/POP3 spool, thread chains) stays in
orchestrator/.

Renames (history-preserving git mv):
  emailgen/personas.py     -> realism/personas.py
  emailgen/prompt.py       -> realism/prompts/email.py
  emailgen/global_pool.py  -> realism/personas_pool.py
  emailgen/llm/            -> realism/llm/

Env-var clean break (pre-v1, no aliases):
  DECNET_EMAILGEN_LLM      -> DECNET_REALISM_LLM
  DECNET_EMAILGEN_MODEL    -> DECNET_REALISM_MODEL
  DECNET_EMAILGEN_TIMEOUT  -> DECNET_REALISM_TIMEOUT
  DECNET_EMAILGEN_PERSONAS -> DECNET_REALISM_PERSONAS
  DECNET_EMAILGEN_FAKE_OUTPUT -> DECNET_REALISM_FAKE_OUTPUT

Importers rewritten in: orchestrator/emailgen/scheduler.py,
orchestrator/drivers/email.py, web/router/{emailgen,topology}/
api_personas.py, cli/emailgen.py. Tests for moved modules relocated
to tests/realism/; tests for stay-put modules updated in place.

API URL `/api/v1/emailgen/personas` and CLI `decnet emailgen
import-personas` keep their public names until the service-collapse
commit (stage 5).
2026-04-27 16:05:43 -04:00

28 lines
1.4 KiB
Python

"""Realism library — synthetic content + scheduling primitives.
A shared, importable library that produces *plausible* artifacts (file
names, file bodies, email content) and the diurnal/persona machinery
that decides *when* and *for whom* to produce them.
Workers (orchestrator, canary cultivator, future-emailgen-equivalents)
import from here. This package owns:
* :mod:`decnet.realism.taxonomy` — :class:`ContentClass` enum and the
:class:`Plan` dataclass that planners emit.
* :mod:`decnet.realism.diurnal` — work-hours gating and a backdated
``mtime`` sampler so planted files don't all stamp at wall-clock-now.
* :mod:`decnet.realism.planner` — picks ``(decky, persona, class,
action, mtime)`` tuples for the orchestrator's tick loop.
* :mod:`decnet.realism.personas` — persona schema (the
:class:`EmailPersona` record describing each fictional employee).
* :mod:`decnet.realism.prompts` — prompt builders, one per content
class, sharing an em-dash-suppression style helper.
* :mod:`decnet.realism.llm` — :class:`LLMBackend` ABC + factory + impl
subpackage; pluggable text-generation backend.
The library has **no worker, no systemd unit, no CLI of its own** —
it's plain Python that consumers import. The CLI surface that does
exist (``decnet realism import-personas``) is registered by
:mod:`decnet.cli.realism` after stage 5 of the migration.
"""