Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.
TypeScript agentai-agentai-agentsai-assistantandroidautomationchatgptcoding-agentcomputer-usedesktop-appelectronllmlocal-firstmcpmulti-agentollamaopenaiprivacyself-hostedtypescript
fix(tools): tool schemas sent to the model carry no Unicode property patterns
leen.zhou4a3b98fe0236
diff --git a/packages/brain/src/runtime/tools/tools.ts b/packages/brain/src/runtime/tools/tools.tsindex f75d8fc..ff6cc39 100644--- a/packages/brain/src/runtime/tools/tools.ts+++ b/packages/brain/src/runtime/tools/tools.ts@@ -420,6 +420,21 @@ const descriptions = {...browserDescriptions,browser_login: browserLoginDescription,};+/**+ * GitHub #2: Unicode property classes (\p{Cc}) are ECMA-262 but not in the regex dialects some+ * OpenAI-compatible gateways validate tool schemas with, and those refuse the whole request. Such+ * patterns are dropped from the model-facing schema only; the zod parser still enforces them.+ */+function portablePatterns(node: unknown): void {+ if (Array.isArray(node)) {+ for (const item of node) portablePatterns(item);+ return;+ }+ if (!node || typeof node !== "object") return;+ const record = node as Record<string, unknown>;+ if (typeof record.pattern === "string" && /\\[pP]\{/.test(record.pattern)) delete record.pattern;+ for (const value of Object.values(record)) portablePatterns(value);+}function definitions(entries: Readonly<Record<string, z.ZodType>>,descriptions: Readonly<Record<string, string>>,@@ -434,6 +449,7 @@ function definitions(? compactOfficeSchema(declared, name === "office_edit", name === "office_create"): declared;delete parameters.$schema;+ portablePatterns(parameters);const tool = {name,description,