Skip to content

An open-source, faster Devin alternative

TypeScript

dashboard+skill: first-run onboarding + opencomputer skill rewrite (#191)

Mohamed Habib19619b0b00b1
diff --git a/.claude/skills/openqemu/SKILL.md b/.claude/skills/openqemu/SKILL.md
deleted file mode 100644
index ff600306..00000000
--- a/.claude/skills/openqemu/SKILL.md
+++ /dev/null
@@ -1,178 +0,0 @@
----
-name: openqemu
-description: Create and interact with OpenSandbox QEMU sandboxes — create, exec, read/write files, list, destroy, hibernate/wake, checkpoint/fork, scale resources
-disable-model-invocation: false
-user-invocable: true
-allowed-tools: Bash, Read, Write
----
-
-# OpenSandbox Skill
-
-You have access to OpenSandbox, a cloud sandbox environment running QEMU VMs. Use it to run code, test commands, and manipulate files in isolated Linux environments.
-
-## Configuration
-
-```
-API_URL=${OPENSANDBOX_API_URL:-http://localhost:8080}
-API_KEY=${OPENSANDBOX_API_KEY}
-```
-
-Set `OPENSANDBOX_API_URL` and `OPENSANDBOX_API_KEY` environment variables before using.
-All requests require `-H 'X-API-Key: $API_KEY'` and `-H 'Content-Type: application/json'`.
-
-## Available Operations
-
-### Create a sandbox
-```bash
-curl -s -X POST $API_URL/api/sandboxes \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"timeout":3600}'
-```
-Returns JSON with `sandboxID`, `status`, `token`.
-
-### Run a command (fire-and-forget, returns stdout/stderr)
-```bash
-curl -s -X POST $API_URL/api/sandboxes/{SANDBOX_ID}/exec/run \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"cmd":"python3","args":["-c","print(1+1)"],"timeout":30}'
-```
-Returns JSON with `exitCode`, `stdout`, `stderr`. This is the simplest way to run commands.
-
-### Create an exec session (long-lived, for streaming)
-```bash
-curl -s -X POST $API_URL/api/sandboxes/{SANDBOX_ID}/exec \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"cmd":"bash","args":["-c","echo hello"]}'
-```
-
-### Read a file
-```bash
-curl -s $API_URL/api/sandboxes/{SANDBOX_ID}/files?path=/etc/os-release \
- -H "X-API-Key: $API_KEY"
-```
-
-### Write a file
-```bash
-curl -s -X PUT "$API_URL/api/sandboxes/{SANDBOX_ID}/files?path=/tmp/test.py" \
- -H "X-API-Key: $API_KEY" \
- -H 'Content-Type: application/octet-stream' \
- --data-binary 'print("hello world")'
-```
-
-### List directory
-```bash
-curl -s "$API_URL/api/sandboxes/{SANDBOX_ID}/files/list?path=/workspace" \
- -H "X-API-Key: $API_KEY"
-```
-
-### List sandboxes
-```bash
-curl -s $API_URL/api/sandboxes \
- -H "X-API-Key: $API_KEY"
-```
-
-### Destroy a sandbox
-```bash
-curl -s -X DELETE $API_URL/api/sandboxes/{SANDBOX_ID} \
- -H "X-API-Key: $API_KEY"
-```
-
-### Hibernate / Wake
-```bash
-# Hibernate (saves state to S3, stops billing)
-curl -s -X POST $API_URL/api/sandboxes/{SANDBOX_ID}/hibernate \
- -H "X-API-Key: $API_KEY"
-
-# Wake (golden restore ~520ms, workspace + rootfs preserved)
-curl -s -X POST $API_URL/api/sandboxes/{SANDBOX_ID}/wake \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"timeout":300}'
-```
-
-### Checkpoint / Fork
-```bash
-# Create checkpoint (savevm snapshot inside qcow2)
-curl -s -X POST $API_URL/api/sandboxes/{SANDBOX_ID}/checkpoints \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"name":"my-checkpoint"}'
-# Returns JSON with `id`, `status` (processing → ready)
-
-# Fork a new sandbox from a checkpoint
-curl -s -X POST $API_URL/api/sandboxes/from-checkpoint/{CHECKPOINT_ID} \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"timeout":3600}'
-# Returns JSON with `sandboxID` (status: creating → running)
-```
-
-### Resource Scaling
-
-Scale sandbox resources at runtime. Memory hotplug adds real RAM to the VM (not just cgroup limits).
-Pricing model: 1 vCPU per 1GB RAM (linear scaling). Setting memoryMB auto-calculates CPU.
-
-#### External API (from your client/SDK)
-```bash
-# Scale up to 2GB RAM + 2 vCPUs
-curl -s -X PUT $API_URL/api/sandboxes/{SANDBOX_ID}/limits \
- -H 'Content-Type: application/json' \
- -H "X-API-Key: $API_KEY" \
- -d '{"memoryMB": 2048}'
-```
-
-#### Internal API (from inside the sandbox — 169.254.169.254)
-```bash
-# From inside the sandbox:
-curl -s http://169.254.169.254/v1/status
-# → {"sandboxId":"sb-xxx","uptime":42.5}
-
-curl -s http://169.254.169.254/v1/limits
-# → {"cpuPercent":100,"memUsage":52428800,"memLimit":907051008,"pids":3}
-
-curl -s -X POST http://169.254.169.254/v1/scale -d '{"memoryMB": 4096}'
-# → {"ok":true,"memoryMB":4096,"cpuPercent":400}
-# Auto-calculates: 4GB RAM → 400% CPU (4 vCPUs)
-
-curl -s http://169.254.169.254/v1/metadata
-# → {"region":"use2","template":"default"}
-```
-
-#### Default cgroup limits
-- `pids.max = 128` (prevents fork bombs)
-- `memory.max = 90% of VM RAM`
-- `cpu.max = 80% of vCPUs` (reserves 20% for agent)
-- Fork bomb protection: cgroup kill on exec timeout
-
-## Architecture
-
-- **Agent communication**: virtio-serial (survives QEMU migration, enables sub-second wake)
-- **Storage**: rootfs qcow2 (COW overlay on base image) + workspace qcow2 (separate /workspace drive)
-- **Persistence**: rootfs installs (apt/pip) AND /workspace files survive hibernate/wake. Only /tmp (tmpfs) is lost.
-- **Resource isolation**: cgroup v2 inside guest — agent (PID 1) in root cgroup, user processes in /sandbox cgroup
-- **Fork bomb protection**: pids.max + cpu.max + cgroup kill on exec timeout
-
-## Workflow
-
-When the user asks you to use a sandbox, or asks $ARGUMENTS:
-
-1. **Create a sandbox** if one isn't already active in this conversation. Save the `sandboxID`. Always use `"timeout":3600` (1 hour idle timeout).
-2. **Use `exec/run`** for commands that produce output — it returns stdout/stderr directly.
-3. **Use `files` API** for reading/writing files in the sandbox.
-4. **Clean up** — destroy the sandbox when done, or let it time out (1 hour of inactivity).
-
-## Tips
-
-- Sandbox VMs run Ubuntu with python3, git, curl, jq, and standard Linux tools.
-- Default timeout is 300s (5 min). Pass `"timeout":3600` for longer sessions.
-- The `exec/run` endpoint is synchronous — it waits for the command to finish and returns the result. Use this for most operations.
-- For exec/run, the JSON field for the command binary is `cmd` (not `command`), and arguments go in `args`.
-- Environment variables can be passed as `"envs":{"KEY":"VALUE"}`.
-- Working directory can be set with `"cwd":"/path"`.
-- **Background processes**: Use `setsid cmd </dev/null >/dev/null 2>&1 &` in one exec, then interact in a separate exec.
-- **Persistence**: `/workspace/` and rootfs changes (apt install, pip install) survive hibernate/wake. `/tmp/` does not (tmpfs).
-- **Checkpoints**: Use `POST /checkpoints` to snapshot, then `POST /from-checkpoint/{id}` to fork. Wait for fork status to become "running" before executing commands.
-- **Pricing model**: 1 vCPU per 1GB RAM (linear scaling, 256MB–16GB). Per-second billing. Hibernated VMs are free.
diff --git a/internal/auth/workos.go b/internal/auth/workos.go
index a8b8ba26..dea3876d 100644
--- a/internal/auth/workos.go
+++ b/internal/auth/workos.go
@@ -218,15 +218,6 @@ func (w *WorkOSMiddleware) ProvisionOrgAndUser(ctx context.Context, email, name,
log.Printf("workos: provisioned new org: %s (%s)", org.Name, org.ID)
}
- // Generate a default API key for the new org
- apiKey, err := GenerateAPIKey()
- if err == nil {
- hash := db.HashAPIKey(apiKey)
- prefix := apiKey[:8]
- _, _ = w.store.CreateAPIKey(ctx, org.ID, nil, hash, prefix, "Default", []string{"sandbox:*"})
- log.Printf("workos: created default API key for org %s: %s...", org.Slug, prefix)
- }
-
// Determine which org the user should be active in
activeOrgID := org.ID
diff --git a/skills/opencomputer/SKILL.md b/skills/opencomputer/SKILL.md
index 94fdf410..57665b82 100644
--- a/skills/opencomputer/SKILL.md
+++ b/skills/opencomputer/SKILL.md
@@ -1,38 +1,54 @@
---
name: opencomputer
description: Manage OpenComputer cloud sandboxes. Use when the user wants to create, run commands in, checkpoint, or manage sandbox environments. Auto-invokes when sandboxes, remote environments, or the oc CLI are mentioned.
-allowed-tools: Bash(oc *), Bash(which oc), Read, Grep, Glob
+allowed-tools: Bash(oc *), Bash(which oc), Bash(curl *), Bash(open *), Bash(xdg-open *), Bash(chmod *), Read, Grep, Glob
---
You have access to the `oc` CLI for managing OpenComputer cloud sandboxes. Use it to create sandboxes, execute commands, manage checkpoints, and more.
-## Prerequisites
+## First-time setup (run this BEFORE any other `oc` command)
-The `oc` CLI must be installed and configured. Check with:
-```
+Before running any sandbox command, make sure the user is set up. Do these checks in order, only fixing what's broken:
+
+### 1. Is the `oc` CLI installed?
+
+```bash
which oc
```
-If not installed, download the latest binary from GitHub Releases:
+If it returns a path → installed, skip to step 2.
+
+If it returns nothing / non-zero exit → install it with the official one-liner:
+
```bash
-# macOS (Apple Silicon)
-curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-darwin-arm64 -o /usr/local/bin/oc && chmod +x /usr/local/bin/oc
+curl -fsSL https://raw.githubusercontent.com/diggerhq/opencomputer/main/scripts/install.sh | bash
+```
-# macOS (Intel)
-curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-darwin-amd64 -o /usr/local/bin/oc && chmod +x /usr/local/bin/oc
+This installs `oc` to `~/.local/bin/oc`. If `~/.local/bin` is not on the user's PATH, tell them to add `export PATH="$HOME/.local/bin:$PATH"` to their shell rc file, and use the full path `~/.local/bin/oc` for the rest of this session.
-# Linux (x86_64)
-curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-linux-amd64 -o /usr/local/bin/oc && chmod +x /usr/local/bin/oc
+### 2. Is the user logged in (API key configured)?
-# Linux (ARM64)
-curl -fsSL https://github.com/diggerhq/opencomputer/releases/latest/download/oc-linux-arm64 -o /usr/local/bin/oc && chmod +x /usr/local/bin/oc
+```bash
+oc config show
```
-Configuration requires an API key. Set it via:
-```
-oc config set api-key <key>
-```
-Or pass `--api-key` on every command. The API URL defaults to `https://app.opencomputer.dev`.
+If `API Key` is shown (even masked) → logged in, you're done.
+
+If no API key is set, OR a sandbox command fails with an auth error (`401`, "unauthorized", "missing API key"):
+
+1. Open the OpenComputer dashboard in the user's browser so they can create a key:
+ - macOS: `open https://app.opencomputer.dev`
+ - Linux: `xdg-open https://app.opencomputer.dev`
+2. Tell the user (in chat) to:
+ - Sign in / sign up at the page that just opened
+ - Create an API key
+ - Run this command in their terminal once they have the key:
+ ```bash
+ oc config set api-key YOUR_API_KEY
+ ```
+3. Wait for the user to confirm they've set the key before proceeding.
+
+Do **not** prompt them for the key in the chat — they should paste it into their own terminal so it never leaves their machine.
## CLI Reference
@@ -40,8 +56,9 @@ Or pass `--api-key` on every command. The API URL defaults to `https://app.openc
```bash
# Create a sandbox (returns sandbox ID)
-oc sandbox create --template base --timeout 300 --cpu 1 --memory 512
+oc sandbox create --timeout 300 --cpu 1 --memory 512
oc sandbox create --env KEY=VALUE --env KEY2=VALUE2
+oc sandbox create --secret-store my-secrets --metadata project=demo
oc create # shortcut
# List running sandboxes
@@ -66,15 +83,25 @@ oc sandbox set-timeout <sandbox-id> <seconds>
### Execute Commands
+`oc exec` streams stdout/stderr live by default and exits with the remote process's exit code. Use `--wait` for buffered/synchronous execution (needed for `--json`), or `--detach` to fire-and-forget.
+
```bash
-# Run a command in a sandbox
+# Stream live (default)
oc exec <sandbox-id> -- echo hello
oc exec <sandbox-id> --cwd /app -- npm install
oc exec <sandbox-id> --timeout 120 -- make build
oc exec <sandbox-id> --env NODE_ENV=production -- node server.js
-# JSON output includes exitCode, stdout, stderr
-oc exec <sandbox-id> --json -- whoami
+# Buffered + JSON envelope (exitCode, stdout, stderr) — required for scripting
+oc exec <sandbox-id> --wait --json -- whoami
+
+# Fire-and-forget; prints the session id so you can re-attach later
+oc exec <sandbox-id> --detach -- long-running-job
+
+# Manage exec sessions
+oc exec list <sandbox-id>
+oc exec attach <sandbox-id> <session-id>
+oc exec kill <sandbox-id> <session-id>
```
### Checkpoints
@@ -152,7 +179,8 @@ All commands support:
### Create and use a sandbox
```bash
ID=$(oc create --json | jq -r '.sandboxID')
-oc exec $ID -- apt update && apt install -y nodejs
+oc exec $ID --wait -- apt update
+oc exec $ID --wait -- apt install -y nodejs
oc exec $ID -- node -e "console.log('hello')"
oc sandbox kill $ID
```
@@ -161,8 +189,9 @@ oc sandbox kill $ID
```bash
# Create base environment
ID=$(oc create --json | jq -r '.sandboxID')
-oc exec $ID -- apt update && apt install -y python3 pip
-oc exec $ID -- pip install flask
+oc exec $ID --wait -- apt update
+oc exec $ID --wait -- apt install -y python3 pip
+oc exec $ID --wait -- pip install flask
# Checkpoint it
CP=$(oc checkpoint create $ID --name "python-flask" --json | jq -r '.id')
diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx
index 53d70be2..798c1889 100644
--- a/web/src/pages/Dashboard.tsx
+++ b/web/src/pages/Dashboard.tsx
@@ -1,6 +1,9 @@
-import { useQuery } from '@tanstack/react-query'
-import { useNavigate } from 'react-router-dom'
-import { getSessions, type Session } from '../api/client'
+import { useState, useEffect, useRef } from 'react'
+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+import { useNavigate, Link } from 'react-router-dom'
+import { getSessions, getAPIKeys, createAPIKey, type Session } from '../api/client'
+
+const SKILL_INSTALL_CMD = 'npx skills add diggerhq/opencomputer'
export default function Dashboard() {
const { data: runningSessions, isLoading: loadingRunning } = useQuery({
@@ -18,13 +21,23 @@ export default function Dashboard() {
const today = new Date().toISOString().slice(0, 10)
const sessionsToday = all.filter(s => new Date(s.startedAt).toISOString().slice(0, 10) === today).length
+ const isFirstRun = !loadingAll && all.length === 0
+
return (
<div>
<div style={{ marginBottom: 32 }}>
- <h1 className="page-title">Dashboard</h1>
- <p className="page-subtitle">Overview of your sandbox infrastructure</p>
+ <h1 className="page-title">{isFirstRun ? 'Welcome to OpenComputer' : 'Dashboard'}</h1>
+ <p className="page-subtitle">
+ {isFirstRun
+ ? 'Get your first sandbox running in two steps'
+ : 'Overview of your sandbox infrastructure'}
+ </p>
</div>
+ {isFirstRun ? (
+ <GettingStarted />
+ ) : (
+ <>
{/* ── Stat Cards ── */}
<div style={{
display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 14, marginBottom: 24,
@@ -122,6 +135,220 @@ export default function Dashboard() {
</div>
)}
</div>
+ </>
+ )}
+ </div>
+ )
+}
+
+/* ── Getting Started (first-run onboarding) ───────────────── */
+function GettingStarted() {
+ const queryClient = useQueryClient()
+ const { data: keys, isLoading: loadingKeys } = useQuery({ queryKey: ['api-keys'], queryFn: getAPIKeys })
+ const [copied, setCopied] = useState<string | null>(null)
+ const [createdKey, setCreatedKey] = useState<string | null>(null)
+ const autoCreateRef = useRef(false)
+
+ const createMutation = useMutation({
+ mutationFn: () => createAPIKey('Default'),
+ onSuccess: (data) => {
+ setCreatedKey(data.key)
+ queryClient.invalidateQueries({ queryKey: ['api-keys'] })
+ },
+ })
+
+ const hasKeys = (keys?.length ?? 0) > 0
+
+ // On first signup (no keys exist), auto-create a Default key so the user
+ // sees their key immediately without having to click anything.
+ useEffect(() => {
+ if (loadingKeys || autoCreateRef.current) return
+ if (!hasKeys && !createdKey && !createMutation.isPending) {
+ autoCreateRef.current = true
+ createMutation.mutate()
+ }
+ }, [loadingKeys, hasKeys, createdKey, createMutation])
+
+ const copy = (text: string, id: string) => {
+ navigator.clipboard.writeText(text)
+ setCopied(id)
+ setTimeout(() => setCopied(c => (c === id ? null : c)), 1500)
+ }
+
+ return (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
+ <StepCard
+ index={1}
+ title="Install the OpenComputer skill"
+ description="Adds a skill to Claude Code (or any agent that supports the Agent Skills standard) so it can drive sandboxes for you."
+ >
+ <CommandRow command={SKILL_INSTALL_CMD} copied={copied === 'install'} onCopy={() => copy(SKILL_INSTALL_CMD, 'install')} />
+ </StepCard>
+
+ <StepCard
+ index={2}
+ title="Your API key"
+ description="The skill uses this key to authenticate with OpenComputer. We've created a Default key for you — copy it now, you won't be able to see it again."
+ >
+ {(loadingKeys || createMutation.isPending) && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, color: 'var(--text-tertiary)', fontSize: 13 }}>
+ <div className="loading-spinner" style={{ width: 14, height: 14 }} />
+ Preparing your API key…
+ </div>
+ )}
+
+ {createdKey && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ <SecretRow
+ secret={createdKey}
+ copied={copied === 'key'}
+ onCopy={() => copy(createdKey, 'key')}
+ />
+ <div style={{ fontSize: 12, color: 'var(--text-tertiary)', marginTop: 6 }}>
+ Then run this in your terminal to configure the CLI:
+ </div>
+ <SecretRow
+ secret={createdKey}
+ wrap={(s) => `oc config set api-key ${s}`}
+ copied={copied === 'cmd'}
+ onCopy={() => copy(`oc config set api-key ${createdKey}`, 'cmd')}
+ />
+ </div>
+ )}
+
+ {!createdKey && !createMutation.isPending && hasKeys && (
+ <div style={{ fontSize: 13, color: 'var(--text-secondary)' }}>
+ You already have {keys!.length} API key{keys!.length === 1 ? '' : 's'} from a previous session.
+ For security, existing key values can&apos;t be re-displayed.{' '}
+ <Link to="/api-keys" style={{ color: 'var(--accent-indigo)' }}>Manage keys</Link> to rotate.
+ </div>
+ )}
+
+ {createMutation.isError && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginTop: 8 }}>
+ <span style={{ fontSize: 12, color: 'var(--accent-rose, #fb7185)' }}>
+ Failed to create your API key.
+ </span>
+ <button
+ className="btn-ghost"
+ style={{ fontSize: 12 }}
+ onClick={() => createMutation.mutate()}
+ >
+ Retry
+ </button>
+ </div>
+ )}
+ </StepCard>
+ </div>
+ )
+}
+
+function StepCard({ index, title, description, children }: {
+ index: number
+ title: string
+ description: string
+ children: React.ReactNode
+}) {
+ return (
+ <div className="glass-card animate-in" style={{ padding: '22px 24px' }}>
+ <div style={{ display: 'flex', alignItems: 'flex-start', gap: 14 }}>
+ <div style={{
+ width: 28, height: 28, borderRadius: '50%',
+ background: 'rgba(99,102,241,0.12)',
+ border: '1px solid var(--border-accent)',
+ color: 'var(--accent-indigo)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: 13, fontWeight: 600, flexShrink: 0, fontFamily: 'var(--font-mono)',
+ }}>
+ {index}
+ </div>
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: 12 }}>
+ <div>
+ <div style={{ fontSize: 15, fontWeight: 600, color: 'var(--text-primary)', marginBottom: 4 }}>
+ {title}
+ </div>
+ <div style={{ fontSize: 13, color: 'var(--text-tertiary)', lineHeight: 1.5 }}>
+ {description}
+ </div>
+ </div>
+ {children}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+function CommandRow({ command, copied, onCopy }: {
+ command: string
+ copied: boolean
+ onCopy: () => void
+}) {
+ return (
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: 8,
+ background: 'var(--bg-deep)',
+ border: '1px solid var(--border-subtle)',
+ borderRadius: 'var(--radius-sm)',
+ padding: '10px 12px',
+ }}>
+ <code style={{
+ flex: 1, fontFamily: 'var(--font-mono)', fontSize: 13,
+ color: 'var(--text-accent)', wordBreak: 'break-all',
+ }}>
+ {command}
+ </code>
+ <button
+ onClick={onCopy}
+ className="btn-ghost"
+ style={{ fontSize: 11, padding: '4px 10px', flexShrink: 0 }}
+ >
+ {copied ? 'Copied' : 'Copy'}
+ </button>
+ </div>
+ )
+}
+
+function SecretRow({ secret, wrap, copied, onCopy }: {
+ secret: string
+ wrap?: (s: string) => string
+ copied: boolean
+ onCopy: () => void
+}) {
+ const [revealed, setRevealed] = useState(false)
+ const masked = '•'.repeat(Math.min(secret.length, 32))
+ const display = revealed ? secret : masked
+ const text = wrap ? wrap(display) : display
+
+ return (
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: 8,
+ background: 'var(--bg-deep)',
+ border: '1px solid var(--border-subtle)',
+ borderRadius: 'var(--radius-sm)',
+ padding: '10px 12px',
+ }}>
+ <code style={{
+ flex: 1, fontFamily: 'var(--font-mono)', fontSize: 13,
+ color: 'var(--text-accent)', wordBreak: 'break-all',
+ letterSpacing: revealed ? 'normal' : '0.05em',
+ }}>
+ {text}
+ </code>
+ <button
+ onClick={() => setRevealed(r => !r)}
+ className="btn-ghost"
+ style={{ fontSize: 11, padding: '4px 10px', flexShrink: 0 }}
+ aria-label={revealed ? 'Hide secret' : 'Reveal secret'}
+ >
+ {revealed ? 'Hide' : 'Reveal'}
+ </button>
+ <button
+ onClick={onCopy}
+ className="btn-ghost"
+ style={{ fontSize: 11, padding: '4px 10px', flexShrink: 0 }}
+ >
+ {copied ? 'Copied' : 'Copy'}
+ </button>
</div>
)
}