moi-computer 0.9.1-next.4 → 0.9.1-next.5
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/client/app/shell/SidebarLayout.tsx +15 -2
- package/client/assets/floppy-disk.webp +0 -0
- package/client/assets.d.ts +5 -0
- package/client/components/ui/button.tsx +2 -1
- package/client/features/chat/tool-group/format/claude.ts +2 -1
- package/client/features/chat/tool-group/format/codex.ts +2 -1
- package/client/features/chat/tool-group/format/hermes.ts +2 -1
- package/client/features/chat/tool-group/format/mcp.ts +7 -3
- package/client/features/chat/tool-group/format/openclaw.ts +6 -2
- package/client/features/chat/tool-group/format/shell.ts +162 -0
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/TextureLabPage.tsx +149 -0
- package/client/features/home/HomePage.tsx +5 -5
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +3 -3
- package/client/features/home/workspace-setup/DemoDialog.tsx +239 -0
- package/client/features/settings/GeneralSettings.tsx +27 -23
- package/client/features/widgets/WidgetFrame.tsx +1 -0
- package/client/index.css +2 -2
- package/client/runtime/workspace-theme.ts +12 -4
- package/client/theme.css +26 -22
- package/dist/{chunk-b959mdkj.js → chunk-0pcdwjkp.js} +1 -1
- package/dist/chunk-4xmcsjjv.js +1 -0
- package/dist/chunk-9m59hf8p.js +10 -0
- package/dist/{chunk-zbeq02yc.js → chunk-9y2zbzqz.js} +1 -1
- package/dist/chunk-dfs36zgc.js +1 -0
- package/dist/chunk-hffvjnmj.js +85 -0
- package/dist/chunk-pq93pv5z.js +1 -0
- package/dist/{chunk-zcyvyebg.js → chunk-te5sfhvx.js} +2 -2
- package/dist/chunk-xtr8kvqx.css +1 -0
- package/dist/{chunk-zfz3b4xg.js → chunk-yhj9bg1s.js} +2 -2
- package/dist/{chunk-zbt8emsw.js → chunk-yt2qjn3m.js} +2 -2
- package/dist/floppy-disk-wmjs0n85.webp +0 -0
- package/dist/index.html +1 -1
- package/lib/ids.ts +27 -0
- package/lib/themes.ts +12 -12
- package/lib/types.ts +2 -2
- package/package.json +2 -1
- package/server/api.ts +1 -1
- package/server/app-config.ts +2 -2
- package/server/bundler/build-applet.ts +2 -3
- package/server/cli.ts +23 -1
- package/server/registry.ts +37 -2
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +0 -245
- package/dist/chunk-87q78504.js +0 -1
- package/dist/chunk-8s41nd3g.js +0 -1
- package/dist/chunk-cagtq45k.js +0 -1
- package/dist/chunk-ek6zde7t.js +0 -10
- package/dist/chunk-n8tq2494.js +0 -82
- package/dist/chunk-v82nefjq.css +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { type ReactNode } from 'react'
|
|
2
2
|
|
|
3
|
-
import { IconPlus, IconSmartHome } from '@tabler/icons-react'
|
|
3
|
+
import { IconAlertSquareRoundedFilled, IconPlus, IconSmartHome } from '@tabler/icons-react'
|
|
4
4
|
import { useQueryClient } from '@tanstack/react-query'
|
|
5
5
|
import { Link, useLocation } from 'wouter'
|
|
6
6
|
|
|
7
7
|
import { useReorderWorkspaces, useWorkspaces } from '@/client/features/home/api'
|
|
8
|
+
import { useAppConfig } from '@/client/api/app-config'
|
|
8
9
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
9
10
|
import { useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
|
|
10
11
|
import { CreateWorkspaceDialog } from '@/client/features/home/workspace-setup/CreateWorkspaceDialog'
|
|
12
|
+
import { DemoDialog } from '@/client/features/home/workspace-setup/DemoDialog'
|
|
11
13
|
import { ReorderableList } from '@/client/components/shared/ReorderableList'
|
|
12
14
|
import type { ReorderableRenderState } from '@/client/components/shared/ReorderableList'
|
|
13
15
|
import { Button, buttonVariants } from '@/client/components/ui/button'
|
|
@@ -63,6 +65,7 @@ type SidebarProps = {
|
|
|
63
65
|
|
|
64
66
|
function Sidebar({ workspaces }: SidebarProps) {
|
|
65
67
|
const reorder = useReorderWorkspaces()
|
|
68
|
+
const { cloudDemo } = useAppConfig()
|
|
66
69
|
|
|
67
70
|
return (
|
|
68
71
|
<aside className="flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]">
|
|
@@ -106,7 +109,17 @@ function Sidebar({ workspaces }: SidebarProps) {
|
|
|
106
109
|
)}
|
|
107
110
|
</nav>
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
{cloudDemo ? (
|
|
113
|
+
<DemoDialog
|
|
114
|
+
trigger={
|
|
115
|
+
<Button size="icon" aria-label="Unlock all features" title="Unlock all features">
|
|
116
|
+
<IconAlertSquareRoundedFilled stroke={1.5} />
|
|
117
|
+
</Button>
|
|
118
|
+
}
|
|
119
|
+
/>
|
|
120
|
+
) : (
|
|
121
|
+
<div aria-hidden="true" className="size-8 shrink-0" />
|
|
122
|
+
)}
|
|
110
123
|
</aside>
|
|
111
124
|
)
|
|
112
125
|
}
|
|
Binary file
|
package/client/assets.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ const buttonVariants = cva(
|
|
|
12
12
|
'bg-primary text-primary-foreground inset-shadow-[0_0_8px_color-mix(in_oklab,var(--color-white)_20%,transparent)] hover:bg-primary/90 disabled:bg-accent disabled:text-muted-foreground disabled:opacity-100 disabled:shadow-none',
|
|
13
13
|
secondary:
|
|
14
14
|
'bg-accent text-foreground hover:bg-[color-mix(in_oklch,var(--accent),var(--foreground)_3%)] hover:text-accent-foreground',
|
|
15
|
-
outline:
|
|
15
|
+
outline:
|
|
16
|
+
'bg-background text-foreground shadow-xs hover:text-accent-foreground hover:shadow-sm',
|
|
16
17
|
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
17
18
|
destructive:
|
|
18
19
|
'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Claude Code vocabulary — also the default when a call carries no provider.
|
|
2
2
|
import type { ToolCall } from '@/lib/types'
|
|
3
3
|
|
|
4
|
+
import { shellBrief } from './shell'
|
|
4
5
|
import { getInputValue, toolInput, type Shorten, type ToolFormatter } from './shared'
|
|
5
6
|
|
|
6
7
|
// Claude tool names are mostly already presentable (Read, Bash, …); only a few
|
|
@@ -24,7 +25,7 @@ function shortToolName(name: string): string {
|
|
|
24
25
|
function brief(call: ToolCall, shorten: Shorten): string {
|
|
25
26
|
const tool = call.name
|
|
26
27
|
const input = toolInput(call)
|
|
27
|
-
if (tool === 'Bash') return
|
|
28
|
+
if (tool === 'Bash') return shellBrief(getInputValue(input, 'command'), shorten)
|
|
28
29
|
if (tool === 'Read' || tool === 'Write' || tool === 'Edit')
|
|
29
30
|
return shorten(getInputValue(input, 'file_path'))
|
|
30
31
|
if (tool === 'Glob') return shorten(getInputValue(input, 'pattern'))
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// unchanged).
|
|
4
4
|
import type { ToolCall } from '@/lib/types'
|
|
5
5
|
|
|
6
|
+
import { shellBrief } from './shell'
|
|
6
7
|
import { getInputValue, toolInput, type Shorten, type ToolFormatter } from './shared'
|
|
7
8
|
|
|
8
9
|
// Exported for mcp.ts: these management pseudo-tools stay plain rows, never
|
|
@@ -81,7 +82,7 @@ function brief(call: ToolCall, shorten: Shorten): string {
|
|
|
81
82
|
.filter(Boolean)
|
|
82
83
|
.join(' ')
|
|
83
84
|
if (action?.type === 'listFiles') return action.path ? shorten(action.path) : ''
|
|
84
|
-
return
|
|
85
|
+
return shellBrief(getInputValue(input, 'command'), shorten)
|
|
85
86
|
}
|
|
86
87
|
if (tool === 'apply_patch') {
|
|
87
88
|
// The adapter sends structured per-file changes: [{ path, kind, diff }].
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// the brief.
|
|
7
7
|
import type { ToolCall } from '@/lib/types'
|
|
8
8
|
|
|
9
|
+
import { prettifyShellCommand } from './shell'
|
|
9
10
|
import type { Shorten, ToolFormatter } from './shared'
|
|
10
11
|
|
|
11
12
|
// Split the action from its parenthesized qualifier and colon detail so the
|
|
@@ -62,7 +63,7 @@ function brief(call: ToolCall, shorten: Shorten): string {
|
|
|
62
63
|
const { action, qualifier, detail } = splitTitle(call.name)
|
|
63
64
|
const text = detail || qualifier
|
|
64
65
|
if (!text) return ''
|
|
65
|
-
return action === 'terminal' ? `$ ${text}` : shorten(text)
|
|
66
|
+
return action === 'terminal' ? `$ ${prettifyShellCommand(text)}` : shorten(text)
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export const hermesFormatter: ToolFormatter = { displayName, brief }
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { ToolCall } from '@/lib/types'
|
|
4
4
|
|
|
5
5
|
import { CODEX_TOOL_LABELS } from './codex'
|
|
6
|
+
import { prettifyShellCommand } from './shell'
|
|
6
7
|
|
|
7
8
|
export type McpRef = { server: string; tool: string; rest: string }
|
|
8
9
|
|
|
@@ -11,11 +12,14 @@ export type McpRef = { server: string; tool: string; rest: string }
|
|
|
11
12
|
// stops at the first command separator so a chained command doesn't bleed into
|
|
12
13
|
// `rest`. Returns null for non-`call` invocations.
|
|
13
14
|
export function parseMcporterCall(call: ToolCall): McpRef | null {
|
|
14
|
-
const isShell = call.name === 'Bash' || call.name === 'exec'
|
|
15
|
+
const isShell = call.name === 'Bash' || call.name === 'exec' || call.name === 'bash'
|
|
15
16
|
if (!isShell) return null
|
|
16
17
|
const input = (call.input as Record<string, unknown>) ?? {}
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
18
|
+
const raw = typeof input.command === 'string' ? input.command : ''
|
|
19
|
+
if (!raw) return null
|
|
20
|
+
// Match against the unwrapped command: providers that hand the script to
|
|
21
|
+
// `/bin/bash -lc "…"` would otherwise leave escaped quotes inside `rest`.
|
|
22
|
+
const command = prettifyShellCommand(raw)
|
|
19
23
|
const m = command.match(
|
|
20
24
|
/(?:^|\s|\$\()mcporter(?:\)?)\s+call\s+([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)((?:\s+(?!&&|\|\||;|\|)\S+)*)/
|
|
21
25
|
)
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { ToolCall } from '@/lib/types'
|
|
6
6
|
|
|
7
7
|
import { claudeFormatter } from './claude'
|
|
8
|
+
import { prettifyShellCommand, shellBrief } from './shell'
|
|
8
9
|
import { getInputValue, toolInput, type Shorten, type ToolFormatter } from './shared'
|
|
9
10
|
|
|
10
11
|
const LABELS: Record<string, string> = {
|
|
@@ -74,14 +75,17 @@ function openclawBrief(call: ToolCall, shorten: Shorten): string {
|
|
|
74
75
|
// `command` on 2026.7.1 + the newer `bash` tool; the 2026.7.2 exec sandbox
|
|
75
76
|
// instead carries a `code` script (JS that shells out) — show whichever.
|
|
76
77
|
const command = getInputValue(input, 'command') || getInputValue(input, 'code')
|
|
77
|
-
return command
|
|
78
|
+
return shellBrief(command, shorten)
|
|
78
79
|
}
|
|
79
80
|
if (tool === 'ls' || tool === 'find' || tool === 'grep')
|
|
80
81
|
return shorten(getInputValue(input, 'path') || getInputValue(input, 'pattern'))
|
|
81
82
|
if (tool === 'process') {
|
|
82
83
|
const action = getInputValue(input, 'action')
|
|
83
84
|
const name = getInputValue(input, 'name')
|
|
84
|
-
return
|
|
85
|
+
return (
|
|
86
|
+
[action, name].filter(Boolean).join(' ') ||
|
|
87
|
+
shorten(prettifyShellCommand(getInputValue(input, 'command')))
|
|
88
|
+
)
|
|
85
89
|
}
|
|
86
90
|
if (tool === 'web_search' || tool === 'x_search') return getInputValue(input, 'query')
|
|
87
91
|
if (tool === 'web_fetch') return getInputValue(input, 'url')
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Shell-command display normalization, shared by every provider's shell tool
|
|
2
|
+
// (Claude `Bash`, Codex/OpenClaw `exec`/`bash`, Hermes `terminal:` titles).
|
|
3
|
+
//
|
|
4
|
+
// Agents rarely hand us the command a person would have typed. Codex and
|
|
5
|
+
// OpenClaw hand the model's script to the login shell, so the tool input is
|
|
6
|
+
// the wrapper invocation:
|
|
7
|
+
//
|
|
8
|
+
// /bin/bash -c "sed -n '1,240p' SKILL.md && sed -n '1,240p' .moi/FIRMA.md"
|
|
9
|
+
//
|
|
10
|
+
// The wrapper is noise in a one-line brief: the shell path and `-lc` eat the
|
|
11
|
+
// width, and the inner quoting arrives escaped, so the row shows `\"` where
|
|
12
|
+
// the model wrote `"`. Rendering strips the wrapper and removes one quoting
|
|
13
|
+
// level, leaving what actually ran:
|
|
14
|
+
//
|
|
15
|
+
// sed -n '1,240p' SKILL.md && sed -n '1,240p' .moi/FIRMA.md
|
|
16
|
+
//
|
|
17
|
+
// Word splitting is `shell-quote`'s, not ours — quoting rules have too many
|
|
18
|
+
// corners (`'` inside `"`, `\d` staying literal, `$(…)` and backticks passing
|
|
19
|
+
// through) to re-derive here.
|
|
20
|
+
//
|
|
21
|
+
// Display only — nothing here feeds execution, so an unrecognized shape is
|
|
22
|
+
// never an error: every step falls back to the raw command unchanged.
|
|
23
|
+
import { parse } from 'shell-quote'
|
|
24
|
+
|
|
25
|
+
import type { Shorten } from './shared'
|
|
26
|
+
|
|
27
|
+
// `shell-quote` resolves `$VAR` through this callback, defaulting to the empty
|
|
28
|
+
// string. We render commands rather than run them, so put the variable back
|
|
29
|
+
// verbatim. Braces only survive where they carry meaning (`${FOO:-x}`); a bare
|
|
30
|
+
// `${FOO}` reads the same without them. A command or arithmetic substitution
|
|
31
|
+
// (`$(pwd)`, `$((1+2))`) arrives here as an empty key — a bare `$` restores it.
|
|
32
|
+
function keepVariable(key: string): string {
|
|
33
|
+
if (!key) return '$'
|
|
34
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key) ? `$${key}` : `\${${key}}`
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// `shell-quote` throws on a few malformed inputs (`${}`), and a streaming tool
|
|
38
|
+
// call can always show us a half-written command. Unparseable means "render it
|
|
39
|
+
// as it came".
|
|
40
|
+
function splitWords(command: string): ReturnType<typeof parse> | null {
|
|
41
|
+
try {
|
|
42
|
+
return parse(command, keepVariable)
|
|
43
|
+
} catch {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function basename(path: string): string {
|
|
49
|
+
return path.split('/').pop() ?? path
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Shells whose `-c` argument is a command string we can lift out. Keep this to
|
|
53
|
+
// real shells: unwrapping `docker run … sh -c …` would hide where the command
|
|
54
|
+
// ran, which is the useful part of that row.
|
|
55
|
+
const SHELLS = new Set([
|
|
56
|
+
'bash',
|
|
57
|
+
'sh',
|
|
58
|
+
'zsh',
|
|
59
|
+
'fish',
|
|
60
|
+
'dash',
|
|
61
|
+
'ash',
|
|
62
|
+
'ksh',
|
|
63
|
+
'mksh',
|
|
64
|
+
'csh',
|
|
65
|
+
'tcsh',
|
|
66
|
+
'nu',
|
|
67
|
+
'pwsh',
|
|
68
|
+
'powershell'
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
// Flags that consume the next word, so it isn't mistaken for the script
|
|
72
|
+
// (`bash -o pipefail -c …`).
|
|
73
|
+
const FLAGS_WITH_VALUE = new Set(['-o', '+o', '-O', '+O', '--rcfile', '--init-file'])
|
|
74
|
+
|
|
75
|
+
const ENV_ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/
|
|
76
|
+
|
|
77
|
+
// `-c`, plus the combined short forms shells are usually invoked with (`-lc`,
|
|
78
|
+
// `-ic`, `-euc`) and the long spellings (`--command`, pwsh's `-Command`).
|
|
79
|
+
function isCommandFlag(word: string): boolean {
|
|
80
|
+
if (/^-[a-zA-Z]*c$/.test(word)) return true
|
|
81
|
+
const lower = word.toLowerCase()
|
|
82
|
+
return lower === '--command' || lower === '-command'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// One unwrap pass: `[VAR=v …] [env] <shell> [flags] -c <script>` → `<script>`.
|
|
86
|
+
// Returns null when the command isn't that shape, which means "leave it alone".
|
|
87
|
+
function unwrapOnce(command: string): string | null {
|
|
88
|
+
// Operators, globs and comments come back as objects rather than strings;
|
|
89
|
+
// a wrapper invocation is plain words all the way to the script, so a
|
|
90
|
+
// non-string where a word belongs ends the match.
|
|
91
|
+
const words = splitWords(command)
|
|
92
|
+
if (!words || words.length < 3) return null
|
|
93
|
+
const word = (index: number): string | null => {
|
|
94
|
+
const entry = words[index]
|
|
95
|
+
return typeof entry === 'string' ? entry : null
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let i = 0
|
|
99
|
+
const skipAssignments = () => {
|
|
100
|
+
while (ENV_ASSIGNMENT.test(word(i) ?? '')) i++
|
|
101
|
+
}
|
|
102
|
+
skipAssignments()
|
|
103
|
+
if (basename(word(i) ?? '') === 'env') {
|
|
104
|
+
i++
|
|
105
|
+
skipAssignments()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!SHELLS.has(basename(word(i) ?? ''))) return null
|
|
109
|
+
i++
|
|
110
|
+
|
|
111
|
+
while (i < words.length) {
|
|
112
|
+
const flag = word(i)
|
|
113
|
+
if (flag === null) return null
|
|
114
|
+
if (isCommandFlag(flag)) {
|
|
115
|
+
// The script must be the final word. `bash -c script name arg` binds the
|
|
116
|
+
// extra words to `$0`/`$1`, and a brief that dropped them would claim the
|
|
117
|
+
// run was something it wasn't.
|
|
118
|
+
if (i + 2 !== words.length) return null
|
|
119
|
+
const script = word(i + 1)?.trim()
|
|
120
|
+
return script || null
|
|
121
|
+
}
|
|
122
|
+
if (!flag.startsWith('-') && !flag.startsWith('+')) return null
|
|
123
|
+
i += FLAGS_WITH_VALUE.has(flag) ? 2 : 1
|
|
124
|
+
}
|
|
125
|
+
return null
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Strip shell wrappers down to the command that actually ran. Bounded, because
|
|
129
|
+
// wrappers nest in practice (a `bash -lc` that runs `sh -c …`) and a malformed
|
|
130
|
+
// self-similar string must not loop.
|
|
131
|
+
export function unwrapShellCommand(command: string): string {
|
|
132
|
+
let out = command
|
|
133
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
134
|
+
const inner = unwrapOnce(out)
|
|
135
|
+
if (inner === null) return out
|
|
136
|
+
out = inner
|
|
137
|
+
}
|
|
138
|
+
return out
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Flatten a command to one line: the brief is a single truncating row, so a
|
|
142
|
+
// multi-line script would otherwise render as its first line with the rest
|
|
143
|
+
// silently collapsed by the browser, and its indentation as a wide gap.
|
|
144
|
+
export function collapseCommand(command: string): string {
|
|
145
|
+
return command
|
|
146
|
+
.replace(/\\\r?\n[ \t]*/g, ' ') // line continuations: drop the backslash too
|
|
147
|
+
.replace(/[ \t]*\r?\n[ \t]*/g, ' ')
|
|
148
|
+
.replace(/[ \t]{2,}/g, ' ')
|
|
149
|
+
.trim()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// The rendered form of a shell command: wrapper stripped, one line.
|
|
153
|
+
export function prettifyShellCommand(command: string): string {
|
|
154
|
+
return collapseCommand(unwrapShellCommand(command))
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// The `$ …` brief every provider's shell tool shows. Empty command → empty
|
|
158
|
+
// brief, so the row falls back to the bare label instead of a lone `$`.
|
|
159
|
+
export function shellBrief(command: string, shorten: Shorten): string {
|
|
160
|
+
const pretty = prettifyShellCommand(command)
|
|
161
|
+
return pretty ? shorten(`$ ${pretty}`) : ''
|
|
162
|
+
}
|
|
@@ -18,6 +18,11 @@ const DEV_ROUTES: DevRouteEntry[] = [
|
|
|
18
18
|
title: 'Tool calls',
|
|
19
19
|
description: 'Tool-call group fixtures: single and merged runs, live states, subagent traces.'
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
path: '/dev/textures',
|
|
23
|
+
title: 'Texture lab',
|
|
24
|
+
description: 'Every texture across color presets, dark mode, widget tokens, and vivid surfaces.'
|
|
25
|
+
},
|
|
21
26
|
{
|
|
22
27
|
path: '/dev/harness',
|
|
23
28
|
title: 'Harness debug',
|
|
@@ -3,6 +3,7 @@ import { Route, Switch } from 'wouter'
|
|
|
3
3
|
import { ChatStatesPage } from './ChatStatesPage'
|
|
4
4
|
import { DevIndexPage } from './DevIndexPage'
|
|
5
5
|
import { HarnessDebugPage } from './HarnessDebugPage'
|
|
6
|
+
import { TextureLabPage } from './TextureLabPage'
|
|
6
7
|
import { ToolCallsPage } from './ToolCallsPage'
|
|
7
8
|
|
|
8
9
|
// All /dev/* routes, colocated with their pages so the whole dev playground
|
|
@@ -15,6 +16,7 @@ export default function DevRoutes() {
|
|
|
15
16
|
<Route path="/dev/harness" component={HarnessDebugPage} />
|
|
16
17
|
<Route path="/dev/chat-states" component={ChatStatesPage} />
|
|
17
18
|
<Route path="/dev/tool-calls" component={ToolCallsPage} />
|
|
19
|
+
<Route path="/dev/textures" component={TextureLabPage} />
|
|
18
20
|
<Route path="/dev" component={DevIndexPage} />
|
|
19
21
|
</Switch>
|
|
20
22
|
)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Fragment } from 'react'
|
|
2
|
+
import { Link } from 'wouter'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/client/lib/cn'
|
|
5
|
+
import { getWorkspaceThemeStyle } from '@/client/runtime/workspace-theme'
|
|
6
|
+
import { COLOR_THEMES, DEFAULT_WORKSPACE_THEME } from '@/lib/themes'
|
|
7
|
+
import type { ColorTheme, WorkspaceTheme } from '@/lib/themes'
|
|
8
|
+
|
|
9
|
+
const TEXTURES = [
|
|
10
|
+
{ label: 'Checker', className: 'texture-checker' },
|
|
11
|
+
{ label: 'Grid', className: 'texture-grid' },
|
|
12
|
+
{ label: 'Noise', className: 'texture-noise' },
|
|
13
|
+
{ label: 'Linear gradient', className: 'texture-gradient-linear' },
|
|
14
|
+
{ label: 'Inset shadow', className: 'texture-inset-shadow' }
|
|
15
|
+
] as const
|
|
16
|
+
|
|
17
|
+
type SurfaceMode = 'base' | 'dark' | 'widget' | 'vivid'
|
|
18
|
+
|
|
19
|
+
type SurfaceConfig = {
|
|
20
|
+
mode: SurfaceMode
|
|
21
|
+
label: string
|
|
22
|
+
description: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const SURFACES: SurfaceConfig[] = [
|
|
26
|
+
{ mode: 'base', label: 'Base', description: 'Workspace tokens' },
|
|
27
|
+
{ mode: 'dark', label: 'Dark', description: 'Dark variant' },
|
|
28
|
+
{ mode: 'widget', label: 'Widget', description: 'Redefined tokens' },
|
|
29
|
+
{ mode: 'vivid', label: 'Vivid', description: 'data-vivid' }
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
const COLOR_THEME_KEYS = Object.keys(COLOR_THEMES) as ColorTheme[]
|
|
33
|
+
|
|
34
|
+
type TexturePreviewProps = {
|
|
35
|
+
color: ColorTheme
|
|
36
|
+
mode: SurfaceMode
|
|
37
|
+
textureClassName: string
|
|
38
|
+
textureLabel: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function TexturePreview({ color, mode, textureClassName, textureLabel }: TexturePreviewProps) {
|
|
42
|
+
const theme: WorkspaceTheme = { ...DEFAULT_WORKSPACE_THEME, color }
|
|
43
|
+
const style = getWorkspaceThemeStyle(theme, mode === 'widget' ? 'widget' : 'workspace')
|
|
44
|
+
const isVivid = mode === 'vivid'
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={cn('h-full', mode === 'dark' && 'dark')} style={style}>
|
|
48
|
+
<div
|
|
49
|
+
data-vivid={isVivid ? true : undefined}
|
|
50
|
+
aria-label={`${COLOR_THEMES[color].label}, ${textureLabel}, ${mode}`}
|
|
51
|
+
className={cn(
|
|
52
|
+
'relative h-28 overflow-hidden rounded-lg border p-3',
|
|
53
|
+
isVivid ? 'bg-primary text-primary-foreground' : 'bg-background text-foreground',
|
|
54
|
+
textureClassName
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
<div className="flex items-start justify-between gap-2">
|
|
58
|
+
<span className="text-xs font-medium">Aa 123</span>
|
|
59
|
+
<span
|
|
60
|
+
className={cn(
|
|
61
|
+
'rounded-md px-2 py-1 text-[10px] font-medium',
|
|
62
|
+
isVivid ? 'bg-background text-foreground' : 'bg-primary text-primary-foreground'
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
Primary
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
<div className="absolute right-3 bottom-3 left-3 flex items-center gap-2">
|
|
69
|
+
<span className="h-2 flex-1 rounded-full bg-muted" />
|
|
70
|
+
<span className="size-4 rounded-full border bg-accent" />
|
|
71
|
+
<span className="size-4 rounded-full border bg-primary" />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function TextureLabPage() {
|
|
79
|
+
return (
|
|
80
|
+
<main className="mx-auto w-full max-w-[96rem] px-6 py-10">
|
|
81
|
+
<Link href="/dev" className="text-sm text-muted-foreground hover:text-foreground">
|
|
82
|
+
← Dev pages
|
|
83
|
+
</Link>
|
|
84
|
+
|
|
85
|
+
<div className="mt-5 max-w-2xl">
|
|
86
|
+
<p className="text-[11px] font-medium tracking-widest text-muted-foreground uppercase">
|
|
87
|
+
Playground
|
|
88
|
+
</p>
|
|
89
|
+
<h1 className="mt-2 text-3xl font-semibold tracking-tight">Texture lab</h1>
|
|
90
|
+
<p className="mt-2 text-sm leading-6 text-muted-foreground">
|
|
91
|
+
Every texture across every color theme. Each row compares the base surface, dark variant,
|
|
92
|
+
widget token derivation, and a vivid container.
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div className="mt-10 flex flex-col gap-10">
|
|
97
|
+
{COLOR_THEME_KEYS.map(color => (
|
|
98
|
+
<section key={color}>
|
|
99
|
+
<div className="mb-3 flex items-center gap-2">
|
|
100
|
+
<span
|
|
101
|
+
style={getWorkspaceThemeStyle({ ...DEFAULT_WORKSPACE_THEME, color })}
|
|
102
|
+
className="size-3 rounded-full bg-primary"
|
|
103
|
+
/>
|
|
104
|
+
<h2 className="text-lg font-medium">{COLOR_THEMES[color].label}</h2>
|
|
105
|
+
<span className="font-mono text-xs text-muted-foreground">{color}</span>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div className="overflow-x-auto rounded-xl border">
|
|
109
|
+
<div className="grid min-w-[56rem] grid-cols-[9rem_repeat(4,minmax(10rem,1fr))] gap-px bg-border">
|
|
110
|
+
<div className="bg-muted px-3 py-2 text-xs font-medium text-muted-foreground">
|
|
111
|
+
Texture
|
|
112
|
+
</div>
|
|
113
|
+
{SURFACES.map(surface => (
|
|
114
|
+
<div key={surface.mode} className="bg-muted px-3 py-2">
|
|
115
|
+
<p className="text-xs font-medium">{surface.label}</p>
|
|
116
|
+
<p className="mt-0.5 text-[10px] text-muted-foreground">
|
|
117
|
+
{surface.description}
|
|
118
|
+
</p>
|
|
119
|
+
</div>
|
|
120
|
+
))}
|
|
121
|
+
|
|
122
|
+
{TEXTURES.map(texture => (
|
|
123
|
+
<Fragment key={texture.className}>
|
|
124
|
+
<div className="bg-background px-3 py-3">
|
|
125
|
+
<p className="text-sm font-medium">{texture.label}</p>
|
|
126
|
+
<p className="mt-1 font-mono text-[10px] leading-4 break-all text-muted-foreground">
|
|
127
|
+
{texture.className}
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
{SURFACES.map(surface => (
|
|
131
|
+
<div key={surface.mode} className="bg-background p-2">
|
|
132
|
+
<TexturePreview
|
|
133
|
+
color={color}
|
|
134
|
+
mode={surface.mode}
|
|
135
|
+
textureClassName={texture.className}
|
|
136
|
+
textureLabel={texture.label}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
))}
|
|
140
|
+
</Fragment>
|
|
141
|
+
))}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</section>
|
|
145
|
+
))}
|
|
146
|
+
</div>
|
|
147
|
+
</main>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from './api'
|
|
12
12
|
import { CreateWorkspaceDialog } from './workspace-setup/CreateWorkspaceDialog'
|
|
13
13
|
import { ImportWorkspaceDialog } from './workspace-setup/ImportWorkspaceDialog'
|
|
14
|
-
import {
|
|
14
|
+
import { DemoDialog } from './workspace-setup/DemoDialog'
|
|
15
15
|
import { useWorkspaceImport } from './workspace-setup/useWorkspaceImport'
|
|
16
16
|
import { HomeLogo } from './HomeLogo'
|
|
17
17
|
import { useAppConfig } from '@/client/api/app-config'
|
|
@@ -43,7 +43,7 @@ export function HomePage() {
|
|
|
43
43
|
onSuccess: entry => navigate(`/workspace/${entry.id}`)
|
|
44
44
|
})
|
|
45
45
|
const appConfig = useAppConfig()
|
|
46
|
-
const [
|
|
46
|
+
const [promoDialogOpen, setPromoDialogOpen] = useState(false)
|
|
47
47
|
const discoveredWorkspacesOpen = useUiStore(state => state.discoveredWorkspacesOpen)
|
|
48
48
|
const setDiscoveredWorkspacesOpen = useUiStore(state => state.setDiscoveredWorkspacesOpen)
|
|
49
49
|
|
|
@@ -68,9 +68,9 @@ export function HomePage() {
|
|
|
68
68
|
const count = workspaces.length
|
|
69
69
|
|
|
70
70
|
function handleAdd(suggestion: DiscoveredWorkspace) {
|
|
71
|
-
// Cloud demo: adding workspaces is off — offer the
|
|
71
|
+
// Cloud demo: adding workspaces is off — offer the promo dialog instead.
|
|
72
72
|
if (appConfig.cloudDemo) {
|
|
73
|
-
|
|
73
|
+
setPromoDialogOpen(true)
|
|
74
74
|
return
|
|
75
75
|
}
|
|
76
76
|
importFlow.startImport(suggestion)
|
|
@@ -161,7 +161,7 @@ export function HomePage() {
|
|
|
161
161
|
/>
|
|
162
162
|
)}
|
|
163
163
|
|
|
164
|
-
<
|
|
164
|
+
<DemoDialog open={promoDialogOpen} onOpenChange={setPromoDialogOpen} />
|
|
165
165
|
</div>
|
|
166
166
|
)
|
|
167
167
|
}
|
|
@@ -17,7 +17,7 @@ import { validateWorkspaceFolderName } from '@/lib/workspace-name'
|
|
|
17
17
|
import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
|
|
18
18
|
import type { WorkspaceType } from '@/lib/types'
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { DemoDialog } from './DemoDialog'
|
|
21
21
|
import { WorkspaceAgentStep } from './WorkspaceAgentStep'
|
|
22
22
|
import { WorkspaceDialogContent } from './WorkspaceDialogContent'
|
|
23
23
|
|
|
@@ -45,9 +45,9 @@ export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
|
|
|
45
45
|
const isCreating = createMutation.isPending
|
|
46
46
|
|
|
47
47
|
// Cloud demo: creating workspaces is off — the same trigger opens the
|
|
48
|
-
//
|
|
48
|
+
// cloud-demo promo dialog instead. After every hook so the hook order is stable.
|
|
49
49
|
if (appConfig.cloudDemo) {
|
|
50
|
-
return <
|
|
50
|
+
return <DemoDialog trigger={trigger} />
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function finish(workspaceId: string) {
|