moi-computer 0.8.0 → 0.8.1-next.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 (100) 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/ModelPicker.tsx +5 -4
  19. package/client/features/chat/TurnView.tsx +108 -13
  20. package/client/features/chat/api.ts +1 -18
  21. package/client/features/chat/chat-send.ts +2 -2
  22. package/client/features/chat/{ChatComposer.tsx → composer/ChatComposer.tsx} +6 -5
  23. package/client/features/chat/composer/banners/ChatErrorBanner.tsx +28 -0
  24. package/client/features/chat/composer/banners/ComposerBanner.tsx +30 -0
  25. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +91 -0
  26. package/client/features/{workspace → chat/composer/banners}/WorkspaceSkillUpdateBanner.tsx +9 -7
  27. package/client/features/chat/composer/useWorkspaceComposerState.tsx +74 -0
  28. package/client/features/{workspace → chat/composer}/useWorkspaceSkillUpdates.ts +1 -1
  29. package/client/features/chat/group-turns.ts +46 -28
  30. package/client/features/chat/interleave-notices.ts +84 -0
  31. package/client/features/chat/model-order.ts +9 -3
  32. package/client/features/chat/tool-group/TimelineRow.tsx +23 -11
  33. package/client/features/chat/tool-group/ToolCallGroup.tsx +38 -3
  34. package/client/features/chat/tool-group/format.ts +23 -7
  35. package/client/features/chat/useAppletChatMessage.ts +11 -16
  36. package/client/features/chat/useChat.ts +3 -7
  37. package/client/features/dev/ChatStatesPage.tsx +428 -0
  38. package/client/features/dev/DevIndexPage.tsx +52 -0
  39. package/client/features/dev/DevRoutes.tsx +6 -3
  40. package/client/features/dev/HarnessDebugPage.tsx +3 -3
  41. package/client/features/dev/chat-states-fixtures.ts +744 -0
  42. package/client/features/scratchpad/Scratchpad.tsx +4 -0
  43. package/client/features/scratchpad/scratch-session.ts +71 -0
  44. package/client/features/views/ViewBuilderTab.tsx +5 -4
  45. package/client/features/views/useViewBuilderActions.ts +2 -2
  46. package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -2
  47. package/client/features/workspace/WorkspaceScreen.tsx +128 -146
  48. package/client/features/workspace/WorkspaceSplitLayout.tsx +111 -0
  49. package/client/features/workspace/api.ts +33 -8
  50. package/client/features/workspace/useFitsSplitLayout.ts +31 -5
  51. package/client/index.css +1 -1
  52. package/client/lib/flags.ts +4 -3
  53. package/client/runtime/useWorkspaceEvents.ts +18 -1
  54. package/client/store/ui.ts +5 -1
  55. package/dist/{chunk-0pcdwjkp.js → chunk-2vaafjp4.js} +1 -1
  56. package/dist/{chunk-9y2zbzqz.js → chunk-35fq49qa.js} +1 -1
  57. package/dist/chunk-gny990qx.css +1 -0
  58. package/dist/chunk-gt7n06ef.js +1 -0
  59. package/dist/{chunk-r5ce5cdg.js → chunk-kkj86722.js} +75 -75
  60. package/dist/chunk-n7pga5x3.js +80 -0
  61. package/dist/chunk-xeyxk7ep.js +10 -0
  62. package/dist/{chunk-h9h8f176.js → chunk-xzx7c9hq.js} +1 -1
  63. package/dist/index.html +1 -1
  64. package/lib/format.ts +17 -1
  65. package/lib/themes.ts +2 -2
  66. package/lib/types.ts +38 -8
  67. package/lib/workspace-layout.ts +2 -2
  68. package/package.json +2 -1
  69. package/server/agent.ts +199 -0
  70. package/server/api.ts +36 -17
  71. package/server/env-apply.ts +4 -0
  72. package/server/harness/README.md +28 -12
  73. package/server/harness/claude-code/auth.ts +54 -0
  74. package/server/harness/claude-code/index.ts +6 -1
  75. package/server/harness/codex/adapter.ts +9 -1
  76. package/server/harness/codex/auth.ts +50 -0
  77. package/server/harness/codex/index.ts +6 -1
  78. package/server/harness/codex/session.ts +33 -14
  79. package/server/harness/openclaw/NOTES.md +518 -187
  80. package/server/harness/openclaw/adapter.ts +125 -31
  81. package/server/harness/openclaw/compat.ts +99 -0
  82. package/server/harness/openclaw/cron-view.ts +78 -0
  83. package/server/harness/openclaw/discovery.ts +145 -52
  84. package/server/harness/openclaw/gateway.ts +224 -36
  85. package/server/harness/openclaw/index.ts +56 -21
  86. package/server/harness/openclaw/session.ts +971 -55
  87. package/server/harness/openclaw/strip.ts +87 -15
  88. package/server/harness/openclaw/thinking.ts +198 -0
  89. package/server/harness/types.ts +10 -5
  90. package/server/layout.ts +5 -2
  91. package/workspace/.claude/skills/moi-workspace/DESIGN.md +19 -9
  92. package/client/features/dev/PixelPainter.tsx +0 -94
  93. package/client/features/dev/PlaygroundPage.tsx +0 -69
  94. package/dist/chunk-0k7brsms.js +0 -9
  95. package/dist/chunk-dfs36zgc.js +0 -1
  96. package/dist/chunk-dtwxpxbg.js +0 -51
  97. package/dist/chunk-ga7t9qsk.js +0 -2
  98. package/dist/chunk-tey2nq7c.js +0 -31
  99. package/dist/chunk-z73xpsa0.js +0 -50
  100. package/dist/chunk-zzgredta.css +0 -1
