feat(clients): optimize: evaluation, simulation, observability and optimizer on a discovery-checked call table

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 04:40:55 +02:00
co-authored by Claude Sonnet 5.5
parent 6d744a433f
commit 1e2fb400bb
55 changed files with 5099 additions and 3 deletions
@@ -0,0 +1,37 @@
// Route: GET /agent/optimize and /agent/optimize/status (page, script, call table)
#include <cstdlib>
#include "support/GoogleRig.hpp"
using namespace molo::example::test;
int main() {
setenv("GOOGLE_CLOUD_PROJECT", "test-proj", 1);
GoogleRig rig(false);
Fixture f(rig.client);
auto page = f.client->get("/agent/optimize");
check(page.status == 200, "page status 200 without a credential");
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
check(contains(page.body, "width=device-width"), "responsive viewport");
check(contains(page.body, "id=\"o-action\""), "action dropdown (no wide button group)");
check(contains(page.body, "/embedded/agent_optimize.js"), "script linked");
auto js = f.client->get("/embedded/agent_optimize.js");
check(js.status == 200 && contains(js.body, "/agent/optimize/"), "script served from the bundle");
auto st = f.client->get("/agent/optimize/status");
check(st.status == 200, "status 200 without a credential");
check(contains(st.headers.get("Content-Type"), "json"), "status is json");
check(contains(st.body, "\"configured\":false"), "reports no credential");
check(contains(st.body, "\"project_set\":true"), "reports the project is set, never its value");
check(!contains(st.body, "test-proj"), "project id never echoed");
check(contains(st.body, "aiplatform.projects.locations.evaluateInstances"),
"call table listed");
check(contains(st.body, "cloudtrace.projects.traces.list"), "trace read listed");
check(contains(st.body, "\"max_sim_turns\":12"), "caps listed");
check(f.client->post("/agent/optimize").status == 405, "post to the page is 405");
check(f.client->post("/agent/optimize/status").status == 405, "post to status is 405");
check(rig.mock->send_count() == 0, "side effect: GET routes make no Google call");
return finish("agent/optimize/page");
}