Skip to content

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

fix(skills): decide direct apply and card room after the import fetch

AdityaUmale8ed728be7bfc
diff --git a/server/index.ts b/server/index.ts
index d62880b08c..d4f4275e8d 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -13530,11 +13530,11 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
if (!connectorThread(from.id, fromThreadId)) {
return json(res, 403, { error: "source conversation does not belong to sender" });
}
+ if (isSkillSwitchAction(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }
+ const body = await importedSkillRequest(received); if ("importError" in body) return json(res, 422, { error: body.importError }); if (!internalCapabilityIsActive(internalCapability)) return json(res, 401, { error: TURN_ENDED_REFUSAL });
const direct = appliesDirectly(from.id, fromThreadId);
- if (isSkillSwitchAction(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, direct); return json(res, staged.status, staged.body); }
const persistence = skillProposalPersistence(from.id, fromThreadId, !direct);
if (!persistence.ok) return json(res, persistence.status, { error: persistence.error });
- const body = await importedSkillRequest(received); if ("importError" in body) return json(res, 422, { error: body.importError }); if (!internalCapabilityIsActive(internalCapability)) return json(res, 401, { error: TURN_ENDED_REFUSAL });
const action = body.action === "create" || body.action === "update" ? body.action : "";
if (!action) return json(res, 400, { error: 'action must be "create", "update" or "import"' });
const skillMd = typeof body.skill_md === "string" ? body.skill_md : "";