ข้ามไปยังเนื้อหา

Ownership Boundary

flowchart LR
  subgraph UI[Browser in kobi-ai]
    UCHAT[Chat UX]
    UCANVAS[Canvas UX]
    UTHREAD[Thread and message CRUD]
  end

  subgraph BFF[kobi-ai API Layer]
    BAI["/api/ai/*"]
    BCANVAS["/api/canvas/*"]
    BINTERNAL["/api/internal/canvas/context"]
  end

  subgraph ENG[kobi-agent-service]
    EGRAPH[LangGraph]
    EHITL[HITL interrupt and resume]
    ETOOLS[MCP dispatch]
  end

  subgraph MCP[kobi-mcp-server]
    MREG[Tool registry]
    MAUTH[Auth and gating]
    MWRITE[Tool-side persistence]
  end

  UCHAT --> BAI
  UCANVAS --> BCANVAS
  UTHREAD --> DB[(Supabase)]

  BAI --> EGRAPH
  EGRAPH --> EHITL
  EGRAPH --> ETOOLS
  ETOOLS --> MREG
  MREG --> MAUTH
  MAUTH --> MWRITE
  MWRITE --> DB
  BCANVAS --> DB
  BINTERNAL --> DB
CapabilityUIBFF (kobi-ai)Engine (kobi-agent-service)MCP (kobi-mcp-server)
Render chat/canvasOwnsNoNoNo
Chat inference request ingressCallsOwnsNoNo
Chat orchestration and HITL stateNoProxy onlyOwnsNo
Tool execution routingNoNoOwnsExecutes
Tool auth/scope/phase checksNoNoContext providerOwns
Canvas workspace/context APIsCallsOwnsNoNo
Canvas mutations via APICallsOwnsNoNo
Tool-side writes (strategy/map/idea)NoNoTriggersOwns
Internal contract to engineNoOwns (sends headers/token)Owns (validates)No
Internal canvas context endpointNoOwnsOptional callerNo
Thread/message table CRUDOwns (via Supabase SDK + RLS)NoReads/writes via servicesUses thread checks
  • Browser must call BFF for all inference (/api/ai/*).
  • Engine contract validation stays enabled (INTERNAL_API_ENFORCE=true) in normal runtime.
  • BFF payload/metadata allowlists are strict and should not be bypassed.
  • MCP side-effect tools require approved execution context with scope IDs.
  • New features must declare whether persistence happens in BFF canvas APIs or MCP tool handlers.