52 lines
2.0 KiB
PHP
52 lines
2.0 KiB
PHP
<?php
|
|
// OPUS5 — Action standalone plan_from_text v2 (auto_create+execute default ON)
|
|
$text = $_GET['text'] ?? $_POST['text'] ?? null;
|
|
$raw = file_get_contents('php://input');
|
|
if ($raw) {
|
|
$d = json_decode($raw, true);
|
|
if ($d) $text = $d['text'] ?? $text;
|
|
}
|
|
if (!$text) $text = 'verifier nonreg puis cache stats puis plans';
|
|
// Defaults ON (user veut action complete auto)
|
|
$auto_create = true;
|
|
$auto_execute = true;
|
|
if (isset($_GET['dry_run']) && $_GET['dry_run']) { $auto_create = false; $auto_execute = false; }
|
|
|
|
$payload = json_encode(['text'=>$text, 'auto_create'=>$auto_create, 'auto_execute'=>$auto_execute]);
|
|
$ch = curl_init('https://127.0.0.1/api/opus5-plan-from-text.php');
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => $payload,
|
|
CURLOPT_HTTPHEADER => ['Content-Type: application/json','Host: weval-consulting.com'],
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_SSL_VERIFYPEER => false,
|
|
CURLOPT_SSL_VERIFYHOST => 0,
|
|
CURLOPT_TIMEOUT => 90
|
|
]);
|
|
$r = curl_exec($ch);
|
|
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
// Parse to return a clean summary (not full dump)
|
|
$parsed = @json_decode((string)$r, true);
|
|
if ($parsed) {
|
|
$summary = [
|
|
'ts' => date('c'),
|
|
'action' => 'plan_from_text_auto',
|
|
'input_text' => $parsed['input_text'] ?? $text,
|
|
'chunks_count' => $parsed['chunks_count'] ?? 0,
|
|
'steps_generated' => $parsed['steps_generated'] ?? 0,
|
|
'parallel_mode' => $parsed['parallel_mode'] ?? false,
|
|
'plan_id' => $parsed['created']['plan_id'] ?? null,
|
|
'exec_rounds' => $parsed['executed']['rounds'] ?? null,
|
|
'exec_done' => $parsed['executed']['done'] ?? 0,
|
|
'exec_failed' => $parsed['executed']['failed'] ?? 0,
|
|
'exec_final' => $parsed['executed']['final_status'] ?? null,
|
|
'doctrine' => '89 — plan_from_text via action standalone'
|
|
];
|
|
header('Content-Type: application/json');
|
|
echo json_encode($summary, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
|
|
} else {
|
|
echo "HTTP $http\n$r";
|
|
}
|