Skip to content

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

Merge origin/main into train/nov21-z1

milind-sonie5e3f265e9d1
diff --cc server/index.ts
index 2d067ffc1c,dfbf9594fe..0f46563272
--- a/server/index.ts
+++ b/server/index.ts
@@@ -884,10 -884,10 +884,10 @@@ function turnOrigin(capability: Pick<In
/** Fail closed: only the person whose own message provably started this exact turn generation. Deliberately not the usage ledger's trigger, which defaults to the owner. */
function sharedComputerPrincipal(capability: Pick<InternalCapability, "botId" | "threadId" | "generation">): string | null {
- if (CLOUD_HOME) return cloudLendingRefusal(capability) === null ? CLOUD_HOME_LENDER : null;
+ if (CLOUD_HOME) { const lends = cloudLendingRefusal(capability) === null; if (lends) refusedLending.allowed(capability.threadId); return lends ? CLOUD_HOME_LENDER : null; }
return lendingPerson(provenRequestPerson(directRequestOwners.get(capability.threadId), capability.generation,
(messageId) => linePersonKey(store.messagesFor(capability.threadId).find((message) => message.id === messageId))), ownHome.ownServer(), () => sessions.list());
-}
+} /** On a self-hosted server, the computers lent to it by the person this turn provably acts for. */ function lentToServer(agents: unknown, turn: Pick<InternalCapability, "botId" | "threadId" | "generation">) { return CLOUD_HOME || CLOUD_TEAM || DESKTOP_MANAGED || !agents || !botLending() ? undefined : sharedComputers.known(sharedComputerPrincipal(turn)).filter((computer) => computer.lent); }
/** The only conversations that may feed a bot's memory, daily log, recall or brief; dropped whenever a session is revoked. */
const ownerOnlyCache = new Map<string, { length: number; last?: string; owner: boolean }>();