Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: drop unreferenced toolUseLocalModelFilter in favor of the tool-use annotation path (#3896)
[._.]/ Adam Eivy8654383898dd
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6e9f41cc28..2460c62e87 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -51,3 +51,4 @@- Every inline `new Date(x).toLocaleDateString()` / `.toLocaleTimeString()` in the client — roughly seventy across fifty components, from the calendar views and CyberCity HUD to the CoS tabs, goals, media queue and app-update panels — now routes through `client/src/utils/formatters.js`, so a change to how PortOS renders a date is one edit rather than fifty. The helper set grew to cover the shapes that were being spelled out by hand (`formatDateNumeric`, `formatTimeOfDaySeconds`, `formatMonthDay`, `formatMonthYear`, `formatWeekdayShort`, `formatWeekdayDate`, `formatWeekdayTime`), and `formatClockTime` gained `seconds` / `hour12` options instead of a second copy of itself. Two long-standing paper cuts go with it: a bare `YYYY-MM-DD` is now anchored at local midnight everywhere (a plain `new Date('2026-03-05')` is UTC midnight and renders as the 4th anywhere west of Greenwich — call sites used to fix this by hand, and the ones that forgot showed the wrong day), and a missing or malformed timestamp renders a caller-chosen fallback instead of the literal text "Invalid Date" — including the calendar event-detail formatter, which had ended up guarding its all-day branch but not its timed one.- The ~460-line Sprite Manager block in `server/lib/validation.js` now lives in its own `server/lib/spriteValidation.js`, matching the eleven other per-domain validation files. A straight lift wasn't possible: the block leans on four fragments (`recordRenderPinFields`, `cloudModelIdString`, `grokVideoDurationSchema`, `isSafeSubdirFilter`) that music video, universe builder, series, video gen and backup also use, and a domain file can't read them back out of `validation.js` — ESM hoists its `export * from` re-exports, so the read lands in the temporal dead zone. Those four moved to a new leaf `server/lib/sharedSchemas.js` first, with `validation.js` still re-exporting them, so every existing deep import keeps working unchanged.- The TUI runner's response-file tests no longer fail at random on a busy machine. They drive the runner's one-second size-stability window with fake timers, but the polls behind that window read the response file from real disk — and a real read finishes on Node's threadpool, which advancing fake timers does not wait for. Under load a poll's read could land after the test had already moved on, so the run took the timeout or fallback path and the failure looked like a regression in whatever diff happened to be under test. Those five tests now serve the response file from memory, so every read settles as a microtask the timer advance always drains, and the assertions are unchanged.+- The unused `toolUseLocalModelFilter` export was removed from the client's provider helpers. It offered to hide non-tool-capable local models from a picker, but nothing ever called it, and the approach it represented was already settled the other way: agent and coding pickers annotate each option (`🔧 tool use` / `⚠ no known tool use`) and warn below the select rather than filtering, because the underlying heuristic is a positive allowlist — a non-match means "not a recognized tool-caller", not a proven negative, so filtering would make a newer tool-capable family unselectable. The rationale now lives on the annotation helper that survived.diff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex 5c89d6b3b5..e2e3ecb578 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -467,20 +467,6 @@ export const isToolUseModel = (id) =>// Mirror of TOOL_USE_RE in server/lib/localModelHeuristics.js — keep in lockstep./qwen|llama-?3\.[1-9]|llama-?4|mistral|mixtral|ministral|codestral|devstral|magistral|command-?r|command-?a|north-mini-code|firefunction|functionary|watt-tool|hermes|functiongemma|glm-?4|granite-?[34]|(?:^|[-_/:])gemma-?4|gpt-oss|nemotron|olmo-?3|lfm2|ornith|muse-glimmer|nex-n2|smollm2|deepseek-v3|deepseek-r1|deepseek-v4/i.test(id);-/**- * Per-model filter for a CODING / tool-use picker: restrict LOCAL backends- * (Ollama / LM Studio) to tool-use-capable models by id, but leave cloud/API- * providers' lists untouched — `isToolUseModel` is a local-name heuristic and- * would wrongly hide capable cloud models whose ids don't encode their family.- * Mirrors `visionLocalModelFilter`. Pass as- * `useProviderModels({ modelFilter: toolUseLocalModelFilter })`.- * @param {string} id- * @param {{endpoint?:string,name?:string}} [provider]- * @returns {boolean}- */-export const toolUseLocalModelFilter = (id, provider) =>- localBackendForProvider(provider) ? isToolUseModel(id) : true;-/*** Agent-picker tool-use annotation for a model id. Agent / CoS tasks (the CD* treatment + plan stages, coding agents) only work with a model that can emit@@ -488,9 +474,13 @@ export const toolUseLocalModelFilter = (id, provider) =>* done-message instead of acting, silently wedging the task. This decides the* per-option marker + the "pick a tool-capable model" warning in agent pickers.*+ * Tool-use is surfaced as an ANNOTATION + warning, never as a filter: the+ * heuristic is a positive allowlist, so a non-match is "not a recognized+ * tool-caller", not a proven negative, and hiding those options would make a+ * newer tool-capable family unselectable (see {@link withToolUseOptionLabel}).+ ** Returns `null` for cloud / API providers: their model ids don't encode their- * family, so the name heuristic would mislabel them (same reason- * `toolUseLocalModelFilter` leaves cloud lists untouched). LOCAL backends return+ * family, so the name heuristic would mislabel them. LOCAL backends return* `{ toolCapable }` keyed on {@link isToolUseModel} — where "local" is BOTH a* direct Ollama / LM Studio backend ({@link localBackendForProvider}) AND an* Ollama-BACKED CLI/TUI wrapper ({@link isOllamaBackedProvider}): a renameddiff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.jsindex 97affb6590..619424c4e3 100644--- a/client/src/utils/providers.test.js+++ b/client/src/utils/providers.test.js@@ -14,7 +14,6 @@ import {isVisionModel,visionLocalModelFilter,isToolUseModel,- toolUseLocalModelFilter,localToolUseHint,withToolUseOptionLabel,localBackendForProvider,@@ -611,20 +610,6 @@ describe('isToolUseModel (mirror of server localModelHeuristics)', () => {});});-describe('toolUseLocalModelFilter', () => {- it('restricts local backends to tool-use models', () => {- const ollama = { name: 'Ollama', endpoint: 'http://localhost:11434/v1' };- expect(toolUseLocalModelFilter('qwen2.5:7b', ollama)).toBe(true);- expect(toolUseLocalModelFilter('gemma2:9b', ollama)).toBe(false);- });-- it('leaves cloud/CLI providers untouched', () => {- const cloud = { name: 'OpenAI', endpoint: 'https://api.openai.com/v1' };- expect(toolUseLocalModelFilter('gpt-4o', cloud)).toBe(true);- expect(toolUseLocalModelFilter('anything', undefined)).toBe(true);- });-});-describe('localToolUseHint', () => {const ollama = { name: 'Ollama', endpoint: 'http://localhost:11434/v1' };