Skip to content

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

gate the Digital Twin sub-tab on its feature, and stop losing a reminder-time edit

[._.]/ Adam Eivy628d3c10aad9
diff --git a/client/src/components/digital-twin/SectionNav.jsx b/client/src/components/digital-twin/SectionNav.jsx
index c68dbcbf0b..7d1d2b0905 100644
--- a/client/src/components/digital-twin/SectionNav.jsx
+++ b/client/src/components/digital-twin/SectionNav.jsx
@@ -13,11 +13,19 @@
// 19-wide scroll the groups were introduced to kill.
import TabPills from '../ui/TabPills';
import { SECTION_GROUPS, groupSections, sectionGroupId } from './constants';
+import { useInstanceFeatures } from '../../hooks/useInstanceFeatures';
+import { filterNavByFeatures } from '../../lib/navFeatures';
export default function SectionNav({ activeSection, onChange }) {
+ const { isFeatureEnabled } = useInstanceFeatures();
const activeGroupId = sectionGroupId(activeSection);
const activeGroup = SECTION_GROUPS.find((g) => g.id === activeGroupId);
- const sections = groupSections(activeGroup);
+ // A section whose manifest entry carries a `feature` tag drops out of the
+ // strip when that feature is off, the same gate the sidebar, ⌘K and the
+ // Messages tab strip apply — the tag rides through `getPageNavTabs` onto
+ // these tab objects. The ROUTE stays live either way (navFeatures.js), so a
+ // deep link, bookmark or voice ui_navigate still lands on the page.
+ const sections = filterNavByFeatures(groupSections(activeGroup), isFeatureEnabled);
// Switching group lands on its first section — the group row is navigation,
// not a mode toggle, so it must always resolve to a real URL.
diff --git a/client/src/components/digital-twin/SectionNav.test.jsx b/client/src/components/digital-twin/SectionNav.test.jsx
index 5cb8e3a277..512460a943 100644
--- a/client/src/components/digital-twin/SectionNav.test.jsx
+++ b/client/src/components/digital-twin/SectionNav.test.jsx
@@ -106,3 +106,28 @@ describe('SectionNav', () => {
expect(groupTab('Profile')).toHaveAccessibleName('Profile');
});
});
+
+// The section strip is a browse surface, so it applies the same feature gate the
+// sidebar and ⌘K do (client/src/lib/navFeatures.js) — the `feature` tag rides
+// through getPageNavTabs onto these tab objects, exactly as it does for the
+// Messages strip. Mocked per-test rather than globally so the default-on case
+// above keeps exercising the real hook's "no override" answer.
+describe('SectionNav feature gating', () => {
+ it('drops a section whose feature is off, and keeps it when the feature is on', async () => {
+ vi.resetModules();
+ vi.doMock('../../hooks/useInstanceFeatures', () => ({
+ useInstanceFeatures: () => ({ isFeatureEnabled: (id) => id !== 'autobiography' })
+ }));
+ const Gated = (await import('./SectionNav')).default;
+
+ render(<Gated activeSection="documents" onChange={() => {}} />);
+ const row = screen.getByRole('tablist', { name: 'Sources sections' });
+ expect(within(row).queryByRole('tab', { name: /Autobiography/ })).toBeNull();
+ // The gate must be scoped to the tagged section — an untagged sibling in the
+ // same group still renders, so this isn't just an empty strip.
+ expect(within(row).getByRole('tab', { name: /^Interview/ })).toBeTruthy();
+
+ vi.doUnmock('../../hooks/useInstanceFeatures');
+ vi.resetModules();
+ });
+});
diff --git a/client/src/components/digital-twin/StoryCraftPanel.jsx b/client/src/components/digital-twin/StoryCraftPanel.jsx
index 2c647af449..cd19edeacc 100644
--- a/client/src/components/digital-twin/StoryCraftPanel.jsx
+++ b/client/src/components/digital-twin/StoryCraftPanel.jsx
@@ -55,15 +55,23 @@ export default function StoryCraftPanel({ evaluation }) {
</div>
{evaluation.cart?.length > 0 && (
- <div className="flex flex-wrap gap-1.5">
- {evaluation.cart.map((stage) => (
- <Pill
- key={stage.id}
- tone={stage.present ? 'success' : 'note'}
- title={stage.note || undefined}
- >
- {stage.label}
- </Pill>
+ <div className="space-y-1.5">
+ <div className="flex flex-wrap gap-1.5">
+ {evaluation.cart.map((stage) => (
+ <Pill key={stage.id} tone={stage.present ? 'success' : 'note'}>
+ {stage.label}
+ </Pill>
+ ))}
+ </div>
+ {/* A MISSING stage's note is the actionable half of CART, so it
+ renders as text rather than only a `title` — a tooltip is
+ unreachable on touch, which is where this gets read. A present
+ stage's note is just confirmation and stays out of the way. */}
+ {evaluation.cart.filter((s) => !s.present && s.note).map((stage) => (
+ <p key={stage.id} className="text-xs text-gray-500">
+ <span className="text-gray-400">{stage.label}: </span>
+ {stage.note}
+ </p>
))}
</div>
)}
diff --git a/client/src/components/digital-twin/StoryCraftPanel.test.jsx b/client/src/components/digital-twin/StoryCraftPanel.test.jsx
index 8eed1cec6a..c2d11f4690 100644
--- a/client/src/components/digital-twin/StoryCraftPanel.test.jsx
+++ b/client/src/components/digital-twin/StoryCraftPanel.test.jsx
@@ -44,6 +44,15 @@ describe('StoryCraftPanel', () => {
expect(screen.getByText(/answer its question/)).toBeInTheDocument();
});
+ it('spells out a MISSING CART stage\'s note as text, not only a tooltip', () => {
+ render(<StoryCraftPanel evaluation={evaluation} />);
+
+ // The actionable half of CART has to be readable on touch, where a `title`
+ // never surfaces. A present stage's note stays a chip.
+ expect(screen.getByText('missing')).toBeInTheDocument();
+ expect(screen.queryByText('kitchen table')).not.toBeInTheDocument();
+ });
+
it('renders nothing before a story has been scored', () => {
const { container } = render(<StoryCraftPanel evaluation={null} />);
diff --git a/client/src/components/digital-twin/tabs/AutobiographyTab.jsx b/client/src/components/digital-twin/tabs/AutobiographyTab.jsx
index 40c51cc345..009cd686e8 100644
--- a/client/src/components/digital-twin/tabs/AutobiographyTab.jsx
+++ b/client/src/components/digital-twin/tabs/AutobiographyTab.jsx
@@ -27,14 +27,15 @@ import { countWords } from '../../../lib/textUtils';
import toast from '../../ui/Toast';
import { useConfirmDelete } from '../../../hooks/useConfirmDelete';
import { formatCount, formatDateTime, formatDateNumeric } from '../../../utils/formatters';
+import { isValidTimeString } from '../../../utils/timeWindow';
-// Mirrors the server's reminder default and its strict HH:MM schema
-// (server/services/autobiography.js DEFAULT_CONFIG, server/lib/timezone.js).
+// Mirrors the server's reminder default (server/services/autobiography.js
+// DEFAULT_CONFIG). The strict HH:MM check comes from the shared, parity-tested
+// `isValidTimeString` rather than a private copy of the pattern.
const DEFAULT_REMINDER_TIME = '09:00';
// Matches CUSTOM_PROMPT_ID in server/services/autobiography.js — the promptId a
// story written against the user's own question is saved under.
const CUSTOM_PROMPT_ID = 'custom';
-const HHMM_RE = /^([01]\d|2[0-3]):[0-5]\d$/;
export default function AutobiographyTab({ onRefresh }) {
const [searchParams, setSearchParams] = useSearchParams();
@@ -227,7 +228,7 @@ export default function AutobiographyTab({ onRefresh }) {
setStories(prev => prev.map(s => (s.id === storyId ? { ...s, evaluation: result.evaluation } : s)));
toast.success(`Storytelling score: ${result.evaluation.overallScore}/${result.evaluation.maxScore}`);
}
- setEvaluatingStoryId(null);
+ setEvaluatingStoryId(prev => (prev === storyId ? null : prev));
};
const handleWeaveNarrative = async (storyId) => {
@@ -282,14 +283,18 @@ export default function AutobiographyTab({ onRefresh }) {
// the reminder's updatedAt, and re-register the cron on every partial value.
// So the field is a local draft that commits on blur, and an unusable value
// reverts to what is saved rather than being sent.
- const commitReminderTime = () => {
+ const commitReminderTime = async () => {
const saved = config?.reminder?.time || DEFAULT_REMINDER_TIME;
- if (!HHMM_RE.test(reminderTimeDraft)) {
+ if (!isValidTimeString(reminderTimeDraft)) {
setReminderTimeDraft(saved);
return;
}
if (reminderTimeDraft === saved) return;
- handleConfigUpdate({ reminder: { time: reminderTimeDraft } });
+ // A rejected save must snap the field back too. Leaving the typed value on
+ // screen after a failed PATCH shows a wake-up time that is not the one
+ // registered, and the user has no reason to re-save it.
+ const result = await handleConfigUpdate({ reminder: { time: reminderTimeDraft } });
+ if (!result) setReminderTimeDraft(saved);
};
const handleConfigUpdate = async (updates) => {
@@ -299,6 +304,7 @@ export default function AutobiographyTab({ onRefresh }) {
setConfig(result);
toast.success('Settings updated');
}
+ return result;
};
const wordCount = countWords(storyContent);
@@ -392,14 +398,17 @@ export default function AutobiographyTab({ onRefresh }) {
value={reminderTimeDraft}
onChange={(e) => setReminderTimeDraft(e.target.value)}
onBlur={commitReminderTime}
+ onKeyDown={(e) => { if (e.key === 'Enter' && !e.repeat) commitReminderTime(); }}
disabled={config.reminder?.enabled !== true}
className="bg-port-bg border border-port-border rounded px-2 py-1 text-sm text-white disabled:opacity-50"
/>
</label>
</div>
- <p className="text-xs text-gray-500">
- Skipped on any day you already wrote a story.
- </p>
+ {config.reminder?.enabled === true && (
+ <p className="text-xs text-gray-500">
+ Skipped on any day you already wrote a story.
+ </p>
+ )}
{config.lastPromptAt && (
<p className="text-xs text-gray-500">
Last prompt: {formatDateTime(config.lastPromptAt)}
@@ -447,7 +456,9 @@ export default function AutobiographyTab({ onRefresh }) {
value={ownQuestion}
maxLength={500}
onChange={(e) => setOwnQuestion(e.target.value)}
- onKeyDown={(e) => { if (e.key === 'Enter') startOwnQuestion(); }}
+ // !e.repeat: a held Enter would otherwise auto-repeat into the story
+ // textarea that mounts autoFocused (client/src/AGENTS.md).
+ onKeyDown={(e) => { if (e.key === 'Enter' && !e.repeat) startOwnQuestion(); }}
placeholder="Why do I like black licorice?"
className="flex-1 bg-port-bg border border-port-border rounded px-3 py-2 text-sm text-white placeholder-gray-600 focus:outline-hidden focus:border-port-accent/50"
/>