sidecar files retained on updates
This commit is contained in:
parent
1697a45376
commit
6d98864ec1
|
|
@ -1599,10 +1599,15 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||||
const sourceModulePath = getSourcePath(`modules/${moduleName}`);
|
const sourceModulePath = getSourcePath(`modules/${moduleName}`);
|
||||||
const sourceAgentPath = path.join(sourceModulePath, 'agents');
|
const sourceAgentPath = path.join(sourceModulePath, 'agents');
|
||||||
|
|
||||||
// Copy sidecar files
|
// Copy sidecar files (preserve existing, add new)
|
||||||
const sidecarFiles = copyAgentSidecarFiles(sourceAgentPath, agentSidecarDir, yamlPath);
|
const sidecarResult = copyAgentSidecarFiles(sourceAgentPath, agentSidecarDir, yamlPath);
|
||||||
|
|
||||||
console.log(chalk.dim(` Copied sidecar to: ${agentSidecarDir}`));
|
if (sidecarResult.copied.length > 0) {
|
||||||
|
console.log(chalk.dim(` Copied ${sidecarResult.copied.length} new sidecar file(s) to: ${agentSidecarDir}`));
|
||||||
|
}
|
||||||
|
if (sidecarResult.preserved.length > 0) {
|
||||||
|
console.log(chalk.dim(` Preserved ${sidecarResult.preserved.length} existing sidecar file(s)`));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the source YAML file - we can regenerate from installer source if needed
|
// Remove the source YAML file - we can regenerate from installer source if needed
|
||||||
|
|
@ -2645,8 +2650,12 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||||
const agentSidecarDir = path.join(resolvedSidecarFolder, finalAgentName);
|
const agentSidecarDir = path.join(resolvedSidecarFolder, finalAgentName);
|
||||||
await fs.ensureDir(agentSidecarDir);
|
await fs.ensureDir(agentSidecarDir);
|
||||||
|
|
||||||
// Find and copy sidecar folder
|
// Copy sidecar files (preserve existing, add new)
|
||||||
const sidecarFiles = copyAgentSidecarFiles(agent.path, agentSidecarDir, agent.yamlFile);
|
const sidecarResult = copyAgentSidecarFiles(agent.path, agentSidecarDir, agent.yamlFile);
|
||||||
|
|
||||||
|
if (sidecarResult.copied.length > 0 || sidecarResult.preserved.length > 0) {
|
||||||
|
console.log(chalk.dim(` Sidecar: ${sidecarResult.copied.length} new, ${sidecarResult.preserved.length} preserved`));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update manifest CSV
|
// Update manifest CSV
|
||||||
|
|
|
||||||
|
|
@ -750,10 +750,16 @@ class ModuleManager {
|
||||||
const agentSidecarDir = path.join(resolvedSidecarFolder, agentName);
|
const agentSidecarDir = path.join(resolvedSidecarFolder, agentName);
|
||||||
await fs.ensureDir(agentSidecarDir);
|
await fs.ensureDir(agentSidecarDir);
|
||||||
|
|
||||||
// Copy sidecar files
|
// Copy sidecar files (preserve existing, add new)
|
||||||
const sidecarFiles = copyAgentSidecarFiles(path.dirname(sourceYamlPath), agentSidecarDir, sourceYamlPath);
|
const sidecarResult = copyAgentSidecarFiles(path.dirname(sourceYamlPath), agentSidecarDir, sourceYamlPath);
|
||||||
|
const totalFiles = sidecarResult.copied.length + sidecarResult.preserved.length;
|
||||||
|
|
||||||
console.log(chalk.dim(` Copied sidecar to: ${agentSidecarDir}`));
|
if (sidecarResult.copied.length > 0) {
|
||||||
|
console.log(chalk.dim(` Copied ${sidecarResult.copied.length} new sidecar file(s) to: ${agentSidecarDir}`));
|
||||||
|
}
|
||||||
|
if (sidecarResult.preserved.length > 0) {
|
||||||
|
console.log(chalk.dim(` Preserved ${sidecarResult.preserved.length} existing sidecar file(s)`));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,7 @@ function copySidecarFiles(sourceDir, targetDir, excludeYaml) {
|
||||||
*/
|
*/
|
||||||
function copyAgentSidecarFiles(sourceDir, targetSidecarDir, excludeYaml) {
|
function copyAgentSidecarFiles(sourceDir, targetSidecarDir, excludeYaml) {
|
||||||
const copied = [];
|
const copied = [];
|
||||||
|
const preserved = [];
|
||||||
|
|
||||||
// Find folders with "sidecar" in the name
|
// Find folders with "sidecar" in the name
|
||||||
const entries = fs.readdirSync(sourceDir, { withFileTypes: true });
|
const entries = fs.readdirSync(sourceDir, { withFileTypes: true });
|
||||||
|
|
@ -345,31 +346,42 @@ function copyAgentSidecarFiles(sourceDir, targetSidecarDir, excludeYaml) {
|
||||||
if (entry.isDirectory() && entry.name.toLowerCase().includes('sidecar')) {
|
if (entry.isDirectory() && entry.name.toLowerCase().includes('sidecar')) {
|
||||||
const sidecarSourcePath = path.join(sourceDir, entry.name);
|
const sidecarSourcePath = path.join(sourceDir, entry.name);
|
||||||
|
|
||||||
// Recursively copy the sidecar folder contents
|
// Recursively sync the sidecar folder contents (preserve existing, add new)
|
||||||
function copySidecarDir(src, dest) {
|
function syncSidecarDir(src, dest) {
|
||||||
if (!fs.existsSync(dest)) {
|
if (!fs.existsSync(dest)) {
|
||||||
fs.mkdirSync(dest, { recursive: true });
|
fs.mkdirSync(dest, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const sidecarEntries = fs.readdirSync(src, { withFileTypes: true });
|
// Get all files in source
|
||||||
for (const sidecarEntry of sidecarEntries) {
|
const sourceEntries = fs.readdirSync(src, { withFileTypes: true });
|
||||||
const srcPath = path.join(src, sidecarEntry.name);
|
|
||||||
const destPath = path.join(dest, sidecarEntry.name);
|
|
||||||
|
|
||||||
if (sidecarEntry.isDirectory()) {
|
for (const sourceEntry of sourceEntries) {
|
||||||
copySidecarDir(srcPath, destPath);
|
const srcPath = path.join(src, sourceEntry.name);
|
||||||
|
const destPath = path.join(dest, sourceEntry.name);
|
||||||
|
|
||||||
|
if (sourceEntry.isDirectory()) {
|
||||||
|
// Recursively sync subdirectories
|
||||||
|
syncSidecarDir(srcPath, destPath);
|
||||||
} else {
|
} else {
|
||||||
fs.copyFileSync(srcPath, destPath);
|
// Check if file already exists in destination
|
||||||
copied.push(destPath);
|
if (fs.existsSync(destPath)) {
|
||||||
|
// File exists - preserve it
|
||||||
|
preserved.push(destPath);
|
||||||
|
} else {
|
||||||
|
// File doesn't exist - copy it
|
||||||
|
fs.copyFileSync(srcPath, destPath);
|
||||||
|
copied.push(destPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copySidecarDir(sidecarSourcePath, targetSidecarDir);
|
syncSidecarDir(sidecarSourcePath, targetSidecarDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return copied;
|
// Return info about what was preserved and what was copied
|
||||||
|
return { copied, preserved };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue