Commit graph

4 commits

Author SHA1 Message Date
Donna
a6f44b1fc9 Set up Alembic database migrations
- Initialize Alembic in bloxserver/
- Configure for async SQLAlchemy (converts async URLs to sync for migrations)
- Generate initial migration with all existing tables:
  - users (Clerk sync, Stripe billing)
  - flows (workflow definitions)
  - triggers (webhook, schedule, manual, event)
  - executions (run history)
  - user_api_keys (BYOK encrypted storage)
  - usage_records (billing metrics)
  - stripe_events (webhook idempotency)

Usage:
  cd bloxserver
  alembic upgrade head    # Apply migrations
  alembic revision --autogenerate -m 'description'  # New migration

Co-authored-by: Dan
2026-01-26 07:21:56 +00:00
dullfig
a69eae79c5 Add FlowRunner - execution bridge for BloxServer flows
FlowRunner connects Flow domain model to xml-pipeline's StreamPump:

- Lifecycle management: start(), stop() with state tracking
- Flow → OrganismConfig conversion: nodes become listeners
- Trigger handling: webhook, schedule, manual triggers
- Message injection: inject() to specific nodes, trigger() by trigger ID
- Execution tracking: events log, status reporting, message counting

States: CREATED → STARTING → RUNNING → STOPPING → STOPPED (or ERROR)

Usage:
    runner = FlowRunner(flow)
    await runner.start()
    thread_id = await runner.trigger("webhook_id", payload)
    await runner.stop()

Known limitation: Tool nodes need adapter wrappers to convert
@tool decorator (ToolResult) to handler pattern (HandlerResponse).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:20:59 -08:00
dullfig
9ba77b843d Add Flow domain model for BloxServer
Domain model bridges frontend canvas, database, and xml-pipeline:

- nodes.py: AgentNode, ToolNode, GatewayNode with serialization
  - Built-in tool mappings (calculate, fetch, shell, etc.)
  - Agent config (prompt, model, temperature)
  - Gateway config (federation + REST API)

- edges.py: Edge connections with conditions
  - Auto-compute peers from edges
  - Cycle detection, entry/exit node finding

- triggers.py: Webhook, Schedule, Manual, Event triggers
  - Config dataclasses for each type
  - Factory functions for common patterns

- flow.py: Main Flow class aggregating all components
  - to_organism_yaml(): Generate xml-pipeline config
  - from_canvas_json() / to_canvas_json(): React Flow compat
  - validate(): Check for errors before execution
  - to_db_dict(): Database serialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:15:51 -08:00
dullfig
a5c00c1e90 Add BloxServer API scaffold + architecture docs
BloxServer API (FastAPI + SQLAlchemy async):
- Database models: users, flows, triggers, executions, usage tracking
- Clerk JWT auth with dev mode bypass for local testing
- SQLite support for local dev, PostgreSQL for production
- CRUD routes for flows, triggers, executions
- Public webhook endpoint with token auth
- Health/readiness endpoints
- Pydantic schemas with camelCase aliases for frontend
- Docker + docker-compose setup

Architecture documentation:
- Librarian architecture with RLM-powered query engine
- Stripe billing integration (usage-based, trials, webhooks)
- LLM abstraction layer (rate limiting, semantic cache, failover)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:04:25 -08:00