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
address review (antigravity): decorate the toolkit /samples payload and re-export canRefreshModels from the service shim
[._.]/ Adam Eivyb4ed65420e02
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex d6e08e6b13..b7ff61c346 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -35,4 +35,3 @@## Internal- **The six provider-seed migrations share one shell instead of six copies of it.** Every migration that ships a new AI provider to already-installed setups (OpenCode Ollama, its TUI sibling, Grok, Cerebras, Kimi, Cursor) repeated the same byte-identical read → validate → add-missing-ids → write body, so any hardening of it was a six-file sweep nobody did — and none of the six had picked up the reserved-key guard (`__proto__` / `constructor` / `prototype`) the split-migration family already applies. They now call a shared `makeProviderSeedMigration` factory that carries that guard, and each migration keeps only its own frozen provider payload, since a migration is the historical record of what it installed. Their duplicated shell tests collapse into one suite against the factory; every payload assertion each migration already made still runs unchanged.- **Whether a provider can refresh its model list is now the server's answer, not the client's guess.** The "Refresh Models" button used to be gated by a hand-written client-side re-derivation of the server's model-refresh dispatch — a mirror kept in step by a comment, backed by a parity test that transcribed the same dispatch a *second* time (so it only ever proved the mirror matched the test's copy). It drifted, silently, in both directions: too generous showed a button that errored on every click, too stingy hid the feature with no error at all. A gemini provider configured by absolute path was in the second bucket. The server now derives the answer from one per-vendor table and sends it on the providers payload as `canRefreshModels`; the client just reads it. The three keying conventions that had accumulated as prose above each branch (exact command string, path-tolerant command basename, display-name substring — and which of them a TUI provider is allowed to use) are columns in that table now, so adding the next vendor is one row instead of four coordinated edits across two repos' worth of files. The field is computed per response and never stored, so it can't go stale against the dispatch it describes. No shipped provider's button visibility changes; the one behavior that does is that a provider whose *command* is literally `gemini` now refreshes as gemini even if someone named it "Claude Something", which is the same "an exact command beats a display-name substring" rule the dispatch had already grown for cursor and Antigravity.->>>>>>> 664e998f3 (refactor([issue-3620]): collapse the model-refresh vendor dispatch into one table and ship it as canRefreshModels)diff --git a/server/lib/aiToolkit/routes/providers.js b/server/lib/aiToolkit/routes/providers.jsindex 984639c17e..fdd17588bb 100644--- a/server/lib/aiToolkit/routes/providers.js+++ b/server/lib/aiToolkit/routes/providers.js@@ -49,7 +49,10 @@ export function createProvidersRoutes(providerService, options = {}) {router.get('/samples', asyncHandler(async (req, res) => {const providers = await providerService.getSampleProviders();- res.json({ providers });+ // Samples are provider-shaped and the flag is derived purely from that+ // shape, so decorate them too — a sample's answer is what the provider it+ // becomes will report. PortOS's shadowing `/samples` handler does the same.+ res.json({ providers: withRefreshCapabilityList(providers) });}));router.get('/:id', asyncHandler(async (req, res) => {diff --git a/server/lib/aiToolkit/routes/providers.refreshCapability.test.js b/server/lib/aiToolkit/routes/providers.refreshCapability.test.jsindex cab3f328c1..52bd44a195 100644--- a/server/lib/aiToolkit/routes/providers.refreshCapability.test.js+++ b/server/lib/aiToolkit/routes/providers.refreshCapability.test.js@@ -83,6 +83,18 @@ describe('#3620: providers route decorates canRefreshModels without persisting iexpect(stored.providers.codex).not.toHaveProperty('canRefreshModels');});+ it('decorates GET /samples — a sample answers as the provider it will become', async () => {+ const res = await request(app).get('/api/providers/samples');+ expect(res.status).toBe(200);+ expect(res.body.providers.length).toBeGreaterThan(0);+ for (const sample of res.body.providers) {+ expect(typeof sample.canRefreshModels, `${sample.id}: sample missing the flag`).toBe('boolean');+ }+ const byId = Object.fromEntries(res.body.providers.map((p) => [p.id, p]));+ expect(byId['claude-code']?.canRefreshModels).toBe(true);+ expect(byId.codex?.canRefreshModels).toBe(false);+ });+it('decorates GET /:id and GET /active too, so every read agrees', async () => {await createProvider({ id: 'claude-code', name: 'Claude Code CLI', type: 'cli', command: 'claude' });await request(app).put('/api/providers/active').send({ id: 'claude-code' });diff --git a/server/services/providers.js b/server/services/providers.jsindex 08eebb8001..30fcd6debb 100644--- a/server/services/providers.js+++ b/server/services/providers.js@@ -10,10 +10,12 @@ import { setAIToolkitInstance, requireToolkit } from '../lib/aiToolkitState.js';// providers / runner / promptService all observe the same instance.export const setAIToolkit = setAIToolkitInstance;-// Pure classification helper, not a toolkit-instance method — a direct-// re-export (no requireToolkit() indirection needed) so callers can classify+// Pure classification helpers, not toolkit-instance methods — direct+// re-exports (no requireToolkit() indirection needed) so callers can classify// a provider shape without an initialized toolkit instance.-export { isOllamaBackedProvider } from '../lib/aiToolkit/providers.js';+// `canRefreshModels` is the model-refresh capability predicate the providers+// routes decorate their payloads with; it is derived on read and never stored.+export { isOllamaBackedProvider, canRefreshModels } from '../lib/aiToolkit/providers.js';export async function getAllProviders() {return requireToolkit().services.providers.getAllProviders();