Skip to content

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

Merge remote-tracking branch 'gh/train/nov30-a8b' into train/nov30-final

milind-soni158b18e0df2e
diff --cc server/claude-endpoints.ts
index fe556ebdce,a2fbd2c5b4..b44b4cdb00
--- a/server/claude-endpoints.ts
+++ b/server/claude-endpoints.ts
@@@ -186,10 -165,8 +186,12 @@@ export function updateClaudeEndpoint(cf
const secret = body.token ?? entry.environment?.ANTHROPIC_AUTH_TOKEN ?? entry.environment?.ANTHROPIC_API_KEY;
if (!secret) throw Object.assign(new Error("Enter the endpoint's token."), { status: 400 });
const config: Record<string, unknown> = { ...rawConfig(entry), endpointModels: fields.model && (body.model !== undefined || TIERS.some(([field]) => body[field] !== undefined)) ? endpointModels(fields) : saved.models };
+ if (body.cacheKeepWarm !== undefined) {
+ if (body.cacheKeepWarm) config.cacheKeepWarm = true;
+ else delete config.cacheKeepWarm;
+ }
+ // Context windows were reported by the old address's gateway.
+ if (address !== endpointBaseUrl(saved.baseUrl)) delete config.endpointContextWindows;
instances[instanceId] = {
...entry,
...(fields.displayName ? { displayName: fields.displayName } : {}),
diff --cc server/tool-schema-profile.ts
index b99d3f94ac,cc124a202d..6a9fbfb54a
--- a/server/tool-schema-profile.ts
+++ b/server/tool-schema-profile.ts
@@@ -327,22 -339,9 +339,22 @@@ export type SchemaFit
| { outcome: "trimmed" | "loosened" | "minimal"; schema: Json; bytes: number; from: number }
| { outcome: "dropped"; bytes: number; from: number };
+/** The Gemini Schema subset the Antigravity and Gemini CLIs convert: an `x-*` extension such as
+ * `x-google-enum-descriptions`, or a local `$ref` it cannot resolve, makes the engine drop the whole tool from its call
+ * registry with no refusal, the way an oversized schema does: the model still reads the tool's definition, but every
+ * call fails as an unknown tool. Cleaning the schema before it is fitted keeps those tools registered; keywords the
+ * engine accepts pass through untouched. A schema whose refs do not all inline (a cycle, a ref that resolves to
+ * nothing) keeps its refs as they were rather than half-inline them. */
+function geminiSafeSchema(schema: Json): Json {
+ const clean = structuredClone(schema);
+ stripAnnotations(clean);
+ const inlined = inlineRefs(clean);
+ return inlined && !JSON.stringify(inlined).includes('"$ref"') ? inlined : clean;
+}
+
/** Least loss first, stopping at the first form that fits. */
export function fitToolSchema(schema: Json, profile: ToolSchemaProfile): SchemaFit {
- const typed = profile.id === "moonshot" ? withTypedMixedEnums(schema) : profile.id === "gemini" ? geminiSafeSchema(schema) : schema;
- const typed = profile.id === "moonshot" ? withTypedMixedEnums(schema) : profile.id === "gemini" ? withArrayItems(schema) : schema;
++ const typed = profile.id === "moonshot" ? withTypedMixedEnums(schema) : profile.id === "gemini" ? withArrayItems(geminiSafeSchema(schema)) : schema;
const measured = profile.measureInlined ? inlineRefs(typed) : typed;
const from = schemaBytes(measured ?? typed);
if (measured && fits(measured, profile)) return { outcome: "kept", schema: typed, bytes: from };