Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(skills): a source folder only counts as gone on the computer it was read from

milind-soni78b28d3a39b7
diff --git a/server/imported-skills.test.ts b/server/imported-skills.test.ts
index ed1c135949..8955566981 100644
--- a/server/imported-skills.test.ts
+++ b/server/imported-skills.test.ts
@@ -315,4 +315,13 @@ describe("removing a skill brought in from this computer", () => {
expect(importedSkillListings(newBot(), new Set())).toEqual([]);
expect(purgeImportedSkill("pdf")).toHaveProperty("error");
});
+
+ it("never calls a source gone when the folder it was read from is not on this computer, as after a move to a Cloud", () => {
+ const root = join(HOME, `elsewhere-${randomUUID()}`);
+ store([input("pdf", { root })]);
+ expect(existsSync(root)).toBe(false);
+ expect(importedSkillListings(newBot(), new Set())[0]).toMatchObject({ name: "pdf", sourceGone: false });
+ expect(purgeImportedSkill("pdf")).toHaveProperty("error");
+ expect(readImportedSkills()["pdf"]).toBeDefined();
+ });
});
diff --git a/server/imported-skills.ts b/server/imported-skills.ts
index 6165bcb1e1..e58a874b46 100644
--- a/server/imported-skills.ts
+++ b/server/imported-skills.ts
@@ -107,6 +107,12 @@ function writeRemoved(botId: string, removed: readonly string[]): void {
* source is only asked whether its SKILL.md is a file; it is never read. */
function sourceFolderGone(entry: ImportedSkillEntry): boolean {
if (!entry.origin) return true;
+ // A workspace moved to another computer (a Cloud) never had the folder it was read from: that proves nothing gone.
+ try {
+ if (!statSync(entry.root).isDirectory()) return false;
+ } catch {
+ return false;
+ }
try {
return !statSync(join(entry.origin, "SKILL.md")).isFile();
} catch (error) {
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 62ec53a83d..4c6195de1a 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -6159,6 +6159,9 @@
"skills.learned.hintOff": "A criação de habilidades está desligada, mas você continua controlando aqui as habilidades que já ativou.",
"skills.origin.imported": "este computador",
"skills.origin.importedHint": "Trazida deste computador. Cada bot lista as que combinam com a função dele e encontra as outras quando uma tarefa precisa. Ative para listá-la neste bot, ou desative para mantê-la longe deste bot.",
+ "skills.imported.sourceGone": "A pasta de origem não existe mais. A cópia do OpenMausBot continua funcionando.",
+ "skills.imported.removeConfirm": "Remover “{name}” deste bot? A cópia importada do OpenMausBot continua nos seus outros bots, e os arquivos no seu computador não são tocados.",
+ "skills.imported.removeStaleConfirm": "Remover “{name}” do OpenMausBot? A pasta de origem não existe mais, então a cópia importada do OpenMausBot é removida de todos os bots. Nenhum arquivo no seu computador é tocado.",
"skills.origin.native": "IA",
"skills.origin.nativeHint": "A IA do bot carrega esta habilidade da pasta indicada em Origem. Desative aqui apenas para este bot; os arquivos ficam onde estão.",
"skills.origin.project": "projeto",