37 Commits
Author SHA1 Message Date
faumaray a6555d4c69 Enforce signed licenses and seamless track handoff
Independent component release / publish (push) Failing after 11s
2026-08-02 01:47:23 +03:00
faumaray c2ec314eb9 Reject incompatible managed plugins before activation
Independent component release / publish (push) Failing after 8s
2026-08-01 18:00:04 +03:00
faumaray 9637f1eef7 Core: add configurable startup log rotation 2026-07-28 21:10:09 +03:00
faumaray a277f2102b Core: finalize plugin services after discovery 2026-07-26 18:11:00 +03:00
faumaray dfbbdaaf01 Sources: use standalone yt-dlp releases 2026-07-26 16:44:25 +03:00
faumaray 7975f2b38e update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-25 23:44:42 +03:00
faumaray 9f06af6c80 Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-16 19:59:45 +03:00
faumaray 39aff68d8d Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-15 19:49:57 +03:00
faumaray 01362d2e51 Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-12 02:56:29 +03:00
faumaray 5c036d91fb making WEB
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-11 00:45:17 +03:00
faumaray d146f11f02 Release 1.0.0
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-04 01:49:28 +03:00
faumarayandClaude Opus 4.8 b9c6c5dbc9 commands: fix result/queue formatting for TeamSpeak markdown
The reply lists rendered badly: durations written as [0:00] were parsed as
Markdown link references (brackets stripped), and titles containing Markdown
punctuation broke the surrounding [title](url) link so it showed raw.

Add shared escapeMarkdown()/markdownLink() helpers (Command.hpp) and reformat
search, play, nowplaying and queue replies to:
  N. [escaped title](shortUrl) · duration
Titles/nicknames are Markdown-escaped so '[', '*', '_', etc. can't break the
link; the duration follows a middot separator instead of [..]. Also guard a
possible nullopt duration deref in the queue list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 03:05:38 +03:00
faumarayandClaude Opus 4.8 5796ccbc74 Core: re-apply YouTube config (API key) on reload
reloadConfig/updateConfig updated the network proxy but never re-pushed the
YouTube settings, so editing youtubeApiKey and reloading had no effect — the
YouTube client kept its startup key. Add MusicManager::applyYouTubeConfig()
(API key, cookies, concurrency, URL shortening; empty key clears it -> yt-dlp
fallback) and call it from both reloadConfig and updateConfig.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 21:49:52 +03:00
faumarayandClaude Opus 4.8 583e4e752d Ensure all outbound calls honor the proxy (fix YouTube API bypass)
Two gaps let network calls escape the configured proxy:

1. NetworkClient::executeRequest read proxy_ without holding mutex_, while
   setProxy()/initialize() write it from other threads (init, config reload).
   A torn read of optional<ProxyConfig> (it holds std::string host/user/pass)
   could yield an empty host -> enabled()==false -> a silent DIRECT connection.
   yt-dlp/ffmpeg snapshot their proxy under their own mutexes, so only the
   HTTP path (YouTube Data API, URL shortener) was affected — matching the
   observed "YouTube API without proxy". Snapshot proxy_ under the lock.

2. Core::reloadConfig updated only the config copy + command manager; it never
   re-applied the proxy to the network stack, so editing the proxy and running
   !reloadconfig left every client on the old/no proxy. Add
   MusicManager::applyNetworkConfig() to push the proxy to the NetworkClient,
   the yt-dlp subprocess, and the ffmpeg AudioDecoder at once, and call it from
   both reloadConfig and updateConfig (which previously touched only the HTTP
   client). reloadConfig now also syncs the shared ConfigManager.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 21:37:46 +03:00
faumarayandClaude Opus 4.8 499143050b Implement reload commands; fix SOCKS5 playback; API->yt-dlp search fallback
F1 (reload commands): Core registers itself as Api::ICoreInterface in the
service registry; !reloadconfig and !reload resolve it via ctx.service and
call Core::reloadConfig() (which reloads config.json from disk), replacing
the old placeholder replies.

