45 ImGui::TextWrapped(
"%s", std::string(
action_status_.message()).c_str());
46 ImGui::PopStyleColor();
54 const float avail_y = std::max(0.0f, ImGui::GetContentRegionAvail().y);
55 const float detail_reserve =
57 const float list_budget = std::max(0.0f, avail_y - detail_reserve);
58 const float preferred_list = std::clamp(avail_y * 0.45f, 180.0f, 320.0f);
59 const float list_height = std::min(preferred_list, list_budget);
61 ImGui::BeginChild(
"ProposalListEmbed", ImVec2(0, list_height),
true);
67 ImGui::BeginChild(
"ProposalDetailEmbed", ImVec2(0, 0),
true);
78 ImGuiIO& io = ImGui::GetIO();
79 ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x -
drawer_width_, 0),
81 ImGui::SetNextWindowSize(ImVec2(
drawer_width_, io.DisplaySize.y),
83 const ImGuiWindowFlags flags = ImGuiWindowFlags_NoMove |
84 ImGuiWindowFlags_NoResize |
85 ImGuiWindowFlags_NoCollapse;
86 if (ImGui::Begin(
"Agent Proposals", &
visible_, flags)) {
159 ImGui::TextWrapped(tr(
"No proposals found."));
160 ImGui::TextWrapped(tr(
"Run CLI command: z3ed agent run --prompt \"...\""));
164 ImGuiTableFlags flags =
165 ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY;
167 if (ImGui::BeginTable(
"ProposalsTable", 3, flags)) {
168 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 60.0f);
169 ImGui::TableSetupColumn(
"Status", ImGuiTableColumnFlags_WidthFixed, 80.0f);
170 ImGui::TableSetupColumn(
"Prompt", ImGuiTableColumnFlags_WidthStretch);
171 ImGui::TableSetupScrollFreeze(0, 1);
172 ImGui::TableHeadersRow();
175 ImGui::TableNextRow();
178 ImGui::TableSetColumnIndex(0);
180 if (ImGui::Selectable(proposal.id.c_str(), is_selected,
181 ImGuiSelectableFlags_SpanAllColumns)) {
186 ImGui::TableSetColumnIndex(1);
187 switch (proposal.status) {
202 ImGui::TableSetColumnIndex(2);
203 std::string truncated = proposal.prompt;
204 if (truncated.length() > 30) {
205 truncated = truncated.substr(0, 27) +
"...";
207 ImGui::TextWrapped(
"%s", truncated.c_str());
221 if (ImGui::CollapsingHeader(tr(
"Metadata"), ImGuiTreeNodeFlags_DefaultOpen)) {
222 ImGui::Text(tr(
"ID: %s"), p.id.c_str());
223 ImGui::Text(tr(
"Sandbox: %s"), p.sandbox_id.c_str());
224 ImGui::Text(tr(
"Created: %s"), absl::FormatTime(p.created_at).c_str());
225 if (p.reviewed_at.has_value()) {
226 ImGui::Text(tr(
"Reviewed: %s"), absl::FormatTime(*p.reviewed_at).c_str());
228 ImGui::Text(tr(
"Commands: %d"), p.commands_executed);
229 ImGui::Text(tr(
"Bytes Changed: %d"), p.bytes_changed);
231 ImGui::TextWrapped(tr(
"Prompt: %s"), p.prompt.c_str());
232 ImGui::TextWrapped(tr(
"Description: %s"), p.description.c_str());
236 if (ImGui::CollapsingHeader(tr(
"Diff"), ImGuiTreeNodeFlags_DefaultOpen)) {
237 if (
diff_content_.empty() && std::filesystem::exists(p.diff_path)) {
238 std::ifstream diff_file(p.diff_path);
239 if (diff_file.is_open()) {
240 std::stringstream buffer;
241 buffer << diff_file.rdbuf();
247 ImGui::BeginChild(
"DiffContent", ImVec2(0, 150),
true,
248 ImGuiWindowFlags_HorizontalScrollbar);
252 ImGui::TextWrapped(tr(
"No diff available"));
257 if (ImGui::CollapsingHeader(tr(
"Execution Log"))) {
258 if (
log_content_.empty() && std::filesystem::exists(p.log_path)) {
259 std::ifstream log_file(p.log_path);
260 if (log_file.is_open()) {
261 std::stringstream buffer;
264 while (std::getline(log_file, line) &&
266 buffer << line <<
"\n";
270 buffer <<
"... (truncated, see " << p.log_path.string() <<
")\n";
277 ImGui::BeginChild(
"LogContent", ImVec2(0, 150),
true,
278 ImGuiWindowFlags_HorizontalScrollbar);
282 ImGui::TextWrapped(tr(
"No log available"));
287#ifdef YAZE_ENABLE_POLICY_FRAMEWORK
308#ifdef YAZE_ENABLE_POLICY_FRAMEWORK
319 if (ImGui::CollapsingHeader(tr(
"Policy Status"),
320 ImGuiTreeNodeFlags_DefaultOpen)) {
323 if (!policy_eval.IsEnabled()) {
327 tr(
"Create .yaze/policies/agent.yaml to enable policy evaluation"));
332 auto policy_result = policy_eval.EvaluateProposal(p.id);
334 if (!policy_result.ok()) {
337 ImGui::TextWrapped(
"%s", policy_result.status().message().data());
341 const auto& result = policy_result.value();
344 if (result.is_clean()) {
347 }
else if (result.passed) {
358 if (!result.critical_violations.empty()) {
361 for (
const auto& violation : result.critical_violations) {
363 ImGui::TextWrapped(
"%s: %s", violation.policy_name.c_str(),
364 violation.message.c_str());
365 if (!violation.details.empty()) {
368 violation.details.c_str());
376 if (!result.warnings.empty()) {
378 for (
const auto& violation : result.warnings) {
380 ImGui::TextWrapped(
"%s: %s", violation.policy_name.c_str(),
381 violation.message.c_str());
382 if (!violation.details.empty()) {
385 violation.details.c_str());
393 if (!result.info.empty()) {
395 for (
const auto& violation : result.info) {
397 ImGui::TextWrapped(
"%s: %s", violation.policy_name.c_str(),
398 violation.message.c_str());