Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(office): Settings theme picker + destructive switch flow (TV-show offices Phase 1)

Chaitanya Giri5d1e33873f9a
diff --git a/src/main/config.ts b/src/main/config.ts
index 541bcaf5..99140a82 100644
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@ -164,6 +164,14 @@ export interface HarnessConfig {
* ("theme" key) at spawn so the TUI's truecolor palette matches. Scoped to
* harness agents only; the user's global Claude theme is never touched. */
terminalTheme?: 'light' | 'dark';
+ /** Master flag for the TV-show office themes feature (Settings theme picker +
+ * destructive switch flow). Default false = the picker is hidden and the
+ * office renders as today (zero behavior change). */
+ tvShowOffices?: boolean;
+ /** Which office map/cast theme the pixel office renders. Only honored when
+ * `tvShowOffices` is on; otherwise the office theme is used. Unbuilt show
+ * themes fall back to 'office' in the loader. */
+ officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
/** Master toggle for the Slack → Michael's-queue integration. */
slackEnabled?: boolean;
/** Slack app signing secret (Basic Information → Signing Secret). Never logged. */
@@ -224,6 +232,8 @@ const DEFAULTS: HarnessConfig = {
missions: [OPS_STANDUP_MISSION],
notifications: false,
multiWindow: false,
+ tvShowOffices: false,
+ officeTheme: 'office',
slackEnabled: false,
slackSigningSecret: undefined,
slackBotToken: undefined,
diff --git a/src/preload/index.ts b/src/preload/index.ts
index f596f8a7..95066ed4 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -181,6 +181,10 @@ export interface HarnessConfig {
knowledgeGraph?: KnowledgeGraphConfig;
/** Terminal theme, mirrored into each agent's per-session Claude settings. */
terminalTheme?: 'light' | 'dark';
+ /** TV-show office themes feature flag (Settings picker + switch flow). Default OFF. */
+ tvShowOffices?: boolean;
+ /** Active office map/cast theme (honored only when tvShowOffices is on). */
+ officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
}
export interface MemoryStatus {
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 0ae262ca..f16eb894 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -53,6 +53,9 @@ export function App() {
// Mirror the Free Flow flag into the store so the composer mic button shows
// only when enabled (Settings keeps this in sync on save).
useStore.getState().setFreeflowEnabled(!!c.freeflowEnabled);
+ // Mirror the active office theme so OfficeFloor renders it (gated on the
+ // tvShowOffices flag; off = always the office). Settings keeps this synced.
+ useStore.getState().setOfficeTheme(c.tvShowOffices ? (c.officeTheme ?? 'office') : 'office');
});
return () => { cancelled = true; };
}, []);
diff --git a/src/renderer/src/components/OfficeThemePicker.tsx b/src/renderer/src/components/OfficeThemePicker.tsx
new file mode 100644
index 00000000..094a0c0e
--- /dev/null
+++ b/src/renderer/src/components/OfficeThemePicker.tsx
@@ -0,0 +1,253 @@
+import { useState } from 'react';
+import type { HarnessConfig } from '@/store/config';
+import { useStore } from '@/store/store';
+import { disposeTerminal } from './terminalPool';
+import { PixelPanel } from './PixelPanel';
+import { PixelButton } from './PixelButton';
+import { Icon } from './Icon';
+import type { ThemeId } from '@/scene/office/themeRegistry';
+
+// TV-show office themes (Phase 1 = the switch flow infra). Only `office` has a
+// real map+cast today; the five shows render via the loader's office fallback
+// until their content lands (Phase 2). `built: false` shows a "soon" tag and a
+// fallback note on switch, but the destructive switch flow still runs so the
+// whole pipeline (modal → delete cast → persist → re-seat) is exercisable now.
+interface ThemeMeta { id: ThemeId; label: string; blurb: string; built: boolean; swatch: string; }
+const THEME_META: ThemeMeta[] = [
+ { id: 'office', label: 'The Office', blurb: 'Dunder Mifflin — the original floor', built: true, swatch: '#6b5a4a' },
+ { id: 'friends', label: 'Friends', blurb: 'Central Perk coffee house', built: false, swatch: '#9a5a32' },
+ { id: 'brooklyn99', label: 'Brooklyn Nine-Nine', blurb: 'The 99th precinct bullpen', built: false, swatch: '#3a5a7a' },
+ { id: 'siliconvalley', label: 'Silicon Valley', blurb: 'The Hacker Hostel', built: false, swatch: '#4a6a4a' },
+ { id: 'got', label: 'Game of Thrones', blurb: 'The Red Keep throne room', built: false, swatch: '#6a2630' },
+ { id: 'hogwarts', label: 'Harry Potter', blurb: 'Hogwarts great hall', built: false, swatch: '#39305a' },
+];
+
+/** Settings "Office Theme" section: an experimental flag toggle + a 6-card
+ * theme picker with the destructive switch flow (report §E). Self-contained so
+ * it stays out of SettingsModal's bulk. */
+export function OfficeThemePicker({ config }: { config: HarnessConfig }) {
+ const [enabled, setEnabled] = useState(!!config.tvShowOffices);
+ const [current, setCurrent] = useState<ThemeId>((config.officeTheme as ThemeId) ?? 'office');
+ const [pending, setPending] = useState<ThemeId | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [note, setNote] = useState('');
+
+ const archiveAgent = useStore((s) => s.archiveAgent);
+ const setOfficeTheme = useStore((s) => s.setOfficeTheme);
+
+ const toggleFlag = async () => {
+ const next = !enabled;
+ setEnabled(next);
+ setNote('');
+ try {
+ await window.cth.updateConfig({ tvShowOffices: next });
+ // Flag off → the office renders regardless of the saved theme; flag on →
+ // restore the persisted theme.
+ setOfficeTheme(next ? current : 'office');
+ } catch {
+ setEnabled(!next); // revert optimistic toggle on failure
+ }
+ };
+
+ const nonGodAgents = () =>
+ useStore.getState().agents.filter((a) => !a.isGod && !a.isAssistant);
+
+ const onSelect = (id: ThemeId) => {
+ setNote('');
+ if (busy || id === current) return; // no-op on the current theme
+ if (nonGodAgents().length === 0) { void applyTheme(id); return; } // god-only → instant
+ setPending(id); // workers exist → confirm modal
+ };
+
+ const applyTheme = async (id: ThemeId) => {
+ setBusy(true);
+ try {
+ // Tear down every non-god agent through the EXISTING lifecycle (kill PTY →
+ // dispose terminal → archive). god + the prep assistant carry over; god's
+ // PTY is never touched. If a PTY won't die, abort the switch (surface the
+ // error, don't persist the new theme) rather than leave a half-switched floor.
+ const victims = nonGodAgents();
+ for (const a of victims) {
+ if (a.ptyId) {
+ await window.cth.killPty(a.ptyId);
+ disposeTerminal(a.ptyId);
+ }
+ }
+ for (const a of victims) archiveAgent(a.id);
+ await window.cth.updateConfig({ officeTheme: id });
+ setCurrent(id);
+ setOfficeTheme(id); // → OfficeFloor rebuilds the scene on the new map/cast
+ const meta = THEME_META.find((t) => t.id === id);
+ if (meta && !meta.built) setNote(`${meta.label} isn't built yet — showing the office for now.`);
+ } catch (e) {
+ setNote(`Switch aborted — a terminal wouldn't close: ${e instanceof Error ? e.message : String(e)}`);
+ } finally {
+ setBusy(false);
+ setPending(null);
+ }
+ };
+
+ const pendingMeta = pending ? THEME_META.find((t) => t.id === pending) : null;
+
+ return (
+ <div>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 10
+ }}>
+ Office Theme
+ </div>
+
+ {/* Experimental feature flag */}
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
+ <span style={{ fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
+ TV-show office themes <span style={{ color: 'var(--cth-ink-500)' }}>(experimental)</span>
+ </span>
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ Re-skin the pixel office as a TV show. Switching starts a fresh cast.
+ </span>
+ </div>
+ <PixelButton variant={enabled ? 'primary' : 'secondary'} size="sm" onClick={toggleFlag}>
+ {enabled ? 'on' : 'off'}
+ </PixelButton>
+ </div>
+
+ {/* Theme picker grid (only when the flag is on) */}
+ {enabled && (
+ <div style={{ marginTop: 12, display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 8 }}>
+ {THEME_META.map((t) => {
+ const isCurrent = t.id === current;
+ return (
+ <button
+ key={t.id}
+ onClick={() => onSelect(t.id)}
+ disabled={busy}
+ style={{
+ display: 'flex', alignItems: 'center', gap: 8, textAlign: 'left',
+ padding: 8, cursor: busy ? 'default' : 'pointer',
+ background: isCurrent ? 'var(--cth-paper-100)' : 'transparent',
+ boxShadow: isCurrent
+ ? 'inset 0 0 0 2px var(--cth-ink-900)'
+ : 'inset 0 0 0 1px var(--cth-ink-300)',
+ opacity: busy && !isCurrent ? 0.6 : 1,
+ }}
+ >
+ <span style={{
+ width: 28, height: 28, flexShrink: 0, background: t.swatch,
+ boxShadow: 'inset 0 0 0 2px var(--cth-ink-900)',
+ }} />
+ <span style={{ display: 'flex', flexDirection: 'column', gap: 1, minWidth: 0 }}>
+ <span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
+ <span style={{ fontSize: 13, lineHeight: '16px', color: 'var(--cth-ink-900)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
+ {t.label}
+ </span>
+ {isCurrent && (
+ <span style={{ fontFamily: 'var(--cth-font-display)', fontSize: 7, color: 'var(--cth-mint)', textTransform: 'uppercase' }}>
+ current
+ </span>
+ )}
+ {!t.built && !isCurrent && (
+ <span style={{ fontFamily: 'var(--cth-font-display)', fontSize: 7, color: 'var(--cth-ink-500)', textTransform: 'uppercase' }}>
+ soon
+ </span>
+ )}
+ </span>
+ <span style={{ fontSize: 11, lineHeight: '14px', color: 'var(--cth-ink-500)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
+ {t.blurb}
+ </span>
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ )}
+
+ {enabled && note && (
+ <div style={{ marginTop: 10, fontSize: 12, color: 'var(--cth-ink-500)' }}>{note}</div>
+ )}
+
+ {pending && pendingMeta && (
+ <ThemeSwitchConfirmModal
+ label={pendingMeta.label}
+ agents={nonGodAgents()}
+ busy={busy}
+ onCancel={() => setPending(null)}
+ onConfirm={() => void applyTheme(pending)}
+ />
+ )}
+ </div>
+ );
+}
+
+interface VictimAgent { id: string; status?: string; }
+
+/** Destructive confirm for a theme switch with live workers (report §E copy). */
+function ThemeSwitchConfirmModal({
+ label, agents, busy, onCancel, onConfirm,
+}: {
+ label: string;
+ agents: VictimAgent[];
+ busy: boolean;
+ onCancel: () => void;
+ onConfirm: () => void;
+}) {
+ const n = agents.length;
+ const working = agents.filter((a) => a.status && !['idle', 'success', 'error'].includes(a.status)).length;
+ const godName = useStore.getState().agents.find((a) => a.isGod)?.name ?? 'the orchestrator';
+
+ return (
+ <div
+ onClick={busy ? undefined : onCancel}
+ style={{
+ position: 'fixed', inset: 0, background: 'rgba(26, 19, 32, 0.7)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 400,
+ }}
+ >
+ <div onClick={(e) => e.stopPropagation()} style={{ width: 480, maxWidth: '92vw' }}>
+ <PixelPanel variant="dialog" title={`SWITCH OFFICE TO "${label.toUpperCase()}"?`} noPadding>
+ <div style={{ padding: 20, display: 'flex', flexDirection: 'column', gap: 16 }}>
+ <div style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
+ <div style={{
+ width: 32, height: 32, flexShrink: 0,
+ background: 'var(--cth-coral-light)',
+ boxShadow: 'inset 0 0 0 2px var(--cth-ink-900)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ }}>
+ <Icon name="bell" />
+ </div>
+ <div style={{ flex: 1 }}>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 12, lineHeight: '20px',
+ color: 'var(--cth-ink-900)', marginBottom: 4,
+ }}>
+ STARTS A FRESH CAST
+ </div>
+ <div style={{ fontSize: 15, lineHeight: '22px', color: 'var(--cth-ink-700)' }}>
+ Your <strong>{n} current agent{n === 1 ? '' : 's'}</strong> will be deleted — their terminals close and any in-progress work stops. Only <strong>{godName}</strong> carries over.
+ {working > 0 && (
+ <span style={{ display: 'block', marginTop: 6, color: 'var(--cth-coral)' }}>
+ ⚠ {working} agent{working === 1 ? ' is' : 's are'} still working.
+ </span>
+ )}
+ </div>
+ <div style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)', marginTop: 8 }}>
+ This can't be undone.
+ </div>
+ </div>
+ </div>
+
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
+ <PixelButton variant="secondary" size="md" onClick={onCancel} disabled={busy}>
+ cancel
+ </PixelButton>
+ <PixelButton variant="destructive" size="md" onClick={onConfirm} disabled={busy}>
+ {busy ? 'switching…' : `delete ${n} & switch`}
+ </PixelButton>
+ </div>
+ </div>
+ </PixelPanel>
+ </div>
+ </div>
+ );
+}
diff --git a/src/renderer/src/components/SettingsModal.tsx b/src/renderer/src/components/SettingsModal.tsx
index fb27f94c..2117ee6d 100644
--- a/src/renderer/src/components/SettingsModal.tsx
+++ b/src/renderer/src/components/SettingsModal.tsx
@@ -4,6 +4,7 @@ import { useStore } from '@/store/store';
import { PixelPanel } from './PixelPanel';
import { PixelButton } from './PixelButton';
import { Icon } from './Icon';
+import { OfficeThemePicker } from './OfficeThemePicker';
export interface SettingsModalProps {
config: HarnessConfig;
@@ -779,6 +780,9 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
</div>
)}
</div>
+
+ {/* Office Theme — TV-show office maps (experimental; flag tvShowOffices, default off) */}
+ <OfficeThemePicker config={config} />
</>
)}
diff --git a/src/renderer/src/scene/office/OfficeFloor.tsx b/src/renderer/src/scene/office/OfficeFloor.tsx
index acd287d1..b4163b13 100644
--- a/src/renderer/src/scene/office/OfficeFloor.tsx
+++ b/src/renderer/src/scene/office/OfficeFloor.tsx
@@ -159,6 +159,9 @@ export function OfficeFloor() {
const hostRef = useRef<HTMLDivElement | null>(null);
const appRef = useRef<Application | null>(null);
const mountIdRef = useRef(0);
+ // The active office theme (store mirror of config.officeTheme). Changing it
+ // tears down and rebuilds the whole scene on the new map/cast (see deps below).
+ const officeTheme = useStore((s) => s.officeTheme);
useEffect(() => {
const host = hostRef.current;
@@ -177,8 +180,8 @@ export function OfficeFloor() {
const MAX_ENVELOPES = 16;
const init = async () => {
- // Active office theme (Phase 0 ships the existing office as `theme:'office'`).
- const theme = await loadTheme('office');
+ // Load the active theme bundle (falls back to 'office' on a bad/absent bundle).
+ const theme = await loadTheme(officeTheme);
await app.init({
background: hexNum(theme.palette.background),
antialias: false,
@@ -1661,7 +1664,7 @@ export function OfficeFloor() {
appRef.current = null;
while (host.firstChild) host.removeChild(host.firstChild);
};
- }, []);
+ }, [officeTheme]);
return (
<div
diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.ts
index 1d646552..728aeaf7 100644
--- a/src/renderer/src/store/config.ts
+++ b/src/renderer/src/store/config.ts
@@ -78,6 +78,10 @@ export interface HarnessConfig {
circuitBreaker?: CircuitBreakerConfig;
/** Enterprise Knowledge Graph (multimodal context for agents). Default OFF. */
knowledgeGraph?: KnowledgeGraphConfig;
+ /** TV-show office themes feature flag (Settings picker + switch flow). Default OFF. */
+ tvShowOffices?: boolean;
+ /** Active office map/cast theme (honored only when tvShowOffices is on). */
+ officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
}
/** The Sonnet model with the 1M-token context window — used for Michael's prep
diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.ts
index f2c5bf8f..4c0f26c9 100644
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@ -1,6 +1,7 @@
import { create } from 'zustand';
import type { AccentColorName } from '@/design/tokens';
import type { OfficeCharacterName } from '@/scene/office/cast';
+import type { ThemeId } from '@/scene/office/themeRegistry';
import type { StatusKind } from '@/components/PixelBadge';
import type { AgentProvider } from '@shared/agentProvider';
@@ -178,6 +179,10 @@ interface State {
* mic button reactively (set by App on config load and by Settings on save). */
freeflowEnabled: boolean;
setFreeflowEnabled: (on: boolean) => void;
+ /** Mirror of the active office theme (set by App on config load + by Settings
+ * on switch). OfficeFloor depends on this and rebuilds the scene on change. */
+ officeTheme: ThemeId;
+ setOfficeTheme: (theme: ThemeId) => void;
/** Park a message for an agent. Returns nothing; the flush loop delivers it.
* `meta.instruction`, when set, is what gets typed into the PTY instead of
* `text` (UI/card surfaces still show `text`). */
@@ -471,6 +476,8 @@ export const useStore = create<State>((set) => ({
set((s) => ({ drafts: { ...s.drafts, [agentId]: text } })),
freeflowEnabled: false,
setFreeflowEnabled: (on) => set({ freeflowEnabled: on }),
+ officeTheme: 'office',
+ setOfficeTheme: (theme) => set({ officeTheme: theme }),
enqueueMessage: (agentId, text, meta) =>
set((s) => {
const trimmed = text.trim();