moi-computer 0.6.1-next.0 → 0.8.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.
Files changed (54) hide show
  1. package/README.md +2 -2
  2. package/client/components/shared/BottomPanel.tsx +2 -1
  3. package/client/components/shared/PanelHeader.tsx +1 -1
  4. package/client/features/applets/AppletMount.tsx +9 -22
  5. package/client/features/applets/applet-cache.ts +7 -0
  6. package/client/features/applets/applet-styles.ts +21 -1
  7. package/client/features/applets/useApplet.ts +1 -1
  8. package/client/features/chat/ChatComposer.tsx +18 -4
  9. package/client/features/chat/ChatSelector.tsx +1 -1
  10. package/client/features/chat/TurnView.tsx +1 -1
  11. package/client/features/home/api.ts +0 -10
  12. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +21 -64
  13. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +1 -1
  14. package/client/features/scratchpad/Scratchpad.tsx +1 -3
  15. package/client/features/views/ViewManager.tsx +258 -0
  16. package/client/features/views/view-residency.ts +77 -0
  17. package/client/features/widgets/WidgetFrame.tsx +6 -2
  18. package/client/features/workspace/CustomizePanel.tsx +40 -24
  19. package/client/features/workspace/WorkspaceLayoutContext.tsx +8 -0
  20. package/client/features/workspace/WorkspaceScreen.tsx +51 -103
  21. package/client/features/workspace/WorkspaceTabs.tsx +1 -1
  22. package/client/index.css +4 -1
  23. package/client/runtime/workspace-theme.ts +29 -10
  24. package/client/theme.css +96 -6
  25. package/dist/chunk-0k7brsms.js +9 -0
  26. package/dist/{chunk-m11ckkxd.js → chunk-dtwxpxbg.js} +1 -1
  27. package/dist/{chunk-55sh4dty.js → chunk-ga7t9qsk.js} +1 -1
  28. package/dist/{chunk-w3tnv51j.js → chunk-h9h8f176.js} +1 -1
  29. package/dist/{chunk-rxvx4ta9.js → chunk-r5ce5cdg.js} +2 -2
  30. package/dist/chunk-tey2nq7c.js +31 -0
  31. package/dist/{chunk-afgbg75t.js → chunk-z73xpsa0.js} +1 -1
  32. package/dist/chunk-zzgredta.css +1 -0
  33. package/dist/index.html +1 -1
  34. package/lib/format.ts +18 -4
  35. package/lib/system-messages.ts +241 -0
  36. package/lib/themes.ts +123 -51
  37. package/lib/types.ts +2 -5
  38. package/package.json +5 -4
  39. package/server/api.ts +2 -73
  40. package/server/bundler/build-applet.ts +7 -4
  41. package/server/cli.ts +46 -15
  42. package/server/control.ts +13 -6
  43. package/server/harness/README.md +11 -0
  44. package/server/harness/claude-code/NOTES.md +22 -7
  45. package/server/harness/claude-code/adapter.ts +39 -5
  46. package/server/moi-scaffold.ts +1 -1
  47. package/server/registry.ts +0 -20
  48. package/server/scratchpad-executor.ts +23 -1
  49. package/server/theme.ts +24 -27
  50. package/workspace/.claude/skills/moi-workspace/DESIGN.md +94 -57
  51. package/workspace/.claude/skills/moi-workspace/SKILL.md +10 -12
  52. package/dist/chunk-175bm057.js +0 -27
  53. package/dist/chunk-agtetn7n.css +0 -1
  54. package/dist/chunk-exj6hr30.js +0 -9
package/lib/format.ts CHANGED
@@ -58,13 +58,27 @@ export type Part =
58
58
  | { type: 'source-document'; mediaType: string; title: string; sourceId: string }
59
59
  | { type: 'data'; name: string; data: unknown }
60
60
 
