mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
* feat(video): Phase A — VideoEngine origination spine + held-source gates
New default-off engine skeleton: opens a UX/UI authoring task (source=video, assigned to a ux-dev, LOW complexity to clear the dev-needs-subtasks guard) and materializes a held CEO-approval draft (source=video_post). Excludes video_post from all three held-source skip sites; adds the video_draft marker, six config flags, and the feature-flag entries. Origination + gate behavior unit-tested.
* refactor(orchestrator): fold _dispatch_dev_work skip chain into a helper
The per-source if/continue chain grew past xenon's --max-absolute B when the video_post held source joined it. Extract _is_non_dev_dispatch_source (every held-CEO source plus the two Board exploration sources) so the dev loop's skip is one flat call. Behavior-identical.
* feat(video): Phase B — propose_video do-tool (metadata-only, team-gated)
UX/UI dev records a video's composition ref + per-platform captions onto the authoring task's video_draft marker. Team-gated at runtime via _caller_team (Role.DEVELOPER can't tell a ux-dev from a be-dev). Resolves the caller's ACTIVE task via get_active_task_for_agent, not an oldest-first scan that would clobber a second open video task. Metadata only, no render. Wired through do_server + route + schema; added to _DEV_DO.
* feat(video): Phase D — render loop + RemotionRenderer client
Orchestrator-async _video_render_loop renders a completed authoring task's merged composition to MP4 (vertical + square) via the remotion-renderer sidecar and materializes the held video_post draft. RemotionRenderer tars the read-clone's motion/ source, POSTs it, and saves the returned MP4 bytes to a TASK-scoped local path (no shared volume; a composition is reused across videos so a composition-scoped path would clobber an earlier draft). Render failures bounded-retry (read-clone catch-up window, transient sidecar) up to a cap, then terminal-fail. Client tested vs a mock transport; loop vs a mock renderer + real DB.
* feat(video): Phase C — release / spotlight / on-demand video triggers
Three entry points open a UX/UI video-authoring task via VideoEngine.open_video_task: (1) a published release drafts a companion video — best-effort in ReleaseProposalService.approve, never fails the publish; script from the CHANGELOG via the local model with a template fallback. (2) propose_feature_spotlight gains optional wants_video/video_script — best-effort, gated on video_on_spotlight, default-off leaves the spotlight flow byte-for-byte unchanged. (3) POST /video/request (CEO-only) for an on-demand brief, with clean disabled/not_opened responses. All gated on video_engine_enabled.
* fix(video): savepoint-isolate video-task inserts (F042 poisoned session)
The best-effort try/except around open_video_task (release-publish + spotlight hooks) swallowed the Python exception, but a DBAPI error at the insert flush left the shared session must-rollback — so the caller's next commit (release finalize / request boundary) threw PendingRollbackError: the release stuck 'pending' after actually publishing, or the spotlight draft + HTTP response were lost. Wrap both inserts (open_video_task, _originate_video_post) in a begin_nested savepoint (the repo's established F042 pattern) so a DB error rolls back only the insert. open_video_task returns None (every caller already handles it); _originate_video_post propagates to the render loop's handler. Regression test: an insert FK error returns None with the session left usable. Dormant while the flags were off; armed on the NAS.
* feat(video): Phase G — motion/ package + remotion-renderer sidecar + compose
In-repo Remotion v4 motion/ package (ReleaseAnnouncement composition; calculateMetadata returns 1080x1920 vertical / 1080x1080 square from inputProps.orientation) + a credential-free remotion-renderer sidecar: untar the POSTed motion/ source, bundle (LRU-cached per source sha), selectComposition + renderMedia h264, stream the MP4 bytes back — matching the RemotionRenderer client contract. docker/remotion.Dockerfile on Debian (Chrome apt deps, build-time Chrome pre-warm, ffmpeg bundled in @remotion/renderer). Wired into both compose files (roboco_default only, shm_size 1gb, /health check) + the release publish matrix. Verified via a real local render of both cuts; the Debian docker build is the CEO's to run.
* chore(video): D-hardening — video_post source_task_id + render-loop docstring
Add a source_task_id back-reference to the video_post held-draft marker (traceability from a draft to its authoring task; also makes the render loop's two-key idempotency check wireable later). Fix the render-loop test's stale docstring ('never retried' -> bounded-retry). Both from the Phase D critic's non-blocking follow-ups.
* feat(video): Phase E1 — VideoPostService + heartbeat mutex (approve->post)
CEO-approve->post service: heartbeat-renewed Redis mutex (fail-closed, grace=ttl-2*heartbeat), re-read-in-lock double-post guard, per-platform durable commits (asyncio.shield-ed, settle-before-rollback on lock-loss), all writes inside the lock (captions validated pre-lock, applied in-lock — no stale whole-column clobber), idempotent, per-platform retry-skip. Poster interfaces (X/TikTok, mocked here). Reject + list-held-drafts. Survived 3 adversarial rounds; residual = a crash in the poster->commit window (CEO-gated low-freq, documented).
* fix(video): G-hardening — renderer leaks + Share Tech Mono brand font
Sidecar: give bundle() an explicit outDir tracked + deleted on LRU eviction (was leaking ~19MB remotion-webpack-bundle-* per source); res.on('close') cleanup so an aborted/retried download no longer leaks its remotion-out-* MP4 dir. Fonts: vendor Share Tech Mono (roboco-website brand font) as the display face (self-hosted woff2, 400-weight, headline fontWeight 700->400 to avoid faux-bold) + self-hosted Inter body — no gstatic fetch at render time (lsof-verified). Extras: composition_id whitelist (400) + Multer error middleware (400/413).
* feat(video): Phase E2 — X v2 + TikTok posters, tiktok_credentials, routes
LiveXVideoPoster (X v2 chunked media upload: init/append/finalize/STATUS-poll -> tweet w/ media_ids, OAuth1 signer reused). LiveTikTokPoster (OAuth2 inbox: init -> chunked PUT with asymmetric final chunk -> status-fetch; 401 -> refresh_token grant, rotated token persisted). tiktok_credentials Fernet singleton + migration 062 (single head). Routes: CEO approve/reject + list held drafts + write-only tiktok creds, wiring real posters into VideoPostService. Residual: a lock-loss right after a token-refresh flush can discard the rotated token (same rare CEO-gated class as the documented post->commit window).
* feat(video): Phase F — panel video-post queue + TikTok creds card + flags
video-post-queue.tsx: <video> MP4 preview with 9:16/1:1 cut switch, per-platform editable captions (280/2200 counters, over-limit disables approve), approve/reject, Request-a-video dialog. tiktok-credentials-card.tsx (4 write-only OAuth2 fields). feature-flags-card inlines TikTokCredentialsForm under video_engine_enabled. Mounted in command-center. tsc/eslint clean, 273 panel tests green. NOTE: needs the GET /video/posts/{id}/media route + mp4_paths on VideoPostResponse (folded into H) for the preview source.
* feat(video): Phase H — media route + e2e smoke + NAS arming + docs
GET /video/posts/{id}/media?cut= (CEO-gated FileResponse of the rendered MP4; closes the panel preview gap) + mp4_paths on VideoPostResponse. e2e smoke tests/e2e_smoke/test_video_pipeline.py (full flow, sidecar+X/TikTok mocked; asserts dispatcher skips, render-loop materialize, propose_video team-gate, approve idempotency). NAS arming: docker-compose.yml/.yaml ROBOCO_VIDEO_ENGINE_ENABLED/ON_RELEASE/ON_SPOTLIGHT default-on (.yaml resynced to .yml); registry stays off. CLAUDE.md video-engine section + CHANGELOG. Fixed 2 pre-existing route-test pollution leaks. Full suite 11763 passed.
* fix(video): auth-carrying preview, media route confinement, VideoPost type drift
Three fixes along the video preview path:
1. panel video preview auth: the <video> element was pointed straight at
GET /video/posts/{id}/media, but a native <video src> GET carries none
of axios's X-Agent-ID/X-Agent-Role headers — so in the default
header-trust deployment the request 401s. Fetch the cut via
videoApi.getMediaBlob (axios, responseType: blob) and drive <video>
off a URL.createObjectURL result instead. The object URL is revoked
on cut-change (the previous cut's URL) and on unmount, so neither
cut switches nor row teardown leak blob URLs.
2. backend media route confinement: GET /video/posts/{id}/media now
resolves mp4_path and refuses it with 404 when it falls outside
settings.video_output_dir. Defense-in-depth against any future
writer of mp4_paths serving files from arbitrary disk locations.
3. panel VideoPost type/comment drift: added mp4_paths to the
VideoPost interface (the committed VideoPostResponse already
carries it), and corrected the stale comment on videoMediaUrl
that claimed no route served the rendered bytes — the route has
existed since the media endpoint landed; the comment now describes
why getMediaBlob exists instead of a direct <video src>.
* Persist rendered videos to data in physical storage.
* ++
* docs(video): 0.18.0 CHANGELOG entry + RAG + map reference for video engine
- Move the video engine bullet from [Unreleased] into [0.18.0] and note
the ROBOCO_VIDEO_OUTPUT_DIR bind-mount persistence.
- Add docs/rag/architecture/video-engine.md (mirrors x-engine.md shape:
enable/disable, three triggers, render loop + sidecar, CEO gate, media
route confinement, credentials).
- Reference the video render loop in docs/map/orchestrator.md's engine list.
* chore(video): re-bump to 0.19.0 + sync registry compose defaults
Version was wrongly bumped to 0.18.0; 0.18.0 is an already-released
section. Restore its 2026-07-04 date and move the video-engine CHANGELOG
bullet into a new [0.19.0] - 2026-07-05 section above it. Bump
pyproject.toml, roboco/__init__.py, roboco/config.py (app_version),
panel/package.json, and the motion/README inputProps example to 0.19.0.
docker-compose.registry.yml: add ROBOCO_VIDEO_ENGINE_ENABLED /
_VIDEO_ON_RELEASE / _VIDEO_ON_SPOTLIGHT defaulted false (NAS arms them
true), and comment out the video-renders bind mount with a short note
so the public registry image ships video off by default. Structural
sync with docker-compose.yml maintained.
* fix(video): rate-limit /render + reflow motion/README
CodeQL flagged js/missing-rate-limiting on the renderer /render route.
The sidecar is container-network-only with one trusted caller (the
orchestrator, which renders cuts serially), so this limiter is a
retry-storm ceiling (30/min, well above legit render rate), not the
primary control. Also reflows motion/README.md hard-wrapped prose that
failed the markdown quality gate.
* fix(build): finish pnpm 11 migration + regen verb tables
The panel Docker image build failed on `pnpm install --frozen-lockfile`:
node:22-alpine's corepack resolved to its bundled pnpm 11, but
panel/package.json pinned packageManager to pnpm@10.25.0, and pnpm 11
refuses to run against that pin. The Dockerfiles were already written for
pnpm 11 (comments, CI=true, strictDepBuilds); the package.json pin was the
stale outlier. Finish the migration instead of working around it:
- panel/package.json: packageManager pnpm@10.25.0 -> pnpm@11.10.0; drop the
`pnpm` field (pnpm 11 ignores it — build approval lives in
panel/pnpm-workspace.yaml's allowBuilds). Lockfile unchanged (pnpm 11
accepts it as-is); frozen-lockfile verified.
- remotion-renderer/package.json: pin packageManager pnpm@11.10.0 for
determinism (was relying on corepack's implicit default); engines.node
>=22.13 (pnpm 11 requirement).
- docker/panel.Dockerfile + docker/remotion.Dockerfile: `corepack prepare
pnpm@11.10.0 --activate` so the build uses the pinned version explicitly
instead of trusting corepack's bundled default (which a future
node:22-alpine could change).
- .github/workflows/panel-ci.yml: Node 20 -> 22 (pnpm 11 requires
Node >=22.13; Node 20 fails the engines check).
Also regenerate agents/prompts/_generated/{developer,head_marketing,verbs}.md
— the video engine added propose_video and extended propose_feature_spotlight
(wants_video, video_script) but the verb tables weren't refreshed, failing
the foundation-check quality gate.
* chore(build): approve esbuild build script in remotion pnpm-workspace.yaml
pnpm 11 generated this file with a placeholder ('set this to true or false')
during install; resolve it to true so local dev of the renderer doesn't
re-prompt. esbuild's postinstall only verifies the prebuilt platform binary
(@esbuild/<platform> is installed as an optional dep), so approving it is
safe and silences the ERR_PNPM_IGNORED_BUILDS warning.
* fix(build): copy pnpm-workspace.yaml into panel + remotion images
pnpm 11 hard-errors with [ERR_PNPM_IGNORED_BUILDS] (exit 1) when a
dependency ships a postinstall script that isn't approved in
allowBuilds. Both Dockerfiles copied only package.json + pnpm-lock.yaml,
so the build-approval map in pnpm-workspace.yaml never made it into the
image — the remotion image build died on esbuild@0.28.1's postinstall.
Copy pnpm-workspace.yaml alongside the manifests in both images. In
panel, this also drops the --config.strictDepBuilds=false workaround:
with sharp and unrs-resolver now approved, their postinstalls run and
install the platform-specific binaries (previously skipped, leaving
sharp without its @img/sharp-* binary at runtime).
Verified locally: remotion + panel `pnpm install --frozen-lockfile`
exit 0 with the workspace file present; both exit 1 without it.
* fix(perf): offload conventions + release-readiness blocking I/O off the event loop
The orchestrator runs uvicorn and the orchestration background loops on a
single shared event loop, so any sync I/O anywhere — even inside a background
loop — blocks API responsiveness for its duration. Two call sites were missing
asyncio.to_thread wrappers:
- ConventionsService.get_map/health/restore called the sync _resolve
(`git rev-parse`), _read_committed_standard (file read + yaml parse), and
_derive (filesystem walk via derive_from_scan) inline. Reachable from
GET /api/projects/{id}/conventions and from the agent spawn-prepare path.
- ReleaseManagerEngine._production_assess called gather_snapshot inline —
multiple `subprocess.run` git calls + a filesystem walk, running inside the
release-manager background loop.
Wrap each blocking call in asyncio.to_thread at the async boundary. No
signature changes; helpers stay sync. Verified: targeted tests pass
(196 passed, 36 DB-skipped), ruff + format clean.
These were the only responsiveness gaps surfaced by the concurrency audit —
the rest of the heavy paths (agent spawn via `docker run -d`, video render
loop, git ops via the 16-worker ThreadPoolExecutor, workspace subprocess
calls) already offload correctly. No API/worker container split needed.
* feat(storage): add MinIO config + dep + compose (no-op, default-off)
Chunk 1 of the MinIO video-storage plan (§1, §2, §6). No behavior change:
minio_endpoint defaults to empty = disabled, the existing FileResponse serve
path is untouched (chunk 4 wires the serve path; chunk 2 adds the client).
- pyproject.toml: add `minio` (minio-py) to dependencies; regenerate uv.lock
(resolves minio v7.2.20 + pycryptodome transitive).
- roboco/config.py: add 5 settings fields after video_output_dir
(minio_endpoint/_access_key/_secret_key/_bucket/_region). Plain str Fields
matching the existing ROBOCO_ENCRYPTION_KEY style; no SecretStr, no
presign_ttl_seconds (YAGNI — we don't presign in phase 1).
- docker-compose.yml: add `minio` service (data network only, named
minio-data volume, host ports 19000/19001 for debugging, mc healthcheck)
and a one-shot `minio-init` service mirroring the ollama-init pattern
(mc alias set + mb -p, idempotent via || true). Add ROBOCO_MINIO_* env to
the orchestrator env block (endpoint, access/secret key, bucket, region).
- docker-compose.registry.yml: intentionally omit the minio/minio-init
services and leave ROBOCO_MINIO_* unset (NAS default-on, registry
default-off — the established pattern); comment added to the orchestrator
env block noting the omission.
* docs(storage): 0.19.0 CHANGELOG + RAG + map reference for MinIO chunk 1
Backfills the release-polish docs for MinIO chunk 1 (§10 of the plan):
- docker-compose.yaml synced to docker-compose.yml (the two NAS compose files
must stay byte-identical; .yml was edited in chunk 1, .yaml was stale).
- CHANGELOG [0.19.0]: Added (MinIO scaffolding) + Fixed (event-loop I/O offload).
- docs/rag/architecture/minio-storage.md: RAG doc mirroring video-engine.md.
- docs/map/deployment-tooling.md: one-line storage reference.
* MinIO chunk 2: minio_client module (singleton + unconfigured guard) (#309)
* feat(storage): minio_client module (singleton + unconfigured guard)
Chunk 2 of the MinIO plan (§3). roboco/services/minio_client.py adds:
- get_client(): singleton minio-py Minio from settings; returns None when
minio_endpoint is empty (the disabled path used by the chunk 3/4 guards).
Parses http://... endpoint into host:port + secure flag.
- put_object(bytes, key): no-ops when unconfigured; otherwise PUTs to
settings.minio_bucket with ContentType video/mp4.
- get_object_stream(key): yields object bytes for StreamingResponse; lets
S3Error propagate so the serve route (chunk 4) can fall back to disk.
Sync calls — every call site wraps in asyncio.to_thread (chunks 3/4). One
unit test covers the unconfigured guard + endpoint scheme parsing (mocks,
no real MinIO). Not yet wired into remotion_client._save or the media route.
* MinIO chunk 3: wire write path (remotion_client._save PUT) (#310)
* feat(storage): wire MinIO write path in remotion_client._save
Chunk 3 of the MinIO plan (§3). After the local mp4 write, _save PUTs the bytes
to MinIO under key = Path(mp4_path).name (already {render_key}-{orientation}.mp4),
guarded by minio_client.get_client() (None when minio_endpoint empty) and
wrapped in asyncio.to_thread. Local disk stays the source of truth for the
poster publish path (x_video_client/tiktok_client read mp4_path from disk);
the PUT is additive. _save still returns the local path str — mp4_paths,
marker, and schema unchanged. Disabled (local-only) when MinIO unconfigured.
One test: asserts put_object is called with the basename key when configured
and the local file is still written; existing test stays green via the
unconfigured-default path. Mocks only.
* fix(storage): make MinIO PUT non-fatal in remotion_client._save
A configured-but-down MinIO made put_object raise inside the worker thread,
failing the render and retry-looping a task whose local file was already
written. Local disk is the source of truth and the serve route falls back to
FileResponse on S3Error, so a failed durable-copy PUT must never fail the
render — log and continue; the next render re-attempts the PUT.
Adds test_save_swallows_minio_put_failure (PUT raises -> _save still returns
the local path and the local file is written). Extends the CHANGELOG write-
path bullet with the non-fatal guarantee.
* MinIO chunk 4: serve path (StreamingResponse + FileResponse fallback) (#311)
* feat(storage): serve MinIO via the media route (StreamingResponse + FileResponse fallback)
Chunk 4 of the MinIO plan (§4 — the crux). GET /api/video/posts/{id}/media
derives key = Path(mp4_path).name and, when minio_endpoint is set, returns a
StreamingResponse over minio_client.get_object_stream(key), keeping
_require_ceo so auth stays end-to-end (no presigned URLs). Falls back to
FileResponse on S3Error (old render not in MinIO) or when MinIO is
unconfigured — the panel's axios-blob flow is unchanged (same URL, headers,
body, just chunked). The confinement check is kept as defense-in-depth (the
key is a basename so traversal is impossible, but the check is cheap and
protects the poster path).
Two integration tests: configured serve path streams from a stubbed
get_object_stream (CEO 200, non-CEO 403); unconfigured fallback serves the
local file via FileResponse. Mocks only — no real MinIO.
* fix(storage): eager stat_object probe so the MinIO serve fallback actually fires
The chunk-4 route wrapped StreamingResponse(get_object_stream(key), ...) in a
try/except, but get_object_stream is a lazy generator — its client.get_object
call runs on the first next(), i.e. AFTER the route returned and Starlette
started streaming. An S3Error (NoSuchKey / MinIO down) there is uncatchable;
the try/except caught nothing and the FileResponse fallback never triggered.
Add minio_client.stat_object(key): an eager existence/readiness probe that
runs INSIDE the route's try/except, so a missing object or down MinIO raises
before the StreamingResponse starts and the fallback serves the local file.
stat-then-get is two round trips; a mid-stream failure after a successful stat
is a rare race the CEO can retry (documented ceiling).
Tests: the configured test now stubs stat_object; a new test asserts the
S3Error fallback serves the local file via FileResponse and that
get_object_stream is never called. RAG doc updated to record the eager-probe
correctness detail + the non-fatal PUT.
* docs(rag): mark MinIO deployment note landed (chunk 5) (#312)
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
* fix(video): offload minio stat_object off the event loop
stat_object was called inline in the async media route, blocking the
shared event loop for one sync urllib3 round-trip per preview request —
contradicting minio_client's own 'every call site wraps in to_thread'
docstring and this PR's perf-fix theme. Wrap in asyncio.to_thread; the
try/except still catches S3Error (to_thread re-raises) so the
FileResponse fallback is unchanged. Also add the trailing newline to
the minio-storage RAG doc.
* Fix red CI
* Make CI green
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
463 lines
16 KiB
TOML
463 lines
16 KiB
TOML
[project]
|
|
name = "roboco"
|
|
version = "0.19.0"
|
|
description = "AI Agents Company - A virtual organization of AI agents functioning as a software development workforce"
|
|
authors = [
|
|
{name = "Renzo Franceschini", email = "rennf93@users.noreply.github.com"}
|
|
]
|
|
readme = "README.md"
|
|
license = { text = "AGPL-3.0-or-later" }
|
|
requires-python = ">=3.13,<3.15"
|
|
|
|
dependencies = [
|
|
# Core
|
|
"pydantic",
|
|
"pydantic-settings",
|
|
# API
|
|
"fastapi",
|
|
"uvicorn[standard]",
|
|
"websockets",
|
|
# Database
|
|
"sqlalchemy[asyncio]",
|
|
"asyncpg", # PostgreSQL async driver
|
|
"alembic", # Migrations
|
|
# Cache/Queue
|
|
"redis",
|
|
"hiredis", # Redis performance
|
|
# AI/LLM
|
|
"anthropic",
|
|
"openai", # For embeddings
|
|
"tiktoken", # Token counting
|
|
"python-toon", # Token-efficient LLM serialization
|
|
# MCP (Model Context Protocol)
|
|
"mcp",
|
|
"tomli-w", # grok_cli_config renders ~/.grok/config.toml in the agent image
|
|
# Utilities
|
|
"httpx",
|
|
"python-multipart",
|
|
"python-jose[cryptography]", # JWT
|
|
"passlib[bcrypt]", # Password hashing
|
|
"tenacity", # Retry logic
|
|
"structlog", # Structured logging
|
|
# Storage
|
|
"minio", # Object storage client for rendered videos (sync, to_thread-wrapped)
|
|
# Streaming
|
|
"sse-starlette", # Server-Sent Events for A2A streaming
|
|
# Direct imports (promoted from transitive)
|
|
"cryptography", # utils/crypto.py — Fernet-encrypted project git tokens
|
|
"packaging", # services/toolchain.py — PEP 440 requires-python resolution
|
|
"pyyaml", # foundation/policy/conventions — .roboco/conventions.yml parse
|
|
# Conventions validator (roboco.conventions) — tree-sitter ASTs, Python + TS
|
|
"tree-sitter",
|
|
"tree-sitter-python",
|
|
"tree-sitter-typescript",
|
|
"claude-agent-sdk",
|
|
"fastapi-guard", # HTTP security middleware + per-route decorators (import: guard)
|
|
"guard-core", # SecurityConfig/decorator models + request/response protocols
|
|
"fastapi-users[sqlalchemy]", # Cloud auth: cookie session for the seeded CEO login
|
|
"fastapi-users-db-sqlalchemy", # imported directly (SQLAlchemyUserDatabase); declare it
|
|
"pyjwt", # imported directly as `jwt` in the cloud-auth JWT strategy
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
# Testing
|
|
"pytest",
|
|
"pytest-asyncio",
|
|
"pytest-cov",
|
|
"pytest-xdist",
|
|
"httpx", # For TestClient
|
|
"factory-boy",
|
|
"faker",
|
|
|
|
# Code Quality
|
|
"ruff",
|
|
"mypy",
|
|
"vulture",
|
|
"bandit",
|
|
"pip-audit",
|
|
"radon",
|
|
"xenon",
|
|
"deptry",
|
|
"import-linter",
|
|
|
|
# Type Stubs
|
|
"types-passlib",
|
|
"types-python-jose",
|
|
"types-PyYAML",
|
|
|
|
# Development
|
|
"ipython",
|
|
"rich",
|
|
]
|
|
|
|
[project.scripts]
|
|
roboco = "roboco.cli:cli"
|
|
roboco-bootstrap = "roboco.bootstrap:cli"
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/rennf93/roboco"
|
|
Documentation = "https://docs.roboco.tech"
|
|
Repository = "https://github.com/rennf93/roboco"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["roboco"]
|
|
|
|
[tool.hatch.metadata]
|
|
allow-direct-references = true
|
|
|
|
# =============================================================================
|
|
# uv: raise the floor on vulnerable transitive dependencies
|
|
# =============================================================================
|
|
# pyjwt is pulled in transitively (by mcp and msal). 2.12.1 carries four
|
|
# disclosed CVEs that are fixed in 2.13.0; constrain the floor so the resolver
|
|
# picks a patched release while leaving the direct dependents' own ranges intact.
|
|
[tool.uv]
|
|
constraint-dependencies = ["pyjwt>=2.13.0"]
|
|
|
|
# =============================================================================
|
|
# RUFF Configuration
|
|
# =============================================================================
|
|
[tool.ruff]
|
|
target-version = "py313"
|
|
src = ["src"]
|
|
exclude = ["vulture_whitelist.py", ".venv", "alembic"]
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # Pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
"ARG", # flake8-unused-arguments
|
|
"SIM", # flake8-simplify
|
|
"TCH", # flake8-type-checking
|
|
"PTH", # flake8-use-pathlib
|
|
"PL", # Pylint
|
|
"RUF", # Ruff-specific
|
|
]
|
|
|
|
# Lazy imports to avoid circular dependencies
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# MCP tool surfaces ARE the LLM-facing contract — every parameter must be
|
|
# top-level + typed so the SDK exposes it as a discrete schema field with
|
|
# enum constraints. Bundling into a dataclass would hide enum hints from
|
|
# the LLM and bring back invented values like nature='standard'.
|
|
"roboco/mcp/**/*.py" = ["PLC0415", "PLR0913"]
|
|
"roboco/services/*.py" = ["PLC0415"]
|
|
# Gateway methods are typed verb surfaces — agent-facing kwargs reflect the
|
|
# verb contract (task title, description, acceptance criteria, assignee, etc.). Bundling
|
|
# into a dataclass hides the field-by-field schema the LLM needs at the
|
|
# tool layer; we accept the >5 kwarg signatures here for the same reason
|
|
# they're accepted in `roboco/mcp/**`.
|
|
"roboco/services/gateway/**/*.py" = ["PLC0415", "PLR0913"]
|
|
# Route signatures ARE the HTTP contract — each FastAPI query/path/body
|
|
# param must be a discrete typed argument for OpenAPI + validation, so the
|
|
# >5-arg rule doesn't fit them (same rationale as roboco/mcp/**). TC003:
|
|
# FastAPI resolves path/query param annotations at runtime via
|
|
# get_type_hints(), even under `from __future__ import annotations` — a
|
|
# stdlib type used only in a path param (e.g. `task_id: UUID`) can't be
|
|
# deferred into TYPE_CHECKING without breaking route registration.
|
|
"roboco/api/routes/*.py" = ["PLC0415", "PLR0913", "TC003"]
|
|
# deps.py is the DI wiring hub; it defers a few service imports to call time
|
|
# to avoid import cycles with the modules it wires (same rationale as above).
|
|
# get_agent_context's dual-path helpers carry the same header/cookie contract
|
|
# as the routes above (X-Agent-* + the session cookie), hence PLR0913 too.
|
|
"roboco/api/deps.py" = ["PLC0415", "PLR0913"]
|
|
"roboco/runtime/*.py" = ["PLC0415"]
|
|
# The e2e smoke harness defers every roboco import until the stack fixture
|
|
# runs, so the default (skipped) suite never pays the app-surface import
|
|
# cost; ARG001 covers FastAPI path params the fake-GitHub handlers must
|
|
# name but not read.
|
|
"tests/e2e_smoke/*.py" = ["PLC0415", "ARG001"]
|
|
# PTH119: _grok_usage_json sanitizes the agent id with os.path.basename — the
|
|
# path-injection sanitizer CodeQL's query models; the pathlib equivalent
|
|
# (Path(...).name) is not recognized by that query, so we keep os.path here.
|
|
# PLR0913: spawn_agent / _launch_spawn carry the spawn contract (task, model,
|
|
# git context, spawner attribution) — a bundle dataclass would just relocate
|
|
# the same six fields behind one hop at the fleet's hottest call surface.
|
|
"roboco/runtime/orchestrator.py" = ["PTH119", "PLR0913"]
|
|
# The intake driver/entrypoint lazily import the heavy `claude-agent-sdk` (and
|
|
# uvicorn) so the modules import without those installed and don't pay the cost
|
|
# until a live container runs them — same rationale as the dirs above.
|
|
"roboco/agent_sdk/*.py" = ["PLC0415"]
|
|
# Lifecycle validators: foundation/_validate_lifecycle is imported from the
|
|
# bottom of policy/lifecycle.py at module-load time, so the validators must
|
|
# defer their inverse imports until call time to avoid a cycle.
|
|
"roboco/foundation/_validate_lifecycle.py" = ["PLC0415"]
|
|
# The conventions validator loads tree-sitter grammars lazily, per language, so
|
|
# the package imports without tree-sitter present and a missing grammar fails
|
|
# loud at call time (GrammarUnavailable) instead of crashing the import.
|
|
"roboco/conventions/grammars.py" = ["PLC0415"]
|
|
# The conventions ambient-layer resolver defers its config + ConventionsService
|
|
# imports so the prompt-composition utility stays decoupled from the heavy
|
|
# service graph (it loads at every agent spawn).
|
|
"roboco/agents/factories/_base.py" = ["PLC0415"]
|
|
# Test fixtures that reload modules to test env-var-at-import-time behavior.
|
|
# ARG002: ApiClient-subclassing fakes must keep the superclass parameter names
|
|
# for mypy's override check, so unused override-stub args can't be renamed.
|
|
"tests/unit/mcp_servers/*.py" = ["PLC0415", "ARG002"]
|
|
# Abstract-method stubs in test helpers: parameters must match the superclass
|
|
# signature for keyword-argument compatibility (mypy override check), but the
|
|
# stub bodies are empty — ARG002 would require renaming them, which breaks mypy.
|
|
"tests/unit/services/test_optimal_grounding.py" = ["ARG002"]
|
|
|
|
# =============================================================================
|
|
# MyPy Configuration
|
|
# =============================================================================
|
|
[tool.mypy]
|
|
python_version = "3.13"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
disallow_untyped_defs = true
|
|
disallow_incomplete_defs = true
|
|
check_untyped_defs = true
|
|
disallow_untyped_decorators = true
|
|
no_implicit_optional = true
|
|
strict_optional = true
|
|
warn_redundant_casts = true
|
|
warn_unused_ignores = true
|
|
warn_no_return = true
|
|
warn_unreachable = true
|
|
exclude = ["vulture_whitelist.py", ".venv", "alembic"]
|
|
|
|
plugins = ["pydantic.mypy"]
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"redis.*",
|
|
"anthropic.*",
|
|
"toon.*",
|
|
"sse_starlette.*",
|
|
"asyncpg.*",
|
|
"claude_agent_sdk.*", # third-party SDK, ships no type stubs
|
|
]
|
|
ignore_missing_imports = true
|
|
|
|
[tool.pydantic-mypy]
|
|
init_forbid_extra = true
|
|
init_typed = true
|
|
warn_required_dynamic_aliases = true
|
|
|
|
# =============================================================================
|
|
# Pytest Configuration
|
|
# =============================================================================
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
asyncio_default_fixture_loop_scope = "function"
|
|
addopts = "--cov=roboco --cov-report=term-missing"
|
|
markers = [
|
|
"asyncio: mark tests as async",
|
|
"slow: marks tests as slow",
|
|
"integration: marks tests as integration tests",
|
|
"unit: marks tests as unit tests",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
# Coverage core. Python 3.12+ supports sys.monitoring; the legacy `pytrace`
|
|
# core loses trace events across `await` boundaries on 3.13, under-counting
|
|
# every async route by ~30%. `sysmon` is the only core that gives accurate
|
|
# coverage for async route handlers.
|
|
core = "sysmon"
|
|
# Modules excluded from the coverage gate because they require live
|
|
# infrastructure (Ollama, real audio/video stacks, real workspaces,
|
|
# Docker daemon, Claude Code CLI) that the unit-coverage gate does not
|
|
# provision. They're covered by dedicated integration runs (smoke tests
|
|
# on the NAS) rather than the unit-coverage threshold.
|
|
omit = [
|
|
# RAG / proactive context — needs Ollama + real embedding model.
|
|
"roboco/services/proactive.py",
|
|
"roboco/services/optimal.py",
|
|
"roboco/services/optimal_brain/*",
|
|
# Audio transcription — needs Whisper-class model.
|
|
"roboco/services/transcription.py",
|
|
# Agent classes — instantiated by the orchestrator when spawning
|
|
# Docker containers running the Claude CLI. No usable unit-test
|
|
# surface; integration coverage is the smoke run.
|
|
"roboco/agents/*",
|
|
"roboco/agent_sdk/*",
|
|
# Container orchestration — drives Docker daemon, agent spawning,
|
|
# health/dispatch loops. Covered by smoke runs.
|
|
"roboco/runtime/orchestrator.py",
|
|
# MCP server entry points — modeled around the Claude CLI's STDIO
|
|
# MCP transport and only meaningful when running inside an agent
|
|
# container with the orchestrator reachable. Their _post() bridges
|
|
# ARE unit-tested separately (test_envelope_on_4xx, test_flow_server,
|
|
# test_do_server) — just not via direct module import here.
|
|
"roboco/mcp/*",
|
|
# WebSocket route — needs a running ASGI app + WS client.
|
|
"roboco/api/websocket.py",
|
|
# Event stream bus — wraps Redis Streams; tested via integration only.
|
|
"roboco/events/stream_bus.py",
|
|
# GitService — runs `git` subprocesses against per-agent workspaces.
|
|
# Unit-testable surface is < 5% of the module; covered via the
|
|
# _StubGit-based real-DB integration test + live smoke runs.
|
|
"roboco/services/git.py",
|
|
"roboco/services/workspace.py",
|
|
# Notification delivery — Redis Streams + push to MCP transport.
|
|
"roboco/services/notification_delivery.py",
|
|
# CLI entry point.
|
|
"roboco/cli.py",
|
|
# Auto-generated migrations.
|
|
"alembic/*",
|
|
]
|
|
|
|
# =============================================================================
|
|
# Vulture Configuration
|
|
# =============================================================================
|
|
[tool.vulture]
|
|
paths = ["roboco", "tests", "vulture_whitelist.py"]
|
|
exclude = ["**/conftest.py", ".venv", "alembic"]
|
|
min_confidence = 100
|
|
ignore_decorators = [
|
|
"@app.route",
|
|
"@app.get",
|
|
"@app.post",
|
|
"@app.put",
|
|
"@app.delete",
|
|
"@app.patch",
|
|
"@pytest.fixture",
|
|
"@pytest.mark.*",
|
|
"@validator",
|
|
"@root_validator",
|
|
"@field_validator",
|
|
"@model_validator",
|
|
]
|
|
ignore_names = [
|
|
"test_*",
|
|
"Test*",
|
|
"cleanup_*",
|
|
"mock_*",
|
|
"expected_*",
|
|
"exc_*",
|
|
"__*__",
|
|
"Config",
|
|
"Field",
|
|
]
|
|
sort_by_size = true
|
|
|
|
# =============================================================================
|
|
# Bandit Configuration
|
|
# =============================================================================
|
|
[tool.bandit]
|
|
skips = []
|
|
exclude_dirs = ["tests", ".venv", "vulture_whitelist.py", "alembic"]
|
|
severity = "medium"
|
|
|
|
# =============================================================================
|
|
# Radon Configuration
|
|
# =============================================================================
|
|
[tool.radon]
|
|
exclude = "tests/*,.venv/*,vulture_whitelist.py,alembic/*"
|
|
cc_min = "C"
|
|
mi_min = "A"
|
|
no_assert = false
|
|
show_closures = true
|
|
total_average = true
|
|
|
|
# =============================================================================
|
|
# Xenon Configuration
|
|
# =============================================================================
|
|
[tool.xenon]
|
|
max_absolute = "B"
|
|
max_modules = "A"
|
|
max_average = "A"
|
|
exclude = ["tests/*", ".venv/*", "vulture_whitelist.py", "alembic/*"]
|
|
ignore = []
|
|
|
|
# =============================================================================
|
|
# Deptry Configuration
|
|
# =============================================================================
|
|
[tool.deptry]
|
|
exclude = ["tests", ".venv", "vulture_whitelist.py", "alembic"]
|
|
extend_exclude = ["conftest.py", "setup.py"]
|
|
known_first_party = ["roboco"]
|
|
|
|
[tool.deptry.per_rule_ignores]
|
|
# DEP002: Dependencies not directly imported but used at runtime or via CLI
|
|
DEP002 = [
|
|
# Runtime server/driver dependencies (used by frameworks, not imported)
|
|
"uvicorn",
|
|
"websockets",
|
|
"asyncpg",
|
|
"hiredis",
|
|
"python-multipart",
|
|
# Database migrations (CLI tool)
|
|
"alembic",
|
|
# Auth libraries (used via passlib[bcrypt], python-jose[cryptography])
|
|
"python-jose",
|
|
"passlib",
|
|
# LLM utilities (embeddings/token counting)
|
|
"openai",
|
|
"tiktoken",
|
|
# Retry logic (used in production services)
|
|
"tenacity",
|
|
# Dev tools (CLI, not imported)
|
|
"pytest",
|
|
"pytest-asyncio",
|
|
"pytest-cov",
|
|
"pytest-xdist",
|
|
"factory-boy",
|
|
"faker",
|
|
"ruff",
|
|
"mypy",
|
|
"vulture",
|
|
"bandit",
|
|
"pip-audit",
|
|
"radon",
|
|
"xenon",
|
|
"deptry",
|
|
# CLI tool — invoked as `lint-imports` from the Makefile / quality gate
|
|
"import-linter",
|
|
"ipython",
|
|
"rich",
|
|
# Type stubs (used by mypy)
|
|
"types-passlib",
|
|
"types-python-jose",
|
|
"types-PyYAML",
|
|
]
|
|
# DEP003: Starlette is a transitive dep of FastAPI, but BaseHTTPMiddleware is needed
|
|
DEP003 = ["starlette"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest",
|
|
"pytest-asyncio",
|
|
"pytest-cov",
|
|
]
|
|
|
|
# =============================================================================
|
|
# Import Linter (architectural boundaries)
|
|
# =============================================================================
|
|
[tool.importlinter]
|
|
root_package = "roboco"
|
|
|
|
[[tool.importlinter.contracts]]
|
|
name = "Gateway layer must not import from API routes or MCP servers"
|
|
type = "forbidden"
|
|
source_modules = ["roboco.services.gateway"]
|
|
forbidden_modules = ["roboco.api.routes", "roboco.mcp"]
|
|
|
|
[[tool.importlinter.contracts]]
|
|
name = "Services must not import from API routes"
|
|
type = "forbidden"
|
|
source_modules = ["roboco.services"]
|
|
forbidden_modules = ["roboco.api.routes"]
|
|
|
|
# =============================================================================
|
|
# Roboco Commit Validator
|
|
# =============================================================================
|
|
[tool.roboco.commits]
|
|
subject_min_chars = 20
|
|
banned_words = ["wip", "tmp", "asdf", "oops", "fix", "update", "change", "stuff", "things"]
|
|
prefer_conventional = true
|