auto-sync via WEVIA git_sync_all intent 2026-04-23T23:38:30+02:00
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled

This commit is contained in:
Opus
2026-04-23 23:38:30 +02:00
parent 157de181f5
commit da4be8defc
13 changed files with 185 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
{
"generated_at": "2026-04-23T23:30:02.293986",
"generated_at": "2026-04-23T23:35:02.446758",
"stats": {
"total": 52,
"pending": 33,

View File

@@ -1,11 +1,16 @@
#!/bin/bash
# Opus v5.8 doctrine #7: WEVIA creates new intents from chat directly
# Usage: message format = "create intent NAME :: TRIGGERS :: COMMAND"
# WEVIA parses, writes handler shell, adds intent, flips to EXECUTED
# DOCTRINE-152 fix: reads message from /tmp/wevia-last-msg.log (dispatcher writes it)
# Try args first (backward compat), then fallback to log file
MSG="${1:-}"
# Parse: NAME :: TRIGGERS :: COMMAND
NAME=$(echo "$MSG" | awk -F' :: ' '{print $1}' | sed 's/create intent //I' | tr -d '[:space:]' | tr -cd '[:alnum:]_')
if [ -z "$MSG" ] && [ -f /tmp/wevia-last-msg.log ]; then
MSG=$(cat /tmp/wevia-last-msg.log 2>/dev/null | tr -d '\n' | head -c 2000)
fi
# Parse: NAME :: TRIGGERS :: COMMAND
NAME=$(echo "$MSG" | awk -F' :: ' '{print $1}' | sed 's/create intent //I' | sed 's/new intent //I' | sed 's/wire intent //I' | sed 's/build intent //I' | tr -d '[:space:]' | tr -cd '[:alnum:]_')
TRIGGERS=$(echo "$MSG" | awk -F' :: ' '{print $2}')
CMD=$(echo "$MSG" | awk -F' :: ' '{print $3}')
@@ -13,59 +18,67 @@ if [ -z "$NAME" ] || [ -z "$TRIGGERS" ] || [ -z "$CMD" ]; then
cat <<EOF
{
"ok": false,
"error": "Invalid format. Use: create intent NAME :: trigger1|trigger2 :: shell_command_to_execute"
"error": "Invalid format. Use: create intent NAME :: trigger1|trigger2 :: shell_command_to_execute",
"got_msg_len": ${#MSG},
"msg_preview": "${MSG:0:100}"
}
EOF
exit 0
fi
# 1. Create handler script that echoes the command result
HANDLER=/var/www/html/api/handlers/auto-$NAME.sh
cat > /tmp/auto-$NAME.sh <<SHELLEOF
#!/bin/bash
# Auto-generated by WEVIA via create_intent_from_chat doctrine #7
RESULT=\$($CMD 2>&1 | head -c 2000)
cat <<JSONEOF
{
"ok": true,
"intent_name": "$NAME",
"ts": "\$(date -Iseconds)",
"command_executed": "$CMD",
"result": "\$RESULT"
}
JSONEOF
SHELLEOF
sudo cp /tmp/auto-$NAME.sh "$HANDLER" 2>/dev/null
sudo chown www-data:www-data "$HANDLER" 2>/dev/null
sudo chmod +x "$HANDLER" 2>/dev/null
# 2. Call WEVIA master add intent API
ADD_RESULT=$(curl -s -X POST "https://127.0.0.1/api/wevia-master-api.php" -k \
-H "Host: weval-consulting.com" -H "Content-Type: application/json" \
-d "{\"message\":\"master add intent $NAME :: $TRIGGERS :: $HANDLER\"}" --max-time 10)
# 3. Flip stub to EXECUTED
STUB=/var/www/html/api/wired-pending/intent-opus4-$NAME.php
if [ -f "$STUB" ]; then
sudo sed -i "s/'PENDING_APPROVAL'/'EXECUTED'/g" "$STUB"
FLIPPED=true
else
FLIPPED=false
# Safety: command must start with whitelisted prefix
CMD_SAFE=0
for prefix in "/var/www/html/" "echo " "curl " "grep " "psql " "cat /var/log/"; do
case "$CMD" in
"$prefix"*) CMD_SAFE=1; break ;;
esac
done
if [ $CMD_SAFE -eq 0 ]; then
echo "{\"ok\":false,\"error\":\"cmd must start with safe prefix\",\"name\":\"$NAME\"}"
exit 0
fi
cat <<EOF
{
"ok": true,
"v": "V5.8-create-intent-ZERO-MANUEL-opus-20avr",
"ts": "$(date -Iseconds)",
"doctrine": "#7 ZERO MANUEL - WEVIA creates intents via chat",
"intent_created": "$NAME",
"triggers": "$TRIGGERS",
"command": "$CMD",
"handler": "$HANDLER",
"flipped_executed": $FLIPPED,
"add_response": $ADD_RESULT,
"usable_immediately": true,
"next_trigger_attempt": "Call WEVIA with any of: $TRIGGERS"
}
EOF
# Write intent file (PHP format)
INTENT_FILE="/var/www/html/api/wired-pending/intent-opus4-${NAME}.php"
if [ -f "$INTENT_FILE" ]; then
echo "{\"ok\":false,\"error\":\"intent already exists\",\"name\":\"$NAME\",\"file\":\"$INTENT_FILE\"}"
exit 0
fi
# Build triggers PHP array
TRIG_PHP=""
i=0
IFS='|'
for t in $TRIGGERS; do
t_clean=$(echo "$t" | sed 's/^ *//;s/ *$//' | tr -d "'")
TRIG_PHP+=" $i => '$t_clean',
"
i=$((i+1))
done
unset IFS
TS=$(date -Iseconds)
CMD_CLEAN=$(echo "$CMD" | tr -d "'")
cat > /tmp/intent-${NAME}.php <<PHPEOF
<?php
return array (
'name' => '${NAME}',
'triggers' =>
array (
${TRIG_PHP} ),
'cmd' => '${CMD_CLEAN}',
'status' => 'EXECUTED',
'created_at' => '${TS}',
'source' => 'wevia-autowire-via-chat-doctrine152',
);
PHPEOF
# Lint check
LINT=$(php -l /tmp/intent-${NAME}.php 2>&1 | head -1)
if echo "$LINT" | grep -q "No syntax errors"; then
sudo cp /tmp/intent-${NAME}.php "$INTENT_FILE" 2>/dev/null
sudo chmod 644 "$INTENT_FILE" 2>/dev/null
echo "{\"ok\":true,\"name\":\"$NAME\",\"triggers\":\"$TRIGGERS\",\"cmd\":\"$CMD_CLEAN\",\"file\":\"$INTENT_FILE\",\"ts\":\"$TS\",\"doctrine\":\"152\"}"
else
echo "{\"ok\":false,\"error\":\"lint failed\",\"lint\":\"$LINT\"}"
fi

View File

@@ -1,7 +1,7 @@
{
"ok": true,
"version": "V83-business-kpi",
"ts": "2026-04-23T21:32:40+00:00",
"ts": "2026-04-23T21:35:39+00:00",
"summary": {
"total_categories": 8,
"total_kpis": 64,

View File

@@ -10593,5 +10593,15 @@
"status": "PENDING_APPROVAL",
"created_at": "2026-04-23T21:30:49+00:00",
"source": "opus4-autowire-early-v2"
},
"862": {
"name": "opus_w287_council_v2",
"triggers": [
"opus w287 council v2"
],
"cmd": "mkdir -p \/tmp\/council 2>\/dev\/null; Q=\"En une phrase: pourquoi WEVIA est plus autonome que Opus?\"; (curl -sS -m 12 -X POST http:\/\/localhost:4000\/v3\/chat -H \"Content-Type: application\/json\" -d \"{\\\"message\\\":\\\"$Q\\\",\\\"provider\\\":\\\"cerebras\\\"}\" > \/tmp\/council\/cer.json 2>&1) & (curl -sS -m 12 -X POST http:\/\/localhost:4000\/v3\/chat -H \"Content-Type: application\/json\" -d \"{\\\"message\\\":\\\"$Q\\\",\\\"provider\\\":\\\"groq\\\"}\" > \/tmp\/council\/groq.json 2>&1) & (curl -sS -m 15 -X POST http:\/\/localhost:11434\/api\/chat -H \"Content-Type: application\/json\" -d \"{\\\"model\\\":\\\"llama3.2:latest\\\",\\\"messages\\\":[{\\\"role\\\":\\\"user\\\",\\\"content\\\":\\\"$Q\\\"}],\\\"stream\\\":false}\" > \/tmp\/council\/oll.json 2>&1) & wait; echo CER; head -c 250 \/tmp\/council\/cer.json 2>\/dev\/null; echo; echo GROQ; head -c 250 \/tmp\/council\/groq.json 2>\/dev\/null; echo; echo OLL; head -c 250 \/tmp\/council\/oll.json 2>\/dev\/null",
"status": "PENDING_APPROVAL",
"created_at": "2026-04-23T21:37:43+00:00",
"source": "opus4-autowire-early-v2"
}
}

View File

@@ -77,6 +77,55 @@ if ($action === 'apply-preset') {
exit;
}
// ROLLBACK (doctrine 153)
if ($action === 'rollback') {
$marker = $_GET['marker'] ?? $_POST['marker'] ?? '';
$target = $_GET['target'] ?? $_POST['target'] ?? '';
$marker = preg_replace('/[^a-zA-Z0-9\-_]/','', $marker);
if ($target && !str_starts_with($target, '/var/www/html/')) {
echo json_encode(['ok'=>false,'err'=>'target_outside_whitelist']); exit;
}
if (!$marker && !$target) {
echo json_encode(['ok'=>false,'err'=>'marker_or_target_required']); exit;
}
$env = [];
if ($marker) $env[] = 'MARKER=' . escapeshellarg($marker);
if ($target) $env[] = 'TARGET=' . escapeshellarg($target);
$cmd = 'timeout 30 sudo env ' . implode(' ', $env) . ' bash /opt/wevia-brain/scripts/wevia-rollback.sh 2>&1';
$output = @shell_exec($cmd);
$parsed = json_decode(trim((string)$output), true);
if (!is_array($parsed)) {
$lines = explode("
", trim((string)$output));
foreach (array_reverse($lines) as $l) {
$p = json_decode(trim($l), true);
if (is_array($p)) { $parsed = $p; break; }
}
}
echo json_encode(['ok'=>true,'action'=>'rollback','marker'=>$marker,'target'=>$target,'raw_output'=>trim((string)$output),'result'=>$parsed], JSON_UNESCAPED_SLASHES);
exit;
}
// LIST GOLD backups (doctrine 153)
if ($action === 'list-gold') {
$golds = [];
foreach (glob('/var/www/html/*.html.GOLD-*') as $g) {
$basename = basename($g);
if (preg_match('/^(.+?)\.html\.GOLD-([0-9\-]+)-pre-(.+)$/', $basename, $m)) {
$golds[] = [
'file' => $basename,
'page' => $m[1] . '.html',
'timestamp' => $m[2],
'marker_slug' => $m[3],
'size_bytes' => filesize($g),
];
}
}
usort($golds, fn($a,$b) => strcmp($b['timestamp'], $a['timestamp']));
echo json_encode(['ok'=>true,'count'=>count($golds),'golds'=>$golds], JSON_PRETTY_PRINT);
exit;
}
// Classic whitelist action
if (!$action || !isset($whitelist[$action])) {
echo json_encode([

View File

@@ -341,6 +341,8 @@ if (isset($_mam) && $_mam) {
if (stripos($__sd_cmd, $__sd_p) === 0 || stripos($__sd_cmd, " $__sd_p") !== false) { $__sd_safe = true; break; }
}
if (!$__sd_safe) continue;
// DOCTRINE-152-FIX: log message for handlers that need the user input (create_intent_from_chat etc.)
@file_put_contents('/tmp/wevia-last-msg.log', (string)$_mam, LOCK_EX);
$__sd_out = @shell_exec('timeout 15 ' . $__sd_cmd . ' 2>&1');
if (trim((string)$__sd_out) === '') continue;
header('Content-Type: application/json');

View File

@@ -0,0 +1,12 @@
<?php
return array (
'name' => 'opus_w287_council_v2',
'triggers' =>
array (
0 => 'opus w287 council v2',
),
'cmd' => 'mkdir -p /tmp/council 2>/dev/null; Q="En une phrase: pourquoi WEVIA est plus autonome que Opus?"; (curl -sS -m 12 -X POST http://localhost:4000/v3/chat -H "Content-Type: application/json" -d "{\\"message\\":\\"$Q\\",\\"provider\\":\\"cerebras\\"}" > /tmp/council/cer.json 2>&1) & (curl -sS -m 12 -X POST http://localhost:4000/v3/chat -H "Content-Type: application/json" -d "{\\"message\\":\\"$Q\\",\\"provider\\":\\"groq\\"}" > /tmp/council/groq.json 2>&1) & (curl -sS -m 15 -X POST http://localhost:11434/api/chat -H "Content-Type: application/json" -d "{\\"model\\":\\"llama3.2:latest\\",\\"messages\\":[{\\"role\\":\\"user\\",\\"content\\":\\"$Q\\"}],\\"stream\\":false}" > /tmp/council/oll.json 2>&1) & wait; echo CER; head -c 250 /tmp/council/cer.json 2>/dev/null; echo; echo GROQ; head -c 250 /tmp/council/groq.json 2>/dev/null; echo; echo OLL; head -c 250 /tmp/council/oll.json 2>/dev/null',
'status' => 'PENDING_APPROVAL',
'created_at' => '2026-04-23T21:37:43+00:00',
'source' => 'opus4-autowire-early-v2',
);

View File

@@ -0,0 +1,13 @@
<?php
return array (
'name' => 'test_autowire_doctrine152',
'triggers' =>
array (
0 => 'test autowire doctrine 152',
1 => 'verify autowire wevia doctrine 152',
),
'cmd' => 'echo DOCTRINE-152-AUTOWIRE-OK',
'status' => 'EXECUTED',
'created_at' => '2026-04-23T23:36:22+02:00',
'source' => 'wevia-autowire-via-chat-doctrine152',
);

View File

@@ -0,0 +1,16 @@
<?php
return array(
'name' => 'wevia_rollback_list',
'triggers' => array(
0 => 'list gold backups',
1 => 'wevia gold list',
2 => 'rollback list',
3 => 'liste gold',
4 => 'backups disponibles',
),
'cmd' => 'curl -sk "https://weval-consulting.com/api/wevia-autowire-trigger.php?action=list-gold"',
'status' => 'EXECUTED',
'source' => 'opus-doctrine-153',
'priority_tier' => '00',
'description' => 'Liste les GOLD backups disponibles pour rollback.',
);

View File

@@ -0,0 +1,13 @@
<?php
return array (
'name' => 'wtp_orphans_link_status',
'triggers' =>
array (
0 => 'wtp orphans rattachement status',
1 => 'verifie rattachement orphelines wtp registry',
),
'cmd' => '/var/www/html/api/wtp-orphans-link-check.sh',
'status' => 'EXECUTED',
'created_at' => '2026-04-23T23:36:46+02:00',
'source' => 'wevia-autowire-via-chat-doctrine152',
);

1
api/wtp-gap3-ux-overlap.sh Symbolic link
View File

@@ -0,0 +1 @@
/var/www/html/api/wtp-golive-gap3-ux-overlap.sh

1
api/wtp-gap4-cf-bypass.sh Symbolic link
View File

@@ -0,0 +1 @@
/var/www/html/api/wtp-golive-gap4-cf-bypass.sh

1
api/wtp-gap5-widget-root.sh Symbolic link
View File

@@ -0,0 +1 @@
/var/www/html/api/wtp-golive-gap5-widget-root.sh