feat: запускать Pi из локальной копии с состоянием в .pi/
Держать всё состояние Pi — настройки, модели, ключи, сессии, установленные пакеты и служебные бинарники — в игнорируемом .pi/ этого репозитория, чтобы рабочий агент лаборатории не читал и не менял глобальный ~/.pi/agent. Версионировать только .pi/agent/settings.json: проверочный скрипт дочитывает его явно и проверяет приватность наравне с остальными файлами. Переносить креды по явному --setup без вывода значений, а ланчеру — снимать маркеры родительской сессии. Обновление версии Pi, подключение супервизора и оценка его полезности остаются отдельными поручениями.
This commit is contained in:
+13
-1
@@ -82,7 +82,9 @@ export function checkRepository(directory) {
|
||||
try { entries = readdirSync(path.join(root, relative), { withFileTypes: true }); }
|
||||
catch { error(slash(relative) || '.', 1, 'read', 'Не удалось прочитать каталог.'); return; }
|
||||
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
||||
if (entry.name === '.git' || entry.name === 'node_modules') continue;
|
||||
// Local runtime state: Pi keeps transcripts, credentials and installed
|
||||
// packages under .pi, and none of that is library material.
|
||||
if (entry.name === '.git' || entry.name === '.pi' || entry.name === 'node_modules') continue;
|
||||
const file = slash(path.join(relative, entry.name));
|
||||
if (entry.isDirectory()) { walk(file); continue; }
|
||||
if (!entry.isFile()) continue; // Do not traverse symlinks or external trees.
|
||||
@@ -111,6 +113,16 @@ export function checkRepository(directory) {
|
||||
}
|
||||
walk();
|
||||
|
||||
// .pi holds Pi runtime state, but the project's Pi settings are versioned:
|
||||
// that one file gets the same privacy review as any other tracked file.
|
||||
for (const file of ['.pi/agent/settings.json']) {
|
||||
try {
|
||||
const text = readFileSync(path.join(root, file), 'utf8');
|
||||
files.set(file, text);
|
||||
privacyWarnings(file, text, warn);
|
||||
} catch { /* Absent local state is not a structural problem. */ }
|
||||
}
|
||||
|
||||
function metadata(file) {
|
||||
if (!files.has(file)) { error(file, 1, 'missing-file', 'Обязательный текстовый файл отсутствует.'); return null; }
|
||||
const text = files.get(file);
|
||||
|
||||
Reference in New Issue
Block a user