F2 (SOCKS5 playback): ffmpeg can't use a SOCKS5 proxy, so it connected
directly to the IP-locked googlevideo URL and timed out; the fallback then
buffered the whole (705 MB) body in memory and tripped Void::Net's body
limit. New YouTubeClient::downloadAudioToFile() re-downloads the audio with
yt-dlp (which handles SOCKS5 + writes to disk) by video id and ffmpeg opens
the local file. MusicManager::downloadAudioForPlayback now uses it, and the
play-open path short-circuits straight to the download when the proxy is
SOCKS5 (skipping the doomed ~15 s ffmpeg attempt); HTTP/no-proxy keeps
stream-first-then-download.

F3 (API fallback): YouTubeClient::search() now falls back to yt-dlp when the
Data API path errors (bad/expired key, quota, network), mirroring what
fetchPlaylistItems already did.

Build green; runtime behaviour to be verified on the live bot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 21:11:20 +03:00
faumarayandClaude Opus 4.8 1efdbe0771 Extract QueueManager from MusicManager
Move the playback queue + shuffle state (the queue vector, shuffled-index
list, shuffle cursor, next-queue-id counter, and RNG) into a QueueManager
class. To preserve the real-time playback loop's exact behavior, the design
is deliberately minimal: QueueManager is a non-thread-safe data holder that
exposes its containers by reference, and MusicManager keeps its single
playback mutex_/cv_ and drives QueueManager under it. Every former queue_/
shuffledIndices_/shuffleIndex_/nextQueueId_/rng_ site is a 1:1 rename to the
accessor with identical semantics — no logic, locking, or ordering change.

Build green. Runtime behavior in the live playback loop is unverified here
(no audio/TeamSpeak); this is an isolated, revertible commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 01:25:07 +03:00
faumarayandClaude Opus 4.8 622335260f Extract PlaylistLoader from MusicManager
Move the async, streaming playlist-load orchestration (the background load
thread, loading/loaded/total counters, and the getPlaylistStreaming wiring)
into a PlaylistLoader class. It enqueues resolved tracks via an injected
callback (-> queueTrack) and asks the owner to start playback on the first
track via requestPlaybackStart() — the single seam back to the audio loop,
which still owns the auto-start thread + cv_ poke. loadPlaylist() now just
delegates. Behavior preserved; build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 01:07:00 +03:00
faumarayandClaude Opus 4.8 30884ad0b5 Decompose Core: split RPC/event setup into files + dedupe init guards
Move Core::setupRpcHandlers (→ CoreRpcHandlers.cpp) and
Core::setupEventBusSubscriptions (→ CoreEventRelay.cpp) out of the
2100-line Core.cpp (now ~1535). They stay Core member functions —
definitions live in dedicated translation units — which gives the
file-decomposition without a risky 500-line this→core rewrite into separate
classes. The RpcAuthRequest struct moves to RpcDtos.hpp as Dto::AuthRequest;
the toJson<T> helper also moves there so both units share it.

Add Core::requireInitialized() and collapse the 28 identical
`if (!initialized_) return fail(ServiceUnavailable,…)` guards into
`if (auto r = requireInitialized(); !r) return std::unexpected(r.error());`.

Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:26:26 +03:00
faumarayandClaude Opus 4.8 0779fdcf20 Serialize RPC responses + event payloads via Void::Json (RpcDtos)
Replace the ~37 hand-built JSON strings in setupRpcHandlers and
setupEventBusSubscriptions (and broadcastEvent) with reflectable DTOs in a
new RpcDtos.hpp, serialized through Void::Json. This fixes a real
correctness bug — track titles/artists, nicknames, playlist IDs, and play
messages containing " or \ produced invalid JSON before; they are now
correctly escaped (verified: `My "Song" \o/` -> `My \"Song\" \\o/`).

