feat(clients): models+runtime: close gaps (all Discovery methods wrapped, live re-verification)
models: EndpointAdmin and PublisherAdmin wrap every remaining method of the owned resources (84 call table rows, 132 Discovery methods covered, v1beta1 twins, IAM, operations, responses, export, config, enableModel); planner rejects undeclared body keys; VertexModel::TurnBuilder replays model turns with every thoughtSignature; Lyria WAV mime from bytes; veo-3.1 default. runtime: v1beta1 feedbackEntries, A2A gateway (40 rpcs), a2aTasks, task store records, scoped operations, beta twin flag (103 rows, 214 methods covered); checker verifies twins, a2aEndpoint patterns and coverage. example: admin routes for both parts. SPECs: live results moved from Unverified to Verified live (Veo, Lyria, thought signatures, v1beta1 routes). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,12 @@
|
||||
#include "../../fw/Router.hpp"
|
||||
#include "../../fw/Templates.hpp"
|
||||
#include "google/resource.h"
|
||||
#include "google/runtime/a2a.h"
|
||||
#include "google/runtime/agent_runtime.h"
|
||||
#include "google/runtime/calls.h"
|
||||
#include "google/runtime/caps.h"
|
||||
#include "google/runtime/feedback.h"
|
||||
#include "google/runtime/operation_calls.h"
|
||||
|
||||
namespace molo::example::app {
|
||||
|
||||
@@ -44,6 +47,24 @@ Lists and queries only; create and delete stay behind explicit calls.</p>
|
||||
<button id="rt-query" type="button">Query</button>
|
||||
<button id="rt-stream" type="button">Stream query</button>
|
||||
</div>
|
||||
<h2>More calls</h2>
|
||||
<p class="hint">Operations, revisions, update, IAM, code, feedback, A2A. Destructive
|
||||
actions are dry runs until the body says <code>"confirm":true</code>.</p>
|
||||
<label>Route
|
||||
<select id="rt-route">
|
||||
<option value="operations">Operations (get, list, cancel, wait, delete)</option>
|
||||
<option value="revisions">Revisions (get, list, delete, query, stream)</option>
|
||||
<option value="update">Update engine</option>
|
||||
<option value="iam">IAM (get, test, set)</option>
|
||||
<option value="code">Execute code</option>
|
||||
<option value="async/cancel">Cancel async query</option>
|
||||
<option value="feedback">Feedback entries</option>
|
||||
<option value="a2a">A2A gateway</option>
|
||||
<option value="a2a/tasks">A2A tasks</option>
|
||||
<option value="a2a/records">A2A task records</option>
|
||||
</select></label>
|
||||
<label>Body (JSON object) <textarea id="rt-body" rows="5"></textarea></label>
|
||||
<div class="rt-actions"><button id="rt-send" type="button">Send</button></div>
|
||||
<p id="rt-error" class="error" role="alert"></p>
|
||||
<pre id="rt-out" class="rt-out"></pre>
|
||||
</section>
|
||||
@@ -171,6 +192,414 @@ rt::EngineDraft draft_from(const Json& body) {
|
||||
return d;
|
||||
}
|
||||
|
||||
// --- extended routes ---------------------------------------------------------
|
||||
// Everything below validates its input first (422), then needs a credential
|
||||
// (503 google_not_configured), then calls the runtime part. Destructive
|
||||
// actions are dry runs unless the body says "confirm":true.
|
||||
|
||||
bool flag(const Json& body, const char* key) {
|
||||
const Json* v = body.find(key);
|
||||
if (!v || v->is_null()) return false;
|
||||
if (!v->is_bool()) bad(std::string(key) + " must be true or false");
|
||||
return v->as_bool();
|
||||
}
|
||||
|
||||
std::string pick(const Json& body, const char* key, std::initializer_list<const char*> allowed) {
|
||||
std::string v = text(body, key, true);
|
||||
std::string list;
|
||||
for (const char* a : allowed) {
|
||||
if (v == a) return v;
|
||||
list += (list.empty() ? "" : ", ") + std::string(a);
|
||||
}
|
||||
bad(std::string(key) + " must be one of " + list);
|
||||
}
|
||||
|
||||
std::string segment(const Json& body, const char* key) {
|
||||
std::string v = text(body, key, true);
|
||||
if (!google::valid_segment(v)) bad(std::string(key) + " must be 1-128 chars of A-Z a-z 0-9 . _ -");
|
||||
return v;
|
||||
}
|
||||
|
||||
Json object_field(const Json& body, const char* key, bool required) {
|
||||
const Json* v = body.find(key);
|
||||
if (!v || v->is_null()) {
|
||||
if (required) bad(std::string(key) + " is required");
|
||||
return Json::object();
|
||||
}
|
||||
if (!v->is_object()) bad(std::string(key) + " must be a JSON object");
|
||||
return *v;
|
||||
}
|
||||
|
||||
Json array_field(const Json& body, const char* key, bool required) {
|
||||
const Json* v = body.find(key);
|
||||
if (!v || v->is_null()) {
|
||||
if (required) bad(std::string(key) + " is required");
|
||||
return Json::array();
|
||||
}
|
||||
if (!v->is_array()) bad(std::string(key) + " must be a JSON array");
|
||||
return *v;
|
||||
}
|
||||
|
||||
int bounded(const Json& body, const char* key, int lo, int hi, int fallback) {
|
||||
auto n = number(body, key);
|
||||
if (!n) return fallback;
|
||||
if (*n < lo || *n > hi)
|
||||
bad(std::string(key) + " must be " + std::to_string(lo) + ".." + std::to_string(hi));
|
||||
return *n;
|
||||
}
|
||||
|
||||
Json dry_run(const char* what, const std::string& target) {
|
||||
Json o = Json::object();
|
||||
o.set("dry_run", Json(true));
|
||||
o.set(what, Json(target));
|
||||
o.set("hint", Json("send confirm:true to run it"));
|
||||
return o;
|
||||
}
|
||||
|
||||
Json operations_json(const std::vector<google::Operation>& ops) {
|
||||
Json arr = Json::array();
|
||||
for (const auto& op : ops) arr.push(operation_json(op));
|
||||
Json o = Json::object();
|
||||
o.set("operations", arr);
|
||||
return o;
|
||||
}
|
||||
|
||||
rt::FeedbackEntry feedback_from(const Json& body) {
|
||||
rt::FeedbackEntry e;
|
||||
e.event_id = text(body, "eventId");
|
||||
e.source = text(body, "source");
|
||||
e.session_id = text(body, "sessionId");
|
||||
e.user_id = text(body, "userId");
|
||||
e.feedback_type = text(body, "feedbackType");
|
||||
e.feedback_text = text(body, "feedbackText");
|
||||
for (const Json& l : array_field(body, "feedbackLabels", false).as_array()) {
|
||||
if (!l.is_string()) bad("feedbackLabels must be strings");
|
||||
e.feedback_labels.push_back(l.as_string());
|
||||
}
|
||||
Json meta = object_field(body, "customMetadata", false);
|
||||
if (!meta.as_object().empty()) e.custom_metadata = meta;
|
||||
try {
|
||||
e.validate();
|
||||
} catch (const google::GoogleError& ex) {
|
||||
rethrow(ex);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
rt::A2aTaskInfo task_from(const Json& body) {
|
||||
rt::A2aTaskInfo t;
|
||||
t.context_id = text(body, "contextId");
|
||||
t.app_id = text(body, "appId");
|
||||
t.user_id = text(body, "userId");
|
||||
t.ttl = text(body, "ttl");
|
||||
t.expire_time = text(body, "expireTime");
|
||||
Json meta = object_field(body, "metadata", false);
|
||||
if (!meta.as_object().empty()) t.metadata = meta;
|
||||
try {
|
||||
t.validate();
|
||||
} catch (const google::GoogleError& ex) {
|
||||
rethrow(ex);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
Json task_list_json(const std::vector<rt::A2aTaskInfo>& tasks) {
|
||||
Json arr = Json::array();
|
||||
for (const auto& t : tasks) arr.push(t.raw);
|
||||
Json o = Json::object();
|
||||
o.set("items", arr);
|
||||
return o;
|
||||
}
|
||||
|
||||
// One object per route family so the register function stays a table of routes.
|
||||
class RuntimeAdminRoutes {
|
||||
public:
|
||||
explicit RuntimeAdminRoutes(std::shared_ptr<google::GoogleClient> client)
|
||||
: client_(std::move(client)) {}
|
||||
|
||||
fw::Response operations(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string action = pick(b, "action", {"get", "list", "cancel", "wait", "delete"});
|
||||
std::string name = text(b, action == "list" ? "parent" : "name", true);
|
||||
rt::OperationScope scope = local([&] { return rt::OperationCalls::scope_from(name); });
|
||||
if (action != "list") local([&] { return rt::OperationCalls::check(scope, name); });
|
||||
if (action == "list" && !rt::OperationCalls::has_list(scope))
|
||||
bad(std::string(rt::OperationCalls::scope_name(scope)) + " operations cannot be listed");
|
||||
int timeout = bounded(b, "timeoutSeconds", 1, rt::ScopedOperationCaps::kMaxWaitSeconds, 30);
|
||||
bool confirm = flag(b, "confirm");
|
||||
if (action == "delete" && !confirm) return json_out(dry_run("would_delete", name));
|
||||
return guarded([&] {
|
||||
rt::OperationCalls ops = runtime().operations();
|
||||
if (action == "get") return json_out(operation_json(ops.get(scope, name)));
|
||||
if (action == "list") return json_out(operations_json(ops.list(scope, name, text(b, "filter"))));
|
||||
if (action == "wait") return json_out(operation_json(ops.wait(scope, name, timeout)));
|
||||
if (action == "cancel") {
|
||||
ops.cancel(scope, name);
|
||||
Json o = Json::object();
|
||||
o.set("cancel_requested", Json(name));
|
||||
return json_out(o);
|
||||
}
|
||||
ops.remove(scope, name, true);
|
||||
Json o = Json::object();
|
||||
o.set("deleted", Json(name));
|
||||
return json_out(o);
|
||||
});
|
||||
}
|
||||
|
||||
fw::Response revisions(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string action = pick(b, "action", {"get", "list", "delete", "query", "stream"});
|
||||
std::string id = engine_id(b);
|
||||
std::string revision = action == "list" ? "" : segment(b, "revision");
|
||||
Json input = Json::object();
|
||||
std::string method = text(b, "classMethod");
|
||||
if (action == "query" || action == "stream") {
|
||||
input = object_field(b, "input", false);
|
||||
local([&] { return rt::AgentRuntime::query_body(input, method.empty() ? "query" : method); });
|
||||
}
|
||||
bool confirm = flag(b, "confirm");
|
||||
if (action == "delete" && !confirm) return json_out(dry_run("would_delete", id + "/" + revision));
|
||||
return guarded([&] {
|
||||
rt::AgentRuntime r = runtime();
|
||||
if (action == "list") {
|
||||
Json arr = Json::array();
|
||||
for (const auto& v : r.list_revisions(id)) arr.push(v.raw);
|
||||
Json o = Json::object();
|
||||
o.set("revisions", arr);
|
||||
return json_out(o);
|
||||
}
|
||||
if (action == "get") return json_out(r.get_revision(id, revision).raw);
|
||||
if (action == "delete") return json_out(operation_json(r.destroy_revision_start(id, revision)), 202);
|
||||
if (action == "query")
|
||||
return json_out(method.empty() ? r.query_revision(id, revision, input)
|
||||
: r.query_revision(id, revision, input, method));
|
||||
Json events = Json::array();
|
||||
auto sink = [&](const Json& e) {
|
||||
events.push(e);
|
||||
return events.as_array().size() < kMaxStreamEventsShown;
|
||||
};
|
||||
if (method.empty()) r.stream_query_revision(id, revision, input, sink);
|
||||
else r.stream_query_revision(id, revision, input, sink, method);
|
||||
Json o = Json::object();
|
||||
o.set("events", events);
|
||||
return json_out(o);
|
||||
});
|
||||
}
|
||||
|
||||
fw::Response update(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string id = engine_id(b);
|
||||
rt::EngineUpdate u;
|
||||
if (b.find("displayName")) u.display_name = text(b, "displayName", true);
|
||||
if (b.find("description")) u.description = text(b, "description", true);
|
||||
local([&] { u.validate(); return 0; });
|
||||
return guarded([&] { return json_out(operation_json(runtime().update_start(id, u)), 202); });
|
||||
}
|
||||
|
||||
fw::Response iam(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string action = pick(b, "action", {"get", "test", "set"});
|
||||
std::string id = engine_id(b);
|
||||
int version = bounded(b, "policyVersion", 0, 3, 0);
|
||||
std::vector<std::string> permissions;
|
||||
if (action == "test") {
|
||||
for (const Json& p : array_field(b, "permissions", true).as_array()) {
|
||||
if (!p.is_string()) bad("permissions must be strings");
|
||||
permissions.push_back(p.as_string());
|
||||
}
|
||||
}
|
||||
Json policy = action == "set" ? object_field(b, "policy", true) : Json::object();
|
||||
if (action == "set" && !flag(b, "confirm")) return json_out(dry_run("would_set_policy_on", id));
|
||||
return guarded([&] {
|
||||
rt::AgentRuntime r = runtime();
|
||||
if (action == "get") return json_out(r.get_iam_policy(id, version));
|
||||
if (action == "set") return json_out(r.set_iam_policy(id, policy));
|
||||
Json arr = Json::array();
|
||||
for (const auto& p : r.test_iam_permissions(id, permissions)) arr.push(Json(p));
|
||||
Json o = Json::object();
|
||||
o.set("permissions", arr);
|
||||
return json_out(o);
|
||||
});
|
||||
}
|
||||
|
||||
fw::Response code(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string id = engine_id(b);
|
||||
Json inputs = array_field(b, "inputs", true);
|
||||
if (inputs.as_array().empty()) bad("inputs must not be empty");
|
||||
return guarded([&] { return json_out(runtime().execute_code(id, inputs)); });
|
||||
}
|
||||
|
||||
fw::Response cancel_async(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string id = engine_id(b);
|
||||
std::string name = text(b, "operation", true);
|
||||
if (name.rfind("projects/", 0) != 0 || name.size() > 512 || name.find("..") != std::string::npos ||
|
||||
name.find('?') != std::string::npos)
|
||||
bad("operation must be an operation name starting with projects/");
|
||||
return guarded([&] {
|
||||
runtime().cancel_async_query(id, name);
|
||||
Json o = Json::object();
|
||||
o.set("cancel_requested", Json(name));
|
||||
return json_out(o);
|
||||
});
|
||||
}
|
||||
|
||||
fw::Response feedback(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
std::string action = pick(b, "action", {"list", "get", "create", "patch", "delete", "context",
|
||||
"context_update"});
|
||||
std::string id = engine_id(b);
|
||||
std::string entry = (action == "list" || action == "create") ? "" : segment(b, "entry");
|
||||
rt::FeedbackEntry fields;
|
||||
if (action == "create" || action == "patch") fields = feedback_from(b);
|
||||
Json events = action == "context_update" ? array_field(b, "contextEvents", true) : Json::array();
|
||||
if (action == "delete" && !flag(b, "confirm")) return json_out(dry_run("would_delete", id + "/" + entry));
|
||||
return guarded([&] {
|
||||
rt::RuntimeFeedback fb(client_, ctx());
|
||||
need_credential();
|
||||
if (action == "list") {
|
||||
Json arr = Json::array();
|
||||
for (const auto& e : fb.list(id, text(b, "filter"), text(b, "orderBy"))) {
|
||||
Json j = e.to_json();
|
||||
j.set("name", Json(e.name));
|
||||
arr.push(j);
|
||||
}
|
||||
Json o = Json::object();
|
||||
o.set("entries", arr);
|
||||
return json_out(o);
|
||||
}
|
||||
if (action == "get") {
|
||||
rt::FeedbackEntry e = fb.get(id, entry);
|
||||
Json j = e.to_json();
|
||||
j.set("name", Json(e.name));
|
||||
return json_out(j);
|
||||
}
|
||||
if (action == "context") return json_out(fb.get_context(id, entry));
|
||||
if (action == "create") return json_out(operation_json(fb.create(id, fields)), 202);
|
||||
if (action == "patch") return json_out(operation_json(fb.patch(id, entry, fields)), 202);
|
||||
if (action == "context_update")
|
||||
return json_out(operation_json(fb.update_context(id, entry, events)), 202);
|
||||
return json_out(operation_json(fb.destroy(id, entry, true)), 202);
|
||||
});
|
||||
}
|
||||
|
||||
fw::Response a2a(const fw::Request& req) const {
|
||||
Json b = parse_body(req);
|
||||
rt::A2aRequest r;
|
||||
r.target = pick(b, "target", {"engine", "revision"}) == "engine" ? rt::A2aTarget::kEngine
|
||||
: rt::A2aTarget::kRevision;
|
||||
r.protocol = pick(b, "protocol", {"plain", "v1"}) == "v1" ? rt::A2aProtocol::kV1
|
||||
: rt::A2aProtocol::kPlain;
|
||||
static const std::pair<const char*, rt::A2aOp> kOps[] = {
|
||||
{"card", rt::A2aOp::kCard}, {"extended_card", rt::A2aOp::kExtendedAgentCard},
|
||||
{"tasks", rt::A2aOp::kTasks}, {"task", rt::A2aOp::kTaskGet},
|
||||
{"push_configs", rt::A2aOp::kPushConfigs}, {"push_config", rt::A2aOp::kPushConfigGet},
|
||||
{"cancel", rt::A2aOp::kTaskCancel}, {"subscribe", rt::A2aOp::kTaskSubscribe},
|
||||
{"send", rt::A2aOp::kMessageSend}, {"stream", rt::A2aOp::kMessageStream}};
|
||||
std::string op = text(b, "op", true);
|
||||
bool known = false;
|
||||
for (const auto& [name, value] : kOps)
|
||||
if (op == name) {
|
||||
r.op = value;
|
||||
known = true;
|
||||
}
|
||||
if (!known) bad("op must be one of card, extended_card, tasks, task, push_configs, push_config, "
|
||||
"cancel, subscribe, send, stream");
|
||||
r.engine_id = engine_id(b);
|
||||
if (r.target == rt::A2aTarget::kRevision) r.revision_id = segment(b, "revision");
|
||||
r.task_id = text(b, "task");
|
||||
r.config_id = text(b, "config");
|
||||
r.history_length = bounded(b, "historyLength", 0, rt::A2aCaps::kMaxHistoryLength, 0);
|
||||
if (!r.is_get()) r.body = object_field(b, "body", true);
|
||||
local([&] { return rt::RuntimeA2a(client_, ctx()).path_of(r); });
|
||||
return guarded([&] {
|
||||
need_credential();
|
||||
rt::RuntimeA2a gateway(client_, ctx());
|
||||
if (r.is_stream()) {
|
||||
Json events = Json::array();
|
||||
gateway.stream(r, [&](const Json& e) {
|
||||
events.push(e);
|
||||
return events.as_array().size() < kMaxStreamEventsShown;
|
||||
});
|
||||
Json o = Json::object();
|
||||
o.set("events", events);
|
||||
return json_out(o);
|
||||
}
|
||||
if (r.op == rt::A2aOp::kTaskSubscribe) return json_out(gateway.subscribe(r));
|
||||
return json_out(gateway.call(r));
|
||||
});
|
||||
}
|
||||
|
||||
// Tasks of an engine ("tasks") or records of a task store ("records").
|
||||
fw::Response tasks(const fw::Request& req, bool records) const {
|
||||
Json b = parse_body(req);
|
||||
std::string action = pick(b, "action", {"create", "get", "list", "delete", "append", "events"});
|
||||
std::string owner = records ? segment(b, "store") : engine_id(b);
|
||||
std::string item = (action == "list") ? "" : (action == "create" && records ? text(b, "record")
|
||||
: (action == "create" ? text(b, "task", true)
|
||||
: segment(b, records ? "record" : "task")));
|
||||
if (action == "create" && !item.empty()) {
|
||||
if (records) {
|
||||
if (!google::valid_segment(item)) bad("record must be 1-128 chars of A-Z a-z 0-9 . _ -");
|
||||
} else {
|
||||
local([&] { rt::RuntimeA2a::check_task_id(item); return 0; });
|
||||
}
|
||||
}
|
||||
rt::A2aTaskInfo fields = action == "create" ? task_from(b) : rt::A2aTaskInfo{};
|
||||
Json events = action == "append" ? array_field(b, "events", true) : Json::array();
|
||||
if (action == "append" && (events.as_array().empty() || events.as_array().size() > 100))
|
||||
bad("events must hold 1..100 items");
|
||||
if (action == "delete" && !flag(b, "confirm")) return json_out(dry_run("would_delete", owner + "/" + item));
|
||||
return guarded([&] {
|
||||
need_credential();
|
||||
rt::RuntimeA2a svc(client_, ctx());
|
||||
std::string filter = text(b, "filter");
|
||||
if (action == "create")
|
||||
return json_out((records ? svc.create_record(owner, item, fields)
|
||||
: svc.create_task(owner, item, fields)).raw, 201);
|
||||
if (action == "get")
|
||||
return json_out((records ? svc.get_record(owner, item, text(b, "view"))
|
||||
: svc.get_task(owner, item, text(b, "view"))).raw);
|
||||
if (action == "list")
|
||||
return json_out(task_list_json(records ? svc.list_records(owner, filter, text(b, "orderBy"))
|
||||
: svc.list_tasks(owner, filter, text(b, "orderBy"))));
|
||||
if (action == "append")
|
||||
return json_out(records ? svc.append_record_events(owner, item, events, text(b, "generation"))
|
||||
: svc.append_task_events(owner, item, events, text(b, "generation")));
|
||||
if (action == "events")
|
||||
return json_out(records ? svc.list_record_events(owner, item, filter)
|
||||
: svc.list_task_events(owner, item, filter));
|
||||
if (records) return json_out(svc.delete_record(owner, item, true).raw);
|
||||
svc.delete_task(owner, item, true);
|
||||
Json o = Json::object();
|
||||
o.set("deleted", Json(owner + "/" + item));
|
||||
return json_out(o);
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
google::CloudContext ctx() const { return google::CloudContext::from_env(); }
|
||||
void need_credential() const {
|
||||
if (!client_->configured()) throw google::NotConfiguredError("aiplatform");
|
||||
}
|
||||
rt::AgentRuntime runtime() const {
|
||||
need_credential();
|
||||
return rt::AgentRuntime(client_, ctx());
|
||||
}
|
||||
// Local validation: a library "invalid" becomes a 422.
|
||||
template <typename F>
|
||||
auto local(F&& f) const -> decltype(f()) {
|
||||
try {
|
||||
return f();
|
||||
} catch (const google::GoogleError& e) {
|
||||
rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<google::GoogleClient> client_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void register_agent_runtime_demo(fw::Router& router, Services& services) {
|
||||
@@ -201,6 +630,7 @@ void register_agent_runtime_demo(fw::Router& router, Services& services) {
|
||||
o.set("project_set", Json(!ctx.project.empty()));
|
||||
o.set("location", Json(ctx.location));
|
||||
o.set("max_stream_events", Json(static_cast<int>(kMaxStreamEventsShown)));
|
||||
o.set("calls", Json(static_cast<int>(rt::call_count())));
|
||||
return json_out(o);
|
||||
});
|
||||
|
||||
@@ -208,8 +638,8 @@ void register_agent_runtime_demo(fw::Router& router, Services& services) {
|
||||
router.get("/agent/runtime/calls", "agent-runtime-calls", [](fw::Request req) {
|
||||
(void)req;
|
||||
Json arr = Json::array();
|
||||
for (int c = static_cast<int>(rt::Call::kCreate); c <= static_cast<int>(rt::Call::kRevisionStreamQuery); ++c) {
|
||||
const rt::CallSpec& s = rt::spec_of(static_cast<rt::Call>(c));
|
||||
for (std::size_t i = 0; i < rt::call_count(); ++i) {
|
||||
const rt::CallSpec& s = rt::spec_at(i);
|
||||
Json row = Json::object();
|
||||
row.set("http", Json(s.http_method));
|
||||
row.set("path", Json(s.path));
|
||||
@@ -330,6 +760,26 @@ void register_agent_runtime_demo(fw::Router& router, Services& services) {
|
||||
}
|
||||
return guarded([&] { return json_out(operation_json(runtime().destroy_start(id, force)), 202); });
|
||||
});
|
||||
|
||||
// Extended routes (operations of every scope, revisions, update, IAM, code
|
||||
// execution, feedback, A2A gateway, A2A tasks and task store records).
|
||||
auto admin = std::make_shared<RuntimeAdminRoutes>(client);
|
||||
using Handler = fw::Response (RuntimeAdminRoutes::*)(const fw::Request&) const;
|
||||
auto add = [&](const char* path, const char* name, Handler h) {
|
||||
router.post(path, name, [admin, h](fw::Request req) { return ((*admin).*h)(req); });
|
||||
};
|
||||
add("/agent/runtime/operations", "agent-runtime-operations", &RuntimeAdminRoutes::operations);
|
||||
add("/agent/runtime/revisions", "agent-runtime-revisions", &RuntimeAdminRoutes::revisions);
|
||||
add("/agent/runtime/update", "agent-runtime-update", &RuntimeAdminRoutes::update);
|
||||
add("/agent/runtime/iam", "agent-runtime-iam", &RuntimeAdminRoutes::iam);
|
||||
add("/agent/runtime/code", "agent-runtime-code", &RuntimeAdminRoutes::code);
|
||||
add("/agent/runtime/async/cancel", "agent-runtime-async-cancel", &RuntimeAdminRoutes::cancel_async);
|
||||
add("/agent/runtime/feedback", "agent-runtime-feedback", &RuntimeAdminRoutes::feedback);
|
||||
add("/agent/runtime/a2a", "agent-runtime-a2a", &RuntimeAdminRoutes::a2a);
|
||||
router.post("/agent/runtime/a2a/tasks", "agent-runtime-a2a-tasks",
|
||||
[admin](fw::Request req) { return admin->tasks(req, false); });
|
||||
router.post("/agent/runtime/a2a/records", "agent-runtime-a2a-records",
|
||||
[admin](fw::Request req) { return admin->tasks(req, true); });
|
||||
}
|
||||
|
||||
} // namespace molo::example::app
|
||||
|
||||
Reference in New Issue
Block a user