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(settings): redesign modal as wide two-pane layout to fix off-screen overflow

Chaitanya Girifa26b0934b51
diff --git a/src/renderer/src/components/SettingsModal.tsx b/src/renderer/src/components/SettingsModal.tsx
index 874a0151..8d5533bc 100644
--- a/src/renderer/src/components/SettingsModal.tsx
+++ b/src/renderer/src/components/SettingsModal.tsx
@@ -43,29 +43,29 @@ const slackLabelStyle: CSSProperties = {
textTransform: 'uppercase'
};
-/** The exact connect walkthrough shown behind the ⓘ icon. Steps 6 & 7 spell out
+/** The exact connect walkthrough shown behind the i icon. Steps 6 & 7 spell out
* the both-lists requirement: subscribe to message.channels / message.groups in
* BOTH "Subscribe to bot events" AND "Subscribe to events on behalf of users". */
const SLACK_CONNECT_STEPS = `Connect Munder Difflin to Slack
-1. api.slack.com/apps → Create New App → From scratch. Name it
+1. api.slack.com/apps -> Create New App -> From scratch. Name it
"Munder Difflin" and pick your workspace.
-2. Basic Information → Signing Secret → copy it into the
+2. Basic Information -> Signing Secret -> copy it into the
"Signing secret" field here.
-3. OAuth & Permissions → Bot Token Scopes: add
+3. OAuth & Permissions -> Bot Token Scopes: add
chat:write (office replies in-thread)
channels:history (read public-channel messages)
groups:history (read private-channel messages)
Install to workspace, then copy the Bot User OAuth Token
- (xoxb-…) into the "Bot token" field here.
+ (xoxb-...) into the "Bot token" field here.
4. Press Start (below) to launch the webhook and get your
Request URL.
-5. Event Subscriptions → Enable Events → Request URL: paste the
- Request URL from here and wait for Slack's green ✓ (Verified).
-6. Event Subscriptions → "Subscribe to bot events": add
+5. Event Subscriptions -> Enable Events -> Request URL: paste the
+ Request URL from here and wait for Slack's green check (Verified).
+6. Event Subscriptions -> "Subscribe to bot events": add
message.channels
message.groups
-7. Event Subscriptions → "Subscribe to events on behalf of users"
+7. Event Subscriptions -> "Subscribe to events on behalf of users"
(add the matching User Token Scope channels:history / groups:history
first if Slack asks): add
message.channels
@@ -73,7 +73,7 @@ const SLACK_CONNECT_STEPS = `Connect Munder Difflin to Slack
8. Save Changes, reinstall if Slack prompts, then invite the bot
to your channel: /invite @MunderDifflin`;
-/** The request/response contract shown behind the webhook ⓘ. `<endpoint>` is the
+/** The request/response contract shown behind the webhook i icon. `<endpoint>` is the
* public URL printed once the server starts; the secret/token go in headers so
* they stay out of URLs and access logs. */
const WEBHOOK_API_DOC = `Generic webhook API
@@ -81,11 +81,11 @@ const WEBHOOK_API_DOC = `Generic webhook API
Trigger work (POST <endpoint>):
header x-md-webhook-secret: <your secret>
body {"message": "do X for me", "title": "optional short title"}
- → 200 {"ok": true, "token": "<capability token>", "taskId": "<card id>"}
+ -> 200 {"ok": true, "token": "<capability token>", "taskId": "<card id>"}
Check status (GET <endpoint>):
header x-md-webhook-token: <token> (or ?token=<token>)
- → 200 {"ok": true, "status": "todo|doing|blocked|done",
+ -> 200 {"ok": true, "status": "todo|doing|blocked|done",
"title": "...", "result": "<summary or null>"}
The secret authorizes new work; the returned token is a read-only handle to
@@ -104,15 +104,21 @@ function clearLocalState(): void {
} catch { /* noop */ }
}
+type Section = 'General' | 'Integrations' | 'Danger Zone';
+const NAV_SECTIONS: Section[] = ['General', 'Integrations', 'Danger Zone'];
+
export function SettingsModal({ config, onClose }: SettingsModalProps) {
const [confirming, setConfirming] = useState(false);
const [busy, setBusy] = useState(false);
+ const [activeSection, setActiveSection] = useState<Section>('General');
+
// Change-home flow: null until the user picks a new folder, then the sub-modal
- // confirms move-vs-fresh. Pre-selects 'move' (recommended — keeps the data).
+ // confirms move-vs-fresh. Pre-selects 'move' (recommended - keeps the data).
const [changeHome, setChangeHome] = useState<string | null>(null);
const [changeMode, setChangeMode] = useState<'move' | 'fresh'>('move');
const [changeBusy, setChangeBusy] = useState(false);
const [changeErr, setChangeErr] = useState('');
+
// `notifications` is an optional field on the main-process config; the renderer
// mirror type may not declare it yet, so read it defensively.
const [notifications, setNotifications] = useState<boolean>(
@@ -126,7 +132,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
catch { setNotifications(!next); /* revert on failure */ }
};
- // ─── circuit-breaker config (Lane A #6 canonical fields, widened view) ───────
+ // --- circuit-breaker config (Lane A #6 canonical fields, widened view) ---
// Drives Jim's real breaker: floor-wide TOKEN budget (costCapTokens) + output-
// token velocity ceiling (circuitBreaker.tokenVelocityPerMin). The token cap
// replaced the old dollar cap as the user-facing budget.
@@ -139,7 +145,6 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
const [velocityCeiling, setVelocityCeiling] = useState(breakerCfg.circuitBreaker?.tokenVelocityPerMin != null ? String(breakerCfg.circuitBreaker.tokenVelocityPerMin) : '');
const [budgetNote, setBudgetNote] = useState('');
const saveBudget = async () => {
- // Empty input clears the cap (undefined = off).
const tokens = agentBudget.trim() === '' ? undefined : Number(agentBudget);
const vel = velocityCeiling.trim() === '' ? undefined : Number(velocityCeiling);
await window.cth.updateConfig({
@@ -152,7 +157,6 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
setBudgetNote('saved');
setTimeout(() => setBudgetNote(''), 1500);
};
- // Live token-count formatting for the budget input hint (1K / 1M / 1B).
const fmtBudgetTokens = (raw: string): string => {
const n = Number(raw);
if (!raw.trim() || !Number.isFinite(n) || n <= 0) return '';
@@ -162,7 +166,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
return String(n);
};
- // ─── Slack integration ─────────────────────────────────────────────────────
+ // --- Slack integration ---
const slackCfg = config as SlackConfig;
const [slackEnabled, setSlackEnabled] = useState(slackCfg.slackEnabled ?? false);
const [slackSecret, setSlackSecret] = useState(slackCfg.slackSigningSecret ?? '');
@@ -175,10 +179,10 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
// Whether the webhook server is currently live. Hydrated from main on open so
// reopening Settings shows the true connection state + the persisted Request URL.
const [running, setRunning] = useState(false);
- // Whether the connect-steps help panel is expanded (the ⓘ icon by the header).
+ // Whether the connect-steps help panel is expanded.
const [showSlackHelp, setShowSlackHelp] = useState(false);
- // ─── Generic webhook + status API ───────────────────────────────────────────
+ // --- Generic webhook + status API ---
const [webhookEnabled, setWebhookEnabled] = useState(slackCfg.webhookEnabled ?? false);
const [webhookSecret, setWebhookSecret] = useState(slackCfg.webhookSecret ?? '');
const [webhookPort, setWebhookPort] = useState(String(slackCfg.webhookPort ?? 3849));
@@ -209,18 +213,18 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
setWebhookSecret(cc.webhookSecret ?? '');
setWebhookPort(String(cc.webhookPort ?? 3849));
}).catch(() => { /* keep prop-seeded values */ });
- // Hydrate live connection state + the persisted Request URL (req B/C/D): the
+ // Hydrate live connection state + the persisted Request URL: the
// tunnel URL lives in main, so reopening Settings while connected re-shows it.
window.cth.slackStatus().then((s) => {
if (!alive) return;
setRunning(s.running);
if (s.url) setTunnelUrl(s.url);
- }).catch(() => { /* status unavailable — assume not running */ });
+ }).catch(() => { /* status unavailable - assume not running */ });
window.cth.webhookStatus().then((s) => {
if (!alive) return;
setWebhookRunning(s.running);
if (s.url) setWebhookUrl(s.url);
- }).catch(() => { /* status unavailable — assume not running */ });
+ }).catch(() => { /* status unavailable - assume not running */ });
return () => { alive = false; };
}, []);
@@ -252,7 +256,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
const res = await window.cth.slackStart();
if (res.ok) {
setRunning(true);
- // Keep the last URL if this start returned none (tunnel hiccup) — don't blank it.
+ // Keep the last URL if this start returned none (tunnel hiccup) - don't blank it.
if (res.url) setTunnelUrl(res.url);
setSlackNote(res.url ? 'listening' : (res.error ?? 'started, but tunnel unavailable'));
} else {
@@ -265,14 +269,13 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
const stopSlack = async () => {
setSlackBusy(true); setSlackNote('');
- // Keep the last Request URL visible (greyed) after Stop — Slack reuses it until
- // the next Start hands out a fresh one, so blanking it would be misleading.
+ // Keep the last Request URL visible (greyed) after Stop.
try { await window.cth.slackStop(); setRunning(false); setSlackNote('stopped'); }
catch (e) { setSlackNote(e instanceof Error ? e.message : String(e)); }
finally { setSlackBusy(false); }
};
- // ─── Generic webhook handlers ───────────────────────────────────────────────
+ // --- Generic webhook handlers ---
const webhookPatch = (enabled: boolean) => ({
secret: webhookSecret,
port: Number(webhookPort) || 3849,
@@ -294,7 +297,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
setWebhookBusy(true); setWebhookNote('');
try {
const res = await window.cth.webhookGenerateSecret();
- if (res.ok && res.secret) { setWebhookSecret(res.secret); setShowWebhookSecret(true); setWebhookNote('new secret — copy it now'); }
+ if (res.ok && res.secret) { setWebhookSecret(res.secret); setShowWebhookSecret(true); setWebhookNote('new secret - copy it now'); }
else setWebhookNote('could not generate secret');
} catch (e) {
setWebhookNote(e instanceof Error ? e.message : String(e));
@@ -328,23 +331,22 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
const copyWebhookUrl = () => { void window.cth.copyToClipboard(webhookUrl); };
const copyWebhookSecret = () => { void window.cth.copyToClipboard(webhookSecret); };
-
const copyTunnel = () => { void window.cth.copyToClipboard(tunnelUrl); };
const reset = async () => {
setBusy(true);
clearLocalState();
// Wipes hive + palace, resets config, and relaunches into onboarding.
- // The app exits, so this never resolves — no need to clear `busy`.
+ // The app exits, so this never resolves - no need to clear `busy`.
await window.cth.resetAll();
};
- // ─── Change home folder ─────────────────────────────────────────────────────
+ // --- Change home folder ---
/** Pick a new folder, then open the move-vs-fresh sub-modal. */
const pickNewHome = async () => {
setChangeErr('');
const res = await window.cth.chooseFolder();
- if (!res.ok) return; // cancelled — no-op
+ if (!res.ok) return; // cancelled - no-op
setChangeMode('move'); // recommended default
setChangeHome(res.path);
};
@@ -355,7 +357,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
if (!changeHome) return;
setChangeBusy(true); setChangeErr('');
// Moving copies the hive (incl. its .git) + palace, so the new home owns the
- // same renderer-side roster — keep localStorage. A 'fresh' home starts empty,
+ // same renderer-side roster - keep localStorage. A 'fresh' home starts empty,
// so clear the renderer cache to match.
if (changeMode === 'fresh') clearLocalState();
try {
@@ -374,6 +376,12 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
['Command', config.defaultCommand]
];
+ const modalTitle = changeHome
+ ? 'CHANGE HOME FOLDER'
+ : confirming
+ ? 'RESET EVERYTHING?'
+ : 'SETTINGS';
+
return (
<div
onClick={busy ? undefined : onClose}
@@ -384,14 +392,23 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
zIndex: 300
}}
>
- <div onClick={(e) => e.stopPropagation()} style={{ width: 520, maxWidth: '92vw' }}>
+ <div
+ onClick={(e) => e.stopPropagation()}
+ style={{
+ width: 840, maxWidth: '92vw', maxHeight: '88vh',
+ display: 'flex', flexDirection: 'column',
+ filter: 'drop-shadow(4px 4px 0 rgba(26, 19, 32, 0.25))'
+ }}
+ >
<PixelPanel
variant="dialog"
- title={changeHome ? 'CHANGE HOME FOLDER' : confirming ? 'RESET EVERYTHING?' : 'SETTINGS'}
+ title={modalTitle}
noPadding
+ style={{ display: 'flex', flexDirection: 'column', overflow: 'hidden', maxHeight: '88vh' }}
>
+ {/* === Change home sub-modal === */}
{changeHome ? (
- <div style={{ padding: 20, display: 'flex', flexDirection: 'column', gap: 16 }}>
+ <div style={{ padding: 20, display: 'flex', flexDirection: 'column', gap: 16, overflowY: 'auto' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
<span style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}>New home folder</span>
<code style={{
@@ -400,10 +417,10 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
}}>{changeHome}</code>
</div>
- {/* Move vs. fresh — two selectable option rows; move is preselected. */}
+ {/* Move vs. fresh - two selectable option rows; move is preselected. */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
{([
- ['move', 'Move existing data (recommended)', 'Copy this harness’s hive (every agent, memory, task) and the semantic-memory palace into the new folder. The old folder is left untouched as a backup you can delete later.'],
+ ['move', 'Move existing data (recommended)', "Copy this harness's hive (every agent, memory, task) and the semantic-memory palace into the new folder. The old folder is left untouched as a backup you can delete later."],
['fresh', 'Start fresh', 'Point the harness at the new (empty) folder. Your existing data stays in the old folder, simply unused.']
] as const).map(([value, title, desc]) => {
const selected = changeMode === value;
@@ -441,421 +458,539 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
cancel
</PixelButton>
<PixelButton variant="primary" size="md" onClick={applyChangeHome} disabled={changeBusy}>
- {changeBusy ? 'applying…' : (changeMode === 'move' ? 'move & restart' : 'switch & restart')}
+ {changeBusy ? 'applying...' : (changeMode === 'move' ? 'move & restart' : 'switch & restart')}
</PixelButton>
</div>
</div>
- ) : !confirming ? (
- <div style={{ padding: 20, display: 'flex', flexDirection: 'column', gap: 16 }}>
- {/* Home folder — a dedicated row so it can carry a Change… action. */}
- <div style={{ display: 'flex', gap: 12, fontSize: 14, lineHeight: '20px', alignItems: 'center' }}>
- <span style={{ width: 140, flexShrink: 0, color: 'var(--cth-ink-500)' }}>Home folder</span>
- <span style={{
- flex: 1, color: 'var(--cth-ink-900)', wordBreak: 'break-all',
- fontFamily: 'var(--cth-font-mono, monospace)'
- }}>{config.harnessHome ?? '—'}</span>
- <PixelButton variant="secondary" size="sm" onClick={pickNewHome}>change…</PixelButton>
- </div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
- {rows.map(([label, value]) => (
- <div key={label} style={{ display: 'flex', gap: 12, fontSize: 14, lineHeight: '20px' }}>
- <span style={{ width: 140, flexShrink: 0, color: 'var(--cth-ink-500)' }}>{label}</span>
- <span style={{
- color: 'var(--cth-ink-900)', wordBreak: 'break-all',
- fontFamily: label === 'Home folder' || label === 'Command' ? 'var(--cth-font-mono, monospace)' : undefined
- }}>{value}</span>
- </div>
- ))}
- </div>
- {/* Desktop notifications toggle */}
- <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)' }}>
- Desktop notifications
- </span>
- <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
- Native toasts when an agent finishes or needs your input.
- </span>
+ /* === Reset confirmation screen === */
+ ) : confirming ? (
+ <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,
+ background: 'var(--cth-coral-light)',
+ boxShadow: 'inset 0 0 0 2px var(--cth-ink-900)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ flexShrink: 0
+ }}>
+ <Icon name="bell" />
+ </div>
+ <div style={{ flex: 1, fontSize: 15, lineHeight: '22px', color: 'var(--cth-ink-700)' }}>
+ This permanently erases all of Michael's memories and the entire hive,
+ and cannot be undone. Any running sessions will be terminated and the app
+ will relaunch into onboarding. Are you sure?
</div>
- <PixelButton
- variant={notifications ? 'primary' : 'secondary'}
- size="sm"
- onClick={toggleNotifications}
- >
- {notifications ? 'on' : 'off'}
- </PixelButton>
</div>
- <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />
-
- {/* #7C.4 — cost / runaway circuit breaker */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
- <span style={{ fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
- Circuit breaker
- </span>
- <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
- Guard against runaway spend. Blank = off. The breaker steers, then constrains, then stops an agent that crosses these.
- </span>
- </div>
- <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4, ...slackLabelStyle }}>
- floor token budget
- <input
- type="number" min="0" step="100000" value={agentBudget}
- onChange={(e) => setAgentBudget(e.target.value)}
- placeholder="e.g. 1000000"
- style={{ ...slackInputStyle, width: 160 }}
- />
- <span style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>
- {fmtBudgetTokens(agentBudget) ? `= ${fmtBudgetTokens(agentBudget)} tokens` : 'total tokens across the floor'}
- </span>
- </label>
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4, ...slackLabelStyle }}>
- token velocity (tok/min)
- <input
- type="number" min="0" step="1000" value={velocityCeiling}
- onChange={(e) => setVelocityCeiling(e.target.value)}
- placeholder="e.g. 200000"
- style={{ ...slackInputStyle, width: 160 }}
- />
- </label>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
- <PixelButton variant="secondary" size="sm" onClick={saveBudget}>save</PixelButton>
- {budgetNote && <span style={{ fontSize: 12, color: 'var(--cth-mint)' }}>{budgetNote}</span>}
- </div>
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
+ <PixelButton variant="secondary" size="md" onClick={() => setConfirming(false)} disabled={busy}>
+ cancel
+ </PixelButton>
+ <PixelButton variant="destructive" size="md" onClick={reset} disabled={busy}>
+ {busy ? 'resetting...' : 'erase everything & restart'}
+ </PixelButton>
</div>
+ </div>
- <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />
+ /* === Main two-pane settings layout === */
+ ) : (
+ <>
+ <div style={{ display: 'flex', flex: 1, overflow: 'hidden', minHeight: 0 }}>
- {/* Slack integration */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
- <span style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
- Slack integration
- {/* ⓘ — toggles the step-by-step connect guide (req A). */}
+ {/* Left nav */}
+ <div style={{
+ width: 160, flexShrink: 0,
+ display: 'flex', flexDirection: 'column',
+ borderRight: '2px solid var(--cth-ink-300)',
+ paddingTop: 8, paddingBottom: 8,
+ background: 'var(--cth-cream-200)'
+ }}>
+ {NAV_SECTIONS.map((section) => {
+ const active = activeSection === section;
+ const isDanger = section === 'Danger Zone';
+ return (
<button
+ key={section}
type="button"
- aria-label="Show Slack connect steps"
- aria-expanded={showSlackHelp}
- onClick={() => setShowSlackHelp((v) => !v)}
+ onClick={() => setActiveSection(section)}
style={{
- display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
- width: 16, height: 16, padding: 0, cursor: 'pointer',
- border: 'none', borderRadius: '50%',
- background: showSlackHelp ? 'var(--cth-ink-700)' : 'var(--cth-ink-300)',
- color: showSlackHelp ? 'var(--cth-paper-100)' : 'var(--cth-ink-900)',
- fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '16px'
+ display: 'block', width: '100%', textAlign: 'left',
+ padding: '10px 16px 8px',
+ border: 'none',
+ borderLeft: active ? '3px solid var(--cth-lemon)' : '3px solid transparent',
+ background: active ? 'var(--cth-ink-900)' : 'transparent',
+ color: active
+ ? 'var(--cth-cream-50)'
+ : isDanger
+ ? '#6E1423'
+ : 'var(--cth-ink-700)',
+ fontFamily: 'var(--cth-font-display)',
+ fontSize: 8,
+ lineHeight: '12px',
+ cursor: 'pointer',
+ letterSpacing: 0
}}
- >ⓘ</button>
- </span>
- <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
- Pipe a Slack channel's messages straight into Michael's queue.
- </span>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
- {/* Connection status (req B/C): clear, always-visible. */}
- <span style={{
- fontSize: 12, lineHeight: '16px',
- color: running ? 'var(--cth-mint-700, #1f7a4d)' : 'var(--cth-ink-500)'
- }}>
- {running ? '● Connected' : '○ Not connected'}
- </span>
- <PixelButton
- variant={slackEnabled ? 'primary' : 'secondary'}
- size="sm"
- onClick={() => setSlackEnabled((v) => !v)}
- >
- {slackEnabled ? 'on' : 'off'}
- </PixelButton>
- </div>
+ >
+ {section}
+ </button>
+ );
+ })}
</div>
- {/* Step-by-step connect guide (req A). Includes the both-lists
- bot-event subscription requirement (steps 6 & 7). */}
- {showSlackHelp && (
- <pre style={{
- margin: 0, padding: 10, whiteSpace: 'pre-wrap',
- background: 'var(--cth-paper-100)',
- boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
- fontFamily: 'var(--cth-font-mono)', fontSize: 11, lineHeight: '16px',
- color: 'var(--cth-ink-700)'
- }}>{SLACK_CONNECT_STEPS}</pre>
- )}
-
- {slackEnabled && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span style={slackLabelStyle}>Signing secret</span>
- <input
- type="password"
- value={slackSecret}
- onChange={(e) => setSlackSecret(e.target.value)}
- placeholder="Slack app → Basic Information → Signing Secret"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- </label>
-
- {/* Bot token (req: in-thread replies). Stays in main; never
- leaves the main process or appears in any agent prompt. */}
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span style={slackLabelStyle}>Bot token</span>
- <input
- type="password"
- value={slackBotToken}
- onChange={(e) => setSlackBotToken(e.target.value)}
- placeholder="Slack app → OAuth & Permissions → Bot User OAuth Token (xoxb-…)"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- </label>
-
- <div style={{ display: 'flex', gap: 10 }}>
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
- <span style={slackLabelStyle}>Channel id (optional)</span>
- <input
- value={slackChannel}
- onChange={(e) => setSlackChannel(e.target.value)}
- placeholder="C0123… or blank for any"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- </label>
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4, width: 92 }}>
- <span style={slackLabelStyle}>Port</span>
- <input
- type="number"
- value={slackPort}
- onChange={(e) => setSlackPort(e.target.value)}
- placeholder="3847"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- </label>
- </div>
-
- <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
- {/* Start disabled once connected (req B); Stop only when running. */}
- <PixelButton variant="primary" size="sm" onClick={startSlack} disabled={slackBusy || !slackSecret.trim() || running}>
- {slackBusy ? '…' : running ? 'connected' : 'start'}
- </PixelButton>
- <PixelButton variant="secondary" size="sm" onClick={stopSlack} disabled={slackBusy || !running}>
- stop
- </PixelButton>
- <PixelButton variant="ghost" size="sm" onClick={saveSlack} disabled={slackBusy}>
- save
- </PixelButton>
- {slackNote && (
- <span style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}>{slackNote}</span>
- )}
- </div>
+ {/* Right scrollable content pane */}
+ <div style={{
+ flex: 1, overflowY: 'auto',
+ padding: '20px 24px',
+ display: 'flex', flexDirection: 'column', gap: 20
+ }}>
- {/* Keep the Request URL visible while connected even after a
- modal reopen (req D); when stopped, show the last URL greyed
- since Slack reuses it until the next Start. */}
- {(running || tunnelUrl) && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 4, opacity: running ? 1 : 0.55 }}>
- <span style={slackLabelStyle}>
- {running
- ? 'Request URL — paste into Slack Event Subscriptions'
- : 'last Request URL — Slack reuses it until you Stop'}
- </span>
- <div style={{ display: 'flex', gap: 6 }}>
- <input
- readOnly
- value={tunnelUrl}
- onFocus={(e) => e.currentTarget.select()}
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)', fontSize: 12 }}
- />
- <PixelButton variant="secondary" size="sm" onClick={copyTunnel} disabled={!tunnelUrl}>copy</PixelButton>
+ {/* GENERAL */}
+ {activeSection === 'General' && (
+ <>
+ {/* Home folder */}
+ <div>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 10
+ }}>
+ Home folder
+ </div>
+ <div style={{ display: 'flex', gap: 12, fontSize: 14, lineHeight: '20px', alignItems: 'center' }}>
+ <span style={{
+ flex: 1, color: 'var(--cth-ink-900)', wordBreak: 'break-all',
+ fontFamily: 'var(--cth-font-mono, monospace)'
+ }}>{config.harnessHome ?? '—'}</span>
+ <PixelButton variant="secondary" size="sm" onClick={pickNewHome}>change...</PixelButton>
</div>
</div>
- )}
-
- <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
- In your Slack app: enable Event Subscriptions → add the{' '}
- <code>message.channels</code> / <code>message.groups</code> bot event → set the
- Request URL above → reinstall to your workspace. The tunnel URL changes on every
- restart, so re-paste it after pressing Start again.
- </span>
- </div>
- )}
- </div>
- <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />
+ <div style={{ height: 1, background: 'var(--cth-ink-300)' }} />
- {/* Generic webhook + status API */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
- <span style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
- Webhook API
- <button
- type="button"
- aria-label="Show webhook API format"
- aria-expanded={showWebhookHelp}
- onClick={() => setShowWebhookHelp((v) => !v)}
- style={{
- display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
- width: 16, height: 16, padding: 0, cursor: 'pointer',
- border: 'none', borderRadius: '50%',
- background: showWebhookHelp ? 'var(--cth-ink-700)' : 'var(--cth-ink-300)',
- color: showWebhookHelp ? 'var(--cth-paper-100)' : 'var(--cth-ink-900)',
- fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '16px'
- }}
- >ⓘ</button>
- </span>
- <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
- A secret-gated HTTP endpoint: POST to start work and get a token, GET the token for status.
- </span>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
- <span style={{
- fontSize: 12, lineHeight: '16px',
- color: webhookRunning ? 'var(--cth-mint-700, #1f7a4d)' : 'var(--cth-ink-500)'
- }}>
- {webhookRunning ? '● Connected' : '○ Not connected'}
- </span>
- <PixelButton
- variant={webhookEnabled ? 'primary' : 'secondary'}
- size="sm"
- onClick={() => setWebhookEnabled((v) => !v)}
- >
- {webhookEnabled ? 'on' : 'off'}
- </PixelButton>
- </div>
- </div>
+ {/* Config rows */}
+ <div>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 10
+ }}>
+ Configuration
+ </div>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
+ {rows.map(([label, value]) => (
+ <div key={label} style={{ display: 'flex', gap: 12, fontSize: 14, lineHeight: '20px' }}>
+ <span style={{ width: 160, flexShrink: 0, color: 'var(--cth-ink-500)' }}>{label}</span>
+ <span style={{
+ color: 'var(--cth-ink-900)', wordBreak: 'break-all',
+ fontFamily: label === 'Command' ? 'var(--cth-font-mono, monospace)' : undefined
+ }}>{value}</span>
+ </div>
+ ))}
+ </div>
+ </div>
- {showWebhookHelp && (
- <pre style={{
- margin: 0, padding: 10, whiteSpace: 'pre-wrap',
- background: 'var(--cth-paper-100)',
- boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
- fontFamily: 'var(--cth-font-mono)', fontSize: 11, lineHeight: '16px',
- color: 'var(--cth-ink-700)'
- }}>{WEBHOOK_API_DOC}</pre>
- )}
-
- {webhookEnabled && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
- {/* Public surface (tunnel-forwarded). Loud, not buried. */}
- <span style={{ fontSize: 12, lineHeight: '16px', color: '#6E1423' }}>
- ⚠ This opens a PUBLIC endpoint anyone with the secret can post to. It stays off until you press Start.
- </span>
-
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
- <span style={slackLabelStyle}>Secret key</span>
- <div style={{ display: 'flex', gap: 6 }}>
- <input
- type={showWebhookSecret ? 'text' : 'password'}
- value={webhookSecret}
- onChange={(e) => setWebhookSecret(e.target.value)}
- placeholder="press Generate, or paste your own"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- <PixelButton variant="secondary" size="sm" onClick={() => setShowWebhookSecret((v) => !v)} disabled={!webhookSecret}>
- {showWebhookSecret ? 'hide' : 'show'}
- </PixelButton>
- <PixelButton variant="secondary" size="sm" onClick={copyWebhookSecret} disabled={!webhookSecret}>copy</PixelButton>
- <PixelButton variant="ghost" size="sm" onClick={generateWebhookSecret} disabled={webhookBusy}>generate</PixelButton>
+ <div style={{ height: 1, background: 'var(--cth-ink-300)' }} />
+
+ {/* Desktop notifications toggle */}
+ <div>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 10
+ }}>
+ Notifications
+ </div>
+ <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)' }}>
+ Desktop notifications
+ </span>
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ Native toasts when an agent finishes or needs your input.
+ </span>
+ </div>
+ <PixelButton
+ variant={notifications ? 'primary' : 'secondary'}
+ size="sm"
+ onClick={toggleNotifications}
+ >
+ {notifications ? 'on' : 'off'}
+ </PixelButton>
+ </div>
</div>
- </label>
-
- <label style={{ display: 'flex', flexDirection: 'column', gap: 4, width: 92 }}>
- <span style={slackLabelStyle}>Port</span>
- <input
- type="number"
- value={webhookPort}
- onChange={(e) => setWebhookPort(e.target.value)}
- placeholder="3849"
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
- />
- </label>
-
- <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
- <PixelButton variant="primary" size="sm" onClick={startWebhook} disabled={webhookBusy || !webhookSecret.trim() || webhookRunning}>
- {webhookBusy ? '…' : webhookRunning ? 'connected' : 'start'}
- </PixelButton>
- <PixelButton variant="secondary" size="sm" onClick={stopWebhook} disabled={webhookBusy || !webhookRunning}>
- stop
- </PixelButton>
- <PixelButton variant="ghost" size="sm" onClick={saveWebhook} disabled={webhookBusy}>
- save
- </PixelButton>
- {webhookNote && (
- <span style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}>{webhookNote}</span>
- )}
- </div>
- {(webhookRunning || webhookUrl) && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 4, opacity: webhookRunning ? 1 : 0.55 }}>
- <span style={slackLabelStyle}>
- {webhookRunning ? 'Endpoint URL — POST work / GET status here' : 'last endpoint URL — rotates on next Start'}
- </span>
- <div style={{ display: 'flex', gap: 6 }}>
- <input
- readOnly
- value={webhookUrl}
- onFocus={(e) => e.currentTarget.select()}
- style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)', fontSize: 12 }}
- />
- <PixelButton variant="secondary" size="sm" onClick={copyWebhookUrl} disabled={!webhookUrl}>copy</PixelButton>
+ <div style={{ height: 1, background: 'var(--cth-ink-300)' }} />
+
+ {/* Circuit breaker */}
+ <div>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 10
+ }}>
+ Circuit breaker
+ </div>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ Guard against runaway spend. Blank = off. The breaker steers, then constrains, then stops an agent that crosses these.
+ </span>
+ <div style={{ display: 'flex', gap: 20, flexWrap: 'wrap' }}>
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, ...slackLabelStyle }}>
+ floor token budget
+ <input
+ type="number" min="0" step="100000" value={agentBudget}
+ onChange={(e) => setAgentBudget(e.target.value)}
+ placeholder="e.g. 1000000"
+ style={{ ...slackInputStyle, width: 180 }}
+ />
+ <span style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>
+ {fmtBudgetTokens(agentBudget) ? `= ${fmtBudgetTokens(agentBudget)} tokens` : 'total tokens across the floor'}
+ </span>
+ </label>
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, ...slackLabelStyle }}>
+ token velocity (tok/min)
+ <input
+ type="number" min="0" step="1000" value={velocityCeiling}
+ onChange={(e) => setVelocityCeiling(e.target.value)}
+ placeholder="e.g. 200000"
+ style={{ ...slackInputStyle, width: 180 }}
+ />
+ </label>
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
+ <PixelButton variant="secondary" size="sm" onClick={saveBudget}>save</PixelButton>
+ {budgetNote && <span style={{ fontSize: 12, color: 'var(--cth-mint)' }}>{budgetNote}</span>}
+ </div>
</div>
</div>
- )}
- </div>
- )}
- </div>
+ </>
+ )}
+
+ {/* INTEGRATIONS */}
+ {activeSection === 'Integrations' && (
+ <>
+ {/* Slack integration */}
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 2
+ }}>
+ Slack
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
+ <span style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
+ Slack integration
+ {/* i - toggles the step-by-step connect guide. */}
+ <button
+ type="button"
+ aria-label="Show Slack connect steps"
+ aria-expanded={showSlackHelp}
+ onClick={() => setShowSlackHelp((v) => !v)}
+ style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 16, height: 16, padding: 0, cursor: 'pointer',
+ border: 'none', borderRadius: '50%',
+ background: showSlackHelp ? 'var(--cth-ink-700)' : 'var(--cth-ink-300)',
+ color: showSlackHelp ? 'var(--cth-paper-100)' : 'var(--cth-ink-900)',
+ fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '16px'
+ }}
+ >i</button>
+ </span>
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ Pipe a Slack channel's messages straight into Michael's queue.
+ </span>
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
+ {/* Connection status: clear, always-visible. */}
+ <span style={{
+ fontSize: 12, lineHeight: '16px',
+ color: running ? 'var(--cth-mint-700, #1f7a4d)' : 'var(--cth-ink-500)'
+ }}>
+ {running ? '● Connected' : '○ Not connected'}
+ </span>
+ <PixelButton
+ variant={slackEnabled ? 'primary' : 'secondary'}
+ size="sm"
+ onClick={() => setSlackEnabled((v) => !v)}
+ >
+ {slackEnabled ? 'on' : 'off'}
+ </PixelButton>
+ </div>
+ </div>
- <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />
+ {/* Step-by-step connect guide. Includes the both-lists
+ bot-event subscription requirement (steps 6 & 7). */}
+ {showSlackHelp && (
+ <pre style={{
+ margin: 0, padding: 10, whiteSpace: 'pre-wrap',
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
+ fontFamily: 'var(--cth-font-mono)', fontSize: 11, lineHeight: '16px',
+ color: 'var(--cth-ink-700)'
+ }}>{SLACK_CONNECT_STEPS}</pre>
+ )}
+
+ {slackEnabled && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ {/* Signing secret + bot token side-by-side in the wider layout */}
+ <div style={{ display: 'flex', gap: 16 }}>
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
+ <span style={slackLabelStyle}>Signing secret</span>
+ <input
+ type="password"
+ value={slackSecret}
+ onChange={(e) => setSlackSecret(e.target.value)}
+ placeholder="Slack app -> Basic Information -> Signing Secret"
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ </label>
+ {/* Bot token: stays in main; never leaves the main process. */}
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
+ <span style={slackLabelStyle}>Bot token</span>
+ <input
+ type="password"
+ value={slackBotToken}
+ onChange={(e) => setSlackBotToken(e.target.value)}
+ placeholder="xoxb-..."
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ </label>
+ </div>
+
+ <div style={{ display: 'flex', gap: 16 }}>
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
+ <span style={slackLabelStyle}>Channel id (optional)</span>
+ <input
+ value={slackChannel}
+ onChange={(e) => setSlackChannel(e.target.value)}
+ placeholder="C0123... or blank for any"
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ </label>
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, width: 100 }}>
+ <span style={slackLabelStyle}>Port</span>
+ <input
+ type="number"
+ value={slackPort}
+ onChange={(e) => setSlackPort(e.target.value)}
+ placeholder="3847"
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ </label>
+ </div>
+
+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
+ {/* Start disabled once connected; Stop only when running. */}
+ <PixelButton variant="primary" size="sm" onClick={startSlack} disabled={slackBusy || !slackSecret.trim() || running}>
+ {slackBusy ? '...' : running ? 'connected' : 'start'}
+ </PixelButton>
+ <PixelButton variant="secondary" size="sm" onClick={stopSlack} disabled={slackBusy || !running}>
+ stop
+ </PixelButton>
+ <PixelButton variant="ghost" size="sm" onClick={saveSlack} disabled={slackBusy}>
+ save
+ </PixelButton>
+ {slackNote && (
+ <span style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}>{slackNote}</span>
+ )}
+ </div>
+
+ {/* Keep the Request URL visible while connected even after a
+ modal reopen; when stopped, show the last URL greyed
+ since Slack reuses it until the next Start. */}
+ {(running || tunnelUrl) && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, opacity: running ? 1 : 0.55 }}>
+ <span style={slackLabelStyle}>
+ {running
+ ? 'Request URL - paste into Slack Event Subscriptions'
+ : 'last Request URL - Slack reuses it until you Stop'}
+ </span>
+ <div style={{ display: 'flex', gap: 6 }}>
+ <input
+ readOnly
+ value={tunnelUrl}
+ onFocus={(e) => e.currentTarget.select()}
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)', fontSize: 12 }}
+ />
+ <PixelButton variant="secondary" size="sm" onClick={copyTunnel} disabled={!tunnelUrl}>copy</PixelButton>
+ </div>
+ </div>
+ )}
+
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ In your Slack app: enable Event Subscriptions, add the{' '}
+ <code>message.channels</code> / <code>message.groups</code> bot event, set the
+ Request URL above, and reinstall to your workspace. The tunnel URL changes on every
+ restart, so re-paste it after pressing Start again.
+ </span>
+ </div>
+ )}
+ </div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
- <div style={{
- fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '14px',
- color: '#6E1423'
- }}>DANGER ZONE</div>
- <p style={{ margin: 0, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-700)' }}>
- Reset wipes Michael's memories, the entire hive (every agent, message,
- task, and the board), the semantic-memory palace, and all settings —
- then takes you back to onboarding.
- </p>
- </div>
+ <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />
+
+ {/* Generic webhook + status API */}
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 2
+ }}>
+ Webhook API
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
+ <span style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>
+ Webhook API
+ <button
+ type="button"
+ aria-label="Show webhook API format"
+ aria-expanded={showWebhookHelp}
+ onClick={() => setShowWebhookHelp((v) => !v)}
+ style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 16, height: 16, padding: 0, cursor: 'pointer',
+ border: 'none', borderRadius: '50%',
+ background: showWebhookHelp ? 'var(--cth-ink-700)' : 'var(--cth-ink-300)',
+ color: showWebhookHelp ? 'var(--cth-paper-100)' : 'var(--cth-ink-900)',
+ fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '16px'
+ }}
+ >i</button>
+ </span>
+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>
+ A secret-gated HTTP endpoint: POST to start work and get a token, GET the token for status.
+ </span>
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
+ <span style={{
+ fontSize: 12, lineHeight: '16px',
+ color: webhookRunning ? 'var(--cth-mint-700, #1f7a4d)' : 'var(--cth-ink-500)'
+ }}>
+ {webhookRunning ? '● Connected' : '○ Not connected'}
+ </span>
+ <PixelButton
+ variant={webhookEnabled ? 'primary' : 'secondary'}
+ size="sm"
+ onClick={() => setWebhookEnabled((v) => !v)}
+ >
+ {webhookEnabled ? 'on' : 'off'}
+ </PixelButton>
+ </div>
+ </div>
+
+ {showWebhookHelp && (
+ <pre style={{
+ margin: 0, padding: 10, whiteSpace: 'pre-wrap',
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
+ fontFamily: 'var(--cth-font-mono)', fontSize: 11, lineHeight: '16px',
+ color: 'var(--cth-ink-700)'
+ }}>{WEBHOOK_API_DOC}</pre>
+ )}
+
+ {webhookEnabled && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ {/* Public surface warning. Loud, not buried. */}
+ <span style={{ fontSize: 12, lineHeight: '16px', color: '#6E1423' }}>
+ This opens a PUBLIC endpoint anyone with the secret can post to. It stays off until you press Start.
+ </span>
+
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
+ <span style={slackLabelStyle}>Secret key</span>
+ <div style={{ display: 'flex', gap: 6 }}>
+ <input
+ type={showWebhookSecret ? 'text' : 'password'}
+ value={webhookSecret}
+ onChange={(e) => setWebhookSecret(e.target.value)}
+ placeholder="press Generate, or paste your own"
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ <PixelButton variant="secondary" size="sm" onClick={() => setShowWebhookSecret((v) => !v)} disabled={!webhookSecret}>
+ {showWebhookSecret ? 'hide' : 'show'}
+ </PixelButton>
+ <PixelButton variant="secondary" size="sm" onClick={copyWebhookSecret} disabled={!webhookSecret}>copy</PixelButton>
+ <PixelButton variant="ghost" size="sm" onClick={generateWebhookSecret} disabled={webhookBusy}>generate</PixelButton>
+ </div>
+ </label>
+
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4, width: 100 }}>
+ <span style={slackLabelStyle}>Port</span>
+ <input
+ type="number"
+ value={webhookPort}
+ onChange={(e) => setWebhookPort(e.target.value)}
+ placeholder="3849"
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)' }}
+ />
+ </label>
+
+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
+ <PixelButton variant="primary" size="sm" onClick={startWebhook} disabled={webhookBusy || !webhookSecret.trim() || webhookRunning}>
+ {webhookBusy ? '...' : webhookRunning ? 'connected' : 'start'}
+ </PixelButton>
+ <PixelButton variant="secondary" size="sm" onClick={stopWebhook} disabled={webhookBusy || !webhookRunning}>
+ stop
+ </PixelButton>
+ <PixelButton variant="ghost" size="sm" onClick={saveWebhook} disabled={webhookBusy}>
+ save
+ </PixelButton>
+ {webhookNote && (
+ <span style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}>{webhookNote}</span>
+ )}
+ </div>
+
+ {(webhookRunning || webhookUrl) && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, opacity: webhookRunning ? 1 : 0.55 }}>
+ <span style={slackLabelStyle}>
+ {webhookRunning ? 'Endpoint URL - POST work / GET status here' : 'last endpoint URL - rotates on next Start'}
+ </span>
+ <div style={{ display: 'flex', gap: 6 }}>
+ <input
+ readOnly
+ value={webhookUrl}
+ onFocus={(e) => e.currentTarget.select()}
+ style={{ ...slackInputStyle, fontFamily: 'var(--cth-font-mono)', fontSize: 12 }}
+ />
+ <PixelButton variant="secondary" size="sm" onClick={copyWebhookUrl} disabled={!webhookUrl}>copy</PixelButton>
+ </div>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ </>
+ )}
+
+ {/* DANGER ZONE */}
+ {activeSection === 'Danger Zone' && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
+ <div style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 10, lineHeight: '14px',
+ color: '#6E1423'
+ }}>DANGER ZONE</div>
+ <p style={{ margin: 0, fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-700)' }}>
+ Reset wipes Michael's memories, the entire hive (every agent, message,
+ task, and the board), the semantic-memory palace, and all settings -
+ then takes you back to onboarding.
+ </p>
+ <div>
+ <PixelButton variant="destructive" size="md" onClick={() => setConfirming(true)}>
+ reset &amp; start over
+ </PixelButton>
+ </div>
+ </div>
+ )}
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
- <PixelButton variant="secondary" size="md" onClick={onClose}>close</PixelButton>
- <PixelButton variant="destructive" size="md" onClick={() => setConfirming(true)}>
- reset &amp; start over
- </PixelButton>
- </div>
- </div>
- ) : (
- <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,
- background: 'var(--cth-coral-light)',
- boxShadow: 'inset 0 0 0 2px var(--cth-ink-900)',
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- flexShrink: 0
- }}>
- <Icon name="bell" />
- </div>
- <div style={{ flex: 1, fontSize: 15, lineHeight: '22px', color: 'var(--cth-ink-700)' }}>
- This permanently erases all of Michael's memories and the entire hive,
- and cannot be undone. Any running sessions will be terminated and the app
- will relaunch into onboarding. Are you sure?
</div>
</div>
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
- <PixelButton variant="secondary" size="md" onClick={() => setConfirming(false)} disabled={busy}>
- cancel
- </PixelButton>
- <PixelButton variant="destructive" size="md" onClick={reset} disabled={busy}>
- {busy ? 'resetting…' : 'erase everything & restart'}
- </PixelButton>
+ {/* Footer */}
+ <div style={{
+ borderTop: '2px solid var(--cth-ink-300)',
+ padding: '10px 16px',
+ display: 'flex', justifyContent: 'flex-end',
+ background: 'var(--cth-cream-50)'
+ }}>
+ <PixelButton variant="secondary" size="md" onClick={onClose}>close</PixelButton>
</div>
- </div>
+ </>
)}
</PixelPanel>
</div>