Shapes preserved (same keys/order); the only change is absent optionals now
serialize as null instead of being omitted. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:20:13 +03:00
faumarayandClaude Opus 4.8 75ee32a24b Remove dead NetworkClient/Core methods + orphaned pool
Delete NetworkClient getAsync/postAsync/requestAsync/requestBatch/getJson/
postJson and the now-unused parseJson + ThreadPool pool_ member (sync
get/post/request + proxy remain). Delete Core::getQueueSummaries. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:27:22 +03:00
faumarayandClaude Opus 4.8 2d7651c308 Route all logging through the Void::Log facade
Delete the echoion Logger adapter (Logger.{hpp,cpp}) and the
ILogger/LoggerRegistry indirection. Core::installLogging() builds the
console + split-file Void::Logging::MultiLogger and installs it as the
process-wide Void::Log sink via Void::Log::make_sink (logSink_ owns it for
the process lifetime). The ~450 ECHOION_LOG_* call sites across EchoionCore
are rewritten to Void::Log::<level>("<Subsystem>", "{}", <expr>) with
per-file module tags (warning->warn, critical->fatal); the pre-formatted
message is passed as the single "{}" argument. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:10:06 +03:00
faumarayandClaude Opus 4.8 0e08ccaefa Own ConfigManager in Core; resolve config via DI instead of the singleton
Core holds a ConfigManager member, keeps it synced (updateConfig(config_)),
and provides it as a service. ConfigManager.cpp drops the instance()
definition. MusicManager gets the manager via setConfigManager() and reads
sections through it (former ECHOION_BOT/YOUTUBE/NETWORK sites); RpcInfoCommand
resolves it from the registry via ctx.service<Api::ConfigManager>(). Build
green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:01:31 +03:00
faumarayandClaude Opus 4.8 f7553d10d3 Own the event bus in Core; inject it into MusicManager
Core holds a Void::EventBus::EventBus (Async), provides it as a service, and
runs its 18 event subscriptions against it directly (setupEventBusSubscriptions
is no longer const since it now mutates the owned bus). MusicManager gets the
bus via setEventBus() and publishes through a small emit<T>() helper (14
former GlobalEventBus publish sites). Delete EventBus.cpp (the singleton
definition). Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:56:32 +03:00
faumarayandClaude Opus 4.8 9d56a6ff01 Consume Void::Net directly in NetworkClient and callers
Delete NetworkClient's to_void_method/to_void_proxy/to_api_response bridge
and the Api::RetryConfig member; the client builds Void::Net::Request, sends
via Void::Net::HttpClient, returns Void::Net::Response, and retries via an
internal Void::Retry policy + retryable-status list.

Call sites updated to Void::Net member names: isSuccess()->ok(),
statusCode->status, getHeader()->header() (optional<string_view>),
isRedirect()->status range check; proxy isValid()->enabled(),
requiresAuth()->has_auth(), isSocks5()->kind == Kind::Socks5. Proxy fields
flow through YtDlpManager/AudioDecoder/MusicManager unchanged in spelling.
On-disk proxy shape is now Void::Net::ProxyConfig (kind: None/Http/Socks5);
config.example.json updated and proxy round-trip verified. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:49:26 +03:00
faumarayandClaude Opus 4.8 3af9aecbec Phase C: run RPC per-client handlers on a Void ThreadPool
Replace the one-detached-std::thread-per-client model and its manual
bookkeeping (the clientThreads_ vector, finished-thread sweep, and
detach-after-timeout shutdown) with a Void::Concurrency::ThreadPool:

- start() builds clientPool_ (CLIENT_POOL_SIZE workers); the accept loop
  submits each accepted connection's handleClient + cleanup as a task.
