Skip to content

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

fix(antigravity): keep skill turn wiring out of server entrypoint

Krishna Dobhal3bd1bcd9341c
diff --git a/server/host/skills-library.ts b/server/host/skills-library.ts
index 854638d85c..831938c78f 100644
--- a/server/host/skills-library.ts
+++ b/server/host/skills-library.ts
@@ -29,7 +29,7 @@ import {
} from "../skill-share.ts";
import { enabledSkillFiles, listSkills, readSkillFile, resolveBotSkills, skillsSystemPrompt, type SkillListing } from "../skills.ts";
import type { BotRecord, Message, Store } from "../store.ts";
-import { claudeUserSkillsEnabled } from "../turn-settings.ts";
+import { claudeUserSkillsEnabled, settingsTurnFields } from "../turn-settings.ts";
import { typedWords } from "../typed-sends.ts";
import { TASK_WORKSPACES_DIR } from "../workspace.ts";
@@ -128,6 +128,12 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {
const liveAssigned = (bot: BotRecord) => store.bot(bot.id)?.assignedSkills ?? bot.assignedSkills ?? [];
const conversationSkills = (bot: BotRecord, threadId: string): string[] | undefined =>
skillsLibraryEnabled(cfg) ? conversationAssignedSkills(bot.id, liveAssigned(bot), conversationStartedAt(threadId)) : undefined;
+ const turnSkillFiles = (bot: BotRecord, threadId: string, instance?: TurnInstance): string[] => {
+ const assigned = conversationSkills(bot, threadId);
+ const names = resolveBotSkills(bot.id, assigned).filter((skill) => skill.enabled).map((skill) => skill.name);
+ return [...enabledSkillFiles(bot.id, names, assigned).values(),
+ ...importsFor(bot, assigned, instance).map((skill) => skill.file)];
+ };
const engineOf = (instance: TurnInstance | undefined): SkillTurnEngine | undefined => {
if (!instance) return undefined;
@@ -268,11 +274,13 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {
return listedImports(bot, importsFor(bot, conversationSkills(bot, threadId), instance));
},
- turnSkillFiles(bot: BotRecord, threadId: string, instance?: TurnInstance): string[] {
- const assigned = conversationSkills(bot, threadId);
- const names = resolveBotSkills(bot.id, assigned).filter((skill) => skill.enabled).map((skill) => skill.name);
- return [...enabledSkillFiles(bot.id, names, assigned).values(),
- ...importsFor(bot, assigned, instance).map((skill) => skill.file)];
+ turnSkillFiles,
+
+ turnSettings(bot: BotRecord, threadId: string, instance: TurnInstance, restrictsMcp: boolean) {
+ return {
+ ...settingsTurnFields(cfg, DATA_DIR, restrictsMcp),
+ ...(instance.driverKind === "antigravityAgent" ? { skillFiles: turnSkillFiles(bot, threadId, instance) } : {}),
+ };
},
/** Each `/name` called for one of the bot's own, library or imported skills, or one its engine loads by itself. `lines`
diff --git a/server/index.ts b/server/index.ts
index 84ebd9fb0a..505dcd041f 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -431,7 +431,7 @@ import { CLOUD_COMPUTER_DID_NOT_START, CLOUD_COMPUTER_START_BUDGET_MS, CLOUD_COM
import { LocalVmLease, LocalVmLeasePool } from "./local-vm-lease.ts";
import { LocalVmSeatPool, type LocalVmSeatHolder } from "./local-vm-seat-pool.ts";
import { createLoopGuard, loopGuardSettings } from "./host/loop-guard.ts"; import { createPersonFirst } from "./host/person-first.ts"; import { createRunOwners, runActorOf } from "./host/run-owner.ts";
-import { claudeUserSkillsEnabled, settingsTurnFields } from "./turn-settings.ts";
+import { claudeUserSkillsEnabled } from "./turn-settings.ts";
import { addHeldSecretScrubber, redactSecretsInText, scrubHeldSecrets } from "./redact.ts";
import * as vps from "./vps-computer.ts";
import { vpsConfigForBot, vpsSshAliasForBot } from "./vps-hosts.ts";
@@ -8429,7 +8429,6 @@ async function beginTurn(
threadId,
botId: bot.id,
startupRecovery,
- ...(instance.driverKind === "antigravityAgent" ? { skillFiles: skillsHost.turnSkillFiles(bot, threadId, instance) } : {}),
text: withTurnClock(clock, withRecalled(recalled, (posted?.text ?? "") + attachmentsForBox(dispatchContext.turnText, cwd) + shareNote.text + devsReports.note(threadId, Boolean(integrations.agents)))),
...(recalled ? { recalled } : {}),
images: dispatchContext.images,
@@ -8450,7 +8449,7 @@ async function beginTurn(
mentionTurn: tagged.length > 0,
integrations,
...(integrations.browser && browserIsThePlace(turnSurfacePlan(bot, undefined, threadId, true)) ? { preloadBrowserTools: true } : {}),
- ...settingsTurnFields(cfg, DATA_DIR, managedPolicy.restrictsMcp()),
+ ...skillsHost.turnSettings(bot, threadId, instance, managedPolicy.restrictsMcp()),
cwd, ...(worksInWorkspace || guestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(bot.id, threadId).find((root) => root !== ATTACHMENTS_DIR) }),
botSettingsFile: botSettingsFile(bot),
}, (input) => quickFallback.sendTurn(instance, input, route.quickModel ? { model, own: bot.modelSelection, onFallback: () => store.patchMessage(threadId, userMessage.id, { quickModel: undefined }) } : undefined))), () => companyShutdown || !directTurnClaimExists(bot.id, dispatchClaimId, threadId), async () => {
@@ -10333,7 +10332,6 @@ async function runClaimedGroupMemberTurn(
threadId,
botId: readyBot.id,
text: roomSession.text,
- ...(instance.driverKind === "antigravityAgent" ? { skillFiles: skillsHost.turnSkillFiles(readyBot, threadId, instance) } : {}),
...(roomRecalled ? { recalled: roomRecalled } : {}),
images: turnImages,
approvalMode: turnApprovalMode,
@@ -10345,7 +10343,7 @@ async function runClaimedGroupMemberTurn(
cwd, ...(worksInWorkspace || roomGuestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(readyBot.id, threadId).find((root) => root !== ATTACHMENTS_DIR) }),
integrations,
...(integrations.browser && browserIsThePlace(roomPlan) ? { preloadBrowserTools: true } : {}),
- ...settingsTurnFields(cfg, DATA_DIR, managedPolicy.restrictsMcp()),
+ ...skillsHost.turnSettings(readyBot, threadId, instance, managedPolicy.restrictsMcp()),
botSettingsFile: botSettingsFile(readyBot),
...(instance.instanceId === readyBot.modelSelection.instanceId
? memberTurnSelection(readyBot.modelSelection)
diff --git a/server/skill-command.test.ts b/server/skill-command.test.ts
index 06ad48558f..ae1e71375c 100644
--- a/server/skill-command.test.ts
+++ b/server/skill-command.test.ts
@@ -64,6 +64,10 @@ describe("words a person typed", () => {
const bot = botWith("standup");
const record = { id: bot } as BotRecord;
expect(host.turnSkillFiles(record, "thread")).toEqual([enabledSkillFile(bot, "standup")]);
+ expect(host.turnSettings(record, "thread", { instanceId: "antigravity", driverKind: "antigravityAgent" }, true))
+ .toMatchObject({ skillFiles: [enabledSkillFile(bot, "standup")], mcpFromUserConfig: false });
+ expect(host.turnSettings(record, "thread", { instanceId: "claude", driverKind: "claudeAgent" }, false))
+ .not.toHaveProperty("skillFiles");
expect("error" in setSkillEnabled(bot, "standup", false)).toBe(false);
expect(host.turnSkillFiles(record, "thread")).toEqual([]);
});