Files

64 KiB
Raw Permalink Blame History

TeamsPeach core contract — native API and diagnostic protocol v1

The Rust/Slint application uses runtime::spawn(CoreConfig) and CoreHandle::request(Command) in process. native/src/app/connections.rs owns session workers; native/src/app/runtime/ dispatches captured UI intents through native services. Shared Rust validation rejects invalid command shapes and semantics without a JSON round trip. The standalone teamspeach-core newline-JSON adapter is diagnostic/automation-only, not the desktop transport or a browser-host fallback. The framing/process sections below describe that adapter only.

The core owns a dedicated current-thread runtime per session. Control events and bounded playback PCM use separate channels; native capture uses CapturedFrame with original timestamp, generation and privacy epoch. Explicit shutdown() joins the worker and releases profile/slot locks; Drop requests cancellation without blocking Slint. Control-consumer loss/overflow ends the session, never silently drops authoritative state. UI attachment generations and media/session ownership remain separate.

Capture invalidation also guards the actual deferred UDP socket send through the pinned vendored transport. Old/expired frames cannot become valid merely by remaining in a transport retry queue. Control events carry the emitting connection generation; playback carries it in its native envelope. Standalone identity improvement, application-audio and hotkey APIs have explicit cancellation/ownership boundaries; callers must not perform their blocking joins or capture work on the UI thread.

1. Process model

teamspeach-core --data-dir <ABSOLUTE_DIR> [--connection-dir <ABSOLUTE_DIR>]
  • --data-dir is an absolute path supplied by a trusted diagnostic caller, never server content or an arbitrary UI field. Standalone ownership is exclusive; distinct connection directories share the vault lock and hold separate slot locks. A conflicting instance fails with exit code 3. The native application owns connection IDs/epochs and equivalent locks through in-process services.
  • stdin: UTF-8, one JSON object per line (\n, \r\n tolerated). Max line 256 KiB; a longer line is discarded up to its newline and answered with an error event bad_request (no id can be recovered).
  • stdout: UTF-8, one JSON object per line. Nothing else is ever written to stdout.
  • stderr: human-readable logs only (never parse). Verbosity: env TEAMSPEACH_LOG (error|warn|info|debug|trace, tracing filter syntax), default info.
  • stdin EOF or shutdown command → graceful disconnect (if connected), then exit 0.
  • Exit codes: 0 clean, 2 bad CLI arguments, 3 data dir locked/unusable, 1 fatal internal error.
  • Workspace diagnostic binary: target/release/teamspeach-core[.exe] (or CARGO_TARGET_DIR). Native packages link the core library, not a required packaged core subprocess.

The first stdout line is always:

{"event":"ready","protocol":1,"core_version":"0.1.0"}

2. Framing

Request (stdin):

{"id":"r1","cmd":"connect","args":{"address":"10.10.10.160:9987"}}
  • id: string, 1–64 chars, chosen by the diagnostic caller; echoed in the response. Required for every command except audio_frame and audio_end (high-rate, never answered; an id there is ignored).
  • cmd: one of the commands in §4. Unknown cmd → unknown_command.
  • args: object; may be omitted when a command takes no arguments. Unknown argument keys are rejected (bad_request).

Response (stdout), exactly one per request with id:

{"id":"r1","ok":true,"result":{}}
{"id":"r1","ok":false,"error":{"code":"not_connected","message":"..."}}

Event (stdout), no id, discriminated by event:

{"event":"state","state":"connected", ...}

A line is a response iff it has an id key; otherwise it is an event. Events may be emitted before the response of the command that caused them (e.g. state: connecting precedes the connect response).

3. Error object

{"code": string, "message": string, "ts_error"?: {"id": number, "name": string, "missing_permission"?: number}, "detail"?: object}

ts_error is present when the TeamSpeak server rejected a command: numeric TeamSpeak error id and tsclientlib's name for it (live example: send_text to a channel without permission → {"id":2568,"name":"PermissionsClientInsufficient","missing_permission":224}). detail carries structured extra state where stated (e.g. rename).

Repository-authored message text and stderr diagnostics are English technical details, not UI translation keys. The UI selects a localized explanation by stable code and may append the technical detail. Do not translate protocol tokens, server-supplied text or user content, and do not branch on human-readable message wording.

code meaning
bad_request malformed JSON, missing/unknown/invalid argument, bad id
unknown_command cmd not in allowlist
profile_missing no identity yet → call profile_create
profile_exists profile_create when an identity already exists (never overwritten)
identity_corrupt identity file unreadable/invalid/UID mismatch. Core never regenerates; user/native service must resolve (restore backup / import)
profile_corrupt profile (nickname) file unreadable/invalid
invalid_nickname nickname rule violated (§4.3)
nickname_required identity exists but no nickname saved (connect refused)
not_connected command needs an active connection
already_connected connect while connecting/connected
connect_failed could not connect (resolve, timeout, server refused …; ts_error when the server sent one)
server_error server answered a command with an error (ts_error set)
audio_format audio_frame.pcm not 1920 bytes after base64 decode
audio_overflow outgoing PCM queue full, oldest frames dropped (event, throttled ≤1/s)
audio_muted audio_frame while input or output muted; frames discarded (event, once per burst)
audio_codec Opus encode/decode failure (event)
audio_codec_unsupported current channel codec is not Opus (legacy Speex/CELT): we cannot transmit there (event, once per burst); received non-Opus voice is reported once per speaker
rename_not_persisted server accepted the new nickname but saving it failed; see §4.3
not_found requested icon/avatar/banner does not exist (detail.builtin:true for built-in icon ids)
target_changed private message/client target disappeared or numeric ID now refers to a different UID
media_too_large file exceeds the size limit of its kind (§4.17)
media_unsupported file is not a recognized image, or a banner reference the core cannot fetch
external_media banner or avatar lives at an https:// URL (detail.url for banners, detail.urls for avatars); native service may fetch it itself
io data dir I/O failure
internal bug; message has details

Asynchronous failures (not tied to a request) are emitted as {"event":"error","error":{...}}.

4. Commands

4.1 profile_get — no args

Result = profile object:

{"exists":true,"uid":"Zx1...base64...=","nickname":"Alice","security_level":8}
{"exists":false,"uid":null,"nickname":null,"security_level":null}

uid is the permanent public TeamSpeak unique identifier (base64 SHA-1 of the public key). The private key is never sent over the bridge. If the identity exists but no nickname is saved: exists:true, nickname:null (UI should prompt and call rename). Corrupt files → error identity_corrupt / profile_corrupt.

4.2 profile_create — {nickname: string}

Generates a new P-256 identity (security level ≥ 8), persists it privately, saves the nickname. Fails with profile_exists if any identity exists. Result = profile object. Also emits {"event":"profile", ...profile object}.

4.3 rename — {nickname: string}

