moi-computer 0.10.1-next.3 → 0.10.1-next.4

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 (69) hide show
  1. package/client/app/shell/SidebarLayout.tsx +53 -14
  2. package/client/components/shared/AgentBlobatar.tsx +3 -3
  3. package/client/components/shared/Composer.tsx +4 -10
  4. package/client/features/chat/ChatEmptyState.tsx +2 -9
  5. package/client/features/chat/ChatPanel.tsx +21 -23
  6. package/client/features/chat/ChatPopup.tsx +1 -2
  7. package/client/features/chat/composer/ChatComposer.tsx +2 -2
  8. package/client/features/chat/composer/banners/AgentAvailabilityBanner.tsx +101 -0
  9. package/client/features/chat/composer/banners/{ChatErrorBanner.tsx → ErrorBanner.tsx} +2 -2
  10. package/client/features/chat/composer/banners/{WorkspaceSkillUpdateBanner.tsx → SkillUpdateBanner.tsx} +3 -3
  11. package/client/features/chat/composer/useWorkspaceComposerState.tsx +14 -24
  12. package/client/features/chat/composer/useWorkspaceSkillUpdates.ts +6 -6
  13. package/client/features/chat/useAppletChatMessage.ts +9 -5
  14. package/client/features/dev/BlobatarShapesPage.tsx +344 -0
  15. package/client/features/dev/ChatStatesPage.tsx +3 -4
  16. package/client/features/dev/DevIndexPage.tsx +5 -0
  17. package/client/features/dev/DevRoutes.tsx +2 -0
  18. package/client/features/home/HomePage.tsx +47 -5
  19. package/client/features/home/WorkspacePreview.tsx +4 -4
  20. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +1 -1
  21. package/client/features/update/{Update.tsx → UpdateControl.tsx} +33 -9
  22. package/client/features/workspace/CustomizePanel.tsx +1 -1
  23. package/client/features/workspace/WorkspaceScreen.tsx +5 -5
  24. package/client/features/workspace/api.ts +10 -1
  25. package/client/lib/agent-availability.ts +19 -0
  26. package/client/runtime/useWorkspaceEvents.ts +16 -2
  27. package/client/runtime/workspace-theme.ts +2 -8
  28. package/dist/chunk-104m57qw.js +2 -0
  29. package/dist/chunk-4vyggdzq.css +1 -0
  30. package/dist/chunk-bj3akjs2.js +1 -0
  31. package/dist/{chunk-0pcdwjkp.js → chunk-c9pjqx9m.js} +1 -1
  32. package/dist/chunk-gbp4m9p2.js +1 -0
  33. package/dist/{chunk-8jh75pjg.js → chunk-j2w2vak4.js} +2 -2
  34. package/dist/chunk-jpdn7nx7.js +83 -0
  35. package/dist/chunk-k2r9c95m.js +10 -0
  36. package/dist/chunk-kmbxhgwv.js +1 -0
  37. package/dist/{chunk-yt2qjn3m.js → chunk-tny85yt2.js} +2 -2
  38. package/dist/{chunk-9y2zbzqz.js → chunk-v7wr1df4.js} +1 -1
  39. package/dist/index.html +1 -1
  40. package/lib/themes.ts +31 -7
  41. package/lib/types.ts +9 -8
  42. package/package.json +1 -1
  43. package/server/AGENTS.md +1 -1
  44. package/server/agent.ts +46 -22
  45. package/server/api.ts +6 -6
  46. package/server/cli-ui-components.ts +63 -22
  47. package/server/harness/README.md +21 -12
  48. package/server/harness/claude-code/auth.ts +38 -23
  49. package/server/harness/claude-code/index.ts +1 -1
  50. package/server/harness/claude-code/permissions.ts +34 -0
  51. package/server/harness/claude-code/session.ts +7 -15
  52. package/server/harness/codex/auth.ts +31 -21
  53. package/server/harness/codex/client.ts +5 -14
  54. package/server/harness/codex/index.ts +1 -1
  55. package/server/harness/codex/permissions.ts +56 -0
  56. package/server/harness/codex/session.ts +25 -20
  57. package/server/harness/executable.ts +2 -2
  58. package/server/harness/hermes/index.ts +4 -5
  59. package/server/ui-components.ts +29 -0
  60. package/workspace/.claude/skills/moi-workspace/SKILL.md +9 -7
  61. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +24 -12
  62. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +0 -82
  63. package/dist/chunk-4xmcsjjv.js +0 -1
  64. package/dist/chunk-76j95afs.css +0 -1
  65. package/dist/chunk-dfs36zgc.js +0 -1
  66. package/dist/chunk-e4e993yf.js +0 -83
  67. package/dist/chunk-vq8ga42s.js +0 -1
  68. package/dist/chunk-yhj9bg1s.js +0 -2
  69. package/dist/chunk-yz743a75.js +0 -10