61
+ // Why a synthetic turn exists. Set by adapters — from the backend's own
62
+ // synthetic flag or from lib/system-messages.ts text classification. The UI
63
+ // hides every synthetic turn; the reason is kept for debugging and future
64
+ // "show system messages" affordances.
65
+ export type SyntheticTurnReason =
66
+ | 'skill-body'
67
+ | 'system-reminder'
68
+ | 'hook-output'
69
+ | 'slash-command'
70
+ | 'interrupt'
71
+ | 'other'
72
+
61
73
  export type TurnOrigin =
62
74
  | { kind: 'user-input' }
63
75
  | { kind: 'tool-return'; toolCallId: string }
64
- | {
65
- kind: 'synthetic'
66
- reason: 'skill-body' | 'system-reminder' | 'hook-output' | 'slash-command' | 'other'
67
- }
76
+ | { kind: 'synthetic'; reason: SyntheticTurnReason }
77
+ // A backend notification (e.g. a background-task completion) rewritten to
78
+ // readable text by lib/system-messages.ts. Rendered as plain text in the
79
+ // flow for now — a dedicated notification block is planned; key it off
80
+ // this origin.
81
+ | { kind: 'notification' }
68
82
  | { kind: 'subagent-prompt'; parentToolCallId: string }
69
83
  | { kind: 'inter-session' }
70
84
  | { kind: 'replay' }
