v2 foundation: shared contracts, app profile schema, wiring stubs
- projects: app profile columns + one app per org; project_external_git, deploy_targets, org_model_grants tables (migration a0f0e1d2c3b4) - ports + fakes: RepoWorkspace, DeliveryHooks, DeployTarget, Memory, ModelGrants, WorkforceBootstrap; AppProfile + AppProfileRepository - per-workstream wiring (container_org/engine/delivery), config blocks, empty routers, delivery worker, MCP/delivery service shells, web stubs - admin nav derives from ADMIN_ITEMS; plan docs updated for ext4 worktrees Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
3a68b0fa07
commit
0cd9194b64
@@ -0,0 +1,44 @@
|
||||
"""Wiring for the org-platform workstream (memory, model grants).
|
||||
|
||||
Foundation defaults: no memory, and every active model granted to every org (today's
|
||||
behaviour). The org-platform agent replaces the bodies with the real services; the
|
||||
function names and return types are FROZEN so other workstreams can call them now.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.application.ports.memory import MemoryPort, NullMemory
|
||||
from app.application.ports.model_grants import (
|
||||
AllActiveModelsGrants,
|
||||
GrantedModel,
|
||||
ModelGrantPort,
|
||||
tier_for,
|
||||
)
|
||||
from app.infrastructure.db.models import AiModelRow
|
||||
|
||||
_null_memory = NullMemory()
|
||||
|
||||
|
||||
def build_memory(session: AsyncSession) -> MemoryPort:
|
||||
return _null_memory
|
||||
|
||||
|
||||
def build_model_grants(session: AsyncSession) -> ModelGrantPort:
|
||||
async def _all_active() -> list[GrantedModel]:
|
||||
rows = (await session.scalars(select(AiModelRow).where(AiModelRow.is_active))).all()
|
||||
return [
|
||||
GrantedModel(
|
||||
ai_model_id=row.id,
|
||||
tier=tier_for(
|
||||
capabilities=list(row.capabilities or []),
|
||||
output_price_per_1m=row.output_price_per_1m,
|
||||
),
|
||||
capabilities=tuple(row.capabilities or []),
|
||||
)
|
||||
for row in rows
|
||||
]
|
||||
|
||||
return AllActiveModelsGrants(_all_active)
|
||||
Reference in New Issue
Block a user