@@ -1,9 +1,11 @@
1
+ import { useEffect } from 'react'
2
+
1
3
  import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
2
4
 
3
5
  import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
4
6
  import { WORKSPACE_RESOURCE_OPTIONS } from '@/client/api/query-options'
5
7
  import { workspaceKeys } from '@/client/api/workspace-keys'
6
- import { useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
8
+ import { onWorkspaceEventsReconnect, useWorkspaceEvent } from '@/client/runtime/useWorkspaceEvents'
7
9
  import type {
8
10
  HarnessLogin,
9
11
  ViewInfo,
@@ -38,6 +40,13 @@ export function useWorkspaceLayout(workspaceId: string) {
38
40
  // refetch stays as a cheap safety net (the server serves its cache).
39
41
  export function useWorkspaceAgent(workspaceId: string) {
40
42
  const queryClient = useQueryClient()
43
+ useEffect(
44
+ () =>
45
+ onWorkspaceEventsReconnect(() => {
46
+ void queryClient.invalidateQueries({ queryKey: workspaceKeys.agent(workspaceId) })
47
+ }),
48
+ [queryClient, workspaceId]
49
+ )
41
50
  useWorkspaceEvent(event => {
42
51
  if (event.type === 'agent:updated' && event.workspaceId === workspaceId) {
43
52
  queryClient.setQueryData<WorkspaceAgent>(workspaceKeys.agent(workspaceId), prev =>
@@ -0,0 +1,19 @@
1
+ import type { HarnessAvailability } from '@/lib/types'
2
+
3
+ export type AgentAvailability =
4
+ | HarnessAvailability
5
+ | { status: 'checking' }
6
+ | { status: 'disconnected' }
7
+
8
+ export type AgentUnavailable = Exclude<
9
+ AgentAvailability,
10
+ { status: 'checking' } | { status: 'available' }
11
+ >
12
+
13
+ export function resolveAgentAvailability(
14
+ availability: HarnessAvailability | undefined,
15
+ disconnected: boolean
16
+ ): AgentAvailability {
17
+ if (disconnected) return { status: 'disconnected' }
18
+ return availability ?? { status: 'checking' }
19
+ }
@@ -64,6 +64,19 @@ let everConnected = false
64
64
  let ws: WebSocket | null = null
65
65
  let connecting = false
66
66
 
67
+ // Reconnect delay grows exponentially on repeated drops so a downed server
68
+ // doesn't get hammered with a request every 2s; resets once a connection
69
+ // actually opens.
70
+ const RECONNECT_BASE_DELAY_MS = 1000
71
+ const RECONNECT_MAX_DELAY_MS = 30_000
72
+ let reconnectAttempt = 0
73
+
74
+ function scheduleReconnect() {
75
+ const delay = Math.min(RECONNECT_BASE_DELAY_MS * 2 ** reconnectAttempt, RECONNECT_MAX_DELAY_MS)
76
+ reconnectAttempt++
77
+ setTimeout(ensureConnection, delay)
78
+ }
79
+
67
80
  function ensureConnection() {
68
81
  if (ws || connecting) return
69
82
  connecting = true
@@ -73,6 +86,7 @@ function ensureConnection() {
73
86
  socket.onopen = () => {
74
87
  ws = socket
75
88
  connecting = false
89
+ reconnectAttempt = 0
76
90
  if (everConnected) for (const handler of reconnectListeners) handler()
77
91
  everConnected = true
78
92
  }
@@ -87,9 +101,9 @@ function ensureConnection() {
87
101
  socket.onclose = () => {
88
102
  ws = null
89
103
  connecting = false
90
- // Reconnect after 2s if there are still listeners
104
+ // Reconnect with backoff if there are still listeners
91
105
  if (listeners.size > 0) {
92
- setTimeout(ensureConnection, 2000)
106
+ scheduleReconnect()
93
107
  }
94
108
  }
95
109
 
@@ -2,13 +2,11 @@ import { useEffect } from 'react'
2
2
  import type { CSSProperties } from 'react'
3
3
 
4
4
  import {
5
- COLOR_THEMES,
6
- DEFAULT_PRIMARY_COLOR,
7
5
  DEFAULT_WORKSPACE_THEME,
8
6
  FONT_THEMES,
9
7
  RADIUS_THEMES,
10
8
  THEME_COLOR_TOKENS,
11
- deriveThemeColors,
9
+ resolveThemeColorOverrides,
12
10
  resolveWorkspaceTheme
13
11
  } from '@/lib/themes'
14
12
  import type { ThemeColorMode, ThemeColorToken } from '@/lib/themes'
@@ -61,11 +59,7 @@ export function getWorkspaceThemeColorStyle(
61
59
  colorMode: ThemeColorMode = 'workspace'
62
60
  ): WorkspaceThemeStyle {
63
61
  const style: WorkspaceThemeStyle = {}
64
- const resolved = resolveWorkspaceTheme(theme)
65
-
66
- const color = COLOR_THEMES[resolved.color] ?? COLOR_THEMES[DEFAULT_WORKSPACE_THEME.color]
67
- const primary = color.primary ?? (colorMode === 'widget' ? DEFAULT_PRIMARY_COLOR : undefined)
68
- const colors = primary ? deriveThemeColors(primary, colorMode) : undefined
62
+ const colors = resolveThemeColorOverrides(theme, colorMode)
69
63
 
70
64
  for (const [token, property] of WORKSPACE_COLOR_PROPERTIES) {
71
65
  style[property] = colors?.[token]
@@ -0,0 +1,2 @@
1
+ import{Xc as P,Yc as v}from"/chunk-v7wr1df4.js";var w=v((q,$)=>{$.exports=globalThis.__esm.react});var x=P(w(),1);function y(o){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}${o}`}var m=new Set,b=new Set,H=!1,g=null,h=!1,U=1000,f=30000,T=0;function j(){let o=Math.min(U*2**T,f);T++,setTimeout(u,o)}function u(){if(g||h)return;h=!0;let o=new WebSocket(y("/api/workspaces/ws"));o.onopen=()=>{if(g=o,h=!1,T=0,H)for(let i of b)i();H=!0},o.onmessage=(i)=>{try{let p=JSON.parse(i.data);for(let a of m)a(p)}catch{}},o.onclose=()=>{if(g=null,h=!1,m.size>0)j()},o.onerror=()=>{o.close()}}function F(o){return b.add(o),()=>{b.delete(o)}}function G(o){let i=x.useRef(o);i.current=o,x.useEffect(()=>{let p=(a)=>i.current(a);return m.add(p),u(),()=>{if(m.delete(p),m.size===0&&g)g.close(),g=null}},[])}
2
+ export{w as Tc,y as Uc,F as Vc,G as Wc};