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.
agent_team_* commandsDesktop Agent Automation bridge for templates, instances, missions, approvals, spawn, and cancel/decision actions.

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 /automations / POST /routinesMission + automation lifecycle endpoints (routines/* remains compatible).
POST /mission/{id}/eventMission reducer endpoint; mission_started can trigger orchestrator-runtime Agent Team spawns.
GET /agent-team/templatesLists loaded Agent Team templates from workspace config.
GET /agent-team/instancesLists agent instances with mission/parent/status filters.
GET /agent-team/missionsLists mission-level Agent Team status rollups and usage totals.
GET /agent-team/approvalsLists pending spawn approvals + pending tool approvals for agent-team sessions.
POST /agent-team/spawnServer-gated spawn with policy, edge, and skill checks.
POST /agent-team/approvals/spawn/{id}/approveApproves a queued spawn request and executes gated spawn path.
POST /agent-team/approvals/spawn/{id}/denyDenies a queued spawn request with auditable reason.
POST /agent-team/instance/{id}/cancelCancels a single agent instance and child session execution.
POST /agent-team/mission/{id}/cancelCancels all tracked agent instances for a mission.

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.
agent_team.spawn.*Spawn requested/denied/approved lifecycle with policy reason codes.
agent_team.instance.startedNew instance lifecycle entry (mission/instance/session lineage).
agent_team.budget.usageLive budget counters (tokensUsed, stepsUsed, toolCallsUsed, costUsedUsd, elapsedMs).
agent_team.budget.exhaustedBudget limit reached; runtime emits reason and usage snapshot.
agent_team.mission.budget.exhaustedMission total budget exhaustion; runtime emits mission-level usage snapshot.
agent_team.instance.cancelledInstance cancellation (manual or budget exhaustion) with reason.
agent_team.instance.completedInstance reached completed terminal state.
agent_team.instance.failedInstance reached failed terminal state.
agent_team.capability.deniedRuntime capability guard blocked a disallowed tool/capability access.
provider.usageProvider-reported token usage (promptTokens, completionTokens, totalTokens) when available.
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]