@@ -1,44 +1,62 @@
1
- // Visual-grouping pass on top of the raw `view.turns` stream.
2
- //
3
- // Background (see `dev/turn-spacing.md`): some providers (OpenAI Codex,
4
- // notably) serialize one assistant message per agent-loop step. A run that
5
- // does Read → Write → Bash often arrives as four tool-only assistant turns
6
- // with no text in between. Each turn renders as its own `<TurnView>` and
7
- // inherits the wider inter-turn gap, which makes the chat feel sparse.
8
- //
9
- // This helper merges consecutive assistant turns into a single synthetic
10
- // turn whenever they're "tool-only" — i.e. the joining turn has no `text`
11
- // part. A turn that contains a `text` part *always* starts a new group.
12
- // User turns, replays, and any non-assistant turn pass through unchanged.
13
- //
14
- // Key stability: the merged turn keeps the FIRST member's `id` (and `seq`,
15
- // `timestamp`, `meta`, etc.). Live-stream upserts that update a member
16
- // turn's parts (tool-result fold-in, optimistic-id rename) flow through
17
- // without changing the merged group's key, so React's reconciliation
18
- // updates in place. New turns appended later either join the same group
19
- // (same key, more parts) or start a new one (their own id).
20
- import type { Part, Turn } from '@/lib/types'
1
+ // Visual grouping on top of the raw `view.turns` stream. Providers serialize
2
+ // one agent run differently: Claude can mix several blocks in one assistant
3
+ // message, while Codex emits a separate item for every step. The chat renders
4
+ // consecutive assistant turns as one run so both shapes finish the same way.
5
+ import type { Turn } from '@/lib/types'
21
6
 
