moi-computer 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/moi.mjs +3 -1
- package/bunfig.toml +4 -0
- package/client/api/workspaces.ts +277 -6
- package/client/assets/mcp/agentation.png +0 -0
- package/client/assets/mcp/airtable.png +0 -0
- package/client/assets/mcp/apollo.png +0 -0
- package/client/assets/mcp/asana.png +0 -0
- package/client/assets/mcp/box.png +0 -0
- package/client/assets/mcp/chrome.svg +33 -0
- package/client/assets/mcp/clickup.png +0 -0
- package/client/assets/mcp/cloudflare.png +0 -0
- package/client/assets/mcp/context7.png +0 -0
- package/client/assets/mcp/datadog.png +0 -0
- package/client/assets/mcp/dropbox.png +0 -0
- package/client/assets/mcp/elevenlabs.png +0 -0
- package/client/assets/mcp/exa.png +0 -0
- package/client/assets/mcp/firecrawl.png +0 -0
- package/client/assets/mcp/gmail.png +0 -0
- package/client/assets/mcp/googlecalendar.png +0 -0
- package/client/assets/mcp/googledrive.png +0 -0
- package/client/assets/mcp/grafana.png +0 -0
- package/client/assets/mcp/huggingface.png +0 -0
- package/client/assets/mcp/intercom.png +0 -0
- package/client/assets/mcp/monday.png +0 -0
- package/client/assets/mcp/mongodb.png +0 -0
- package/client/assets/mcp/paper.png +0 -0
- package/client/assets/mcp/paypal.png +0 -0
- package/client/assets/mcp/perplexity.png +0 -0
- package/client/assets/mcp/postgresql.png +0 -0
- package/client/assets/mcp/posthog.png +0 -0
- package/client/assets/mcp/puppeteer.png +0 -0
- package/client/assets/mcp/railway.png +0 -0
- package/client/assets/mcp/redis.png +0 -0
- package/client/assets/mcp/salesforce.png +0 -0
- package/client/assets/mcp/shopify.png +0 -0
- package/client/assets/mcp/snowflake.png +0 -0
- package/client/assets/mcp/telegram.png +0 -0
- package/client/assets/mcp/twilio.png +0 -0
- package/client/assets/mcp/zapier.png +0 -0
- package/client/components/App.tsx +7 -1
- package/client/components/BottomPanel.tsx +2 -2
- package/client/components/ChatInput.tsx +195 -14
- package/client/components/ChatPanel.tsx +118 -49
- package/client/components/ChatPopup.tsx +2 -2
- package/client/components/CustomizePanel.tsx +8 -8
- package/client/components/HiddenPanel.tsx +1 -1
- package/client/components/HomePage.tsx +1 -1
- package/client/components/IconMcp.tsx +21 -0
- package/client/components/MarkdownContent.tsx +2 -2
- package/client/components/McpMenu.tsx +125 -0
- package/client/components/ModelPicker.tsx +147 -0
- package/client/components/Scratchpad.tsx +775 -0
- package/client/components/ShimmerText.tsx +20 -0
- package/client/components/ThreadSelector.tsx +2 -2
- package/client/components/TurnView.tsx +114 -534
- package/client/components/WidgetErrorBoundary.tsx +2 -2
- package/client/components/WidgetFrame.tsx +1 -1
- package/client/components/WidgetShell.tsx +2 -2
- package/client/components/Widgets.tsx +2 -2
- package/client/components/WorkspacePreview.tsx +3 -3
- package/client/components/WorkspacesPage.tsx +28 -20
- package/client/components/layout/SidebarLayout.tsx +24 -15
- package/client/components/playground/PixelPainter.tsx +2 -2
- package/client/components/playground/PlaygroundPage.tsx +1 -1
- package/client/components/playground/ToolCallsPage.tsx +81 -0
- package/client/components/routes/workspace/[id].tsx +534 -141
- package/client/components/routes/workspace/create.tsx +155 -0
- package/client/components/settings/IconPicker.tsx +590 -0
- package/client/components/settings/SettingsPages.tsx +307 -0
- package/client/components/settings/WorkspaceSettings.tsx +92 -0
- package/client/components/tool-group/CodeBlock.tsx +41 -0
- package/client/components/tool-group/Collapse.tsx +28 -0
- package/client/components/tool-group/ReadImagePreview.tsx +46 -0
- package/client/components/tool-group/SubagentCard.tsx +135 -0
- package/client/components/tool-group/TimelineRow.tsx +147 -0
- package/client/components/tool-group/ToolCallGroup.tsx +231 -0
- package/client/components/tool-group/ToolOutput.tsx +139 -0
- package/client/components/tool-group/detect.ts +93 -0
- package/client/components/tool-group/fixtures.ts +315 -0
- package/client/components/tool-group/format.ts +211 -0
- package/client/components/tool-group/index.ts +9 -0
- package/client/components/ui/button.tsx +4 -4
- package/client/components/ui/dialog.tsx +58 -0
- package/client/components/ui/dropdown-menu.tsx +9 -9
- package/client/components/ui/hover-card.tsx +44 -0
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/switch.tsx +23 -0
- package/client/components/ui/tooltip.tsx +54 -0
- package/client/externalize-react.ts +11 -5
- package/client/hooks/useApplet.ts +117 -0
- package/client/hooks/useChat.ts +162 -62
- package/client/hooks/useMeiEvents.ts +9 -2
- package/client/hooks/useStickToBottom.ts +86 -0
- package/client/hooks/useWorkspaceTheme.ts +8 -2
- package/client/index.css +49 -3
- package/client/index.html +22 -18
- package/client/index.tsx +29 -2
- package/client/lib/WorkspaceContext.tsx +5 -8
- package/client/lib/WorkspaceLayoutContext.tsx +30 -10
- package/client/lib/applet-cache.ts +54 -0
- package/client/lib/connection.ts +237 -0
- package/client/lib/flags.ts +10 -0
- package/client/lib/mcp-icons.ts +142 -10
- package/client/lib/preview-turn.ts +37 -0
- package/client/lib/render-icon.ts +173 -0
- package/client/lib/scratch-executor.ts +20 -0
- package/client/lib/uploads.ts +18 -0
- package/client/main.tsx +5 -0
- package/client/store/live.ts +282 -0
- package/client/structured-clone-shim.ts +14 -0
- package/client/theme.css +2 -2
- package/client/vendor/emojibase/en/data.json +1 -0
- package/client/vendor/emojibase/en/messages.json +1 -0
- package/client/vendor/react/development/_impl/react-dom-client.js +15871 -0
- package/client/vendor/react/development/_impl/react-dom.js +223 -0
- package/client/vendor/react/development/_impl/react-jsx-dev-runtime.js +256 -0
- package/client/vendor/react/development/_impl/react-jsx-runtime.js +260 -0
- package/client/vendor/react/development/_impl/react.js +863 -0
- package/client/vendor/react/development/react-dom-client.js +6 -0
- package/client/vendor/react/development/react-dom.js +17 -0
- package/client/vendor/react/development/react-jsx-dev-runtime.js +5 -0
- package/client/vendor/react/development/react-jsx-runtime.js +6 -0
- package/client/vendor/react/development/react.js +47 -0
- package/client/vendor/react/production/_impl/react-dom-client.js +10361 -0
- package/client/vendor/react/production/_impl/react-dom.js +184 -0
- package/client/vendor/react/production/_impl/react-jsx-dev-runtime.js +37 -0
- package/client/vendor/react/production/_impl/react-jsx-runtime.js +60 -0
- package/client/vendor/react/production/_impl/react.js +428 -0
- package/client/vendor/react/production/react-dom-client.js +6 -0
- package/client/vendor/react/production/react-dom.js +17 -0
- package/client/vendor/react/production/react-jsx-dev-runtime.js +5 -0
- package/client/vendor/react/production/react-jsx-runtime.js +6 -0
- package/client/vendor/react/production/react.js +47 -0
- package/dist/agentation-4s0nn45p.png +0 -0
- package/dist/airtable-hsa66v6q.png +0 -0
- package/dist/apollo-2ed5dy2d.png +0 -0
- package/dist/asana-tvgtwbx2.png +0 -0
- package/dist/atlassian-b3tq39hs.png +0 -0
- package/dist/box-w3n36t5g.png +0 -0
- package/dist/chrome-tspm94rw.svg +33 -0
- package/dist/chunk-kc6e9nd4.css +1 -0
- package/dist/chunk-yf3p7qg7.js +673 -0
- package/dist/claude-z2xnay0d.svg +3 -0
- package/dist/clickup-qqrqqvqb.png +0 -0
- package/dist/cloudflare-j9p931v6.png +0 -0
- package/dist/context7-8ht0xjfy.png +0 -0
- package/dist/datadog-70ne3yzt.png +0 -0
- package/dist/discord-vejhptwx.png +0 -0
- package/dist/dropbox-4m5s9mgr.png +0 -0
- package/dist/elevenlabs-2nzzej1t.png +0 -0
- package/dist/exa-qqj3vr0x.png +0 -0
- package/dist/favicon-nbmyjfjh.png +0 -0
- package/dist/figma-y9898rry.png +0 -0
- package/dist/firecrawl-w2t8nehx.png +0 -0
- package/dist/github-av5r5y3e.png +0 -0
- package/dist/gitlab-4pv5vm6b.png +0 -0
- package/dist/gmail-sg6a5v3x.png +0 -0
- package/dist/googlecalendar-nqhh2v7r.png +0 -0
- package/dist/googledrive-6s8xyab7.png +0 -0
- package/dist/grafana-1yfsnwr6.png +0 -0
- package/dist/granola-7j3b0nk2.png +0 -0
- package/dist/hermes-nous-pznd63x9.png +0 -0
- package/dist/hubspot-hghcmc2t.png +0 -0
- package/dist/huggingface-kxzaxj83.png +0 -0
- package/dist/index.html +47 -0
- package/dist/intercom-td763jt8.png +0 -0
- package/dist/linear-v9s3az2d.png +0 -0
- package/dist/monday-jdbs4wwf.png +0 -0
- package/dist/mongodb-emzxvhd5.png +0 -0
- package/dist/neon-zj4qar44.png +0 -0
- package/dist/notion-w034c0b8.png +0 -0
- package/dist/openclaw-a2pyfhpn.svg +22 -0
- package/dist/paper-zbt34fab.png +0 -0
- package/dist/paypal-kwwf7xsc.png +0 -0
- package/dist/perplexity-4y63rxvj.png +0 -0
- package/dist/postgresql-qsspbsr1.png +0 -0
- package/dist/posthog-sphppc4w.png +0 -0
- package/dist/puppeteer-2xjt1a9b.png +0 -0
- package/dist/railway-834de8d2.png +0 -0
- package/dist/redis-spm6w2m1.png +0 -0
- package/dist/salesforce-1mk56v4z.png +0 -0
- package/dist/sentry-hdwpmvek.png +0 -0
- package/dist/shopify-90dadaav.png +0 -0
- package/dist/slack-1c1wj62s.png +0 -0
- package/dist/snowflake-hfpykpgy.png +0 -0
- package/dist/stripe-zrfaqbj3.png +0 -0
- package/dist/supabase-4vg33zf2.png +0 -0
- package/dist/telegram-v6tjyrs7.png +0 -0
- package/dist/twilio-dpyjdwpj.png +0 -0
- package/dist/vercel-7d0ssw28.png +0 -0
- package/dist/zapier-p67qfch0.png +0 -0
- package/lib/attachment-note.ts +48 -0
- package/lib/claude-adapter.ts +219 -29
- package/lib/format.ts +32 -0
- package/lib/types.ts +314 -6
- package/package.json +21 -31
- package/server/CLAUDE.md +3 -0
- package/server/agent.ts +25 -118
- package/server/api.ts +593 -0
- package/server/applets.ts +396 -0
- package/server/build-applet.ts +580 -0
- package/server/cc-session.ts +611 -0
- package/server/cli-colors.ts +17 -0
- package/server/cli-ui.ts +52 -0
- package/server/cli.ts +970 -72
- package/server/control.ts +166 -19
- package/server/debug.ts +10 -0
- package/server/events.ts +24 -0
- package/server/functions-worker.ts +18 -2
- package/server/functions.ts +59 -12
- package/server/icon.ts +13 -0
- package/server/layout.ts +25 -3
- package/server/mcp.ts +125 -0
- package/server/moi-scaffold.ts +85 -0
- package/server/openclaw-session.ts +41 -10
- package/server/openclaw.ts +22 -0
- package/server/preview.ts +70 -0
- package/server/registry.ts +32 -2
- package/server/scratchpad-executor.ts +380 -0
- package/server/scratchpad-relay.ts +45 -0
- package/server/scratchpad.ts +171 -0
- package/server/skill-version.ts +146 -0
- package/server/skills-template.ts +6 -1
- package/server/state.ts +22 -36
- package/server/static.ts +23 -0
- package/server/status.ts +94 -0
- package/server/thread-config.ts +125 -0
- package/server/uploads.ts +0 -0
- package/server/vendor.ts +63 -0
- package/server/views.ts +0 -0
- package/server/web.ts +113 -223
- package/server/widgets.ts +52 -142
- package/server/workspace-config.ts +37 -0
- package/server/workspace-env.ts +407 -0
- package/server/workspace-init.ts +66 -0
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +109 -0
- package/workspace/.claude/skills/moi-workspace/SCRATCHPAD.md +57 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +252 -0
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +22 -0
- package/client/hooks/useWidget.ts +0 -72
- package/client/hooks/useWidgetList.ts +0 -30
- package/client/lib/ws.ts +0 -129
- package/client/store/chat.tsx +0 -162
- package/server/build-widget.ts +0 -343
- package/workspace/.claude/skills/widgets/DESIGN.md +0 -630
- package/workspace/.claude/skills/widgets/SKILL.md +0 -176
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { type ReactNode, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconChevronDown, IconLoader2, IconPlus, IconTrash } from '@tabler/icons-react'
|
|
4
|
+
|
|
5
|
+
import { useUpdateEnv, useSaveWorkspaceName, useWorkspaceEnv } from '@/client/api/workspaces'
|
|
6
|
+
import {
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuRadioGroup,
|
|
10
|
+
DropdownMenuRadioItem,
|
|
11
|
+
DropdownMenuTrigger
|
|
12
|
+
} from '@/client/components/ui/dropdown-menu'
|
|
13
|
+
import { Button } from '@/client/components/ui/button'
|
|
14
|
+
import { Input } from '@/client/components/ui/input'
|
|
15
|
+
import { Switch } from '@/client/components/ui/switch'
|
|
16
|
+
import { useWorkspaceLayoutCtx } from '@/client/lib/WorkspaceLayoutContext'
|
|
17
|
+
import { cn } from '@/client/lib/cn'
|
|
18
|
+
import type { EnvScope, WorkspaceEnvVar } from '@/lib/types'
|
|
19
|
+
|
|
20
|
+
import { IconPicker } from './IconPicker'
|
|
21
|
+
|
|
22
|
+
// ── Shared page primitives ──────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
type SettingsPageProps = {
|
|
25
|
+
title: string
|
|
26
|
+
description?: string
|
|
27
|
+
children: ReactNode
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function SettingsPage({ title, description, children }: SettingsPageProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex flex-col gap-6">
|
|
33
|
+
<header className="flex flex-col gap-1">
|
|
34
|
+
<h2 className="text-xl font-semibold tracking-tight">{title}</h2>
|
|
35
|
+
{description && <p className="text-sm text-muted-foreground">{description}</p>}
|
|
36
|
+
</header>
|
|
37
|
+
{children}
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type SettingsSectionProps = {
|
|
43
|
+
label?: string
|
|
44
|
+
children: ReactNode
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SettingsSection({ label, children }: SettingsSectionProps) {
|
|
48
|
+
return (
|
|
49
|
+
<section className="flex flex-col gap-2">
|
|
50
|
+
{label && <p className="px-0.5 text-xs font-medium text-muted-foreground">{label}</p>}
|
|
51
|
+
<div className="flex flex-col divide-y divide-dashed divide-border overflow-hidden rounded-lg border border-border bg-card">
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type SettingsRowProps = {
|
|
59
|
+
title: string
|
|
60
|
+
description?: string
|
|
61
|
+
control?: ReactNode
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function SettingsRow({ title, description, control }: SettingsRowProps) {
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex items-center gap-3 px-3.5 py-3">
|
|
67
|
+
<div className="flex min-w-0 flex-col">
|
|
68
|
+
<span className="text-sm font-medium">{title}</span>
|
|
69
|
+
{description && <span className="text-xs text-muted-foreground">{description}</span>}
|
|
70
|
+
</div>
|
|
71
|
+
{control && <div className="ml-auto flex shrink-0 items-center pl-3">{control}</div>}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ── General ─────────────────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
export function GeneralSettings() {
|
|
79
|
+
const { name, icon, workspaceId } = useWorkspaceLayoutCtx()
|
|
80
|
+
const saveName = useSaveWorkspaceName(workspaceId)
|
|
81
|
+
const [draft, setDraft] = useState(name ?? '')
|
|
82
|
+
|
|
83
|
+
// Persist on blur (or Enter): an empty value clears the override so the name
|
|
84
|
+
// falls back to the folder name.
|
|
85
|
+
const commit = () => {
|
|
86
|
+
const next = draft.trim()
|
|
87
|
+
if (next === (name ?? '')) return
|
|
88
|
+
saveName.mutate(next === '' ? null : next)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<SettingsPage title="General" description="Basic details for this workspace.">
|
|
93
|
+
<SettingsSection>
|
|
94
|
+
<SettingsRow
|
|
95
|
+
title="Name"
|
|
96
|
+
description="Shown in the sidebar and the workspace header."
|
|
97
|
+
control={
|
|
98
|
+
<Input
|
|
99
|
+
value={draft}
|
|
100
|
+
onChange={e => setDraft(e.target.value)}
|
|
101
|
+
onBlur={commit}
|
|
102
|
+
onKeyDown={e => {
|
|
103
|
+
if (e.key === 'Enter') e.currentTarget.blur()
|
|
104
|
+
}}
|
|
105
|
+
placeholder="Workspace name"
|
|
106
|
+
className="w-56"
|
|
107
|
+
/>
|
|
108
|
+
}
|
|
109
|
+
/>
|
|
110
|
+
<div className="flex flex-col gap-4 px-3.5 py-3.5">
|
|
111
|
+
<div className="flex flex-col">
|
|
112
|
+
<span className="text-sm font-medium">Icon</span>
|
|
113
|
+
<span className="text-xs text-muted-foreground">
|
|
114
|
+
Pick an emoji or a glyph on a generated background, or upload an image.
|
|
115
|
+
</span>
|
|
116
|
+
</div>
|
|
117
|
+
<IconPicker icon={icon} />
|
|
118
|
+
</div>
|
|
119
|
+
</SettingsSection>
|
|
120
|
+
</SettingsPage>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ── Environment ─────────────────────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
const SCOPE_LABEL: Record<EnvScope, string> = {
|
|
127
|
+
widgets: 'Widgets',
|
|
128
|
+
agent: 'Agent',
|
|
129
|
+
both: 'Both'
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Source badge copy: where the key actually comes from.
|
|
133
|
+
const SOURCE_LABEL: Record<WorkspaceEnvVar['source'], string> = {
|
|
134
|
+
dotenv: '.env',
|
|
135
|
+
custom: 'secret',
|
|
136
|
+
both: 'override'
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
140
|
+
|
|
141
|
+
type ScopeSelectProps = {
|
|
142
|
+
value: EnvScope
|
|
143
|
+
onChange: (scope: EnvScope) => void
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function ScopeSelect({ value, onChange }: ScopeSelectProps) {
|
|
147
|
+
return (
|
|
148
|
+
<DropdownMenu>
|
|
149
|
+
<DropdownMenuTrigger
|
|
150
|
+
render={
|
|
151
|
+
<Button variant="outline" size="sm" className="h-7 gap-1 px-2 font-normal">
|
|
152
|
+
{SCOPE_LABEL[value]}
|
|
153
|
+
<IconChevronDown stroke={1.75} className="text-muted-foreground" />
|
|
154
|
+
</Button>
|
|
155
|
+
}
|
|
156
|
+
/>
|
|
157
|
+
<DropdownMenuContent align="end" className="w-32">
|
|
158
|
+
<DropdownMenuRadioGroup value={value} onValueChange={v => onChange(v as EnvScope)}>
|
|
159
|
+
{(Object.keys(SCOPE_LABEL) as EnvScope[]).map(scope => (
|
|
160
|
+
<DropdownMenuRadioItem key={scope} value={scope}>
|
|
161
|
+
{SCOPE_LABEL[scope]}
|
|
162
|
+
</DropdownMenuRadioItem>
|
|
163
|
+
))}
|
|
164
|
+
</DropdownMenuRadioGroup>
|
|
165
|
+
</DropdownMenuContent>
|
|
166
|
+
</DropdownMenu>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function EnvironmentSettings() {
|
|
171
|
+
const { workspaceId } = useWorkspaceLayoutCtx()
|
|
172
|
+
const env = useWorkspaceEnv(workspaceId)
|
|
173
|
+
const update = useUpdateEnv(workspaceId)
|
|
174
|
+
|
|
175
|
+
const [draftKey, setDraftKey] = useState('')
|
|
176
|
+
const [draftValue, setDraftValue] = useState('')
|
|
177
|
+
const [draftScope, setDraftScope] = useState<EnvScope>('both')
|
|
178
|
+
|
|
179
|
+
const keyValid = ENV_KEY_RE.test(draftKey)
|
|
180
|
+
const canAdd = keyValid && draftValue.length > 0 && !update.isPending
|
|
181
|
+
|
|
182
|
+
const addVar = () => {
|
|
183
|
+
if (!canAdd) return
|
|
184
|
+
update.mutate(
|
|
185
|
+
{ set: { [draftKey]: draftValue }, scopes: { [draftKey]: draftScope } },
|
|
186
|
+
{
|
|
187
|
+
onSuccess: () => {
|
|
188
|
+
setDraftKey('')
|
|
189
|
+
setDraftValue('')
|
|
190
|
+
setDraftScope('both')
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const vars = env.data?.vars ?? []
|
|
197
|
+
const fileCount = env.data?.files.reduce((n, f) => n + f.count, 0) ?? 0
|
|
198
|
+
const dotenvFiles = env.data?.files.length ?? 0
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<SettingsPage
|
|
202
|
+
title="Environment"
|
|
203
|
+
description="Secrets injected into widgets and the agent at run time. Values are write-only — they're never shown again once saved."
|
|
204
|
+
>
|
|
205
|
+
<SettingsSection label="Variables">
|
|
206
|
+
{env.isLoading ? (
|
|
207
|
+
<div className="flex items-center justify-center px-3.5 py-6 text-muted-foreground">
|
|
208
|
+
<IconLoader2 className="size-4 animate-spin" stroke={1.75} />
|
|
209
|
+
</div>
|
|
210
|
+
) : vars.length === 0 ? (
|
|
211
|
+
<p className="px-3.5 py-4 text-sm text-muted-foreground">No variables yet.</p>
|
|
212
|
+
) : (
|
|
213
|
+
vars.map(v => {
|
|
214
|
+
const editable = v.source !== 'dotenv'
|
|
215
|
+
return (
|
|
216
|
+
<div key={v.key} className="flex items-center gap-3 px-3.5 py-2.5">
|
|
217
|
+
<code className="min-w-0 flex-1 truncate font-mono text-xs text-foreground">
|
|
218
|
+
{v.key}
|
|
219
|
+
</code>
|
|
220
|
+
<span className="text-xs tracking-widest text-muted-foreground/60 select-none">
|
|
221
|
+
••••••
|
|
222
|
+
</span>
|
|
223
|
+
<span
|
|
224
|
+
className={cn(
|
|
225
|
+
'rounded-sm px-1.5 py-0.5 text-[11px] font-medium',
|
|
226
|
+
v.source === 'dotenv'
|
|
227
|
+
? 'bg-muted text-muted-foreground'
|
|
228
|
+
: 'bg-primary/10 text-primary'
|
|
229
|
+
)}
|
|
230
|
+
>
|
|
231
|
+
{SOURCE_LABEL[v.source]}
|
|
232
|
+
</span>
|
|
233
|
+
{editable ? (
|
|
234
|
+
<ScopeSelect
|
|
235
|
+
value={v.scope ?? 'both'}
|
|
236
|
+
onChange={scope => update.mutate({ scopes: { [v.key]: scope } })}
|
|
237
|
+
/>
|
|
238
|
+
) : (
|
|
239
|
+
<span className="w-[60px] text-right text-[11px] text-muted-foreground/60">
|
|
240
|
+
from file
|
|
241
|
+
</span>
|
|
242
|
+
)}
|
|
243
|
+
<button
|
|
244
|
+
type="button"
|
|
245
|
+
onClick={() => update.mutate({ remove: [v.key] })}
|
|
246
|
+
disabled={!editable}
|
|
247
|
+
aria-label={`Delete ${v.key}`}
|
|
248
|
+
className="text-muted-foreground/50 transition-colors not-disabled:hover:text-foreground disabled:invisible [&_svg]:size-4"
|
|
249
|
+
>
|
|
250
|
+
<IconTrash stroke={1.5} />
|
|
251
|
+
</button>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
})
|
|
255
|
+
)}
|
|
256
|
+
|
|
257
|
+
{/* Add row */}
|
|
258
|
+
<div className="flex items-center gap-2 px-3.5 py-2.5">
|
|
259
|
+
<Input
|
|
260
|
+
value={draftKey}
|
|
261
|
+
onChange={e => setDraftKey(e.target.value)}
|
|
262
|
+
placeholder="NEW_KEY"
|
|
263
|
+
aria-invalid={draftKey.length > 0 && !keyValid}
|
|
264
|
+
className="h-7 w-40 font-mono text-xs"
|
|
265
|
+
/>
|
|
266
|
+
<Input
|
|
267
|
+
value={draftValue}
|
|
268
|
+
onChange={e => setDraftValue(e.target.value)}
|
|
269
|
+
onKeyDown={e => {
|
|
270
|
+
if (e.key === 'Enter') addVar()
|
|
271
|
+
}}
|
|
272
|
+
type="password"
|
|
273
|
+
placeholder="value"
|
|
274
|
+
className="h-7 flex-1 text-xs"
|
|
275
|
+
/>
|
|
276
|
+
<ScopeSelect value={draftScope} onChange={setDraftScope} />
|
|
277
|
+
<Button variant="outline" size="sm" className="h-7" onClick={addVar} disabled={!canAdd}>
|
|
278
|
+
{update.isPending ? (
|
|
279
|
+
<IconLoader2 className="animate-spin" />
|
|
280
|
+
) : (
|
|
281
|
+
<IconPlus stroke={1.75} />
|
|
282
|
+
)}
|
|
283
|
+
Add
|
|
284
|
+
</Button>
|
|
285
|
+
</div>
|
|
286
|
+
</SettingsSection>
|
|
287
|
+
|
|
288
|
+
<SettingsSection label="From .env files">
|
|
289
|
+
<SettingsRow
|
|
290
|
+
title="Inherit .env files"
|
|
291
|
+
description={
|
|
292
|
+
dotenvFiles > 0
|
|
293
|
+
? `Discovered ${fileCount} ${fileCount === 1 ? 'key' : 'keys'} across ${dotenvFiles} ${dotenvFiles === 1 ? 'file' : 'files'} in this workspace.`
|
|
294
|
+
: 'No .env files found in this workspace.'
|
|
295
|
+
}
|
|
296
|
+
control={
|
|
297
|
+
<Switch
|
|
298
|
+
checked={env.data?.inheritDotenv ?? true}
|
|
299
|
+
disabled={env.isLoading}
|
|
300
|
+
onCheckedChange={checked => update.mutate({ inheritDotenv: checked })}
|
|
301
|
+
/>
|
|
302
|
+
}
|
|
303
|
+
/>
|
|
304
|
+
</SettingsSection>
|
|
305
|
+
</SettingsPage>
|
|
306
|
+
)
|
|
307
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { IconKey, IconSettings, IconX } from '@tabler/icons-react'
|
|
4
|
+
|
|
5
|
+
import { Button } from '@/client/components/ui/button'
|
|
6
|
+
import { Dialog, DialogClose, DialogContent, DialogTitle } from '@/client/components/ui/dialog'
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
8
|
+
import { cn } from '@/client/lib/cn'
|
|
9
|
+
|
|
10
|
+
import { EnvironmentSettings, GeneralSettings } from './SettingsPages'
|
|
11
|
+
|
|
12
|
+
type SettingsNav = 'general' | 'environment'
|
|
13
|
+
|
|
14
|
+
const NAV: { id: SettingsNav; label: string; icon: typeof IconSettings }[] = [
|
|
15
|
+
{ id: 'general', label: 'General', icon: IconSettings },
|
|
16
|
+
{ id: 'environment', label: 'Environment', icon: IconKey }
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
export function WorkspaceSettings() {
|
|
20
|
+
const [open, setOpen] = useState(false)
|
|
21
|
+
const [page, setPage] = useState<SettingsNav>('general')
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Tooltip delay={50}>
|
|
26
|
+
<TooltipTrigger
|
|
27
|
+
render={
|
|
28
|
+
<Button
|
|
29
|
+
variant="ghost"
|
|
30
|
+
size="icon"
|
|
31
|
+
aria-label="Workspace settings"
|
|
32
|
+
className="size-7 text-primary [&_svg]:size-[20px]"
|
|
33
|
+
onClick={() => setOpen(true)}
|
|
34
|
+
>
|
|
35
|
+
<IconSettings stroke={1.75} />
|
|
36
|
+
</Button>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
<TooltipContent>Workspace settings</TooltipContent>
|
|
40
|
+
</Tooltip>
|
|
41
|
+
|
|
42
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
43
|
+
<DialogContent className="flex h-[min(680px,90vh)] w-[880px] max-w-[94vw]">
|
|
44
|
+
<DialogTitle className="sr-only">Workspace settings</DialogTitle>
|
|
45
|
+
|
|
46
|
+
{/* Sidebar nav — top padding lines the "Settings" label up with the
|
|
47
|
+
page title across the divider. */}
|
|
48
|
+
<nav className="flex w-48 shrink-0 flex-col gap-0.5 border-r border-border bg-muted/30 p-3">
|
|
49
|
+
<p className="px-2.5 pt-4 pb-2 text-[11px] font-semibold tracking-wider text-muted-foreground/80 uppercase">
|
|
50
|
+
Settings
|
|
51
|
+
</p>
|
|
52
|
+
{NAV.map(item => (
|
|
53
|
+
<button
|
|
54
|
+
key={item.id}
|
|
55
|
+
type="button"
|
|
56
|
+
onClick={() => setPage(item.id)}
|
|
57
|
+
className={cn(
|
|
58
|
+
'flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors [&_svg]:size-[18px]',
|
|
59
|
+
page === item.id
|
|
60
|
+
? 'bg-muted text-foreground'
|
|
61
|
+
: 'text-muted-foreground hover:bg-muted/60 hover:text-foreground'
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
<item.icon stroke={1.75} />
|
|
65
|
+
{item.label}
|
|
66
|
+
</button>
|
|
67
|
+
))}
|
|
68
|
+
</nav>
|
|
69
|
+
|
|
70
|
+
{/* Page */}
|
|
71
|
+
<div className="relative scrollbar-thin min-w-0 flex-1 overflow-y-auto">
|
|
72
|
+
<DialogClose
|
|
73
|
+
render={
|
|
74
|
+
<Button
|
|
75
|
+
variant="ghost"
|
|
76
|
+
size="icon"
|
|
77
|
+
aria-label="Close"
|
|
78
|
+
className="absolute top-3 right-3 z-10 size-7 text-muted-foreground"
|
|
79
|
+
>
|
|
80
|
+
<IconX stroke={1.5} />
|
|
81
|
+
</Button>
|
|
82
|
+
}
|
|
83
|
+
/>
|
|
84
|
+
<div className="px-8 py-7">
|
|
85
|
+
{page === 'general' ? <GeneralSettings /> : <EnvironmentSettings />}
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</DialogContent>
|
|
89
|
+
</Dialog>
|
|
90
|
+
</>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
|
|
3
|
+
import { highlight } from 'sugar-high'
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/client/lib/cn'
|
|
6
|
+
|
|
7
|
+
type CodeBlockProps = { code: string; className?: string }
|
|
8
|
+
|
|
9
|
+
// sugar-high colors each token with `style="color:var(--sh-*)"`, so a theme is
|
|
10
|
+
// just these CSS vars on an ancestor. Muted palette tuned for the light
|
|
11
|
+
// `bg-muted` output box. Set once via Tailwind arbitrary properties.
|
|
12
|
+
const SH_THEME = cn(
|
|
13
|
+
'[--sh-identifier:#1f2937]',
|
|
14
|
+
'[--sh-keyword:#cf222e]',
|
|
15
|
+
'[--sh-string:#16a34a]',
|
|
16
|
+
'[--sh-class:#2d6e7e]',
|
|
17
|
+
'[--sh-property:#0550ae]',
|
|
18
|
+
'[--sh-entity:#6f42c1]',
|
|
19
|
+
'[--sh-jsxliterals:#6f42c1]',
|
|
20
|
+
'[--sh-sign:#8b949e]',
|
|
21
|
+
'[--sh-comment:#9ca3af]'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
// Lightweight syntax highlight via sugar-high (~1KB, no language config). The
|
|
25
|
+
// tokenize pass is pure, so memoize on `code` — it only re-runs when the source
|
|
26
|
+
// changes, and the component only mounts while the row is expanded.
|
|
27
|
+
export function CodeBlock({ code, className }: CodeBlockProps) {
|
|
28
|
+
const html = useMemo(() => highlight(code), [code])
|
|
29
|
+
return (
|
|
30
|
+
<pre
|
|
31
|
+
className={cn(
|
|
32
|
+
'overflow-auto font-mono text-xs leading-relaxed whitespace-pre',
|
|
33
|
+
SH_THEME,
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{/* sugar-high escapes token text, so this HTML is safe to inject. */}
|
|
38
|
+
<code dangerouslySetInnerHTML={{ __html: html }} />
|
|
39
|
+
</pre>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import { AnimatePresence, motion } from 'motion/react'
|
|
4
|
+
|
|
5
|
+
type CollapseProps = { open: boolean; children: ReactNode }
|
|
6
|
+
|
|
7
|
+
// Height auto-animation — the same spring as the meta-ficus FAQ accordion
|
|
8
|
+
// (height 0 ↔ auto, opacity, overflow-hidden). The body is mounted only while
|
|
9
|
+
// open (AnimatePresence), so heavy children (highlighted code) neither render
|
|
10
|
+
// nor tokenize until expanded — and unmount again on collapse.
|
|
11
|
+
export function Collapse({ open, children }: CollapseProps) {
|
|
12
|
+
return (
|
|
13
|
+
<AnimatePresence initial={false}>
|
|
14
|
+
{open && (
|
|
15
|
+
<motion.div
|
|
16
|
+
key="content"
|
|
17
|
+
initial={{ height: 0, opacity: 0 }}
|
|
18
|
+
animate={{ height: 'auto', opacity: 1 }}
|
|
19
|
+
exit={{ height: 0, opacity: 0 }}
|
|
20
|
+
transition={{ type: 'spring', duration: 0.25, bounce: 0.1 }}
|
|
21
|
+
className="overflow-hidden"
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</motion.div>
|
|
25
|
+
)}
|
|
26
|
+
</AnimatePresence>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { useWorkspaceId } from '@/client/lib/WorkspaceContext'
|
|
4
|
+
import type { ToolCall } from '@/lib/types'
|
|
5
|
+
|
|
6
|
+
// Image extensions the server's preview route can render (see server/preview.ts).
|
|
7
|
+
const IMAGE_PATH_RE = /\.(png|jpe?g|gif|webp|avif|svg)$/i
|
|
8
|
+
|
|
9
|
+
// When the agent `Read`s an image that lives inside the workspace, return its
|
|
10
|
+
// workspace-relative path so the expanded row can show the actual picture.
|
|
11
|
+
// Anything else — non-Read tools, non-image paths, files outside the workspace
|
|
12
|
+
// (the preview route can only serve workspace files) — returns null.
|
|
13
|
+
export function readImageRelPath(call: ToolCall, cwd: string | null): string | null {
|
|
14
|
+
if (call.name !== 'Read' || !cwd) return null
|
|
15
|
+
const input = call.input as { file_path?: unknown }
|
|
16
|
+
const p = typeof input.file_path === 'string' ? input.file_path : null
|
|
17
|
+
if (!p || !IMAGE_PATH_RE.test(p)) return null
|
|
18
|
+
const root = cwd.endsWith('/') ? cwd : `${cwd}/`
|
|
19
|
+
if (!p.startsWith(root)) return null
|
|
20
|
+
return p.slice(root.length)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type ReadImagePreviewProps = { relPath: string }
|
|
24
|
+
|
|
25
|
+
// The picture a Read tool call opened, loaded on demand from the workspace via
|
|
26
|
+
// the preview route (server-side downscaled). The file can be gone or
|
|
27
|
+
// undecodable by the time the row is expanded — on any load error the preview
|
|
28
|
+
// just disappears, leaving the normal output view.
|
|
29
|
+
export function ReadImagePreview({ relPath }: ReadImagePreviewProps) {
|
|
30
|
+
const workspaceId = useWorkspaceId()
|
|
31
|
+
const [failed, setFailed] = useState(false)
|
|
32
|
+
if (failed) return null
|
|
33
|
+
const src = `/api/workspaces/${workspaceId}/preview/${relPath
|
|
34
|
+
.split('/')
|
|
35
|
+
.map(encodeURIComponent)
|
|
36
|
+
.join('/')}`
|
|
37
|
+
return (
|
|
38
|
+
<img
|
|
39
|
+
src={src}
|
|
40
|
+
alt={relPath}
|
|
41
|
+
loading="lazy"
|
|
42
|
+
onError={() => setFailed(true)}
|
|
43
|
+
className="max-h-64 max-w-full self-start rounded-md border border-border object-contain"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Subagent ("Agent" tool) row — matches the chat card: a node + the "Agent: <task>"
|
|
2
|
+
// header, and the LATEST ACTION (the last `progress` line) as a muted sub-row
|
|
3
|
+
// while running, switching to the step count once done. While running the node
|
|
4
|
+
// cycles sport glyphs and the header shimmers; once finished a duration badge sits
|
|
5
|
+
// top-right and expanding shows the subagent's nested transcript as a recursive
|
|
6
|
+
// sub-timeline, then its final summary. The `subagent` record
|
|
7
|
+
// (progress/status/usage/transcript) is built live from `task_*` events and isn't
|
|
8
|
+
// persisted, so a finished/replayed call shows only the header.
|
|
9
|
+
import { useEffect, useState } from 'react'
|
|
10
|
+
|
|
11
|
+
import { IconPlayBasketball, IconPlayFootball, IconPlayVolleyball } from '@tabler/icons-react'
|
|
12
|
+
|
|
13
|
+
import { ShimmerText } from '@/client/components/ShimmerText'
|
|
14
|
+
import { cn } from '@/client/lib/cn'
|
|
15
|
+
import type { ToolCall } from '@/lib/types'
|
|
16
|
+
|
|
17
|
+
import { Collapse } from './Collapse'
|
|
18
|
+
import { NodeBox, type RowPosition, RowChevron, TimelineRow } from './TimelineRow'
|
|
19
|
+
import { ToolCallGroup } from './ToolCallGroup'
|
|
20
|
+
import { formatDuration } from './format'
|
|
21
|
+
|
|
22
|
+
// While a subagent runs, its node cycles through "playing sport" glyphs — a
|
|
23
|
+
// light-hearted "still working" animation in place of a spinner.
|
|
24
|
+
const SPORT_ICONS = [IconPlayBasketball, IconPlayVolleyball, IconPlayFootball]
|
|
25
|
+
function RunningSportNode() {
|
|
26
|
+
const [i, setI] = useState(0)
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const t = setInterval(() => setI(n => (n + 1) % SPORT_ICONS.length), 600)
|
|
29
|
+
return () => clearInterval(t)
|
|
30
|
+
}, [])
|
|
31
|
+
const Icon = SPORT_ICONS[i]
|
|
32
|
+
return (
|
|
33
|
+
<NodeBox className="size-5">
|
|
34
|
+
<Icon size={16} stroke={1.75} className="text-foreground" />
|
|
35
|
+
</NodeBox>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type SubagentCardProps = RowPosition & { call: ToolCall; cwd: string | null }
|
|
40
|
+
export function SubagentCard({ call, cwd, isFirst, isLast }: SubagentCardProps) {
|
|
41
|
+
const [open, setOpen] = useState(false)
|
|
42
|
+
const sub = call.subagent
|
|
43
|
+
const input = (call.input ?? {}) as { description?: string }
|
|
44
|
+
const description = sub?.description ?? input.description ?? 'Subtask'
|
|
45
|
+
const status = sub?.status
|
|
46
|
+
const isError = call.state === 'error' || status === 'failed'
|
|
47
|
+
const isRunning = call.state === 'running' || status === 'running'
|
|
48
|
+
const toolUses = sub?.usage?.toolUses
|
|
49
|
+
// Wall-clock runtime, shown as a badge once the agent has finished.
|
|
50
|
+
const durationMs = sub?.usage?.durationMs
|
|
51
|
+
|
|
52
|
+
// While running → the latest action (last progress line); once done → a verb +
|
|
53
|
+
// count of the steps it took. Same rule as the chat card.
|
|
54
|
+
const latest = isRunning && sub?.progress?.length ? sub.progress[sub.progress.length - 1] : null
|
|
55
|
+
const subLine =
|
|
56
|
+
latest ?? (toolUses != null ? `Took ${toolUses} step${toolUses === 1 ? '' : 's'}` : null)
|
|
57
|
+
|
|
58
|
+
const nestedParts = (sub?.transcript ?? []).flatMap(t => t.parts)
|
|
59
|
+
const summary = typeof call.output === 'string' ? call.output : ''
|
|
60
|
+
const hasBody = nestedParts.length > 0 || !!summary
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<TimelineRow
|
|
64
|
+
isFirst={isFirst}
|
|
65
|
+
isLast={isLast}
|
|
66
|
+
marker={
|
|
67
|
+
isRunning ? (
|
|
68
|
+
<RunningSportNode />
|
|
69
|
+
) : (
|
|
70
|
+
// Done → the runner reaches the finish: freeze on the football glyph.
|
|
71
|
+
<NodeBox className="size-5">
|
|
72
|
+
<IconPlayFootball size={16} stroke={1.75} className="text-foreground" />
|
|
73
|
+
</NodeBox>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
isError={isError}
|
|
77
|
+
>
|
|
78
|
+
<div className="min-w-0 flex-1">
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
title={`Agent: ${description}`}
|
|
82
|
+
onClick={() => hasBody && setOpen(o => !o)}
|
|
83
|
+
className={cn(
|
|
84
|
+
'group/row flex w-full flex-col items-start gap-0.5 py-1.5 text-left select-none',
|
|
85
|
+
hasBody ? 'cursor-pointer' : 'cursor-default'
|
|
86
|
+
)}
|
|
87
|
+
>
|
|
88
|
+
<span className="flex w-full items-center gap-2">
|
|
89
|
+
<ShimmerText active={isRunning} className="min-w-0 flex-1 truncate text-xs font-medium">
|
|
90
|
+
Agent: {description}
|
|
91
|
+
</ShimmerText>
|
|
92
|
+
{!isRunning && durationMs != null && (
|
|
93
|
+
<span className="shrink-0 rounded-full border border-border px-1.5 text-[10px] font-medium text-muted-foreground tabular-nums">
|
|
94
|
+
{formatDuration(durationMs)}
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
{status === 'failed' && <span className="shrink-0 text-xs text-red-600">✗</span>}
|
|
98
|
+
{status === 'stopped' && (
|
|
99
|
+
<span className="shrink-0 text-xs text-muted-foreground">✗</span>
|
|
100
|
+
)}
|
|
101
|
+
{hasBody && <RowChevron open={open} />}
|
|
102
|
+
</span>
|
|
103
|
+
{subLine && (
|
|
104
|
+
<span className="w-full truncate text-xs text-muted-foreground">{subLine}</span>
|
|
105
|
+
)}
|
|
106
|
+
</button>
|
|
107
|
+
{hasBody && (
|
|
108
|
+
<Collapse open={open}>
|
|
109
|
+
{/* One card, two segments: the nested steps (default bg) on top and
|
|
110
|
+
the final summary (muted bg, roomier padding) below, split by a
|
|
111
|
+
border. The divider + summary segment only render when there's a
|
|
112
|
+
summary, so a steps-only card has no trailing border. */}
|
|
113
|
+
<div className="mt-1 mb-1 overflow-hidden rounded-md border border-border">
|
|
114
|
+
{nestedParts.length > 0 && (
|
|
115
|
+
<div className="py-1.5 pr-2 pl-3">
|
|
116
|
+
<ToolCallGroup parts={nestedParts} cwd={cwd} />
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
119
|
+
{summary && (
|
|
120
|
+
<div
|
|
121
|
+
className={cn(
|
|
122
|
+
'bg-muted/30 px-3.5 py-3 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground',
|
|
123
|
+
nestedParts.length > 0 && 'border-t border-border'
|
|
124
|
+
)}
|
|
125
|
+
>
|
|
126
|
+
{summary}
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</Collapse>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
</TimelineRow>
|
|
134
|
+
)
|
|
135
|
+
}
|