@@ -0,0 +1,241 @@
1
+ // Provider-agnostic filtering of system machinery that agent backends leave
2
+ // in user-role message text: slash-command records, interrupt markers, local
3
+ // command output, injected reminder/hook envelopes. Chat bubbles must show
4
+ // only what a person actually typed; everything else is transcript plumbing
5
+ // the backend wrote for itself.
6
+ //
7
+ // The layer is a flat rule registry over plain text — it knows nothing about
8
+ // any harness's wire types, so every adapter (and the client, if it ever
9
+ // needs to) can share it. Two granularities:
10
+ //
11
+ // - `filterSystemText` one text block → cleaned text ('' when the whole
12
+ // block is machinery)
13
+ // - `classifySystemMessage` all of a message's text blocks → a synthetic-turn
14
+ // reason when the message as a whole is machinery
15
+ //
16
+ // Adapters keep a hide-classified message's raw text and mark the turn
17
+ // `origin: { kind: 'synthetic', reason }` — the same treatment the Claude SDK's
18
+ // own `isSynthetic` injections get — so nothing renders but nothing is lost.
19
+ // A `notify`-classified message instead SURFACES: its machinery is rewritten
20
+ // to a short readable sentence and the turn lands as
21
+ // `origin: { kind: 'notification' }`, plain text in the flow (a dedicated
22
+ // notification block in the UI is planned; the origin is its hook).
23
+ //
24
+ // Adding rules: append to SYSTEM_TEXT_RULES with a `<provider>:<what>` id.
25
+ // Registry order is priority — the first matching hide/notify rule decides the
26
+ // block. `hide`/`notify` patterns must match the WHOLE block (`^…$`), and
27
+ // tag-shaped ones require every element complete (open + close), so a person
28
+ // typing a tag name, pasting an unterminated fragment, or quoting a record
29
+ // with commentary around it keeps their bubble. Prose-anchored rules (the
30
+ // caveat, the compaction summary) are prefix matches by necessity — the
31
+ // accepted tradeoff is that pasting that exact sentence at position 0 hides
32
+ // the message. Keep `hide`/`notify` regexes non-global (`.test` on a /g
33
+ // regex is stateful) and `strip` regexes global.
34
+ //
35
+ // Current rules cover Claude Code. Sources: the patterns were verified against
36
+ // the `claude` CLI binary's strings and live `~/.claude/projects/*.jsonl`
37
+ // transcripts (see harness/claude-code/NOTES.md §4). OpenClaw's inbound-meta
38
+ // stripper stays in server/harness/openclaw/strip.ts — it mirrors upstream
39
+ // code verbatim and is synced against it, so it does not fold into this
40
+ // registry.
41
+ import type { SyntheticTurnReason } from './format'
42
+
43
+ export type SystemTextRule = {
44
+ // Stable `<provider>:<what>` id, for tests and debugging.
45
+ id: string
46
+ // The synthetic-turn reason a consumed match maps onto (lib/format.ts).
47
+ reason: SyntheticTurnReason
48
+ } &
49
+ // The whole text block is machinery when `test` matches.
50
+ (
51
+ | { action: 'hide'; test: RegExp }
52
+ // Machinery embedded in otherwise-real text: remove every `pattern` match,
53
+ // keep the rest. A block left empty counts as fully consumed.
54
+ | { action: 'strip'; pattern: RegExp }
55
+ // The whole block is machinery worth SHOWING: `render` turns the raw
56
+ // payload into a short readable sentence for the chat flow.
57
+ | { action: 'notify'; test: RegExp; render: (text: string) => string }
58
+ )
59
+
60
+ function xmlField(text: string, tag: string): string | undefined {
61
+ const m = text.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`))
62
+ return m?.[1].trim() || undefined
63
+ }
64
+
65
+ // `<summary>` is already a human sentence ("Background command "…" completed
66
+ // (exit code 0)"); fall back to `<status>` (completed | failed | stopped)
67
+ // when a producer omits it.
68
+ function renderTaskNotification(text: string): string {
69
+ const summary = xmlField(text, 'summary')
70
+ if (summary) return summary
71
+ const status = xmlField(text, 'status')
72
+ return status ? `Background task ${status}` : 'Background task update'
73
+ }
74
+
75
+ export const SYSTEM_TEXT_RULES: readonly SystemTextRule[] = [
76
+ // -- Claude Code: whole-message records ------------------------------------
77
+ // Slash-command invocation, e.g. `<command-name>/clear</command-name>
78
+ // <command-message>clear</command-message><command-args></command-args>`.
79
+ // Tag order varies across CLI versions; `<command-contents>` carries older
80
+ // expanded-command payloads. The block must be NOTHING BUT complete
81
+ // `<command-*>…</command-*>` elements — a typed message that merely starts
82
+ // with the tag name, or a pasted record followed by a question, keeps its
83
+ // bubble.
84
+ {
85
+ id: 'claude-code:slash-command',
86
+ reason: 'slash-command',
87
+ action: 'hide',
88
+ test: /^\s*(<command-(name|message|args|contents)>[\s\S]*?<\/command-\2>\s*)+$/
89
+ },
90
+ // Output of a local slash command, e.g. `<local-command-stdout>Compacted.
91
+ // ...</local-command-stdout>` — the other half of the invocation record.
92
+ {
93
+ id: 'claude-code:local-command-output',
94
+ reason: 'slash-command',
95
+ action: 'hide',
96
+ test: /^\s*(<local-command-(stdout|stderr)>[\s\S]*?<\/local-command-\2>\s*)+$/
97
+ },
98
+ // Marker the CLI writes when the user aborts a turn (Esc / moi's stop).
99
+ // Full-block match only: someone quoting the marker inside a longer
100
+ // message keeps their bubble.
101
+ {
102
+ id: 'claude-code:interrupt',
103
+ reason: 'interrupt',
104
+ action: 'hide',
105
+ test: /^\s*\[Request interrupted by user( for tool use)?\]\s*$/
106
+ },
107
+ // `!command` bash mode: the input echo and its captured output
108
+ // (`<bash-stdout>…</bash-stdout><bash-stderr>…</bash-stderr>` ride in one
109
+ // message).
110
+ {
111
+ id: 'claude-code:bash-mode',
112
+ reason: 'other',
113
+ action: 'hide',
114
+ test: /^\s*(<bash-(input|stdout|stderr)>[\s\S]*?<\/bash-\2>\s*)+$/
115
+ },
116
+ // `#note` memory mode.
117
+ {
118
+ id: 'claude-code:memory-input',
119
+ reason: 'other',
120
+ action: 'hide',
121
+ test: /^\s*<user-memory-input>[\s\S]*?<\/user-memory-input>\s*$/
122
+ },
123
+ // Background-task completion notices delivered as user turns — surfaced
124
+ // as readable text rather than hidden. Local CC is the bare tag block;
125
+ // cloud harnesses prepend a NOT-USER-INPUT preamble. The test requires a
126
+ // COMPLETE `<task-notification>…</task-notification>` message: a person
127
+ // typing the tag name (or an unterminated fragment) keeps their bubble.
128
+ {
129
+ id: 'claude-code:task-notification',
130
+ reason: 'other',
131
+ action: 'notify',
132
+ test: /^\s*(\[SYSTEM NOTIFICATION - NOT USER INPUT\][\s\S]*)?<task-notification>[\s\S]*<\/task-notification>\s*$/,
133
+ render: renderTaskNotification
134
+ },
135
+ // Preamble injected before replayed local-command messages. `isMeta` in
136
+ // current CLI versions (so usually pre-hidden), but older transcripts
137
+ // carry it unflagged.
138
+ {
139
+ id: 'claude-code:local-command-caveat',
140
+ reason: 'other',
141
+ action: 'hide',
142
+ test: /^\s*Caveat: The messages below were generated by the user while running local commands\./
143
+ },
144
+ // Post-compaction continuation summary. Wording after the first sentence
145
+ // differs across CLI versions; the anchor sentence is stable.
146
+ {
147
+ id: 'claude-code:compact-continuation',
148
+ reason: 'other',
149
+ action: 'hide',
150
+ test: /^\s*This session is being continued from a previous conversation that ran out of context\./
151
+ },
152
+ // -- Claude Code: envelopes embedded in real messages ----------------------
153
+ // Ambient context reminders attached to (or around) typed text. moi's own
154
+ // envelope is stripped more precisely by lib/moi-context.ts before this
155
+ // rule sees the text; this catches every other reminder.
156
+ {
157
+ id: 'claude-code:system-reminder',
158
+ reason: 'system-reminder',
159
+ action: 'strip',
160
+ pattern: /<system-reminder>[\s\S]*?<\/system-reminder>\s*/g
161
+ },
162
+ // UserPromptSubmit hook stdout, appended to the message it ran for.
163
+ {
164
+ id: 'claude-code:prompt-submit-hook',
165
+ reason: 'hook-output',
166
+ action: 'strip',
167
+ pattern: /<user-prompt-submit-hook>[\s\S]*?<\/user-prompt-submit-hook>\s*/g
168
+ }
169
+ ]
170
+
171
+ export type SystemTextFilter = {
172
+ // What remains for display — '' when the block was entirely machinery,
173
+ // the readable rendering when a `notify` rule consumed it.
174
+ text: string
175
+ // Rules that consumed the block or stripped something from it, in
176
+ // application order (first entry names the dominant reason; its `action`
177
+ // says whether the block was hidden, rewritten, or partially stripped).
178
+ matched: SystemTextRule[]
179
+ }
180
+
181
+ export function filterSystemText(
182
+ text: string,
183
+ rules: readonly SystemTextRule[] = SYSTEM_TEXT_RULES
184
+ ): SystemTextFilter {
185
+ for (const rule of rules) {
186
+ if (rule.action === 'hide' && rule.test.test(text)) return { text: '', matched: [rule] }
187
+ if (rule.action === 'notify' && rule.test.test(text)) {
188
+ return { text: rule.render(text), matched: [rule] }
189
+ }
190
+ }
191
+ let out = text
192
+ const matched: SystemTextRule[] = []
193
+ for (const rule of rules) {
194
+ if (rule.action !== 'strip') continue
195
+ const next = out.replace(rule.pattern, '')
196
+ if (next !== out) {
197
+ matched.push(rule)
198
+ out = next
199
+ }
200
+ }
201
+ // Only a touched block gets its edges trimmed — untouched user text keeps
202
+ // its exact spacing.
203
+ return { text: matched.length > 0 ? out.trim() : out, matched }
204
+ }
205
+
206
+ export type SystemMessageVerdict =
207
+ // Transcript plumbing: keep the raw parts, mark the turn synthetic, hide.
208
+ | { kind: 'hide'; reason: SyntheticTurnReason; rules: SystemTextRule[] }
209
+ // A backend notification: show `text` as an `origin: 'notification'` turn.
210
+ | { kind: 'notification'; text: string; rules: SystemTextRule[] }
211
+
212
+ /**
213
+ * Decide whether a message is, in aggregate, all machinery: every text block
214
+ * either matched a hide/notify rule or was stripped down to nothing, and at
215
+ * least one rule fired. Blocks that were already blank neither veto nor
216
+ * count. Any notify match makes the whole message a notification (its
217
+ * rendered texts joined); real surviving text makes it a normal message.
218
+ */
219
+ export function classifySystemMessage(
220
+ texts: readonly string[],
221
+ rules: readonly SystemTextRule[] = SYSTEM_TEXT_RULES
222
+ ): SystemMessageVerdict | undefined {
223
+ const matched: SystemTextRule[] = []
224
+ const rendered: string[] = []
225
+ for (const text of texts) {
226
+ const f = filterSystemText(text, rules)
227
+ if (f.matched[0]?.action === 'notify') {
228
+ if (f.text.trim()) rendered.push(f.text)
229
+ matched.push(...f.matched)
230
+ continue
231
+ }
232
+ if (f.text.trim() !== '') return undefined
233
+ matched.push(...f.matched)
234
+ }
235
+ if (rendered.length > 0) {
236
+ return { kind: 'notification', text: rendered.join('\n\n'), rules: matched }
237
+ }
238
+ return matched.length > 0
239
+ ? { kind: 'hide', reason: matched[0].reason, rules: matched }
240
+ : undefined
241
+ }
package/lib/themes.ts CHANGED
@@ -1,85 +1,131 @@
1
- import { colord, extend } from 'colord'
2
- import a11yPlugin from 'colord/plugins/a11y'
1
+ import { wcagLuminance } from 'culori'
3
2
 
