feat(clients): meta: Meta Model API module, Muse Code protocol client, demo and tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 08:02:23 +02:00
co-authored by Claude Sonnet 5.5
parent 2e0270c043
commit 6fb7c80d2d
51 changed files with 7035 additions and 3 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "meta/models.h"
#include "meta/calls.h"
#include "meta/check.h"
namespace molo::meta {
ModelEntry ModelEntry::from_json(const Json& j) {
ModelEntry m;
m.id = JsonX::str(j, "id");
m.created = JsonX::num(j, "created");
m.owned_by = JsonX::str(j, "owned_by");
if (const Json* md = JsonX::obj(j, "metadata")) m.metadata = *md;
return m;
}
ServiceStatus ServiceStatus::from_json(const Json& j) {
ServiceStatus s;
s.is_alive = JsonX::flag(j, "is_alive");
s.service_status = JsonX::str(j, "service_status");
s.service_message = JsonX::str(j, "service_message");
s.updated_at = JsonX::str(j, "updated_at");
if (const Json* m = JsonX::arr(j, "model_statuses")) s.model_statuses = *m;
return s;
}
std::vector<ModelEntry> ModelsService::list() {
Json doc = client_->get(path_for(Call::kModelsList));
std::vector<ModelEntry> out;
if (const Json* d = JsonX::arr(doc, "data"))
for (const Json& m : d->as_array()) out.push_back(ModelEntry::from_json(m));
return out;
}
ModelEntry ModelsService::retrieve(const std::string& model_id) {
Check::model_id(model_id);
return ModelEntry::from_json(client_->get(path_for(Call::kModelsRetrieve, model_id)));
}
ServiceStatus StatusService::get() {
return ServiceStatus::from_json(client_->get(path_for(Call::kStatus)));
}
} // namespace molo::meta