22
- function hasText(parts: Part[]): boolean {
23
- return parts.some(p => p.type === 'text')
7
+ function isVisibleChatTurn(turn: Turn): boolean {
8
+ return (
9
+ turn.origin.kind !== 'replay' &&
10
+ turn.origin.kind !== 'synthetic' &&
11
+ turn.origin.kind !== 'subagent-prompt'
12
+ )
13
+ }
14
+
15
+ function mergeAssistantTurns(first: Turn, next: Turn): Turn {
16
+ const meta = first.meta || next.meta ? { ...first.meta, ...next.meta } : undefined
17
+ return {
18
+ ...first,
19
+ parts: [...first.parts, ...next.parts],
20
+ timestamp: next.timestamp ?? first.timestamp,
21
+ meta
22
+ }
24
23
  }
25
24
 
26
25
  export function groupTurns(turns: Turn[]): Turn[] {
27
26
  const out: Turn[] = []
28
27
  for (const t of turns) {
28
+ if (!isVisibleChatTurn(t)) continue
29
29
  if (t.role !== 'assistant') {
30
30
  out.push(t)
31
31
  continue
32
32
  }
33
33
  const last = out.length > 0 ? out[out.length - 1] : null
34
- const canJoin = !hasText(t.parts) && last !== null && last.role === 'assistant'
35
- if (canJoin) {
36
- // Replace the last entry with a merged copy. Spread `last` first so
37
- // its id/timestamp/meta/origin/seq survive; only `parts` is rebuilt.
38
- out[out.length - 1] = { ...last, parts: [...last.parts, ...t.parts] }
34
+ if (last?.role === 'assistant') {
35
+ // Keep the first id as the React key while carrying the latest timestamp
36
+ // and metadata forward for the completed run.
37
+ out[out.length - 1] = mergeAssistantTurns(last, t)
39
38
  } else {
40
39
  out.push(t)
41
40
  }
42
41
  }
43
- return out
42
+ return out.map((turn, index) => {
43
+ const previous = out[index - 1]
44
+ if (
45
+ turn.role !== 'assistant' ||
46
+ previous?.role !== 'user' ||
47
+ previous.origin.kind !== 'user-input' ||
48
+ !previous.timestamp ||
49
+ !turn.timestamp
50
+ ) {
51
+ return turn
52
+ }
53
+
54
+ const startedAt = Date.parse(previous.timestamp)
55
+ const finishedAt = Date.parse(turn.timestamp)
56
+ if (!Number.isFinite(startedAt) || !Number.isFinite(finishedAt) || finishedAt < startedAt) {
57
+ return turn
58
+ }
59
+
60
+ return { ...turn, meta: { ...turn.meta, durationMs: finishedAt - startedAt } }
61
+ })
44
62
  }
@@ -0,0 +1,84 @@
1
+ // Weaves transcript notices (context compaction, mid-session model switches)
2
+ // into the turn list so each one reads at the moment it happened.
3
+ //
4
+ // Only 'compact' and 'model-change' render today. Every other SystemNotice
5
+ // kind is claude-code-specific plumbing with no designed chat treatment yet,
6
+ // so `chatNoticeLabel` skips it explicitly.
7
+ import type { SystemNotice, Turn } from '@/lib/types'
8
+
9
+ export type ChatTimelineItem =
10
+ | { kind: 'turn'; turn: Turn }
11
+ | { kind: 'notice'; notice: SystemNotice }
12
+
13
+ // One-line copy for a notice row; null = this kind does not render in chat.
14
+ export function chatNoticeLabel(notice: SystemNotice): string | null {
15
+ switch (notice.kind) {
16
+ case 'compact':
17
+ return 'Context compacted'
18
+ case 'model-change':
19
+ return notice.prev
20
+ ? `Model changed to ${notice.model} (was ${notice.prev})`
21
+ : `Model changed to ${notice.model}`
22
+ // Claude-code-specific notices without a designed chat treatment yet —
23
+ // skipped on purpose. New kinds stay hidden until designed.
24
+ case 'rate-limit':
25
+ case 'api-retry':
26
+ case 'hook':
27
+ case 'session-state':
28
+ case 'files-persisted':
29
+ case 'elicitation':
30
+ default:
31
+ return null
32
+ }
33
+ }
34
+
35
+ function parseTime(value: string | undefined): number | undefined {
36
+ if (!value) return undefined
37
+ const time = Date.parse(value)
38
+ return Number.isNaN(time) ? undefined : time
39
+ }
40
+
41
+ // Merge renderable notices into the turn stream chronologically: a notice
42
+ // lands before the first turn strictly newer than its `at`. Turns keep their
43
+ // original order; a turn without a timestamp inherits the previous turn's, so
44
+ // notices never jump ahead of undated turns. Notices with no parseable `at`
45
+ // have no comparable anchor and go after the last turn.
46
+ //
47
+ // Known limitation — a transcript whose turns are ALL undated gives nothing to
48
+ // compare against, so every dated notice lands after the last turn. That is
49
+ // right while a session is live (compaction happens at the current end of the
50
+ // conversation) but drifts on replay: the notice follows the new end instead of
51
+ // staying where it happened. Codex hits this today — `codexItemToTurn` sets no
52
+ // `timestamp` and `codexItemToNotice` stamps `at` with replay-time `new Date()`
53
+ // — so fixing it means giving those rows a real anchor, not changing the merge.
54
+ export function interleaveNotices(turns: Turn[], notices: SystemNotice[]): ChatTimelineItem[] {
55
+ const shown = notices.filter(notice => chatNoticeLabel(notice) !== null)
56
+ if (shown.length === 0) return turns.map((turn): ChatTimelineItem => ({ kind: 'turn', turn }))
57
+
58
+ const dated: { notice: SystemNotice; time: number }[] = []
59
+ const anchorless: SystemNotice[] = []
60
+ for (const notice of shown) {
61
+ const time = parseTime(notice.at)
62
+ if (time === undefined) anchorless.push(notice)
63
+ else dated.push({ notice, time })
64
+ }
65
+ dated.sort((a, b) => a.time - b.time)
66
+
67
+ const out: ChatTimelineItem[] = []
68
+ let next = 0
69
+ let turnTime = Number.NEGATIVE_INFINITY
70
+ for (const turn of turns) {
71
+ turnTime = Math.max(turnTime, parseTime(turn.timestamp) ?? turnTime)
72
+ // `<=`: a notice stamped with the turn's own timestamp announces that
73
+ // turn (model-change carries the switching turn's time) and must render
74
+ // before it.
75
+ while (next < dated.length && dated[next].time <= turnTime) {
76
+ out.push({ kind: 'notice', notice: dated[next].notice })
77
+ next += 1
78
+ }
79
+ out.push({ kind: 'turn', turn })
80
+ }
81
+ for (; next < dated.length; next += 1) out.push({ kind: 'notice', notice: dated[next].notice })
82
+ for (const notice of anchorless) out.push({ kind: 'notice', notice })
83
+ return out
84
+ }
@@ -37,20 +37,26 @@ function stableSortModels(models: Model[], compare: ModelComparator): Model[] {
37
37
  .map(({ model }) => model)
38
38
  }
39
39
 
40
+ // `modelDefault` is the provider's own resolved default for this model
41
+ // (OpenClaw `thinkingDefault`, which is `low` on one model and `off` on the
42
+ // next). It outranks the app-wide DEFAULT_EFFORT but never the user's pick.
40
43
  export function resolveDisplayedEffort(
41
44
  levels: readonly string[],
42
- selectedEffort: string | undefined
45
+ selectedEffort: string | undefined,
46
+ modelDefault?: string
43
47
  ): string | undefined {
44
48
  if (selectedEffort && levels.includes(selectedEffort)) return selectedEffort
49
+ if (modelDefault && levels.includes(modelDefault)) return modelDefault
45
50
  if (levels.includes(DEFAULT_EFFORT)) return DEFAULT_EFFORT
46
51
  return levels[levels.length - 1]
47
52
  }
48
53
 
49
54
  export function resolveEffortIndex(
50
55
  levels: readonly string[],
51
- selectedEffort: string | undefined
56
+ selectedEffort: string | undefined,
57
+ modelDefault?: string
52
58
  ): number {
53
- const displayedEffort = resolveDisplayedEffort(levels, selectedEffort)
59
+ const displayedEffort = resolveDisplayedEffort(levels, selectedEffort, modelDefault)
54
60
  return displayedEffort ? levels.indexOf(displayedEffort) : -1
55
61
  }
56
62
 
@@ -41,31 +41,44 @@ export function TimelineRow({
41
41
  isError = false,
42
42
  children
43
43
  }: TimelineRowProps) {
44
+ const hasLargeMarker = marker != null || loading
45
+
44
46
  return (
45
47
  <div className="relative flex gap-2.5">
46
48
  {/* Odd rail width (13px) puts the centerline on a half-pixel, so a crisp
47
- 1px rule lands on a single pixel column instead of straddling two. */}
49
+ 1px rule lands on a single pixel column instead of straddling two.
50
+ The split rule leaves a real gap around the node, so it works on any
51
+ surface without a background-colored halo. */}
48
52
  <div className="relative w-[13px] shrink-0">
49
53
  {!isFirst && (
50
- <span className="absolute top-0 left-1/2 h-3 w-px -translate-x-1/2 bg-border" />
54
+ <span
55
+ className={cn(
56
+ 'absolute top-0 left-1/2 w-px -translate-x-1/2 bg-border',
57
+ hasLargeMarker ? 'h-1' : 'h-2.5'
58
+ )}
59
+ />
51
60
  )}
52
61
  {!isLast && (
53
- <span className="absolute top-[18px] bottom-0 left-1/2 w-px -translate-x-1/2 bg-border" />
62
+ <span
63
+ className={cn(
64
+ 'absolute bottom-0 left-1/2 w-px -translate-x-1/2 bg-border',
65
+ hasLargeMarker ? 'top-[26px]' : 'top-5'
66
+ )}
67
+ />
54
68
  )}
55
69
  {marker ? (
56
70
  <span className="absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2">
57
71
  {marker}
58
72
  </span>
59
73
  ) : loading ? (
60
- // A spinner node stands in for the dot; bg-background carves the rule.
61
- <span className="absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 rounded-full bg-background p-0.5">
74
+ // A spinner node stands in for the dot.
75
+ <span className="absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 p-0.5">
62
76
  <IconLoader2 size={12} stroke={1.75} className="animate-spin text-muted-foreground" />
63
77
  </span>
64
78
  ) : (
65
- // Background-colored ring carves a gap in the rule around the dot.
66
79
  <span
67
80
  className={cn(
68
- 'absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full ring-3 ring-background',
81
+ 'absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full',
69
82
  isError ? 'bg-destructive' : 'bg-border'
70
83
  )}
71
84
  />
@@ -95,14 +108,13 @@ export function RowChevron({ open }: { open: boolean }) {
95
108
  )
96
109
  }
97
110
 
98
- // A rounded node box used as a timeline marker (size-4 by default). The bg-colored
99
- // ring carves it out of the rule, matching the dot rows. Shared by the MCP logo,
100
- // the skill node, and the (larger) subagent node; pass `className` to resize.
111
+ // A rounded node box used as a timeline marker (size-4 by default). Shared by the
112
+ // MCP logo, the skill node, and the (larger) subagent node; pass `className` to resize.
101
113
  export function NodeBox({ children, className }: { children: ReactNode; className?: string }) {
102
114
  return (
103
115
  <span
104
116
  className={cn(
105
- 'flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted ring-2 ring-background',
117
+ 'flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted',
106
118
  className
107
119
  )}
108
120
  >
@@ -32,6 +32,7 @@ import {
32
32
  } from './TimelineRow'
33
33
  import { ToolOutput } from './ToolOutput'
34
34
  import {
35
+ formatDuration,
35
36
  formatInputBrief,
36
37
  parseCodexMcp,
37
38
  formatMcpTool,
@@ -62,7 +63,13 @@ export function ToolCallGroup({ parts, cwd = null, processing = false }: ToolCal
62
63
  // A reasoning block reads as live "Thinking" only while it's the last
63
64
  // row of an active stream; anything after it makes it a done "Thought".
64
65
  return (
65
- <ReasoningRow key={i} text={part.text} inProgress={processing && isLast} {...pos} />
66
+ <ReasoningRow
67
+ key={i}
68
+ text={part.text}
69
+ durationMs={part.durationMs}
70
+ inProgress={processing && isLast}
71
+ {...pos}
72
+ />
66
73
  )
67
74
  return <ToolCallCard key={part.call.toolCallId || i} call={part.call} cwd={cwd} {...pos} />
68
75
  })}
@@ -144,9 +151,37 @@ function ToolRow({ isFirst, isLast, call, leading, marker, name, brief, preview
144
151
  // so the streaming thought is visible; it collapses on its own the moment
145
152
  // anything follows it (a text/tool row makes it no longer the last row, so
146
153
  // `inProgress` goes false and it reverts to the user's collapsed default).
147
- type ReasoningRowProps = RowPosition & { text: string; inProgress?: boolean }
148
- function ReasoningRow({ isFirst, isLast, text, inProgress = false }: ReasoningRowProps) {
154
+ //
155
+ // Some backends report that the model reasoned without handing over the text
156
+ // (Anthropic `redacted_thinking`; the OpenClaw codex app-server, which sends a
157
+ // Reasoning item with timing only). Those rows have nothing to expand, so they
158
+ // render as a bare label — "Thought for 1.2s" — with no chevron.
159
+ type ReasoningRowProps = RowPosition & {
160
+ text: string
161
+ inProgress?: boolean
162
+ durationMs?: number
163
+ }
164
+ function ReasoningRow({
165
+ isFirst,
166
+ isLast,
167
+ text,
168
+ inProgress = false,
169
+ durationMs
170
+ }: ReasoningRowProps) {
149
171
  const [open, setOpen] = useState(false)
172
+ if (!text) {
173
+ const doneLabel =
174
+ durationMs === undefined ? 'Thought' : `Thought for ${formatDuration(durationMs)}`
175
+ return (
176
+ <TimelineRow isFirst={isFirst} isLast={isLast} loading={inProgress}>
177
+ <div className={cn(HEADER, 'min-w-0 flex-1 cursor-default')}>
178
+ <span className="text-xs font-medium text-muted-foreground">
179
+ {inProgress ? 'Thinking' : doneLabel}
180
+ </span>
181
+ </div>
182
+ </TimelineRow>
183
+ )
184
+ }
150
185
  const label = inProgress ? 'Thinking' : 'Thought'
151
186
  const expanded = inProgress || open
152
187
  return (
@@ -68,14 +68,18 @@ function getInputValue(input: Record<string, unknown>, key: string): string {
68
68
  return typeof value === 'string' ? value : ''
69
69
  }
70
70
 
71
- // Compact wall-clock duration: sub-second → "850ms", under a minute → "3.2s" /
72
- // "11s", longer → "1m 5s". Used on the subagent card's duration badge.
71
+ // Compact wall-clock duration in whole seconds: under a minute → "3s", longer
72
+ // → "1m 5s". Used on agent-run and subagent duration labels.
73
+ //
74
+ // Never milliseconds. A column of "Thought for 514ms" / "Thought for 784ms"
75
+ // rows reads as jitter — the exact figure is noise at this size, and the
76
+ // varying width makes the list look ragged next to a plain "Thought for 1s".
77
+ // Sub-second durations round UP so a real pause never renders as "0s".
73
78
  export function formatDuration(ms: number): string {
74
- if (ms < 1000) return `${Math.round(ms)}ms`
75
- const s = ms / 1000
76
- if (s < 60) return `${s < 10 ? s.toFixed(1) : Math.round(s)}s`
79
+ const s = Math.max(1, Math.round(ms / 1000))
80
+ if (s < 60) return `${s}s`
77
81
  const m = Math.floor(s / 60)
78
- const rem = Math.round(s % 60)
82
+ const rem = s % 60
79
83
  return rem ? `${m}m ${rem}s` : `${m}m`
80
84
  }
81
85
 
@@ -97,6 +101,11 @@ const OPENCLAW_TOOL_LABELS: Record<string, string> = {
97
101
  edit: 'Edit file',
98
102
  apply_patch: 'Edit',
99
103
  exec: 'Bash',
104
+ // 2026.7.2+ renamed the shell tool `bash` and split filesystem tools out.
105
+ bash: 'Bash',
106
+ ls: 'List files',
107
+ find: 'Find files',
108
+ grep: 'Search',
100
109
  process: 'Manage process',
101
110
  web_search: 'Web search',
102
111
  web_fetch: 'Fetch',
@@ -309,7 +318,14 @@ function formatOpenClawBrief(
309
318
  const firstLine = patch.split('\n').find(l => l.startsWith('*** ')) ?? patch.split('\n')[0]
310
319
  return shorten(firstLine ?? '')
311
320
  }
312
- if (tool === 'exec') return shorten(`$ ${getInputValue(input, 'command')}`)
321
+ if (tool === 'exec' || tool === 'bash') {
322
+ // `command` on 2026.7.1 + the newer `bash` tool; the 2026.7.2 exec sandbox
323
+ // instead carries a `code` script (JS that shells out) — show whichever.
324
+ const command = getInputValue(input, 'command') || getInputValue(input, 'code')
325
+ return command ? shorten(`$ ${command}`) : ''
326
+ }
327
+ if (tool === 'ls' || tool === 'find' || tool === 'grep')
328
+ return shorten(getInputValue(input, 'path') || getInputValue(input, 'pattern'))
313
329
  if (tool === 'process') {
314
330
  const action = getInputValue(input, 'action')
315
331
  const name = getInputValue(input, 'name')
@@ -13,6 +13,7 @@
13
13
  import { reportAppletError } from '@/client/features/applets/applet-log'
14
14
  import { type AppletChatMessage, useAppletEvent } from '@/client/features/applets/applet-runtime'
15
15
  import type { ChatSendOptions } from '@/client/features/chat/chat-send'
16
+ import type { ComposerAvailability } from '@/client/components/shared/Composer'
16
17
  import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
17
18
 
18
19
  type UseAppletChatMessageOptions = {
@@ -21,36 +22,30 @@ type UseAppletChatMessageOptions = {
21
22
  // full-screen mode the chat is a popover that is closed by default, so
22
23
  // without this the agent would start working somewhere the user can't see.
23
24
  revealChat: () => void
24
- // Same gate the composer's send button uses: `null` means the agent is
25
- // ready, a string names why it isn't, and `undefined` means the availability
26
- // query hasn't answered yet. Only `null` may send.
27
- unavailableReason: string | null | undefined
25
+ // Same explicit availability state the composer's send button uses.
26
+ composerAvailability: ComposerAvailability
28
27
  }
29
28
 
30
29
  // Why an applet message can't go out right now, or null when it can. The gate
31
- // is exactly the composer's — `canSubmitComposerAction` requires `null`, so
32
- // `undefined` (availability still loading) blocks there too. Starting a run the
33
- // visible UI would have refused is worse than dropping a click the user can
34
- // repeat a moment later.
35
- export function appletSendBlockedReason(
36
- unavailableReason: string | null | undefined
37
- ): string | null {
38
- if (unavailableReason === null) return null
39
- if (unavailableReason === undefined) {
30
+ // is exactly the composer's. Starting a run the visible UI would have refused
31
+ // is worse than dropping a click the user can repeat a moment later.
32
+ export function appletSendBlockedReason(availability: ComposerAvailability): string | null {
33
+ if (availability.status === 'available') return null
34
+ if (availability.status === 'checking') {
40
35
  return "this workspace's agent availability has not resolved yet"
41
36
  }
42
- return `this workspace's agent is unavailable (${unavailableReason})`
37
+ return "this workspace's agent is unavailable"
43
38
  }
44
39
 
45
40
  export function useAppletChatMessage({
46
41
  send,
47
42
  revealChat,
48
- unavailableReason
43
+ composerAvailability
49
44
  }: UseAppletChatMessageOptions): void {
50
45
  const workspaceId = useWorkspaceId()
51
46
 
52
47
  useAppletEvent(workspaceId, 'sendChatMessage', (event: AppletChatMessage) => {
53
- const blocked = appletSendBlockedReason(unavailableReason)
48
+ const blocked = appletSendBlockedReason(composerAvailability)
54
49
  if (blocked) {
55
50
  // Journaled rather than dropped quietly: from the applet's side the
56
51
  // button did nothing, and this is the only place that says why.
@@ -3,12 +3,8 @@ import { useCallback, useMemo } from 'react'
3
3
  import { useQueryClient } from '@tanstack/react-query'
4
4
 
5
5
  import { workspaceKeys } from '@/client/api/workspace-keys'
6
- import {
7
- useSessionConfig,
8
- useSessionView,
9
- useWorkspaceModels,
10
- useWorkspaceSessions
11
- } from '@/client/features/chat/api'
6
+ import { useSessionConfig, useSessionView, useWorkspaceSessions } from '@/client/features/chat/api'
7
+ import { useWorkspaceAgent } from '@/client/features/workspace/api'
12
8
  import { useSelectedSession } from '@/client/features/chat/useSelectedSession'
13
9
  import {
14
10
  type WorkspaceTabAddress,
@@ -51,7 +47,7 @@ export function useChat(address: WorkspaceTabAddress) {
51
47
  const { layout } = useWorkspaceLayoutCtx()
52
48
  const [selectedSession, selectSession] = useSelectedSession()
53
49
  const selectedSessionId = selectedSession ?? null
54
- const modelsData = useWorkspaceModels(workspaceId).data
50
+ const modelsData = useWorkspaceAgent(workspaceId).data
55
51
  const sessions = useWorkspaceSessions(workspaceId).data
56
52
  // Snapshot of the workspace's ambient UI state + queued one-shot
57
53
  // directives, taken when the message actually goes out.