Persists the nickname. UID never changes.

  • Disconnected: validate → atomically save profile.json → result.
  • Connected: send clientupdate client_nickname and wait for the server's answer. Server rejects (e.g. nickname in use) → server_error, nothing saved, nothing changed. Server accepts → save atomically. If saving fails, the core immediately sends clientupdate back to the saved nickname and answers rename_not_persisted with detail: {"saved_nickname": "<still on disk>", "server_nickname": "<what the server shows now>", "reverted": bool} (reverted:false = revert also failed; the server keeps the new name for this session only).

Result = profile object; emits profile event.

Nickname rules: after trimming, 3–30 Unicode scalar values, no control characters.

4.4 connect — {address, server_password?, channel?, channel_password?, identity_id?, nickname?}

  • address: host, host:port, [v6]:port (default port 9987). Not a path.
  • server_password: optional string.
  • channel: optional initial channel, either numeric channel id string "cid:12" or a path "Parent/Child".
  • identity_id: selected vault UID; omitted selects the default. Server-demanded proof-of-work is handled by the bounded identity CLI, not automatically during connect.
  • Uses the persisted identity and nickname (profile_missing / nickname_required otherwise). An optional nickname overrides the name for this connection only, without changing the saved identity, name, nickname or UID. At connect time the core trims and validates 3–30 Unicode scalar values with no control characters; an invalid override returns invalid_nickname, never a fallback to the saved name. If the nickname is taken on the server, the server appends digits (e.g. Name1); the snapshot shows the server-side name, the profile keeps the saved one.
  • After connecting the core subscribes to all channels (channelsubscribeall), so the snapshot lists clients in every channel.

Emits state: connecting, then on success snapshot, audio_state, state: connected, then the response {"ok":true,"result":{"own_client_id":7}}. On failure the response is connect_failed and state: disconnected with reason.

Native bookmark orchestration (not additional protocol commands)

native/src/services/bookmarks.rs, secrets.rs and native/src/app/runtime/ resolve bookmarks before connect. UI intents identify bookmarks/operations, not host paths or decryption commands. State reads expose availability without plaintext; reveal requires an explicit action bound to the exact bookmark, trimmed address and purpose. Platform secret storage has no plaintext fallback. Historical Electron ciphertext is never reused: read-only profile import records password re-entry. Canceling a password prompt sends no connect. Address changes invalidate credentials; clearing works without an available key store. Delayed work rechecks connection/session/UI generation and binding. Startup-muted waits for input-mute acknowledgement and never changes output mute. Enumeration is ordered and not duplicated by UI reattachment. Isolated runs disable network/device/OS actions. Generic prefs cannot forge credentials/grants; OS-user encryption is not a portable backup or protection against every program running as that user. Platform hardware key-store acceptance remains separate.

4.5 disconnect — {message?: string}

Sends a clean clientdisconnect and waits (≤ 3 s) for the server. Result {"clean": true} when the server confirmed, {"clean": false} on timeout or when a pending connect attempt was abandoned. not_connected if idle. Emits state: disconnecting → state: disconnected.

4.6 join_channel — {channel_id: number, password?: string}

Moves self (clientmove). Result {} after the server confirms; snapshot follows.

4.7 send_text — {target: "channel"|"server"|"client", client_id?: number, expected_client_uid?: string, message: string}

client_id and expected_client_uid are required iff target = "client". Native rechecks the UID immediately before sending, otherwise target_changed. Message 1–8192 bytes UTF-8; TeamSpeak escaping is done by the core. Result {} after server confirmation. The server echoes our own messages as text events (verified live for private messages: the sender receives exactly one text with to_client_id = recipient); the core adds no synthetic echo.

4.8 set_audio — {input_muted?: bool, output_muted?: bool}

input_muted = mute microphone, output_muted = deafen. Updates the server-visible flags (client_input_muted / client_output_muted) when connected, and the core-side gates: while input_muted || output_muted outgoing frames are discarded; while output_muted no audio events are emitted. Allowed when disconnected (applied at next connect). Result = audio state object; emits audio_state. Initial state at process start: both false.

4.9 audio_frame — {pcm: string, whisper?: u32} (no id, no response)

One 20 ms microphone frame: base64 (standard alphabet, padded) of 960 signed 16-bit little-endian mono samples at 48 kHz = 1920 bytes (2560 base64 chars). In transmit mode direct (see 4.11), native audio services forward frames only when allowed by push-to-talk/open-microphone and privacy gates, ending the burst on stop. In mode vad, current authorized capture/DSP frames pass to the core detector. The diagnostic adapter accepts the same PCM. The core Opus-encodes 20 ms frames with the current channel's codec: Opus Voice (mono) or Opus Music (stereo — the mono frame is duplicated to both channels). Legacy Speex/CELT channels → audio_codec_unsupported event and nothing is sent. Outgoing queue bound: 10 frames (200 ms); on overflow the oldest frames are dropped (audio_overflow event). If no frame arrives for 200 ms during a burst the core ends the burst itself. Not connected → frames dropped with one not_connected error event per burst. Muted, deafened, or not allowed to talk by the server → frames dropped with one audio_muted event per burst; in mode vad the detector state and preroll are discarded as well.

Native capture timestamps blocks using their original capture clock. Expired frames drop and privacy epochs are invalidated before deferred work/socket sends; a busy UI cannot replay a backlog. This is separate from queue bounds and intentional VAD preroll. Device switches, capture stop, reconnect, mute/deafen and whisper transitions revoke old work without making already queued frames valid again.

Channel quality q remains clamped to 0–10: Voice targets 8000 + 4000*q bps with OPUS_APPLICATION_VOIP; Music targets 24000 + 8000*q bps with OPUS_APPLICATION_AUDIO. These are TeamsPeach's existing targets, not a claim of TeamSpeak's proprietary encoder configuration. The installed official UI contains a different bandwidth-estimate table; that display code alone does not justify lowering encoder targets. Evidence and the exact source hash are in docs/evidence/voice-official-source-20261029.json. No real server's bitrate cap was queried or changed in this offline audit.

Historical timed metrics are in docs/evidence/voice-timed-20261029.json; the browser capture harness has been removed. Retain the 600 ms consumer-stall acceptance case: discard expired PCM, never replay it. The ignored Rust captured_speech_quality_matrix accepts TEAMSPEACH_AUDIT_PCM and TEAMSPEACH_AUDIT_OUT for real encoding/receiving at quality 0/6/10, both codecs and a context reset. File-fed/generated media does not prove natural microphone quality, private DSP identity or Asahi hardware.

4.10 audio_end — no args (no id, no response)

Ends the current transmission burst (core sends the TeamSpeak end-of-voice packet). In mode vad it also discards the detector state and preroll when capture or the native audio service stops forwarding.

4.11 set_transmit — {mode: "direct"|"vad", detector?: "automatic"|"volume_gate"|"hybrid", sensitivity?: "high"|"normal"|"low", level_db?: number}

