moi-computer 0.8.0 → 0.9.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 (110) hide show
  1. package/client/api/workspace-keys.ts +1 -2
  2. package/client/app/AppRouter.tsx +10 -3
  3. package/client/app/routes/HomeRoute.tsx +1 -1
  4. package/client/app/shell/SidebarLayout.tsx +2 -14
  5. package/client/components/shared/Composer.tsx +20 -7
  6. package/client/components/shared/PanelHeader.tsx +8 -1
  7. package/client/components/ui/button.tsx +3 -3
  8. package/client/components/ui/dialog.tsx +1 -1
  9. package/client/components/ui/dropdown-menu.tsx +2 -2
  10. package/client/components/ui/hover-card.tsx +1 -1
  11. package/client/components/ui/popover.tsx +1 -1
  12. package/client/components/ui/resizable.tsx +40 -0
  13. package/client/features/chat/ChatEmptyState.tsx +9 -11
  14. package/client/features/chat/ChatPanel.tsx +76 -48
  15. package/client/features/chat/ChatPopup.tsx +16 -2
  16. package/client/features/chat/ChatPromptBubbles.tsx +6 -8
  17. package/client/features/chat/ChatSelector.tsx +24 -7
  18. package/client/features/chat/MarkdownContent.tsx +1 -1
  19. package/client/features/chat/ModelPicker.tsx +5 -4
  20. package/client/features/chat/TurnView.tsx +108 -13
  21. package/client/features/chat/api.ts +1 -18
  22. package/client/features/chat/chat-send.ts +2 -2
  23. package/client/features/chat/{ChatComposer.tsx → composer/ChatComposer.tsx} +6 -5
  24. package/client/features/chat/composer/banners/ChatErrorBanner.tsx +28 -0
  25. package/client/features/chat/composer/banners/ComposerBanner.tsx +30 -0
  26. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +91 -0
  27. package/client/features/{workspace → chat/composer/banners}/WorkspaceSkillUpdateBanner.tsx +9 -7
  28. package/client/features/chat/composer/useWorkspaceComposerState.tsx +74 -0
  29. package/client/features/{workspace → chat/composer}/useWorkspaceSkillUpdates.ts +1 -1
  30. package/client/features/chat/group-turns.ts +46 -28
  31. package/client/features/chat/interleave-notices.ts +84 -0
  32. package/client/features/chat/model-order.ts +9 -3
  33. package/client/features/chat/tool-group/TimelineRow.tsx +23 -11
  34. package/client/features/chat/tool-group/ToolCallGroup.tsx +38 -3
  35. package/client/features/chat/tool-group/format.ts +51 -10
  36. package/client/features/chat/useAppletChatMessage.ts +11 -16
  37. package/client/features/chat/useChat.ts +3 -7
  38. package/client/features/dev/ChatStatesPage.tsx +466 -0
  39. package/client/features/dev/DevIndexPage.tsx +52 -0
  40. package/client/features/dev/DevRoutes.tsx +6 -3
  41. package/client/features/dev/HarnessDebugPage.tsx +3 -3
  42. package/client/features/dev/chat-states-fixtures.ts +744 -0
  43. package/client/features/scratchpad/Scratchpad.tsx +4 -0
  44. package/client/features/scratchpad/scratch-session.ts +71 -0
  45. package/client/features/views/ViewBuilderTab.tsx +5 -4
  46. package/client/features/views/useViewBuilderActions.ts +2 -2
  47. package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -2
  48. package/client/features/workspace/WorkspaceScreen.tsx +128 -146
  49. package/client/features/workspace/WorkspaceSplitLayout.tsx +111 -0
  50. package/client/features/workspace/api.ts +33 -8
  51. package/client/features/workspace/useFitsSplitLayout.ts +31 -5
  52. package/client/index.css +1 -1
  53. package/client/lib/flags.ts +4 -3
  54. package/client/runtime/useWorkspaceEvents.ts +18 -1
  55. package/client/store/ui.ts +5 -1
  56. package/dist/{chunk-0pcdwjkp.js → chunk-2vaafjp4.js} +1 -1
  57. package/dist/{chunk-9y2zbzqz.js → chunk-35fq49qa.js} +1 -1
  58. package/dist/{chunk-h9h8f176.js → chunk-3b3rkjet.js} +1 -1
  59. package/dist/chunk-gt7n06ef.js +1 -0
  60. package/dist/{chunk-r5ce5cdg.js → chunk-kkj86722.js} +75 -75
  61. package/dist/chunk-ty1sqbmn.js +80 -0
  62. package/dist/chunk-xeyxk7ep.js +10 -0
  63. package/dist/chunk-yz6wd5vc.css +1 -0
  64. package/dist/index.html +1 -1
  65. package/lib/format.ts +37 -7
  66. package/lib/themes.ts +2 -2
  67. package/lib/types.ts +38 -8
  68. package/lib/workspace-layout.ts +2 -2
  69. package/package.json +6 -4
  70. package/server/agent.ts +199 -0
  71. package/server/api.ts +36 -17
  72. package/server/bundler/build-applet.ts +35 -44
  73. package/server/cli-env.ts +2 -2
  74. package/server/cli.ts +39 -53
  75. package/server/constants.ts +8 -0
  76. package/server/control-client.ts +124 -0
  77. package/server/control.ts +2 -2
  78. package/server/env-apply.ts +4 -0
  79. package/server/harness/README.md +32 -12
  80. package/server/harness/claude-code/auth.ts +54 -0
  81. package/server/harness/claude-code/index.ts +6 -1
  82. package/server/harness/codex/adapter.ts +9 -1
  83. package/server/harness/codex/auth.ts +50 -0
  84. package/server/harness/codex/index.ts +6 -1
  85. package/server/harness/codex/session.ts +33 -14
  86. package/server/harness/openclaw/NOTES.md +619 -186
  87. package/server/harness/openclaw/adapter.ts +121 -54
  88. package/server/harness/openclaw/compat.ts +95 -0
  89. package/server/harness/openclaw/cron-view.ts +78 -0
  90. package/server/harness/openclaw/discovery.ts +145 -52
  91. package/server/harness/openclaw/gateway.ts +224 -36
  92. package/server/harness/openclaw/index.ts +56 -21
  93. package/server/harness/openclaw/session.ts +1002 -67
  94. package/server/harness/openclaw/strip.ts +71 -23
  95. package/server/harness/openclaw/thinking.ts +150 -0
  96. package/server/harness/types.ts +10 -5
  97. package/server/layout.ts +5 -2
  98. package/server/service.ts +2 -2
  99. package/workspace/.claude/skills/moi-workspace/SKILL.md +6 -6
  100. package/workspace/.claude/skills/moi-workspace/{DESIGN.md → references/DESIGN.md} +19 -9
  101. package/client/features/dev/PixelPainter.tsx +0 -94
  102. package/client/features/dev/PlaygroundPage.tsx +0 -69
  103. package/dist/chunk-0k7brsms.js +0 -9
  104. package/dist/chunk-dfs36zgc.js +0 -1
  105. package/dist/chunk-dtwxpxbg.js +0 -51
  106. package/dist/chunk-ga7t9qsk.js +0 -2
  107. package/dist/chunk-tey2nq7c.js +0 -31
  108. package/dist/chunk-z73xpsa0.js +0 -50
  109. package/dist/chunk-zzgredta.css +0 -1
  110. /package/workspace/.claude/skills/moi-workspace/{SCRATCHPAD.md → references/SCRATCHPAD.md} +0 -0