4
- // Registers optional WCAG helpers such as luminance() on Colord.
5
- extend([a11yPlugin])
6
-
7
- export type FontTheme = 'default' | 'serif' | 'mono' | 'blobby' | 'geometric' | 'awkward'
3
+ export type FontTheme =
4
+ | 'sans'
5
+ | 'serif'
6
+ | 'mono'
7
+ | 'geometric'
8
+ | 'rounded'
9
+ | 'blobby'
10
+ | 'awkward'
11
+ | 'comic'
8
12
 
9
13
  export type FontThemeConfig = {
10
14
  label: string
11
- feel: string
12
15
  sans: string
13
16
  mono: string
14
17
  googleFontsQuery?: string // passed as `family=` param to Google Fonts API
15
18
  }
16
19
 
17
20
  export const FONT_THEMES: Record<FontTheme, FontThemeConfig> = {
18
- default: {
19
- label: 'Default',
20
- feel: 'System font',
21
+ sans: {
22
+ label: 'Sans',
21
23
  sans: 'system-ui',
22
24
  mono: 'Geist Mono',
23
25
  googleFontsQuery: 'Geist+Mono:wght@400;500'
24
26
  },
25
27
  serif: {
26
28
  label: 'Serif',
27
- feel: 'Literata',
28
29
  sans: 'Literata',
29
30
  mono: 'Geist Mono',
30
31
  googleFontsQuery: 'Literata:wght@400;600;700&family=Geist+Mono:wght@400;500'
31
32
  },
32
33
  mono: {
33
34
  label: 'Mono',
34
- feel: 'Geist Mono',
35
35
  sans: 'Geist Mono',
36
36
  mono: 'Geist Mono',
37
37
  googleFontsQuery: 'Geist+Mono:wght@400;500;600'
38
38
  },
39
- blobby: {
40
- label: 'Blobby',
41
- feel: 'Sour Gummy',
42
- sans: 'Sour Gummy',
43
- mono: 'Azeret Mono',
44
- googleFontsQuery: 'Sour+Gummy:wght@400;500;600&family=Azeret+Mono:wght@400;500'
45
- },
46
39
  geometric: {
47
40
  label: 'Geometric',
48
- feel: 'Manrope',
49
41
  sans: 'Manrope',
50
42
  mono: 'Geist Mono',
51
43
  googleFontsQuery: 'Manrope:wght@400;500;600&family=Geist+Mono:wght@400;500'
52
44
  },
45
+ rounded: {
46
+ label: 'Rounded',
47
+ sans: 'SN Pro',
48
+ mono: 'Geist Mono',
49
+ googleFontsQuery: 'SN+Pro:wght@400;500;600&family=Geist+Mono:wght@400;500'
50
+ },
51
+ blobby: {
52
+ label: 'Blobby',
53
+ sans: 'Sour Gummy',
54
+ mono: 'Azeret Mono',
55
+ googleFontsQuery: 'Sour+Gummy:wght@400;500;600&family=Azeret+Mono:wght@400;500'
56
+ },
53
57
  awkward: {
54
58
  label: 'Awkward',
55
- feel: 'Averia Sans Libre',
56
59
  sans: 'Averia Sans Libre',
57
60
  mono: 'Azeret Mono',
58
61
  googleFontsQuery: 'Averia+Sans+Libre:wght@400;500;600&family=Azeret+Mono:wght@400;500'
62
+ },
63
+ comic: {
64
+ label: 'Comic',
65
+ sans: 'Comic Sans MS, Comic Sans, cursive',
66
+ mono: 'Geist Mono',
67
+ googleFontsQuery: 'Geist+Mono:wght@400;500'
59
68
  }
60
69
  }
61
70
 
62
- export type ColorTheme = 'default' | 'paper' | 'sand' | 'rose' | 'lavender' | 'mint' | 'sky'
71
+ export type RadiusTheme = 'squishy' | 'soft' | 'subtle' | 'square'
63
72
 
64
- function foregroundForPrimary(primary: string): string {
65
- if (!/^#[0-9a-f]{6}$/i.test(primary)) {
66
- throw new Error(`Primary theme color must use #rrggbb: ${primary}`)
67
- }
73
+ export type RadiusThemeConfig = {
74
+ label: string
75
+ radius: string
76
+ }
77
+
78
+ export const RADIUS_THEMES: Record<RadiusTheme, RadiusThemeConfig> = {
79
+ squishy: { label: 'Squishy', radius: '0.875rem' },
80
+ soft: { label: 'Soft', radius: '0.625rem' },
81
+ subtle: { label: 'Subtle', radius: '0.375rem' },
82
+ square: { label: 'Square', radius: '0' }
83
+ }
68
84
 
69
- return colord(primary).luminance() > 0.24 ? '#000000' : '#ffffff'
85
+ export type ColorTheme =
86
+ | 'default'
87
+ | 'paper'
88
+ | 'rose'
89
+ | 'tangerine'
90
+ | 'sand'
91
+ | 'mint'
92
+ | 'sky'
93
+ | 'lavender'
94
+
95
+ export type ThemeColorMode = 'workspace' | 'widget'
96
+
97
+ export const DEFAULT_PRIMARY_COLOR = 'oklch(0.205 0 0)'
98
+
99
+ function foregroundForPrimary(primary: string): string {
100
+ return wcagLuminance(primary) > 0.3 ? 'oklch(0 0 0)' : 'oklch(1 0 0)'
70
101
  }
71
102
 
72
103
  const THEME_COLOR_DERIVATIONS = {
73
- primary: primary => primary,
74
- primaryForeground: primary => foregroundForPrimary(primary),
75
- background: () => 'color-mix(in oklch, var(--primary) 3%, white 97%)',
76
- foreground: () => 'color-mix(in oklch, var(--primary) 24%, black 76%)',
77
- muted: () => 'color-mix(in oklch, var(--background) 95%, var(--foreground) 5%)',
78
- mutedForeground: () => 'color-mix(in oklch, var(--background) 58%, var(--foreground) 42%)',
79
- accent: () => 'color-mix(in oklch, var(--primary) 4%, var(--foreground) 4%)'
80
- } satisfies Record<string, (primary: string) => string>
81
-
82
- export type ThemeColorToken = keyof typeof THEME_COLOR_DERIVATIONS
104
+ workspace: {
105
+ primary: primary => primary,
106
+ primaryForeground: primary => foregroundForPrimary(primary),
107
+ background: () => 'color-mix(var(--primary) 3%, oklch(1 0 0) 97%)',
108
+ foreground: () => 'color-mix(var(--primary) 20%, oklch(0 0 0) 80%)',
109
+ muted: () => 'color-mix(var(--background) 95%, var(--foreground) 5%)',
110
+ mutedForeground: () => 'color-mix(var(--background) 50%, var(--foreground) 50%)',
111
+ accent: () => 'color-mix(var(--primary) 4%, var(--foreground) 4%)',
112
+ accentForeground: () => 'var(--foreground)',
113
+ border: () => 'color-mix(var(--foreground) 7%, transparent)'
114
+ },
115
+ widget: {
116
+ background: primary => primary,
117
+ foreground: primary => foregroundForPrimary(primary),
118
+ primary: () => 'color-mix(var(--background) 3%, oklch(1 0 0) 97%)',
119
+ primaryForeground: () => 'color-mix(var(--background) 20%, oklch(0 0 0) 80%)',
120
+ muted: () => 'color-mix(var(--background) 95%, var(--foreground) 5%)',
121
+ mutedForeground: () => 'color-mix(var(--background) 50%, var(--foreground) 50%)',
122
+ accent: () => 'color-mix(var(--primary) 4%, var(--foreground) 4%)',
123
+ accentForeground: () => 'var(--foreground)',
124
+ border: () => 'color-mix(var(--foreground) 15%, transparent)'
125
+ }
126
+ } satisfies Record<ThemeColorMode, Record<string, (primary: string) => string>>
127
+
128
+ export type ThemeColorToken = keyof (typeof THEME_COLOR_DERIVATIONS)['workspace']
83
129
  export type ThemeColors = Record<ThemeColorToken, string>
84
130
 
85
131
  export type ColorThemeConfig = {
@@ -88,12 +134,18 @@ export type ColorThemeConfig = {
88
134
  primary?: string
89
135
  }
90
136
 
91
- export const THEME_COLOR_TOKENS = Object.keys(THEME_COLOR_DERIVATIONS) as ThemeColorToken[]
137
+ export const THEME_COLOR_TOKENS = Object.keys(
138
+ THEME_COLOR_DERIVATIONS.workspace
139
+ ) as ThemeColorToken[]
92
140
 
93
- export function deriveThemeColors(primary: string): ThemeColors {
141
+ export function deriveThemeColors(
142
+ primary: string,
143
+ mode: ThemeColorMode = 'workspace'
144
+ ): ThemeColors {
94
145
  const colors = {} as ThemeColors
146
+ const derivations = THEME_COLOR_DERIVATIONS[mode]
95
147
  for (const token of THEME_COLOR_TOKENS) {
96
- colors[token] = THEME_COLOR_DERIVATIONS[token](primary)
148
+ colors[token] = derivations[token](primary)
97
149
  }
98
150
  return colors
99
151
  }
@@ -102,26 +154,46 @@ export const COLOR_THEMES: Record<ColorTheme, ColorThemeConfig> = {
102
154
  default: { label: 'Default' },
103
155
  paper: {
104
156
  label: 'Paper',
105
- primary: '#453521'
106
- },
107
- sand: {
108
- label: 'Sand',
109
- primary: '#ff8700'
157
+ primary: 'oklch(0.4328 0.0351 66.67)'
110
158
  },
111
159
  rose: {
112
160
  label: 'Rose',
113
- primary: '#f13c3c'
161
+ primary: 'oklch(0.6322 0.2171 26.02)'
114
162
  },
115
- lavender: {
116
- label: 'Lavender',
117
- primary: '#9051ff'
163
+ tangerine: {
164
+ label: 'Tangerine',
165
+ primary: 'oklch(0.6886 0.22 37.15)'
166
+ },
167
+ sand: {
168
+ label: 'Sand',
169
+ primary: 'oklch(0.8334 0.1271 67.80)'
118
170
  },
119
171
  mint: {
120
172
  label: 'Tropics',
121
- primary: '#009155'
173
+ primary: 'oklch(0.5774 0.1399 156.06)'
122
174
  },
123
175
  sky: {
124
176
  label: 'Sky',
125
- primary: '#007ae3'
177
+ primary: 'oklch(0.5824 0.1830 253.59)'
178
+ },
179
+ lavender: {
180
+ label: 'Lavender',
181
+ primary: 'oklch(0.6025 0.2426 294.58)'
126
182
  }
127
183
  }
184
+
185
+ export type WorkspaceTheme = {
186
+ font: FontTheme
187
+ color: ColorTheme
188
+ radius: RadiusTheme
189
+ }
190
+
191
+ export const DEFAULT_WORKSPACE_THEME: WorkspaceTheme = {
192
+ font: 'sans',
193
+ color: 'default',
194
+ radius: 'soft'
195
+ }
196
+
197
+ export function resolveWorkspaceTheme(theme?: Partial<WorkspaceTheme>): WorkspaceTheme {
198
+ return { ...DEFAULT_WORKSPACE_THEME, ...theme }
199
+ }
package/lib/types.ts CHANGED
@@ -503,7 +503,7 @@ export type WorkspaceTabsState = {
503
503
  active: WorkspaceTabId
504
504
  }
505
505
 
506
- export type { FontTheme, ColorTheme } from './themes'
506
+ export type { ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
507
507
 
508
508
  export type WorkspaceLayout = {
509
509
  version: 1
@@ -533,10 +533,7 @@ export type WorkspaceLayout = {
533
533
  selectedEffort?: string
534
534
  // Fast-mode default for new sessions. Undefined inherits the provider setting.
535
535
  selectedFastMode?: boolean
536
- theme?: {
537
- font: import('./themes').FontTheme
538
- primary?: string
539
- }
536
+ theme?: import('./themes').WorkspaceTheme
540
537
  // Widget thumbnails captured client-side from the live grid, used for
541
538
  // home-screen previews. Saved through their own endpoint (PUT
542
539
  // .../thumbnails), never through the layout PUT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moi-computer",
3
- "version": "0.6.1-next.0",
3
+ "version": "0.8.0",
4
4
  "description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
@@ -69,8 +69,8 @@
69
69
  "citty": "^0.2.1",
70
70
  "class-variance-authority": "^0.7.1",
71
71
  "clsx": "^2.1.1",
72
- "colord": "^2.9.3",
73
72
  "conf": "^15.1.0",
73
+ "culori": "^4.0.2",
74
74
  "devalue": "^5.6.4",
75
75
  "env-paths": "^4.0.0",
76
76
  "frimousse": "^0.3.0",
@@ -94,8 +94,8 @@
94
94
  "shadcn": "^4.13.0",
95
95
  "sharp": "^0.35.1",
96
96
  "sugar-high": "^1.2.1",
97
- "tailwind-merge": "^3.5.0",
98
- "tailwindcss": "^4.1.11",
97
+ "tailwind-merge": "^3.6.0",
98
+ "tailwindcss": "^4.3.3",
99
99
  "tldraw": "5.2.3",
100
100
  "tw-animate-css": "^1.4.0",
101
101
  "typescript": "^5.9.3",
@@ -107,6 +107,7 @@
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/bun": "latest",
110
+ "@types/culori": "^4.0.1",
110
111
  "@types/react": "^19",
111
112
  "@types/react-dom": "^19",
112
113
  "@types/react-grid-layout": "^2.1.0",