forked from retoor/devplacepy
- Add `cmd_isslop_prune`, `cmd_isslop_clear`, `cmd_isslop_analyze` CLI commands for AI usage analysis job management - Register `/game` router with `index` and `farm` endpoints for Code Farm idle game - Add `politics` to allowed TOPICS constant replacing `signals` - Introduce `ISSLOP_DIR`, `ISSLOP_WORKSPACES_DIR`, `ISSLOP_RUNS_DIR`, `ISSLOP_MEDIA_DIR` config paths - Add `clear_user_stars` and `clear_user_projects_cache` calls on vote and project create/delete - Update `make prod` to use `nproc` workers via `DEVPLACE_WEB_WORKERS` env var - Convert `database.py` and `utils.py` to packages for modular structure - Add `devplace apikey` and `devplace token` CLI subcommands for API key and access token management
59 lines
3.3 KiB
HTML
59 lines
3.3 KiB
HTML
<div class="docs-content" data-render>
|
|
# Devii internals
|
|
|
|
Admin-only technical reference for the **Devii** module (`devplacepy/services/devii/`), the
|
|
implementation companion to the functional [Devii Assistant](/docs/devii.html) page members see. It
|
|
covers the module's structure, scopes, data model, security, and operations.
|
|
|
|
> Audience: administrators and maintainers. These pages are hidden from members and guests in the
|
|
> sidebar, the search index, and the documentation export.
|
|
|
|
## What Devii is
|
|
|
|
Devii is an in-platform agentic assistant exposed as a WebSocket terminal at `/devii/ws` and as a
|
|
`devii` console script. It runs a ReAct loop (plan, act, verify, reflect) over a declarative tool
|
|
catalog. A signed-in user's Devii operates that user's own DevPlace account; guests get a sandbox.
|
|
It runs as a configurable background service (`DeviiService`) configured on `/admin/services`.
|
|
|
|
## Module map
|
|
|
|
```
|
|
devplacepy/services/devii/
|
|
service.py DeviiService (BaseService): config fields, limits, metrics, the hub
|
|
hub.py DeviiHub: one DeviiSession per owner-and-channel; shared stores
|
|
session/ DeviiSession (core.py) + prompts: websocket(s), turns, persistence, broadcast
|
|
agent.py Agent: the ReAct driver + system prompt + lesson recall
|
|
registry.py CATALOG: the full tool catalog (union of *_ACTIONS)
|
|
config.py Settings dataclass, ConfigField keys, build_settings()
|
|
llm.py LLMClient (OpenAI-compatible chat)
|
|
http_client.py PlatformClient (operates the account over the platform API)
|
|
store.py ConversationStore, UsageLedger, TurnAudit (main DB)
|
|
cli.py the `devii` console script
|
|
actions/ spec (Action/Param/Catalog), catalog/ (platform endpoints, one module per
|
|
domain), dispatcher, and *_actions for each local handler
|
|
agentic/ ReAct loop, AgenticController, LessonStore, state, compaction
|
|
tasks/ TaskStore, Scheduler, TaskController (autonomous tasks)
|
|
behavior/ virtual_tools/ customization/ notification/ email/ container/ rsearch/
|
|
chunks/ cost/ fetch/ docs/ avatar/ client/ local tool controllers
|
|
```
|
|
|
|
## Request lifecycle
|
|
|
|
1. The browser terminal (or the CLI) sends `{"type":"input","text":...}` over `/devii/ws`.
|
|
2. The router resolves the owner `(owner_kind, owner_id)` and the per-owner `DeviiSession` from the
|
|
`DeviiHub`, enforces the 24h spend cap, then `session.spawn_turn(text)`.
|
|
3. The `Agent` runs the ReAct loop: it must `plan()` first, then calls tools. The `Dispatcher`
|
|
routes each tool to its handler (platform HTTP, or a local controller).
|
|
4. Trace frames stream live to every connected socket; the final reply is broadcast.
|
|
5. After the turn, the session persists the conversation, appends a usage-ledger row, and writes an
|
|
audit row.
|
|
|
|
## The subpages
|
|
|
|
- [Architecture and sessions](/docs/devii-architecture.html) - hub, sessions, websocket, persistence, workers.
|
|
- [Tools and scopes](/docs/devii-tools.html) - the catalog, handler categories, and auth scopes.
|
|
- [Data and persistence](/docs/devii-data.html) - the SQLite tables and the owner-scoping model.
|
|
- [Security and limits](/docs/devii-security.html) - isolation, spend caps, eval toggle, audit.
|
|
- [Configuration and CLI](/docs/devii-config.html) - service config fields, env vars, the `devii` CLI.
|
|
</div>
|