@@ -1,30 +1,36 @@
1
1
  // OpenClaw as a Harness. Thin wiring over this folder's modules — see
2
2
  // ../types.ts for the contract and ../README.md for the architecture.
3
3
  import type { DiscoveredWorkspaceCandidate, Harness } from '../types'
4
+ import { OPENCLAW_WIRE_SCOPE, getOpenClawGatewayStatus } from './gateway'
4
5
  import { toSessionInfo, toStreamEvents } from './adapter'
6
+ import { cronRunsToStreamEvents, openClawCronJobIdFromKey } from './cron-view'
5
7
  import {
8
+ archiveOpenClawSession,
6
9
  discoverOpenClawAgents,
10
+ getOpenClawCronRuns,
7
11
  getOpenClawModels,
8
12
  getOpenClawSessionMessages,
9
13
  getOpenClawSessions,
10
- getOpenClawWorkspacePreview
14
+ getOpenClawWorkspacePreview,
15
+ resolveOpenClawSessionKey
11
16
  } from './discovery'
12
17
  import {
13
18
  abortOpenClawRun,
14
19
  ensureOpenClawSessionLive,
15
20
  getLiveOpenClawEvents,
16
21
  getOpenClawActiveSessions,
22
+ killAllOpenClawSessions,
17
23
  sendOpenClawMessage
18
24
  } from './session'
19
25
 
