Phase 9: Clearance Protocol — intercept, approve/deny, HUD, voice commands

- reactor.py v9.0.0: clearance endpoints, watchdog, create_job intercept
- arc.php: 7 clearance actions (pending/history/approve/deny/rules/rule_update/create)
- chat.php: Tier 0.9j voice commands — approve/deny/status clearance
- index.html: clearance banner, CLEARANCE tab with pending requests + rules + history
- admin/index.php: CLEARANCE nav + tab with full CRUD for rules and approve/deny UI
This commit is contained in:
2026-06-11 12:19:14 +00:00
parent aaf07edacb
commit 93d7594c4f
4 changed files with 615 additions and 0 deletions
+46
View File
@@ -292,6 +292,52 @@ switch ($action) {
echo json_encode(arc_request('PUT', "/missions/{$id}", ['enabled' => $enabled]));
break;
// GET /api/arc?action=clearance_pending
case 'clearance_pending':
echo json_encode(arc_request('GET', '/clearance/pending'));
break;
// GET /api/arc?action=clearance_history
case 'clearance_history':
$limit = (int)($_GET['limit'] ?? 50);
echo json_encode(arc_request('GET', "/clearance/history?limit={$limit}"));
break;
// POST /api/arc?action=clearance_approve&id=123 body: { decided_by: "..." }
case 'clearance_approve':
$id = (int)($_GET['id'] ?? $data['id'] ?? 0);
if (!$id) { http_response_code(400); echo json_encode(['error' => 'Missing id']); break; }
$decided_by = $data['decided_by'] ?? 'admin';
echo json_encode(arc_request('POST', "/clearance/{$id}/approve", ['decided_by' => $decided_by]));
break;
// POST /api/arc?action=clearance_deny&id=123 body: { decided_by: "...", note: "..." }
case 'clearance_deny':
$id = (int)($_GET['id'] ?? $data['id'] ?? 0);
if (!$id) { http_response_code(400); echo json_encode(['error' => 'Missing id']); break; }
$decided_by = $data['decided_by'] ?? 'admin';
$note = $data['note'] ?? '';
echo json_encode(arc_request('POST', "/clearance/{$id}/deny", ['decided_by' => $decided_by, 'note' => $note]));
break;
// GET /api/arc?action=clearance_rules
case 'clearance_rules':
echo json_encode(arc_request('GET', '/clearance/rules'));
break;
// PUT /api/arc?action=clearance_rule_update&id=123 body: { require_approval: 0|1, auto_approve_after_min: N, ... }
case 'clearance_rule_update':
$id = (int)($_GET['id'] ?? $data['id'] ?? 0);
if (!$id) { http_response_code(400); echo json_encode(['error' => 'Missing id']); break; }
unset($data['id']);
echo json_encode(arc_request('PUT', "/clearance/rules/{$id}", $data));
break;
// POST /api/arc?action=clearance_rule_create body: { job_type, risk_level, require_approval, ... }
case 'clearance_rule_create':
echo json_encode(arc_request('POST', '/clearance/rules', $data));
break;
default:
http_response_code(404);
echo json_encode(['error' => "Unknown arc action: {$action}"]);