Skip to content

Protocol Matrix

This matrix summarizes the engine-backed contracts between Desktop/TUI clients and the engine runtime.

Frontend <-> Tauri Commands

CommandContract
get_storage_migration_status / run_storage_migrationControls startup + settings-triggered migration flow.
list_plansReads .tandem/plans with legacy .opencode/plans fallback.
read_plan_contentReads a plan markdown file by path.
build_permission_rulesReturns rule names aligned with runtime tool names.
Session scopeSession list is scoped to the active workspace.

Tauri <-> Engine HTTP

EndpointContract
GET /session?scope=workspace&workspace=<abs>Workspace-scoped session list (engine-enforced).
GET /session?scope=globalExplicit cross-workspace list for advanced/debug flows.
POST /session/{id}/attachExplicit attach across workspaces with audit fields.
POST /session/{id}/workspace/overrideTemporary sandbox override with TTL.
GET /providerProvider catalog with default/connected metadata.
POST /mission / POST /routinesMission/routine lifecycle endpoints.

Engine SSE -> Client Events

EventContract
message.part.updatedText and tool part streaming for chat timeline + console.
todo.updatedNormalized todo state (pending, in_progress, completed, cancelled).
question.askedQuestions with tool.callID for correlation.
storage-migration-progressMigration phase/progress/counters.
storage-migration-completeMigration completion status and summary.

Canonical Event Examples

message.part.updated (text)

{
"type": "message.part.updated",
"properties": {
"part": {
"id": "part_123",
"sessionID": "ses_123",
"messageID": "msg_123",
"type": "text",
"text": "Hello"
},
"delta": "Hello"
}
}

todo.updated

{
"type": "todo.updated",
"properties": {
"sessionID": "ses_123",
"todos": [{ "id": "t1", "content": "Audit contracts", "status": "pending" }]
}
}

question.asked

{
"type": "question.asked",
"properties": {
"id": "q_123",
"sessionID": "ses_123",
"messageID": "msg_123",
"questions": [
{
"header": "Scope",
"question": "Pick one",
"options": [{ "label": "A", "description": "..." }]
}
],
"tool": { "callID": "call_2", "messageID": "msg_123" }
}
}

JSON-First Orchestrator Contract

Tandem validates planner + validator responses as strict JSON first. The strict mode can be enabled with:

Terminal window
TANDEM_ORCH_STRICT_CONTRACT=1

Strict mode emits contract_warning or contract_error events when the JSON contract is degraded.

Protocol Flow Diagram

flowchart LR
  FE[Frontend] -->|invoke| TAURI[Tauri Commands]
  TAURI -->|HTTP| ENGINE[tandem-engine]
  ENGINE -->|SSE| TAURI
  TAURI -->|events| FE

  ENGINE --> MISSIONS[Mission APIs]
  ENGINE --> ROUTINES[Routine APIs]
  ENGINE --> SESSION[Session/Run APIs]
  ENGINE --> EVENTS[message.part.updated / todo.updated / question.asked]