20
26
  export const openclawHarness: Harness = {
21
27
  id: 'openclaw',
22
28
  capabilities: {
23
- supportsStreaming: false, // durable message rows only — deliberate v2 cut
29
+ supportsStreaming: true, // `chat` delta frames → StreamPreview
24
30
  imagesInline: 'path-note',
25
- liveModelSwitch: false,
26
- liveEffortSwitch: false,
27
- nativeUserEcho: true // gateway echoes sends (lagged); matched by text
31
+ liveModelSwitch: true, // sessions.patch { model } before each send
32
+ liveEffortSwitch: true, // sessions.patch { thinkingLevel }
33
+ nativeUserEcho: true // echo matched by `<runId>:user` idempotency key, text fallback
28
34
  },
29
35
 
30
36
  sendMessage: async input => {
@@ -34,6 +40,11 @@ export const openclawHarness: Harness = {
34
40
  return sendOpenClawMessage({ ...input, agentId: input.agentId })
35
41
  },
36
42
  interrupt: (workspaceId, sessionId) => abortOpenClawRun({ workspaceId, sessionId }),
43
+ // `sessions.patch { archived: true }`. 2026.6.x gateways reject the field
44
+ // (their patch schema predates it and validates with
45
+ // `additionalProperties: false`) — the RPC error propagates and the API
46
+ // layer reports the archive as failed.
47
+ archiveSession: (ws, sessionId) => archiveOpenClawSession(sessionId, ws.path, ws.agentId),
37
48
  activeSessions: () => getOpenClawActiveSessions(),
38
49
 
39
50
  listSessions: async ws => {
@@ -45,24 +56,34 @@ export const openclawHarness: Harness = {
45
56
  // Prefer the live view if we already hold one — keeps REST + WS in
46
57
  // agreement for any reload that lands while a run is active. The first cold
47
58
  // call also primes the live subscription so subsequent WS frames upsert
48
- // into the same view; the static transcript is the last resort.
59
+ // into the same view; the static transcript is the last resort. A session
60
+ // that still comes back empty may be an isolated cron bucket — its per-run
61
+ // transcripts are orphaned by the gateway's post-run session reset (see
62
+ // cron-view.ts), so fall back to synthesizing turns from `cron.runs`.
49
63
  sessionEvents: async (ws, sessionId) => {
50
- const live = getLiveOpenClawEvents(ws.id, sessionId)
51
- if (live) return live
52
- if (ws.agentId) {
53
- try {
54
- return await ensureOpenClawSessionLive({
55
- workspaceId: ws.id,
56
- workspacePath: ws.path,
57
- agentId: ws.agentId,
58
- sessionId
59
- })
60
- } catch {
61
- // fall through to static path
64
+ const events = await (async () => {
65
+ const live = getLiveOpenClawEvents(ws.id, sessionId)
66
+ if (live) return live
67
+ if (ws.agentId) {
68
+ try {
69
+ return await ensureOpenClawSessionLive({
70
+ workspaceId: ws.id,
71
+ workspacePath: ws.path,
72
+ agentId: ws.agentId,
73
+ sessionId
74
+ })
75
+ } catch {
76
+ // fall through to static path
77
+ }
62
78
  }
63
- }
64
- const preview = await getOpenClawSessionMessages(sessionId, ws.path, ws.agentId)
65
- return toStreamEvents(preview)
79
+ const preview = await getOpenClawSessionMessages(sessionId, ws.path, ws.agentId)
80
+ return toStreamEvents(preview)
81
+ })()
82
+ if (events.length > 0) return events
83
+ const key = await resolveOpenClawSessionKey(sessionId, ws.path, ws.agentId)
84
+ const jobId = key ? openClawCronJobIdFromKey(key) : null
85
+ if (!jobId) return events
86
+ return cronRunsToStreamEvents(await getOpenClawCronRuns(jobId))
66
87
  },
67
88
  listModels: () => getOpenClawModels(),
68
89
 
@@ -78,11 +99,25 @@ export const openclawHarness: Harness = {
78
99
  )
79
100
  },
80
101
 
102
+ // Server shutdown: tear down every live session (unsubscribe + stop ingest).
103
+ // The shared gateway client is left running — process exit drops it. Invoked
104
+ // from web.ts's SIGTERM/SIGINT handler via allHarnesses().shutdown().
105
+ shutdown: () => killAllOpenClawSessions(),
81
106
  skillsDir: workspaceRoot => `${workspaceRoot}/skills`,
82
107
 
108
+ // One process-global gateway connection → one shared wire-tap scope.
109
+ wireScope: () => OPENCLAW_WIRE_SCOPE,
110
+
83
111
  statusLines: () => {
84
112
  const active = getOpenClawActiveSessions()
113
+ const status = getOpenClawGatewayStatus()
114
+ const gateway = status.connected
115
+ ? `gateway connected · protocol ${status.info?.protocol ?? '?'} · server ${status.info?.serverVersion ?? '?'}`
116
+ : status.failure
117
+ ? `gateway ${status.failure.kind}: ${status.failure.message}`
118
+ : 'gateway not connected yet'
85
119
  return [
120
+ gateway,
86
121
  `live OpenClaw runs ${active.length}`,
87
122
  ...active.map(r => ` ▶ busy ws=${r.workspaceId} session=${r.sessionId}`)
88
123
  ]