feat(integration): prepaid billing, engine UI, credits console, direct tasks, v2 final
- Prepaid credit system: org wallet, debit on usage, chat gate, admin credit console - Engine UI: /manager, /tasks, /tasks/[id], /workforce, /dashboard, /traces pages - Direct task creation (HTTP POST /tasks, MCP tasks_create) at pending_manager_review - Pause/resume/cancel/answer actions in engine API and UI - Employee cap (7 per org default), review pipeline guard (active reviewer required) - Scheduler: wide window prevents org starvation; archived employees excluded from cap - Tenant isolation: project-id cross-org 404, engine never uses another tenant's sandbox - Order route fix: manager built with pipeline states + employee profiles - Contract extension: ModelGrantPort.get_org_policy with DefaultOrgPolicy - Engine event types in @agy/contracts (task.step, task.gate, run.log, run.tool, team.changed) - api-engine.ts typed client; api-credit.ts client - Alembic migration c4d5e6f7a8b9: prepaid credit + engine UI tables - 859 tests passed, 1 skipped; ruff/mypy/tsc/eslint/vitest all green Refs: PLAN-v2.md §9 (T1–T43), todo-v2-final.md
This commit is contained in:
@@ -28,6 +28,7 @@ from app.application.ports.realtime import (
|
||||
task_channel,
|
||||
)
|
||||
from app.core.config import settings
|
||||
from app.domain.workforce.pipeline import PipelineKey, Stage, coarse_status
|
||||
|
||||
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
@@ -204,4 +205,33 @@ async def emit_team_changed(
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["RunFeed", "emit_team_changed"]
|
||||
async def emit_task_step(
|
||||
*,
|
||||
task_id: str,
|
||||
organization_id: str,
|
||||
from_stage: Stage,
|
||||
to_stage: Stage,
|
||||
pipeline: PipelineKey,
|
||||
) -> None:
|
||||
"""A task moved one stage: the task page's stepper follows it live.
|
||||
|
||||
The payload carries stage names and the coarse status only, never a model
|
||||
or an employee name.
|
||||
"""
|
||||
await publish(
|
||||
RealtimeEvent(
|
||||
type="task.step",
|
||||
channels=(task_channel(task_id), org_channel(organization_id)),
|
||||
organization_id=organization_id,
|
||||
data={
|
||||
"task_id": task_id,
|
||||
"from": str(from_stage),
|
||||
"to": str(to_stage),
|
||||
"pipeline": str(pipeline),
|
||||
"status": coarse_status(to_stage).value,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["RunFeed", "emit_task_step", "emit_team_changed"]
|
||||
|
||||
Reference in New Issue
Block a user