- stop() closes the client sockets (so each handler's read() returns) then
  resets the pool, whose destructor drains and joins every handler.

The accept loop stays on its own dedicated thread — a long-lived listen
loop is not pool work, and its cancellable/timeout-guarded shutdown is
unchanged. CLIENT_POOL_SIZE (64) caps concurrent long-lived client handlers
far above any realistic count for this bot's RPC surface.

Build green. Runtime behavior (live RPC sessions) is unverified here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:26:16 +03:00
faumarayandClaude Opus 4.8 ef094c0d78 Phase C: replace CommandManager's hand-rolled pool with Void ThreadPool
CommandManager dispatched async commands through a bespoke pool — a jthread
vector, a CommandTask queue, a mutex/condition_variable, and a manual
drain-on-shutdown loop. Replace it with a Void::Concurrency::ThreadPool:

- startThreadPool() builds the pool at THREAD_POOL_SIZE; shutdown() flips
  the accept flag and resets the pool (~ThreadPool drains queued commands
  then joins — the same shutdown semantics the manual loop had).
- dispatch() submits the CommandTask lambda straight to the pool instead of
  enqueuing + notifying; executeCommandAsync already swallows exceptions, so
  the discarded future is safe.
- processCommandQueue() and the queue/cv/worker members are gone.

Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 03:12:10 +03:00
faumarayandClaude Opus 4.8 da708fa9bb Phase C: replace YtDlpManager's hand-rolled pool with Void ThreadPool
YtDlpManager carried a bespoke worker pool — a jthread vector, a
packaged_task queue, and a mutex/condition_variable/stop-flag loop. Swap
all of it for a single Void::Concurrency::ThreadPool (held by unique_ptr so
setThreadPoolSize can recreate it):

- startThreadPool() constructs the pool at the (auto-adjusted) size;
  stopThreadPool() resets it (the destructor drains and joins).
- executeAsync() submits to the pool under mutex_ (mutually exclusive with
  start/stop), with a synchronous fallback if called before start.
- workerThread() and the taskQueue_/taskCv_/taskMutex_/stopThreads_ members
  are gone.

Behaviorally equivalent (bounded yt-dlp concurrency, same std::future
results) with far less concurrency code to own. Build green.

The init-time "update yt-dlp in background" detached thread is left as-is:
it's a one-shot fired before the pool exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 03:09:15 +03:00
faumarayandClaude Opus 4.8 5775c522eb Phase C: back parallel fan-outs with Void ThreadPool
Replace the per-call std::async OS-thread spawns in the blocking
fan-out/collect paths with a bounded Void::Concurrency::ThreadPool member,
giving thread reuse instead of an unbounded thread per request:

- YouTubeClient: getVideoInfoAsync, getPlaylistAsync, and the two playlist
  resolution batches now submit to pool_. The std::future<T>/.get() join
  semantics are unchanged, so control flow is identical.
- NetworkClient: getAsync/postAsync/requestAsync (and thus requestBatch)
  submit to pool_.

populateShortenedUrls is deliberately left on std::async — it relies on
wide parallelism under a tight 5s budget, which a bounded pool would
throttle. Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 03:06:44 +03:00
faumarayandClaude Opus 4.8 51f1651c18 Serialize AppConfig directly via Void::Json reflection
Drop the parallel *Json mirror structs and the ~370 LOC of field-by-field
mapping in ConfigLoader and Core. Api::AppConfig is now reflected straight
to/from JSON:

- ConfigLoader::{loadFromFile,saveToFile} use from_json/to_json<AppConfig>
  directly; a small normalize() keeps the yt-dlp concurrency cap that the
  mapping layer used to enforce.
- Core::{getConfigJson,updateConfigJson} likewise reflect directly, which
  also extends them to honor youtube/features/advanced sections that the
  old hand-mapping silently dropped.
- parseQuality/qualityToString removed — enums serialize by name.

On-disk format change (v3, clean cutover): durations are strings
("30000ms", also accepts "30s"/"5m"/"1h"), enums are names, the proxy is a
nested object (or null) instead of flat proxyType/proxyHost fields, and the
admin/custom sections now round-trip. Verified: build green, a
serialize->parse->deserialize round-trip of AppConfig (incl. a SOCKS5
proxy) passes, and config.example.json loads through the reflection path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 03:00:58 +03:00
faumarayandClaude Opus 4.8 a9ab0d6b75 Make the service registry a real read path for commands
The DI registry was write-only — populated in Core::initialize() but never
resolved through. Thread it into command execution so commands resolve
shared services by interface instead of constructing throwaways:

- CommandContext gains a non-owning ServiceRegistry* plus an ergonomic
  service<I>() resolver.
- CommandManager carries the registry (Core::setServices(&registry_)) and
  stamps it onto every CommandContext it builds (async + sync paths).
- RpcInfoCommand's getPublicIpAddress() now reuses the shared, initialized
  INetworkClient from the registry, falling back to a throwaway client only
  when none is registered.

Core itself (the composition root) keeps direct member wiring and commands
keep explicit MusicManager injection — converting those to a service locator
would only hide dependencies; the registry earns its keep at the genuine
seam where a command needs a service it isn't handed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 22:25:15 +03:00
faumarayandClaude Opus 4.8 23759899bb Use Api::fail() for error returns (241 sites)
Mechanically convert std::unexpected(Api::Error(ErrorCode::X, msg[, src]))
to Api::fail(ErrorCode::X, msg[, src]) across Core. Pure syntax; forwards of
existing errors (std::unexpected(x.error())) are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 22:07:18 +03:00
faumarayandClaude Opus 4.8 f8757d6040 Inline 4 trivial Void delegation shims
Remove YouTubeClient::urlEncode/decodeHtmlEntities/parseIso8601Duration and
StateSerializer::getCurrentTimestampISO8601 — each just forwarded to one Void
call — and have the ~12 call sites call Void directly
(Void::Encoding::Url::encode, Void::Text::html_unescape,
Void::Time::parse_iso8601_interval(...).value_or(0), Void::Time::utc_now_iso8601).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 22:04:43 +03:00
faumarayandClaude Opus 4.8 32fbffa171 Introduce a service registry as Core's composition root
Add Void::Service::ServiceRegistry to Core. initialize() now registers every
service by interface — ILogger, ConfigManager, EventBus, INetworkClient,
Database, MusicManager, RpcServer — so code can resolve them via
Core::services().require<I>() instead of reaching for global singletons. The
three former singletons (logger/config/event bus) are wrapped in non-owning
aliasing shared_ptrs and remain valid behind the ECHOION_LOG_*/PUBLISH/
SUBSCRIBE macros; the registry just makes them discoverable as services.

This establishes the DI backbone; migrating individual call sites to
registry resolution is intentionally incremental. Requires the VoidLibrary
fix allowing non-polymorphic service types in provide<I>. Link Void::Service.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 17:00:31 +03:00
faumarayandClaude Opus 4.8 914eb0a232 Rewrite NetworkClient as a Void::Net::HttpClient adapter
Replace the ~700-line hand-rolled HTTP stack (Boost.Beast/Asio client,
URL parsing, HTTP-CONNECT + SOCKS5 proxy handshakes, a bespoke 4-thread
packaged_task pool) with a thin adapter over Void::Net::HttpClient that
still implements Api::INetworkClient. Translates Api::HttpRequest/Response/
ProxyConfig <-> Void::Net types; retry/backoff stays on Void::Retry; async
methods use std::async. Link Void::Net.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:35:11 +03:00
faumaray 2bdb63766d Migrate core infrastructure to VoidLibrary 2026-06-22 15:53:23 +03:00
faumaray 53801f2b53 many different fixes 2026-02-03 05:07:15 +03:00
faumaray a583c17916 Initial commit 2026-02-01 23:04:49 +03:00