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
fix: say why the activity digest drafts no AI narrative for a tool-capable provider
Adam Eivy576db669ca65
diff --git a/client/src/components/brain/tabs/DailyLogTab.jsx b/client/src/components/brain/tabs/DailyLogTab.jsxindex 100a60d5b3..295b4f19a0 100644--- a/client/src/components/brain/tabs/DailyLogTab.jsx+++ b/client/src/components/brain/tabs/DailyLogTab.jsx@@ -15,6 +15,7 @@ import useMounted from '../../../hooks/useMounted';import { useVisibilityEvent } from '../../../hooks/useVisibilityEvent';import { formatDateFull, localDateKey, shiftISODate } from '../../../utils/formatters';import { pluralize } from '../../../lib/textUtils';+import { strictToolFreeOneShotSelectionPolicy, supportsStrictToolFreeOneShot } from '../../../utils/providerSelection';// Autosave cadence. The debounce keeps us from PUTting on every keystroke;// the max-wait ceiling exists because a pure debounce never fires at all@@ -609,7 +610,10 @@ export default function DailyLogTab() {}const applied = res.entry ? applyEntry(res.entry, requestDate) : true;if (res.drafted) {- if (applied) {+ if (res.narrativeSkipped === 'provider-not-tool-free') {+ const saved = applied ? 'Drafted from your timeline' : `Draft saved to ${formatDateFull(requestDate) || requestDate}`;+ toast(`${saved} without an AI narrative: the selected provider cannot run tool-free. Pick an API provider.`, { icon: '🗓️' });+ } else if (applied) {toast.success(res.usedLlm ? 'Drafted with AI narrative' : 'Drafted from your timeline');} else {toast.success(`Draft saved to ${formatDateFull(requestDate) || requestDate}`);@@ -753,6 +757,7 @@ export default function DailyLogTab() {providers={providers}selectedProviderId={digestSettings?.provider || ''}onProviderChange={(id) => saveDigestSettings({ provider: id || null })}+ selectionPolicy={strictToolFreeOneShotSelectionPolicy}emptyProviderOption="None — structured summary only (no AI)"/>{digestProvider && (@@ -779,7 +784,9 @@ export default function DailyLogTab() {/></FormField><p className="text-[10px] text-gray-600">- {digestProvider+ {digestProvider && !supportsStrictToolFreeOneShot(digestProvider)+ ? `${digestProvider.name || digestProvider.id} cannot run tool-free, so drafts stay a structured summary with no AI narrative. The digest quotes other people's calendar and message text, so only API or tool-free providers draft it.`+ : digestProvider? `Scheduled drafts will call ${digestProvider.name || digestProvider.id}. Use the Draft action in the toolbar to run it now.`: 'No AI provider selected — drafts are a deterministic structured summary with zero AI calls.'}</p>diff --git a/client/src/components/brain/tabs/DailyLogTab.test.jsx b/client/src/components/brain/tabs/DailyLogTab.test.jsxindex c82064a65c..9dbea75b71 100644--- a/client/src/components/brain/tabs/DailyLogTab.test.jsx+++ b/client/src/components/brain/tabs/DailyLogTab.test.jsx@@ -594,6 +594,24 @@ describe('DailyLogTab draft/append date guard', () => {expect(mockToast.success).toHaveBeenCalledWith('Drafted with AI narrative');});+ // The server refuses a provider that cannot run tool-free; the draft must+ // say why no narrative appeared instead of reporting a plain success.+ it('says why a Draft has no AI narrative when the provider cannot run tool-free', async () => {+ api.draftActivityDigest.mockResolvedValue({+ entry: entryFor(TODAY, 'drafted content'),+ drafted: true,+ usedLlm: false,+ narrativeSkipped: 'provider-not-tool-free',+ });+ await renderTab();++ fireEvent.click(screen.getByLabelText('Draft activity digest'));+ await act(async () => { await vi.advanceTimersByTimeAsync(0); });++ expect(mockToast).toHaveBeenCalledWith(expect.stringMatching(/^Drafted from your timeline without an AI narrative/), expect.anything());+ expect(mockToast.success).not.toHaveBeenCalled();+ });+it('does not apply a Quick Append response to a day the user switched away from', async () => {let releaseAppend;api.appendDailyLog.mockImplementation(() => new Promise((resolve) => {diff --git a/client/src/utils/README.md b/client/src/utils/README.mdindex 39bc81d825..3182eab367 100644--- a/client/src/utils/README.md+++ b/client/src/utils/README.md@@ -61,7 +61,7 @@ is where each shared table is re-exported from its `server/lib` leaf.| `providerHarnesses` | `harnessLabel(harnessId)` — the display name for an agent program PortOS drives (Claude Code, OpenCode, Codex, …), used wherever a harness is named (the preset-first pickers, the composition catalog hook), where `null` means Direct API and an unknown id renders verbatim rather than disappearing. Read through `harnessById` from the pure leaf `server/lib/providerHarnesses.js`, so a harness added to the registry is named here without a second edit. Also `providerHarnessId(provider)` (a derived preset's own `harnessId`, else the server's `harnessForProvider` classification) and `groupProvidersByHarness(providers)` — the `{ harnessId, label, providers }` buckets in registry order (Direct API after the agent harnesses, an `Other` bucket last) that the preset-first `ProviderModelSelector` renders as `<optgroup>`s (#7566) and the AI Providers page renders as its preset sections (#7567). `presetEditPath(presetId)` — the preset editor URL (`/ai/presets/:id`), falling back to the kept `/ai/edit/:id` alias for the one id (`new`) the static create route shadows. || `providerEndpoints` | WHERE a provider's endpoint points. `isLocalEndpoint` (loopback), `isPrivateNetworkEndpoint` (RFC1918 / tailnet address, or a `.local` / `.ts.net` / single-label host — somewhere an unauthenticated OpenAI-compatible server is a normal setup rather than a missing API key), `isLocalInstanceProvider` (talks to a daemon on THIS machine; mirror of `server/lib/localProviderRuntime.js#isLocalInstanceEndpoint` — gate anything that explains a provider by inspecting the host PortOS runs on), `isFleetProvider` / `isFleetHostConfigured` (another machine inside the private network), and `localBackendForProvider` (`'ollama'` / `'lmstudio'` / `null` by id, endpoint or name — it matches by NAME, so pair it with `isLocalInstanceProvider` before claiming this machine's install state). || `providerModels` | Which MODEL and EFFORT a run resolves to, and what a picker may list. `sortProviderModels` alphabetizes display options by name/id without mutating the catalog. The configured-default sentinels (`CODEX_CONFIGURED_DEFAULT` …, `isConfiguredDefaultModel`, `configuredDefaultIn` — so a picker can render an option matching a sentinel-valued tier instead of a blank select) and `filterSelectableModels`; the per-CLI effort ladders, `effortLevelsForProvider`, `resolveCliEffort` (what a stored effort actually runs as, so the picker can name a clamped level), `effortSurvivingModel` and `seedModelEffort`; the Antigravity base-model ↔ effort-suffix split (`splitAntigravityModel`, `antigravityBaseModels`, `antigravityModelEffortLevels`, `withStaleAntigravityPin`); the account-aware option list (`providerModelList`, `resolveProviderModelOptions`, `effortAwareModelOptions`, `MODEL_SOURCE` — the one place a Codex-subscription account catalog enters a picker); `effectiveModelFor`; `mergeModelLists` / `mergeProviderUpdate`; and `generationControlsFor` (which temperature / top-p / thinking controls a provider forwards at all). The sentinels, effort ladders and the Antigravity split are re-exported from the pure leaf `server/lib/providerModels.js`; `effortLevelsForProvider` / `resolveCliEffort` delegate to the server's and add the ladder a sanitized provider inventory publishes, clamped through the server's `clampEffortToLadder`. The generation-control tables still mirror `server/lib/opencodeConfig.js`. |-| `providerSelection` | Which providers and models a picker may OFFER on this install: `isProviderHardwareCompatible` / `isProviderModelHardwareCompatible` / `filterHardwareCompatibleProviderModels` (server-annotated, fail-open), `selectableProviders` (the single rule `ProviderModelSelector` renders from), `filterRunnableProviders` (agent jobs need a CLI/TUI harness), `supportsToolFreeOneShot` / `toolFreeOneShotSelectionPolicy` (API or server-verified tool-free CLI authoring; excludes TUI and unverified composite routes), the fail-closed tool-free local policy (`TOOL_FREE_LOCAL_PROVIDER_IDS`, `TOOL_FREE_LOCAL_TEXT_CAPABILITIES`, `isToolFreeLocalProvider`, `isToolFreeLocalModel`, `toolFreeLocalSelectionPolicy`) used by security-sensitive pickers, and the pr-reviewer postures (`PUBLIC_REVIEW_NO_TOOL_POSTURE` / `PUBLIC_REVIEW_ACTIONS_POSTURE`, `supportsPublicReviewPosture`, `enforcesPublicReviewPosture`, `publicReviewSelectionPolicy` — mirror of `server/lib/agentExecutionProfiles.js`: a pipeline stage names a POSTURE, the server publishes each provider's `publicReviewPostures` and `publicReviewEnforcedPostures` on `GET /api/providers`, and the picker offers exactly the providers this install can run the stage on, so no vendor is named on either side). Also the caller EXECUTION-MODE picker rule (`callerModeList`, `providerModeSelectionPolicy` — whose `modes` also bound the selector's compose flow) and `COMPOSE_OPTION_VALUE`, the "Custom combination…" action sentinel outside both provider-id grammars (#7566), over `server/lib/callerModePolicy.js` — the server enforces the policy on the pin, on `activeProvider` inheritance and on every fallback candidate; this only lets a picker SHOW the rule, keeping an ineligible saved value visible-but-disabled instead of hidden or silently replaced — read off `CALLER_MODE_POLICIES` in that pure leaf, so it cannot drift). |+| `providerSelection` | Which providers and models a picker may OFFER on this install: `isProviderHardwareCompatible` / `isProviderModelHardwareCompatible` / `filterHardwareCompatibleProviderModels` (server-annotated, fail-open), `selectableProviders` (the single rule `ProviderModelSelector` renders from), `filterRunnableProviders` (agent jobs need a CLI/TUI harness), `supportsToolFreeOneShot` / `toolFreeOneShotSelectionPolicy` (API or server-verified tool-free CLI authoring; excludes TUI and unverified composite routes), `supportsStrictToolFreeOneShot` / `strictToolFreeOneShotSelectionPolicy` (the same without read-only-sandboxed authoring CLIs, mirroring the server's `isToolFreeOneShotProvider`), the fail-closed tool-free local policy (`TOOL_FREE_LOCAL_PROVIDER_IDS`, `TOOL_FREE_LOCAL_TEXT_CAPABILITIES`, `isToolFreeLocalProvider`, `isToolFreeLocalModel`, `toolFreeLocalSelectionPolicy`) used by security-sensitive pickers, and the pr-reviewer postures (`PUBLIC_REVIEW_NO_TOOL_POSTURE` / `PUBLIC_REVIEW_ACTIONS_POSTURE`, `supportsPublicReviewPosture`, `enforcesPublicReviewPosture`, `publicReviewSelectionPolicy` — mirror of `server/lib/agentExecutionProfiles.js`: a pipeline stage names a POSTURE, the server publishes each provider's `publicReviewPostures` and `publicReviewEnforcedPostures` on `GET /api/providers`, and the picker offers exactly the providers this install can run the stage on, so no vendor is named on either side). Also the caller EXECUTION-MODE picker rule (`callerModeList`, `providerModeSelectionPolicy` — whose `modes` also bound the selector's compose flow) and `COMPOSE_OPTION_VALUE`, the "Custom combination…" action sentinel outside both provider-id grammars (#7566), over `server/lib/callerModePolicy.js` — the server enforces the policy on the pin, on `activeProvider` inheritance and on every fallback candidate; this only lets a picker SHOW the rule, keeping an ineligible saved value visible-but-disabled instead of hidden or silently replaced — read off `CALLER_MODE_POLICIES` in that pure leaf, so it cannot drift). || `localModelHeuristics` | What an untyped LOCAL model can do, judged from its id: `isEmbeddingModel` / `isVisionModel` / `isToolUseModel` (re-exported from the pure leaf `server/lib/localModelHeuristics.js` — one regex per family; a model card's explicit capability metadata outranks the id regex), `isVisionCapableCliProvider`, `filterGenerationModels` (sentinels and embedding-only models dropped), `visionLocalModelFilter` and `localToolUseHint` / `withToolUseOptionLabel` (unioned with the server's authoritative per-provider capability maps from `useVisionModelIds` / `useToolUseModelIds`; tool-use is an annotation plus warning, never a filter), and `modelCapabilityInfo` (capability badges for a selected model without over-sharing a local runtime's answer with another provider). || `providerContextWindows` | How large a context window a provider/model gets for planning and where the number came from: the vendor constants and the `KNOWN_MODEL_CONTEXT_WINDOWS` ladder (`knownModelContextWindow`, `knownProviderContextWindow`), `catalogModelContextWindow` (the window the provider's own `/models` catalog reported), `resolveModelContextWindow` → `{ tokens, source }` with `CONTEXT_WINDOW_SOURCE` (`override` / `reported` / `assumed` — the state a card has to label rather than print as fact), `effectiveModelContextWindow`, and `modelOptionLabel` ("id (32K ctx)"). The constants and the known-model / known-provider / catalog rungs are re-exported from the pure leaf `server/lib/providerContextWindows.js`, the same rungs the server's `effectiveContextWindow` budgets with — including `mergeObservedContextWindows`, which folds a local daemon's live window (off the readiness payload) onto the catalog rung so the card shows what the dispatch gate enforces, and holds every resolved window down to an Ollama daemon's launch `num_ctx` through `clampToRuntimeContextWindow` (applied internally, from `server/lib/aiToolkit/internal/ollamaBacked.js` — the same module the server's budgeter and pre-dispatch gate use), so the meter can't promise a budget a run would be refused for (#7466). `withRuntimeContextWindow(provider, ceiling)` stamps that ceiling's second rung — the ambient `OLLAMA_CONTEXT_LENGTH` the server launched the daemon with, which the browser cannot read and so takes off the readiness payload as `runtimeContextWindow` (#7472). || `providerModelAccess` | Which of a provider's advertised catalog this install is entitled to run (free tier, plan, hand-picked allowlist). Re-exports the policy rules the browser consumes from the pure leaf `server/lib/aiToolkit/internal/modelAccess.js` — `MODEL_ACCESS_MODES`, `MAX_MODEL_ACCESS_PATTERNS`, `CONFIGURED_MODEL_KEYS`, `normalizeModelAccess`, `modelMatchesAccessPatterns` — so the editor's live preview and the server's own scoping cannot disagree. Adds `providerModelCatalog(provider)` (the FULL list, off `modelCatalog` when the payload was scoped — seed a model editor from this or a Save persists the narrowed list), `previewModelAccess(catalog, policy, configuredModels)` → `{ total, visibleCount, hidden, inert }`, `configuredModelsOf`, `NO_MODEL_ACCESS` and `MODEL_ACCESS_MODE_LABELS`. `applyModelAccess` is deliberately NOT re-exported: a client payload is already scoped, and re-scoping would overwrite `modelCatalog` with the narrowed list. |diff --git a/client/src/utils/providerSelection.js b/client/src/utils/providerSelection.jsindex a54d793434..4db84f57a3 100644--- a/client/src/utils/providerSelection.js+++ b/client/src/utils/providerSelection.js@@ -95,6 +95,15 @@ export const supportsToolFreeOneShot = (provider) => provider?.enabled !== false// path, with incompatible records visible but disabled.export const toolFreeOneShotSelectionPolicy = Object.freeze({ provider: supportsToolFreeOneShot });+/** Strictly tool-free: a direct API or a server-verified tool-free CLI, never a+ * read-only-sandboxed authoring CLI. Mirrors `isToolFreeOneShotProvider` in+ * server/lib/providerVendors.js, for pickers whose server refuses the rest.+ */+export const supportsStrictToolFreeOneShot = (provider) => provider?.enabled !== false+ && (provider?.type === 'api' || provider?.type === 'cli' && provider.toolFreeOneShot === true);++export const strictToolFreeOneShotSelectionPolicy = Object.freeze({ provider: supportsStrictToolFreeOneShot });+// The two enforceable public-review postures. MIRROR of// `server/lib/agentExecutionProfiles.js`; a pr-reviewer stage names a posture// and the server publishes each provider's `publicReviewPostures` ondiff --git a/server/services/activityDigest.js b/server/services/activityDigest.jsindex d4e7fba03e..a1cbafcbd8 100644--- a/server/services/activityDigest.js+++ b/server/services/activityDigest.js@@ -255,19 +255,20 @@ async function buildNameMap(events) {return map;}-// Generate the LLM narrative from the bullet template. Returns null on any-// failure (caller falls back to the non-LLM bullets). Never throws — runs on+// Generate the LLM narrative from the bullet template. Returns `{ text: null }`+// on any failure (caller falls back to the non-LLM bullets), plus `skipped`+// when the configured provider is refused outright. Never throws — runs on// the scheduler path too.async function generateNarrative(template, date, settings) {const provider = await getProviderById(settings.provider).catch(() => null);- if (!provider || !provider.enabled) return null;+ if (!provider || !provider.enabled) return { text: null };// The template quotes other people's text (calendar invite titles, message// participant names, media titles) and runs unattended on the scheduler, so// it never reaches host tools: only a provider that can run it tool-free// drafts the narrative, pinned so no fallback swaps in an agent harness.if (!isToolFreeOneShotProvider(provider)) {console.warn(`⚠️ Activity digest ${date}: provider ${provider.id} cannot run tool-free — keeping the bullet digest`);- return null;+ return { text: null, skipped: 'provider-not-tool-free' };}const model = settings.model || provider.defaultModel;// Headless classification-style run — append headlessArgs so a CLI provider@@ -287,7 +288,7 @@ async function generateNarrative(template, date, settings) {return null;});const text = (result?.text || '').trim();- return text || null;+ return { text: text || null };}/**@@ -299,7 +300,9 @@ async function generateNarrative(template, date, settings) {* @param {object} [opts]* @param {boolean} [opts.recordRun=false] — stamp settings.lastRun* on success* (the scheduler sets this; manual drafts don't move the scheduler cursor).- * @returns {Promise<{ date, drafted: boolean, usedLlm: boolean, reason?: string }>}+ * @returns {Promise<{ date, drafted: boolean, usedLlm: boolean, reason?: string, narrativeSkipped?: string }>}+ * `narrativeSkipped: 'provider-not-tool-free'` names why a configured+ * provider drafted no narrative, so the UI can say so.*/export async function runDigestForDate(date, { recordRun = false } = {}) {if (!journal.isIsoDate(date)) throw new Error(`invalid date: ${date}`);@@ -322,8 +325,10 @@ export async function runDigestForDate(date, { recordRun = false } = {}) {let sectionBody = template;let usedLlm = false;+ let narrativeSkipped = null;if (settings.provider) {- const narrative = await generateNarrative(template, date, settings);+ const { text: narrative, skipped } = await generateNarrative(template, date, settings);+ narrativeSkipped = skipped || null;if (narrative) {// Prose narrative on top; keep the structured bullets beneath it for// provenance / at-a-glance scanning.@@ -335,7 +340,7 @@ export async function runDigestForDate(date, { recordRun = false } = {}) {await journal.upsertAutoSection(date, buildSectionBody(date, sectionBody, { usedLlm }), DIGEST_MARKERS);if (recordRun) await stampRun(date);console.log(`🗓️ Activity digest drafted ${date} (${events.length} event(s), ${usedLlm ? 'LLM' : 'non-LLM'}) in ${Date.now() - started}ms`);- return { date, drafted: true, usedLlm };+ return { date, drafted: true, usedLlm, ...(narrativeSkipped ? { narrativeSkipped } : {}) };}// Advance the scheduler cursor to the drafted day.diff --git a/server/services/activityDigest.narrative.test.js b/server/services/activityDigest.narrative.test.jsindex db3e8e6351..f42e2bc3ac 100644--- a/server/services/activityDigest.narrative.test.js+++ b/server/services/activityDigest.narrative.test.js@@ -34,7 +34,7 @@ describe('activity digest narrative provider', () => {const result = await runDigestForDate('2026-10-01');- expect(result).toMatchObject({ drafted: true, usedLlm: false });+ expect(result).toMatchObject({ drafted: true, usedLlm: false, narrativeSkipped: 'provider-not-tool-free' });expect(runPromptThroughProvider).not.toHaveBeenCalled();});@@ -44,6 +44,7 @@ describe('activity digest narrative provider', () => {const result = await runDigestForDate('2026-10-01');expect(result).toMatchObject({ drafted: true, usedLlm: true });+ expect(result.narrativeSkipped).toBeUndefined();expect(runPromptThroughProvider).toHaveBeenCalledWith(expect.objectContaining({ toolFree: true, allowFallback: false }));});});