Put everything Varaverk persists under one root, state included

This commit is contained in:
Gmer4Lfe
2026-08-08 23:26:46 -04:00
parent d5c36db531
commit f1603349cc
11 changed files with 420 additions and 77 deletions
+6 -6
View File
@@ -115,7 +115,7 @@ function vv_ai_config(): array {
'url' => rtrim(trim($vars["{$host}_OLLAMA_URL"] ?? ''), '/'),
'model' => trim($vars["{$host}_OLLAMA_MODEL"] ?? ''),
'embed_model' => trim($vars["{$host}_OLLAMA_EMBED_MODEL"] ?? 'nomic-embed-text'),
'db' => trim($vars['AI_INDEX_DB'] ?? '') ?: DATA_DIR . '/ai_index.db',
'db' => trim($vars['AI_INDEX_DB'] ?? '') ?: AI_DATA_DIR . '/ai_index.db',
'k' => (int)($vars['AI_SEARCH_K'] ?? 8),
'per_file' => (int)($vars['AI_SEARCH_PER_FILE'] ?? 3),
'timeout' => (int)($vars['AI_REQUEST_TIMEOUT'] ?? 240),
@@ -552,7 +552,7 @@ function vv_ai_memory_path(): string {
$vars = vv_conf_vars();
$p = trim($vars['AI_MEMORY_FILE'] ?? '');
$p = str_replace(['$DATA_DIR', '${DATA_DIR}'], DATA_DIR, $p);
return $p !== '' ? $p : DATA_DIR . '/ai_memory.md';
return $p !== '' ? $p : AI_DATA_DIR . '/ai_memory.md';
}
function vv_ai_memory_max(): int {
@@ -624,7 +624,7 @@ function vv_ai_memory_write(string $text): array {
function vv_ai_token_db(): string {
$p = str_replace(['$DATA_DIR', '${DATA_DIR}'], DATA_DIR,
trim(vv_conf_vars()['AI_TOKEN_DB'] ?? ''));
return $p !== '' ? $p : DATA_DIR . '/ai_token_history.db';
return $p !== '' ? $p : AI_DATA_DIR . '/ai_token_history.db';
}
function vv_ai_token_retain(): int {
@@ -966,7 +966,7 @@ function vv_ai_scope_ok(string $scope): bool {
//
// Under data/ and therefore gitignored: these quote this installation's logs.
function vv_ai_bugs_dir(): string {
$d = DATA_DIR . '/ai_bugs';
$d = AI_DATA_DIR . '/ai_bugs';
if (!is_dir($d)) @mkdir($d, 0755, true);
return $d;
}
@@ -1094,7 +1094,7 @@ function vv_ai_bug_set_open(string $id, bool $open): bool {
// Markdown rather than a delimited .db because the useful part is prose — a fix is a sentence,
// not a field — and it stays hand-editable when a note turns out to be wrong.
function vv_ai_incidents_path(): string {
return DATA_DIR . '/ai_incidents.md';
return AI_DATA_DIR . '/ai_incidents.md';
}
// One entry, appended. The symptom is captured from what was being asked; the fix is written by
@@ -1159,7 +1159,7 @@ function vv_ai_incidents_for(string $scope, int $max = 4): array {
// runs often enough to be trusted with it, and an unbounded directory here would quietly grow
// for as long as the operator keeps talking to the assistant.
function vv_ai_chats_dir(): string {
$d = DATA_DIR . '/ai_chats';
$d = AI_DATA_DIR . '/ai_chats';
if (!is_dir($d)) @mkdir($d, 0755, true);
return $d;
}