Selects who decides when voice is sent. direct (initial state at process start): every forwarded frame is sent. vad: voice activation in the core (core/src/vad.rs) with the official TS6 VAD modes (our own implementations, not TS6's native code):

  • automatic (default; TS6 "Automatic"/Likelihood): frames are decimated to 16 kHz and scored by the earshot voice detector (embedded model, 16 ms windows, probability 0–1). The gate opens after 3 consecutive windows at or above the threshold (high 0.45, normal 0.6 — default, low 0.75). While open, a window counts as voiced down to 0.15 below the threshold. It cannot open during the first 10 frames after a reset. sensitivity is a TeamsPeach extension.
  • volume_gate (TS6 "Volume Gate"/Power): level_db is required (−50..=50, TS6 slider range, default −30 in the app). A frame opens the gate when its RMS level in dBFS is ≥ level_db; while open it counts as voiced down to 3 dB below. No warm-up. TS6's native level reference is not visible: here 0 dB is digital full scale, so positive levels can never open the gate. sensitivity is rejected.
  • hybrid (TS6 "Hybrid"/LikelihoodAndPower): level_db required; the detector onset AND the current frame's level must both pass; while open, a frame must be voiced and within 3 dB of the level. sensitivity applies to the detector.

The gate sends the 5 frames (100 ms) held before the onset, then the current frame, and closes 20 frames (400 ms) after the last voiced frame. Until the first spurt after a reset all frames since it are held (at most 15 = 300 ms) and sent before the current one, later spurts send 5. Detector, filter history and preroll are reset on audio_end, mute/deafen, disconnect, channel or codec change, when the server does not allow talking, and on every set_transmit that changes between direct/vad or to another detector: before answering such a change the core discards frames still queued from the previous mode and ends any open burst; the native audio service forwards nothing until it has this answer. A set_transmit that only changes sensitivity or level_db of the active detector (the user moving the VAD level slider) applies from the next frame without discarding audio or ending the spurt. Result {"mode":"direct"}, {"mode":"vad","detector":"automatic","sensitivity":"normal"}, {"mode":"vad","detector":"volume_gate","level_db":-30} or {"mode":"vad","detector":"hybrid","sensitivity":"normal","level_db":-30}. audio_state.transmitting is true only while voice packets are actually being sent.

4.11a set_local_volumes — {replace: bool, volumes: [{uid: string, db: number}]}

Persisted local per-user volume modifiers are pushed by the native service: uid is the client's base64 unique identifier (1–128 chars), db −200..=10 in 0.5 dB steps (−200 = silence, gain 10^(dB/20)). replace:true swaps the whole map (sent whenever a core becomes ready), false upserts; a 0 dB entry removes the UID. At most 4096 entries per request. The map lives for the core process and applies to every connection it makes; a live client_action volume on the current connection takes precedence until disconnect. Result {"count": <entries>}.

4.11b set_playback_dsp — {agc: bool}

Playback automatic gain control of the current output device profile (TS6 "Automatic Gain Control — Automatically level the volume of other users"; our own algorithm in core/src/voice_dsp.rs, not TS6's): every speaker's decoded 20 ms (before local volume) updates a smoothed speech level (frames below −50 dBFS are ignored); the speaker's gain moves toward −20 dBFS RMS within ±12 dB, rising at most 0.25 dB and falling at most 3 dB per 20 ms, and applies from the next tick multiplied with the user modifier. Off (process default) = gain exactly 1. Multitrack recording taps stay pre-AGC; the mix is still hard-clipped at full scale (no limiter). Result {"agc": bool}.

4.12 stream_list — {client_id?: number}

TS6 screenshare discovery. Sends requeststreaminfo clid=<id> for client_id, or for every other client in our current channel when omitted. Result:

{"results":[{"client_id":5,"ok":true},{"client_id":9,"ok":false,"ts_error":{"id":...}}]}

Live behaviour (TS6 6.0.0-beta13.1): every requeststreaminfo is answered ok, plus one stream event notifystreaminfo per request. For a streaming client the item carries id (stream UUID), clid, name, type, mode, accessibility, audio, bitrate, viewer, viewer_limit; for a non-streaming client the item has only return_code. So: "is streaming" ⇔ the notifystreaminfo item has id.

4.13 stream_join — {stream_id: string, client_id: number, message?: string}

Sends joinstreamrequest id=<stream_id> clid=<client_id> msg=<message|our nickname> is_remove=0. Result {} (or server_error). The SDP offer arrives as stream event notifyrespondjoinstreamrequest (decision=1, offer=<sdp>).

4.14 stream_signal — {stream_id: string, client_id: number, json: object}

Sends streamsignaling id=<stream_id> clid=<client_id> json=<compact JSON of json>. Examples of json: {"cmd":"answer","args":{"answer":"<sdp>"}}, {"cmd":"iceCandidate","args":{"mLine":0,"mid":"0","sdp":"candidate:..."}}. Publisher ICE restart responses use {"cmd":"reconnectOffer","args":{"offer":"<sdp>"}}. Shared core validation accepts only answer, iceCandidate, and reconnectOffer, never arbitrary signaling commands. Max serialized json size 60 KiB (the whole stdin line is capped at 256 KiB). Result {} or server_error.

4.15 stream_leave — {stream_id: string, client_id: number}

Sends joinstreamrequest id=… clid=… msg= is_remove=1. Result {}.

4.15a Publishing: stream_setup, stream_update, stream_stop, stream_respond, stream_remove

Metadata arguments: {name, type, accessibility, mode, bitrate, viewer_limit, audio}. type is camera 1, screen 2, window 3; accessibility is public 1, official contacts-only 2, private/by-approval 3; only P2P mode:1 is accepted. bitrate is an integer target in Kbps (100..100000), viewer_limit is 0..65535 (0 means unlimited), and audio is boolean, serialized as 1/0.

Bridge command Additional arguments Legacy wire
stream_setup none setupstream name type bitrate accessibility mode viewer_limit audio
stream_update stream_id (required) updatestream id name type bitrate accessibility mode viewer_limit audio
stream_stop only stream_id stopstream id
stream_respond only stream_id, client_id, decision, offer, message respondjoinstreamrequest id clid decision offer msg
stream_remove only stream_id, client_id removeclientfromstream id clid reason=4

stream_respond.decision is boolean; acceptance requires nonempty SDP (offer, max 60000 UTF-8 bytes); denial requires an empty offer. message is at most 200 characters. Eviction reason 4 is the official KICKED enum and cannot be chosen by the UI. All commands use the existing escaped OutCommand and server-acknowledgement path; they do not synthesize successful server responses. A successful setup command is not the stream ID: wait for our notifystreamstarted notification. Stopping while that notification is pending retains the session solely to unregister its late ID.

The native publisher owns one peer per authorized UID and source tracks, and reconciles client-ID reuse on every snapshot. Selected participants are a local UID allowlist, not myTeamSpeak contacts: this mode advertises public metadata (accessibility=1) but never sends an offer/media to an unlisted UID. The stream may appear in the channel list. By-approval uses private metadata (3) and queues requests until explicit acceptance. Reducing access/limits closes revoked peers before waiting for server eviction responses. A kicked UID cannot rejoin that share.

Resolution/FPS/bitrate options apply capture-track constraints and actual per-peer RTP sender parameters; they are targets/ceilings, not claims of achieved resolution, throughput or frame rate. Presets fit the source aspect ratio without upscaling; presentation uses 5 FPS. Sender codecs intentionally offer only H264 High and VP8 based on the desktop decoder compatibility evidence; AV1/VP9 are not offered by this sender. SFU publication is unsupported, never relabeled P2P.

Evidence: docs/evidence/ts6-publisher-native.json (DLL hash and legacy argument assembly addresses), ts6-publisher-ui-enums.json (official JS enums/limit logic), and ts6-official-client.md. Static reverse engineering is not live server proof. Historical generated publisher/viewer checks used only synthetic canvas/tone and no server/device. The removed browser harness is not a current command. Native tests/smoke must exercise production peers, decoded video/audio and stop/cleanup. Serialization/validation or disconnected diagnostic rejection is not controlled-server/official-viewer interoperability proof.

4.16 shutdown — no args

Disconnects cleanly if needed, responds {}, exits 0.

4.17 Media: fetch_icon, fetch_avatar, fetch_banner, fetch_server_banner

Read-only downloads over TeamSpeak file transfer from the connected server. No paths cross the bridge: the core derives the server file from ids it already knows.

command args server file limit
fetch_icon {icon_id: number} (u32, non-zero) /icon_<id> in the server root 256 KiB
fetch_avatar {client_id: number} /avatar_<uid> of that visible client (needs avatar_hash); myTeamSpeak-only avatar → external_media with detail.urls:[{variant,url}] 1 MiB
fetch_banner {channel_id: number} file referenced by the channel's banner_url 4 MiB
fetch_server_banner — file referenced by server.hostbanner_gfx_url 4 MiB

Result: {"mime":"image/png","bytes":108726,"data":"<base64>"}. mime is sniffed from the bytes (image/png|jpeg|gif|webp|x-icon|svg+xml); anything else → media_unsupported. Decode validated image bytes through the native image path, never execute SVG/markup. Cache by icon/avatar/URL identity.

  • Icon ids 100, 200, 300, 500, 600 are TeamSpeak's default group icons that clients ship; servers have no file for them (verified live for each: error 2054 FileInvalidPath), so the core answers not_found with detail.builtin:true without asking. Draw built-in glyphs. Every other id is requested from the server.
  • Banners: ts3image://<host>?port=<p>&channel=<cid>&path=<dir>&filename=<name> references are fetched from that channel's file area on the connected server (port must match; ../backslashes/control characters rejected). http(s):// → external_media with detail.url for native service to fetch (untrusted URL).
  • At most 3 transfers run at once (the rest queue); each has a 20 s deadline (io error). Server refusals surface as server_error with ts_error.

4.18 User context and target-bound actions

client_context {client_id, uid} requests the connected server's permission catalog and returns {generation,client_id,uid,is_self,channel_id,is_channel_commander,volume_db, volume_muted,capabilities,server_groups,channel_groups,permissions}. The UID must match the currently visible client. generation changes on reconnect; reuse of a numeric client ID cannot redirect a stale menu operation to another identity.

Each capability is {allowed:true|false|null,reason,source}. null means the server must decide, not administrator permission or success. Source evidence is target-specific notifyclientpermhints, effective notifyclientneededpermissions, and group membership power requirements. No role name, icon or “admin” label grants a capability. Reasons are server_hint, permission_denied, server_decides, self_only, other_only, or local. If catalog retrieval is refused, context still returns known hints with permission_error; unknown metadata remains unknown. The server rechecks every protocol mutation.

Group rows contain {id,name,member,can_add,can_remove}; channel rows additionally contain can_set, combining the current group's removal requirement with the new group's add requirement. These fields are capability objects. Only regular server-provided groups are offered. Permission metadata is {id,name,description} from permissionlist, not a hardcoded server-version-specific numeric table.

client_action always requires {client_id,uid,generation,action,...}. Unknown fields, missing required values and invalid ranges are rejected by shared Rust command validation.

action additional fields behavior
poke message (1–1024 UTF-8 bytes) clientpoke; other clients only
connection_info none getconnectioninfo; result {rows:[...]}
commander enabled:bool self clientupdate client_is_channel_commander
server_group group_id,enabled servergroupaddclient / servergroupdelclient
channel_group group_id,channel_id setclientchannelgroup; channel must still match target
client_permissions none clientpermlist; result {rows:[...]}
channel_permissions channel_id channelclientpermlist; result {rows:[...]}
set_client_permission `permission_id,value:i32 null,skip:bool`
set_channel_permission `channel_id,permission_id,value:i32 null`
kick_channel, kick_server reason (0–1024 bytes) clientkick, reason IDs 4 / 5
ban reason,duration:u32 banclient; duration is seconds (0 permanent)
volume db:-200..10 (0.5 steps),muted:bool local pre-mix gain 10^(db/20) (−200 = silence), no server mutation
avatar data:base64 self PNG/JPEG, at most 128 KiB decoded
move_to_own_channel password? target-bound clientmove to current own channel; password encoded
delete_avatar none target-bound clientavatardeleted cluid=…, after explicit UI confirmation

Volume retains the modifier while muted; reset is {db:0,muted:false}. It is keyed by native UID bytes for the connection lifetime, not a recycled client ID. Result echoes {volume_db,volume_muted}. Persisted modifiers are pushed with set_local_volumes; mute is not persisted.

Read rows contain source key/value strings; render as text, not markup. Only one client information/permission read is in flight because these notifications are not tagged with the bridge request ID. Connection reads expose connection_* fields, not login tokens. Avatar bytes upload through ftinitupload /avatar; only after TCP upload completion does the core send clientupdate client_flag_avatar=<MD5>. Success requires the server's command acknowledgement; file-transfer and command errors remain visible. Uploads have a bounded deadline and are canceled on disconnect. File-transfer keys never reach the UI.

Protocol mutation results are {} only after server acknowledgement. Server refusals include the existing numeric ts_error and missing_permission; preflight hints cannot override a server rejection. Destructive confirmations belong to the UI. Tests use escaped protocol fixtures and disconnected subprocess requests, never real participant kicks, bans or permission/group mutations.

4.19 Channel file browser: file_list, file_mkdir, file_rename, file_delete, file_download, file_upload, file_cancel, file_transfers, file_fetch_image

Legacy TeamSpeak file transfer (ftgetfilelist, ftcreatedir, ftrenamefile, ftdeletefile, ftinitdownload, ftinitupload, ftstop), implemented in core/src/file_transfer.rs and core/src/files_session.rs. Every command needs an established connection (not_connected otherwise) and a channel the client can see (not_found). The native service-only snapshot exception permits channel_id:0 for listing /icons/ and transferring /icons/icon_<u32 CRC32>; UI file operations still require a nonzero channel. channel_password is optional; it travels as base64(SHA-1), like tsclientlib's own transfers, and an empty one is sent as the bare cpw flag.

Remote paths are UTF-8, start with /, are at most 512 characters, and every component is non-empty, not . or .., and contains no control character or backslash. A folder path (file_list) is normalized to / or /a/b/. A file or folder path (file_mkdir, file_rename, file_delete, file_download, file_upload, file_fetch_image) has no trailing slash and is not the root.

Command Args Result
file_list {channel_id, path, channel_password?} {channel_id, path, entries:[{name, type:"file"|"folder", size, datetime, incomplete_size?}], malformed, capabilities, storage}
file_mkdir {channel_id, path, channel_password?} {}
file_rename {channel_id, from, to, channel_password?, target_channel_id?, target_channel_password?} {} (a target channel moves the item between channels)
file_delete {channel_id, paths:[1..100], channel_password?} {} (one ftdeletefile, one name per entry)
file_download {channel_id, path, channel_password?, dest_dir, subdirs?:[..32], overwrite} transfer record, state:"queued"
file_upload {channel_id, path, channel_password?, source, overwrite} transfer record, state:"queued"
file_cancel {transfer_id} {transfer_id, cancelled:true}
file_transfers {} {transfers:[record…], storage}
file_fetch_image {channel_id, path} {mime, bytes, data} (base64; same pipeline and limits as §4.17 channel banners)

file_list details

  • The server's empty-folder answer (error 0x0501 "database empty result set") becomes an empty entries.
  • Rows of notifyfilelist are matched by the echoed return_code, or else by channel and path. Only one listing per folder may be pending; a second one is bad_request.
  • Arguments sent once for all |-joined entries are inherited by the later entries.
  • A row is counted in malformed instead of being returned if any of these hold: the name is invalid, type is not 0 (folder) or 1 (file), or size/datetime are not numbers.
  • More than 10 000 rows is an error, never a truncated list.
  • The listing fails if the server does not complete it within 20 s.

capabilities are the full-width u64 channel permission hints (notifychannelpermhints): {known, upload, download, delete, rename, browse, create_directory}. Unknown hints count as allowed, as in the official client; the server decides. No narrowing cast discards high bits.

storage is {capability_extensions, httpft, s3, supported}. It is computed from virtualserver_capability_extensions (tapped from initserver/notifyserverupdated/notifyserveredited) using the official substring test. Known HTTPFT or s3 advertisements cause every file operation except transfer inspection/cancellation to fail with media_unsupported and storage detail before any legacy command or local disk side effect. No UI override falls back to a different store. Unknown/unannounced capability flags retain legacy requests and authoritative server errors; they do not prove newer-storage support.

Host paths belong only at the trusted core boundary. Native file services resolve session/purpose-owned chooser grants before constructing download/upload commands; UI fields cannot provide arbitrary paths.

  • dest_dir is an absolute, existing folder.
    • subdirs are created inside it, never through an existing non-directory or symlink.
    • Every created name, and the downloaded file name, must be storable on every supported OS. Refused: / \ : * ? " < > |, control characters, a trailing dot or space, and Windows device names such as CON or COM1.txt.
  • A download streams into .teamspeach-<pid>-<id>-….part in the target folder, is fsynced, and then moved into place.
    • With overwrite:false it never replaces an existing name: it uses an atomic hard link, which fails if the name exists. File systems without hard links fail safely; there is no racy check-then-rename fallback. A conflict is file_exists (detail.name), both before the transfer and at commit.
    • With overwrite:true (the user confirmed) the move replaces the target.
    • Any failure or cancel deletes the temporary file.
  • source must be a regular file. Its size is measured once and sent in ftinitupload. Exactly that many bytes are streamed; a file that shrinks fails the upload.
    • With overwrite:false a server-side "file already exists" (0x0802) fails the transfer with code file_exists.

Transfers

  • Native scheduling allocates app-global directional slots (combined maximum ten); at most 512 native records per connection.
  • Transfer ids are bridge-visible u32 values, unique per connection.
  • Lifecycle: queued → starting (ftinit* sent) → running (stream granted) → [confirming, upload only] → done | failed | cancelled.
  • A transfer fails with an explicit error in these cases:
    • no grant within 30 s;
    • no byte moved for 30 s (file transfer stalled);
    • the connection closes;
    • a non-success notifystatusfiletransfer.
  • An upload is done when either of these happens after the last byte and the write-half shutdown:
    • the server closes the stream;
    • status 0x0811 "file transfer complete" arrives. Otherwise it fails after 15 s ("server did not confirm the upload").
  • file_cancel is refused with bad_request in upload confirming or once atomic download publication has won the cancellation/commit gate.
    • Accepted cancellation wins the gate before reporting cancelled:true, aborts the stream task, closes the TCP connection, and prevents a queued disk commit from publishing. The blocking disk worker owns temporary-file creation and cleanup; it closes its handle before deleting on Windows.
    • When the serverftfid is known (tapped from notifystartdownload/notifystartupload; the ftkey is never stored or logged), it sends ftstop serverftfid=… delete=1 for uploads and delete=0 for downloads.
    • A grant that arrives after the cancel is dropped and stopped.
  • Progress is emitted at most every 250 ms while bytes move.

Not implemented (explicit limits):

  • The TeamSpeak 6 HTTPFT and s3 branches. Exact recovered constructor arguments, bounded RIP-relative/native-function continuation, and unresolved endpoint/payload semantics are in docs/evidence/ts6-filetransfer-native.json and docs/evidence/ts6-filetransfer-native-continuation.json. These are static interoperability evidence, not server acknowledgements.
  • Resume/pause.
  • Drag-and-drop upload without a purpose-bound native resource grant.

file_transfer (event)

{event:"file_transfer", transfer_id, direction:"download"|"upload", channel_id, path, name, state, bytes, total, error?}. state is one of queued|starting|running|confirming|done|failed|cancelled; error is an error object (§3), e.g. code file_exists, transfer_cancelled, io, server_error with ts_error. Records never contain host paths. total is 0 for a download until the server reports the size.

New error codes (§3): file_exists (target name exists and replacing it was not confirmed; detail.name), transfer_cancelled.

Native chooser and overwrite-confirmation continuations capture/recheck the originating SessionKey before use. Grants bind purpose and session; delayed/revoked results cannot start work on a replacement connection. Isolated tests use disposable resources without OS dialogs/folder opening.

Native regression requirements include real loopback bytes/hash, cancellation, Unicode, empty/short/conflicting files and deterministic cancellation/publication gates in core/src/file_transfer.rs and native file services. Existence is not an execution result.

File Transfer preferences and app-wide scheduling

Official source: installed html/client_ui/main.js module 87209 (SettingsFileTransfer). It reads singleton workflow settings alwaysAskForDownload, ft_max_parallel_downloads/uploads, and global native getTransferSpeedLimit/setTransferSpeedLimit/updateConcurrentTransferLimits calls without a connection ID. This supports app-global, not multiplied per-tab, semantics. Source control values: speed 1–25600 MiB/s with 0.5 steps; concurrency at least one each, combined at most ten.

native/src/services/file_settings.rs persists prompt/slot/rate controls and an approved destination. A displayed basename is not a chooser grant; only explicit native chooser work approves destinations. Isolated runs disable OS dialogs/clipboard. Missing destinations fail explicitly; unset ones ask. Reject unknown/out-of-range settings and retain truthful atomic-save failures. Native scheduling owns app-wide reservations across sessions/snapshot work: delayed events cannot duplicate slots, lower limits drain old work and reconnect discards stale records. Current native defaults/bounds are authoritative, not a browser IPC compatibility layer.

Service-owned file_config accepts {download_slots,upload_slots,download_limit,upload_limit}. Zero slots pauses new starts; unconfigured diagnostic cores use two per direction. Rates are integer bytes/second, zero unlimited. Connected native scheduling configures this internally; UI cannot bypass the broker. Changes update live pacing without restarting streams.

Each direction's global byte ceiling is divided conservatively across currently demanded server cores. Every stream in a core shares one async pacing mutex; each TCP read/write chunk acquires a pacing turn (up to 64 KiB). Config decreases apply before increases. The aggregate rate is not multiplied by tabs; bounded bursts are one chunk per participating core, and already-scheduled chunks finish under their prior pacing interval. Unused per-core bandwidth is not borrowed until allocation changes, so this is a conservative ceiling rather than a work-conserving bandwidth optimizer. Downloads with short reads may be slower than the configured maximum, never faster because of short-read accounting. These user file/snapshot transfer limits do not throttle unrelated cached icon/avatar preview fetches.

Regression requirements include approved-destination persistence, rejected UI path injection, aggregate slots/rates, delayed events, drain-on-reduction, cancellation and real-byte pacing in core/src/file_transfer.rs. Only exercised QA establishes a pass.

4.20 Server/channel administration

Every mutation below is answered only after its real server command result. Permission hints never manufacture success. Requests capture a server connection ID in native service and its native generation; stale mutations fail. Read replies are {rows:[wire-key/string-value objects]}, not HTML. Only one reader per notification type is allowed in flight; over 10,000 rows fails rather than silently truncating. Empty database/permission-list replies become empty rows.

admin_context {} returns {generation,server_uid,own_client_id,catalog_received,permissions,permissions_catalog,permission_error?}. Permissions are the official named hint values (null if unknown); catalog entries are {id,name,description}.

Command Arguments / result
channel_create {generation,parent_id,properties} → {channel_id} from own channel-created event
channel_edit {generation,channel_id,properties}
channel_move {generation,channel_id,parent_id,order?}
channel_delete {generation,channel_id,force,confirm}; confirm exact current channel name
channel_subscribe / channel_subscribe_all {channel_id,subscribe} / {subscribe}
channel_description {channel_id} → {description}
channel_list / channel_info {} / {channel_id}; observed channel wire properties, info refreshes description
client_info {client_id,uid}; checks current UID, requests clientgetvariables
set_away {away,message?}; message only when away, ≤80 characters
talk_request {request,message?}; message only when requesting, ≤50 characters
talk_power {generation,client_id,uid,grant}; UID checked against live target
server_info {}; servergetvariables/notifyserverupdated
server_edit {generation,confirm,properties}; confirm exact server UID
ban_list {}
ban_add {generation,ip?,name?,uid?,duration_s,reason?}; at least one target; 0 seconds permanent
ban_delete / ban_delete_all {generation,ban_id,confirm} / {generation,confirm}; confirm decimal ID / all_bans
privilege_key_list {}
privilege_key_add `{generation,kind:"server_group"
privilege_key_use / privilege_key_delete {generation,token} / {generation,token,confirm}; confirm exact token
temp_password_list {}
temp_password_add {generation,password,description?,duration_s,channel_id?,channel_password?}; positive duration
temp_password_delete {generation,password,confirm}; confirm exact password
server_log {lines:1..1000,reverse,instance,begin_pos}; logview → source rows including last_pos/file_size/l
client_database_list {start:u32,duration:1..200}
client_database_find {pattern,uid:bool}; clientdbfind -details [-uid]
client_database_delete {generation,client_database_id,confirm}; confirm decimal database ID
client_database_id {uid}; rows with cluid/cldbid
server_group_list / channel_group_list {}
server_group_perm_list / channel_group_perm_list {group_id}
channel_perm_list {channel_id}
server_group_client_list {group_id}; sends -names to include UID/nickname
group_add `{generation,kind:"server"
group_rename {generation,kind,group_id,name}
group_set_permissions {generation,kind,group_id,permissions:[{id:string,value:i32,negate?,skip?}]}; 1..512 rows; negate/skip only server group
channel_set_permissions {generation,channel_id,permissions:[{id:string,value:i32}]}
group_delete {generation,kind,group_id,force:bool,confirm}; confirm the decimal group ID; servergroupdel sgid force / channelgroupdel cgid force (official requestGroupDel, UI force=true after a required confirmation checkbox)
group_delete_permissions / channel_delete_permissions {generation,kind,group_id,permissions:[id]} / {generation,channel_id,permissions:[id]}; 1..512 identifiers (permid when numeric, else permsid); servergroupdelperm / channelgroupdelperm / channeldelperm (official requestPermissionsDel); channel must be visible
server_group_add_client {generation,group_id,client_database_id}
server_group_member_add_uid {generation,group_id,uid}; official TS6 vsgroupassignbyids json={version:1,add:[…]}; short UID uses migration, long UID client_uid, group ID string

Property allowlists/bounds are shared Rust contracts in core/src/admin.rs and core validation, never arbitrary wire fields. Password encoding, codec/quality bounds and exclusive permanence remain required; large snapshot integers must not round. Native server-action/runtime services project menus/forms/views with captured connection/session/generation, explicit destructive confirmation and retained errors/forms on failed acknowledgements. Database pages are 100; log offsets explicit; local events are not server logs.

4.21 Client-built server JSON snapshots

Native snapshot orchestration in native/src/services/snapshots.rs uses ordinary core commands and chooser grants, never fictitious serversnapshotcreate/ServerQuery. Schema 0.0.1, options/remapping/confirmations: ts6spec-snapshots.md. Select settings/groups/permissions/members/icons independently. Non-atomic import retains truthful partial/cancellation/error reports, not rollback/full success. Typed banner/SFU/storage mutations do not imply HTTPFT/S3 icon support.

4.22 Whisper routes

whisper_start {epoch:u32,target} resolves a route against the live connection; epoch must be nonzero. Target is {kind:"list",entries:[{type:1|2,uuid,name}]}, {kind:"group",group_type:0..3,target_mode:0..6,group_id,server_uuid}, or {kind:"ids",clients:[{id,uid}],channel_ids:[…]}. At most 255 resolved clients and channels. whisper_stop {epoch} stops that route; set_whisper_receive {mode:"allow_all"|"deny_all"} controls incoming whispers.

audio_frame accepts optional whisper:epoch; stale/stopped/other-generation tags drop, never fall back to ordinary voice. Untagged queued frames also drop while a whisper route is held. Transitions end the previous spurt and discard capture queued before the transition. Incoming whisper_received {client_id} feeds reply history; receive deny mode removes queued whispers. This is real TeamSpeak whisper packet routing, not local recipient filtering.

Local recording (recording_*)

One recorder per core (= per server connection). Nothing is recorded until recording_start; recording stops on recording_stop, disconnect (reason: "disconnected"), a write failure ("write_failed") or core shutdown. While recording, the core sends clientupdate client_is_recording=1 (others see REC, like the official client) and =0 when it stops; failures of that update arrive as error events (client_is_recording: …).

Command Args Result
recording_start directory (absolute, ≤1024 chars, no control chars; created if missing), mode 1 Multitrack / 2 Master / 3 Both (official values), label optional YYYY-MM-DD_HH-MM-SS (session folder name, caller's local time; default UTC with Z) recording_info object. Errors: bad_request (already recording, bad args), not_connected, recording_failed (folder/manifest/thread).
recording_stop — {outputPath, finalizing: true}; files are finalized on a writer thread, then recording_finalized.
recording_pause / recording_resume — {isRecording: true, isPaused}. Paused time is not on the timeline.
recording_status — {isRecording, isPaused}
recording_info — official getRecordingInfo fields: isRecording, isPaused, mode, startTimeEpochMs, outputPath, sampleRate (48000), peakBucketFrames (960), timelineFrames, droppedChunks, droppedCaptureFrames, totalBytes, error, tracks[{id, kind: client|capture|master, uid (base64), name, instance, file, startOffsetFrames, timelineFrames, audioFrames, bytes}]; {isRecording:false} when idle.
recording_waveform track_id, from_bucket {trackId, fromBucket, nextBucket, totalBuckets, bucketFrames, peaks[0..1000]} (≤2000 per call, last 6000 kept).

Events: recording_state {isRecording, isPaused, outputDirectory, mode, reason?, error?}, recording_dropped {droppedChunks} (first dropped tick after a good one), recording_finalized {outputPath, ok, error, totalBytes}.

Files (<directory>/<label>[_N]/): NN <name>.wav per track (48 kHz mono s16le; 00 master.wav, NN capture - <nick>.wav, client tracks by nickname, (k) for a concurrent second connection of the same UID), … (part N).wav past the 4 GiB RIFF limit, and session.json (finalized:false until stop) with per-track speech segments {startFrame, endFrame, startEpochMs, clientId, nickname, channelId, channelName, whisper}, pauses, droppedRanges, endReason, errors.

Signal paths: client tracks = each speaker's decoded audio before local volume (official: "individual tracks stay untouched"); capture = frames this connection actually encoded and sent (after mute/PTT/VAD); master = the local playback mix with local volumes plus the sent capture. A full disk queue (2 s) drops whole 20 ms ticks, counts them and pads them with silence so tracks stay aligned. Headers are refreshed every 2 s. TeamsPeach's file layout/format is its own; the official native format is not published.

Starting a second recorder while prior files finalize is refused. Dropped capture includes queued TX discarded on pause/stop; dropped tails are padded through declared timelines, empty master is a valid 44-byte WAV. Header-finalization errors keep finalized false, are recorded, and actual final file bytes are recomputed. Multitrack taps are pre-gain/pre-AGC; master is post-client-gain/AGC plus sent capture, not native device output gain.

5. Events

server_event

Normalized client/channel/server changes retain kind, numeric and named reason, message, and invoker:{id,uid,name}|null. Client changes include last-known UID/nickname, own-client flag and from/to channel IDs; channel changes include last-known name/parent. Talk requests and talker changes carry their explicit requested/granted state. Fields are built before raw lifecycle deletion so a departed client does not lose its label. This is local event history, not the server logview response.

ready

See §1.

profile

{"event":"profile","exists":true,"uid":"...","nickname":"...","security_level":8} — after profile_create / rename.

state

{"event":"state","state":"connecting|connected|disconnecting|disconnected",
 "address":"10.10.10.160:9987","reason":{"code":"...","message":"...","ts_error":{...}}}

reason only on disconnected when not user-initiated (kicked, banned, timeout, server shutdown, connect failure) and on an automatic-reconnect connecting. For a server-closed connection reason.detail.reason is one of kicked, banned, server_shutdown, timeout, connection_closed. tsclientlib reconnects automatically after a timeout: connecting may then follow connected without a connect command.

snapshot

Full replacement of the server view, emitted after connect and after every change (coalesced, ≤ 1 per 50 ms). The UI must replace its model wholesale.

{"event":"snapshot","rev":12,
 "server":{"name":"...","welcome_message":"...","platform":"...","version":"...",
           "icon_id":null,"hostbanner_url":null,"hostbanner_gfx_url":"ts3image://…",
           "hostbanner_gfx_interval_s":0,"hostbanner_mode":"adjust_keep_aspect",
           "hostbutton_url":null,"hostbutton_gfx_url":null,"hostbutton_tooltip":null,
           "default_server_group":8,"default_channel_group":8},
 "own_client_id":7,"own_channel_id":1,
 "server_groups":[{"id":10,"name":"…","icon_id":3558086607,"sort_id":0,
                   "name_mode":"after","type":"regular"}],
 "channel_groups":[{"id":5,"name":"Channel Admin","icon_id":100,"sort_id":0,
                    "name_mode":"none","type":"regular"}],
 "channels":[{"id":1,"parent_id":0,"order":0,"name":"Lobby","topic":"",
              "has_password":false,"is_default":true,"max_clients":null,
              "needed_talk_power":0,"codec":"opus_voice","codec_quality":6,
              "icon_id":1775712350,"banner_url":"ts3image://…","banner_mode":2,"depth":0}],
 "clients":[{"id":7,"uid":"...","nickname":"Alice","channel_id":1,"is_self":true,
             "client_type":"normal","input_muted":false,"output_muted":false,
             "input_hardware":true,"output_hardware":true,"away":false,
             "away_message":null,"talk_power":0,"is_talker":false,
             "is_channel_commander":false,"is_priority_speaker":false,"is_recording":false,
             "is_streaming":false,"description":null,"country":"RU","server_groups":[7,10],
             "channel_group_id":8,"channel_group_inherited_from":20,"avatar_hash":null,
             "has_myts":true,"myts_avatars":[{"variant":2,"url":"https://storage.googleapis.com/ts-sys-myts-avatars/…"}],
             "myts_avatar_unparsed":null,"icon_id":null,"badges":null}]}
  • channels is in display order (pre-order tree walk following TeamSpeak order); depth = nesting level. max_clients: null = unlimited.
  • codec: "opus_voice", "opus_music", "speex_narrowband", "speex_wideband", "speex_ultrawideband", "celt_mono" or null if unknown. Only Opus channels can transmit; the UI should show the reason for others.
  • client_type: "normal" or "query". uid may be null if not visible.
  • icon_id: TeamSpeak icon id or null (0 = none). Fetch with fetch_icon (§4.17).
  • Groups: server_groups/channel_groups are the server's group catalogs (sent to every client on connect; sorted by sort_id, then id). A client's server_groups and channel_group_id reference them. name_mode (none|before|after) is TeamSpeak's "show group name in tree" setting: live, the label shown next to a nickname by the official client is the name of a server group with name_mode:"after" (verified: a client with groups [7,10], group 10 name_mode:"after" → that group's name is the label). Group icons are drawn from icon_id. type: template|regular|query.
  • country: ISO code or null (flag). description: client description or null. badges: raw myTeamSpeak badges string (not groups) or null.
  • Avatars, in the official client's precedence: avatar_hash non-null → server-stored avatar (fetch_avatar); otherwise myts_avatars (TeamSpeak 6 / myTeamSpeak, client_myteamspeak_avatar = <variant>,<https url>; live: variant 2 on storage.googleapis.com/ts-sys-myts-avatars/…, publicly readable without an account, served as Content-Type: text/plain but PNG bytes → native service must sniff, not trust the header). Multiple pairs are accepted separated by ;/| (only one pair observed). A value the core cannot parse is passed as myts_avatar_unparsed. has_myts = the client has a myTeamSpeak id (null if not sent). Neither set → default avatar.
  • Deliberately not exposed: client_user_tag (live it carries a signed myts_token and the account handle) and client_myteamspeak_id (account id; only has_myts).
  • Nickname colour: no colour field was observed in notifycliententerview on this server (checked client_user_tag, client_integrations, client_badges, client_signed_badges, client_meta_data); the snapshot has none.
  • is_streaming: TeamSpeak 6 client_is_streaming flag (null if the server did not send it). Confirm/obtain the stream id with stream_list.
  • Channel banner_url / banner_mode (int) are the TS5/6 channel banner properties, null when unset; fetch with fetch_banner. Server hostbanner_* likewise via fetch_server_banner. All strings here are server-controlled, untrusted input.

audio_state

{"event":"audio_state","input_muted":false,"output_muted":false,"transmitting":false}

talking

{"event":"talking","client_id":5,"talking":true} — start/stop of a remote speaker's voice stream (also for self: transmitting in audio_state).

audio

{"event":"audio","pcm":"<base64 1920 bytes>","speakers":[5,9]} — mixed playback, 960 i16le mono samples at 48 kHz, emitted on a 20 ms clock while decoded speaker streams are active and output is not muted. Per-speaker jitter buffering and Opus decoding (including packet-loss concealment) happen in the core. Local user volume is applied to each decoded stereo stream before summation, never to the already mixed output audio or through a server volume command. Per-participant gain follows the dB contract in §4.11a/§4.18; local mute preserves the selected modifier. The final mono sum saturates to signed PCM range instead of wrapping. Amplified or simultaneous loud voices can reach that existing saturation limit; no limiter or automatic gain compensation is introduced. Global voice volume remains independent.

Local volume/mute is keyed by the peer's UID, resolved from the current client ID on each mix tick. It survives speech restarts and channel changes within the same connection, but resets on disconnect/reconnect or core exit. Departing clients' decode queues are discarded before their numeric IDs can be reused. speakers still reports active decoded streams even when local volume/mute makes them silent; local volume does not change talking notifications. Native playback retains a small playback ring (target 40–60 ms, drop oldest beyond ~200 ms, play silence on underrun).

text

{"event":"text","target":"channel|server|client|poke","from_client_id":5,
 "from_uid":"...","from_nickname":"Bob","message":"hi","to_client_id":7}

to_client_id only for target:"client" (recipient: our id for incoming, the peer for our own echoed message). poke = a TeamSpeak poke addressed to us.

stream

Raw TS6 screenshare notifications, lifted from the protocol layer before tsclientlib would discard them:

{"event":"stream","name":"notifystreamsignaling",
 "items":[{"id":"…","clid":"5","json":"{\"cmd\":\"offer\",…}"}]}
  • name ∈ every notifystream* notification (notifystreaminfo, notifystreamstarted, notifystreamstopped, notifystreamupdated, notifystreamsignaling, notifystreamclientjoined, notifystreamclientleft, notifystreamattendees, …), notifyjoinstreamrequest, notifyrespondjoinstreamrequest, and notifysfuaccessinfo. TeamsPeach supports only the P2P path: on notifysfuaccessinfo (SFU/mediasoup stream) the UI must report "SFU streams are not supported" instead of "no stream". The core never logs stream payloads (SDP/ICE/tokens).
  • items: one map per |-separated entry; keys and values are unescaped strings (JSON/SDP stay raw strings — parse/validate them in the native stream service). Flags without value → "".

error

{"event":"error","error":{...}} — asynchronous error (see §3).

6. Identity storage (native service ownership)

The private vault, nickname metadata and profile lock live in --data-dir; legacy identity/profile files are migrated by Store without changing keys or UIDs. UID is recomputed on read; corrupt data never triggers silent regeneration. Private writes are atomic and owner-only. Connection cores share the vault but hold distinct --connection-dir locks. Identity mutations serialize on the profile lock and refuse deleting identities currently used by live connections.

Diagnostic identity CLI (host paths from trusted native dialogs/callers, never arbitrary UI strings):

teamspeach-core identity <list|create|update|default|delete|export|import|improve> --data-dir <DIR> …

  • create: --name --nickname; update: --uid [--name] [--nickname]; default: --uid.
  • delete: --uid --confirm-uid; export: --uid --out; import: --in (additive, no destructive replace).
  • improve: --uid --target [--seconds 1..60] (default 30). Cancellation is a stdin line or EOF; work checkpoints safely without changing the key/UID. Connecting never performs implicit unbounded proof-of-work; a higher requirement returns required security level for the explicit worker.

Results are {ok:true,result} or {ok:false,error}. Improvement also emits {event:"identity_progress",uid,level,target,searched:string,elapsed_ms}. No private key is emitted on stdout. Export uses TeamSpeak-compatible INI with a user-selected private file, owner-only publication. Export/list are read-only and can run while a connection holds the vault; writes retain locking.

7. Build prerequisites

Use rust-toolchain.toml, installed C/C++ tools, CMake and Python 3. Repository .cargo/config.toml controls static bundled Opus/CMake compatibility; run Cargo from the repository root. Application builds also require source-built pinned Skia/libwebrtc and target SDKs through Cargo xtask; see README. Keep normal Skia/WebRTC features: reduced-feature compilation is not product acceptance. CARGO_TARGET_DIR is a workspace override. The standalone diagnostic binary can be built with cargo build --release --locked -p teamspeach-core.

Workspace tests cover offline core/stdio contracts. Physical media/live peers/server mutations require separate authorization. Windows requires MSVC C++ tools/SDK and a compatible CMake VS generator; Linux/macOS require native C/C++ tools/CMake, not system libopus. Lower parallelism with --jobs when needed without weakening features or validation gates.

  • tsclientlib is vendored with a small patch (core/vendor/README.md); third-party notices: core/THIRD_PARTY_NOTICES.md (regenerate with python core/tools/third_party_notices.py).