edytlab logoedytlabGitHub

API Reference

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

FunctionReturnsDescription
openProject(path)ProjectInfoOpen or create a project directory. Returns the current head node ID (null if empty).

API Keys

FunctionReturnsDescription
setApiKey(key)voidStore the API key for the active provider in the OS keychain.
setApiKeyFor(provider, key)voidStore the API key for a specific provider.
hasApiKey()booleanCheck whether the active provider has a key configured.
hasApiKeyFor(provider)booleanCheck whether a specific provider has a key.
clearApiKeyFor(provider)voidRemove a specific provider's key from the keychain.
clearApiKey()voidRemove the API key for the active provider from the keychain.
testApiKeyFor(provider, key)voidValidate a key against a specific provider with a 1-token probe.
testApiKey(key)voidValidate a key with a 1-token probe request. Throws on failure.

Provider and Model

FunctionReturnsDescription
listProviders()ProviderId[]Returns ["anthropic", "openrouter", "openai"].
getActiveProvider()ProviderIdReturns the currently active provider ID.
setActiveProvider(provider)voidSwitch the active provider. Rebuilds the agent.
listModelsFor(provider, apiKey?)ModelInfo[]Fetch available models. Results cached 10 minutes.
getActiveModel(provider)stringReturns the model ID selected for the provider.
setActiveModel(provider, model)voidSet the active model for a provider.

Session Graph

FunctionReturnsDescription
getSessionHead()NodeIdReturns the current head node ID.
getNode(id)SessionNodeFetch a full node (including SessionState) by ID.
getGraph()GraphSummaryFetch all nodes (without full state) and the current head.
setHeadTo(nodeId)NodeIdMove the head pointer to any existing node (non-destructive revert).
renameNode(nodeId, label)voidSet a human-readable label on a node.

Rendering and A/B

FunctionReturnsDescription
renderPreview(node)string (path)Render session to a temp WAV for playback. Returns file path.
renderRange(node, startSec, endSec, outPath)voidRender 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)NodeIdAccept node B as the new session head.

Agent

FunctionReturnsDescription
sendMessage(text)voidSend a user message. Agent runs async; emits events during processing.
approvePlan()voidIn mashup mode: approve the agent's proposed plan to proceed.

Selection and Markers

FunctionReturnsDescription
setSelectionContext(range?)voidSet 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)NodeIdRemove a marker by annotation ID.
listMarkers()Marker[]List all markers and regions for the current session.

Tracks

FunctionReturnsDescription
batchLoad(paths)LoadReportLoad several audio files in one call, each as its own track.
listTracks()TrackSummary[]List all tracks in the current session head.

Skills

FunctionReturnsDescription
listSkills()SkillSummary[]List every skill in the library, re-reading the skills directory first so files added or removed since startup are picked up.
readSkill(name)SkillContentRead one skill's front matter and markdown body.
upsertSkill(name, content)voidCreate or overwrite a skill. The name is validated before it becomes a filename.
deleteSkill(name)voidDelete a skill from the library.
installBundledSkills()numberCopy the skills that ship with the app into the user's library. Returns how many were written.

Agent Profiles

FunctionReturnsDescription
listAgentProfiles()AgentProfileSummary[]List saved agent profiles, re-reading them from disk first.
readAgentProfile(name)AgentProfileContentRead one profile's model override, tool whitelist and system-prompt addition.
upsertAgentProfile(name, content)voidCreate or overwrite an agent profile.
deleteAgentProfile(name)voidDelete an agent profile.
getActiveAgentProfile()string | nullThe profile currently in effect, or null when none is selected.
setActiveAgentProfile(name)voidSwitch the active profile. Pass null to clear it.

MCP Servers

FunctionReturnsDescription
listMcpServers()McpServerListEntry[]Every registered MCP server with its transport, enabled flag and current connection state.
readMcpServer(id)McpServerEntryFull configuration for one server — command, args, env, headers.
upsertMcpServer(id, entry)voidRegister or update a server. A server installed by a plugin always arrives disabled.
deleteMcpServer(id)voidStop the server and remove it from the configuration.
restartMcpServer(id)voidStop and re-launch one server, picking up an edited configuration.

Plugins and Capabilities

FunctionReturnsDescription
installPlugin(source)PluginInstallReportInstall skills and agent profiles from github:org/repo or a local path. Existing files are never overwritten, and any MCP servers the plugin declares are registered disabled.
listCapabilities()CapabilitiesA snapshot of everything the agent can currently reach: tools, skills, MCP servers and profiles, with their enabled state.

Templates

FunctionReturnsDescription
listTemplates()TemplateInfo[]Session templates that ship with the app.
applyTemplate(name)nodeIdApply a template to the current session.

Recording

FunctionReturnsDescription
startRecording()stringBegin capturing from the default input device.
stopRecording(outputPath){ path, duration_sec }Stop capture and write the take to a WAV file.

Memory

FunctionReturnsDescription
readMemory("global" | "project")stringRead the memory markdown for the given scope. Returns empty string if none.
writeMemory("global" | "project", contents)voidOverwrite 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(); };
EventPayloadDescription
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: stringNew DAG node appended. Refresh the graph view and track list.
onAgentDone(cb)noneAgent 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)noneMarker 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 }