All Tauri commands, TypeScript bridge types, and SSE events.
This page covers the public API consumed by the edytlab frontend. For the full Rust implementation, see commands.rs and tauri-bridge.ts. The complete reference is in docs/api-reference.md.
Commands
All commands are invoked via tauri-bridge.ts. They return Promise<T> and throw a string on Rust Err(_).
Project
| Function | Returns | Description |
|---|
openProject(path) | ProjectInfo | Open or create a project directory. Returns the current head node ID (null if empty). |
API Keys
| Function | Returns | Description |
|---|
setApiKey(key) | void | Store the API key for the active provider in the OS keychain. |
setApiKeyFor(provider, key) | void | Store the API key for a specific provider. |
hasApiKey() | boolean | Check whether the active provider has a key configured. |
hasApiKeyFor(provider) | boolean | Check whether a specific provider has a key. |
clearApiKey() | void | Remove the API key for the active provider from the keychain. |
testApiKey(key) | void | Validate a key with a 1-token probe request. Throws on failure. |
Provider and Model
| Function | Returns | Description |
|---|
listProviders() | ProviderId[] | Returns ["anthropic", "openrouter", "openai"]. |
getActiveProvider() | ProviderId | Returns the currently active provider ID. |
setActiveProvider(provider) | void | Switch the active provider. Rebuilds the agent. |
listModelsFor(provider, apiKey?) | ModelInfo[] | Fetch available models. Results cached 10 minutes. |
getActiveModel(provider) | string | Returns the model ID selected for the provider. |
setActiveModel(provider, model) | void | Set the active model for a provider. |
Session Graph
| Function | Returns | Description |
|---|
getSessionHead() | NodeId | Returns the current head node ID. |
getNode(id) | SessionNode | Fetch a full node (including SessionState) by ID. |
getGraph() | GraphSummary | Fetch all nodes (without full state) and the current head. |
setHeadTo(nodeId) | NodeId | Move the head pointer to any existing node (non-destructive revert). |
renameNode(nodeId, label) | void | Set a human-readable label on a node. |
Rendering and A/B
| Function | Returns | Description |
|---|
renderPreview(node) | string (path) | Render session to a temp WAV for playback. Returns file path. |
renderRange(node, startSec, endSec, outPath) | void | Render a time range to a specific output file. |
prepareCompare(a, b) | { a_path, b_path } | Pre-render two nodes for A/B comparison. |
acceptB(b) | NodeId | Accept node B as the new session head. |
Agent
| Function | Returns | Description |
|---|
sendMessage(text) | void | Send a user message. Agent runs async; emits events during processing. |
approvePlan() | void | In mashup mode: approve the agent's proposed plan to proceed. |
Selection and Markers
| Function | Returns | Description |
|---|
setSelectionContext(range?) | void | Set or clear the selection range. Injected as agent context on next turn. |
addMarker(timeSec, name) | string (annotation_id) | Add a named point marker. |
removeMarker(id) | NodeId | Remove a marker by annotation ID. |
listMarkers() | Marker[] | List all markers and regions for the current session. |
Tracks
| Function | Returns | Description |
|---|
listTracks() | TrackSummary[] | List all tracks in the current session head. |
Memory
| Function | Returns | Description |
|---|
readMemory("global" | "project") | string | Read the memory markdown for the given scope. Returns empty string if none. |
writeMemory("global" | "project", contents) | void | Overwrite the memory file atomically. |
Events
Subscribe with the unlisten pattern. Each handler returns an UnlistenFn — call it in useEffect cleanup.
const unlisten = await bridge.onTextDelta((chunk) => {
appendText(chunk);
});
// cleanup:
return () => { unlisten(); };
| Event | Payload | Description |
|---|
onTextDelta(cb) | string (text chunk) | Each streamed text chunk from the LLM. Append to the current assistant message. |
onToolCall(cb) | { name, id } | Tool execution started. Use to show a tool badge in the chat UI. |
onToolCallEnd(cb) | { id, ok: boolean } | Tool execution completed. ok = false if the tool returned an error. |
onNodeCreated(cb) | nodeId: string | New DAG node appended. Refresh the graph view and track list. |
onAgentDone(cb) | none | Agent turn fully complete — no more text or tool calls. |
onPlan(cb) | steps: object[] | Mashup mode: agent proposed a multi-step plan before execution. |
onMarkerChanged(cb) | none | Marker or region annotation added or removed. Refresh the marker list. |
Key types
type NodeId = string;
type ProviderId = "anthropic" | "openrouter" | "openai";
interface ProjectInfo { path: string; head: NodeId | null }
interface SessionNode { id: NodeId; parent: NodeId | null; label: string | null; state: SessionState }
interface GraphSummary { nodes: GraphNode[]; head: NodeId | null }
interface GraphNode { id: NodeId; parent: NodeId | null; label: string | null; tool: string | null }
interface TrackSummary { id: string; name: string; muted: boolean; gain_db: number; audio_path: string | null }
interface ModelInfo { id: string; display_name: string; context_length: number | null }
interface Marker { id: string; name: string; kind: "marker" | "region"; time_sec?: number; start_sec?: number; end_sec?: number }