Add a scope-aware assistant dock to the scheduler right panel

This commit is contained in:
Gmer4Lfe
2026-08-05 19:56:02 -04:00
parent 60994c7667
commit 185abdb442
4 changed files with 233 additions and 4 deletions
+12 -1
View File
@@ -210,6 +210,16 @@ if ($action === 'ask') {
}
$maxTurns = VV_AI_PROFILES[$profile] ?? VV_AI_MAX_TURNS;
// Where the caller is standing — "master.conf", "daily_sync_maintenance.sh", a log name.
// The scheduler page sends it so a question can say "this setting" and mean something; the
// AI tab sends nothing and the worker simply omits the location line.
//
// Whitelisted hard, not escaped and hoped for. It reaches the model as text, so anything
// richer than a file name is an instruction-injection surface for no benefit — a scope is
// only ever a name from this page's own view state.
$scope = trim($_POST['scope'] ?? '');
if ($scope !== '' && !preg_match('#^[A-Za-z0-9 ._/-]{1,80}$#', $scope)) $scope = '';
// The retrieval filter only means anything to the profile that retrieves.
$kind = $profile === 'varaverk' ? trim($_POST['kind'] ?? '') : '';
if ($kind !== '' && !in_array($kind, VV_AI_KINDS, true)) {
@@ -259,7 +269,8 @@ if ($action === 'ask') {
. escapeshellarg(json_encode($clean)) . ' '
. escapeshellarg($kind) . ' '
. escapeshellarg(($_POST['think'] ?? '1') === '1' ? '1' : '0') . ' '
. escapeshellarg($profile)
. escapeshellarg($profile) . ' '
. escapeshellarg($scope)
. ' >/dev/null 2>&1 </dev/null &';
$out = []; $rc = 0;
exec($cmd, $out, $rc);