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.
- package/client/api/workspace-keys.ts +1 -2
- package/client/app/AppRouter.tsx +10 -3
- package/client/app/routes/HomeRoute.tsx +1 -1
- package/client/app/shell/SidebarLayout.tsx +2 -14
- package/client/components/shared/Composer.tsx +20 -7
- package/client/components/shared/PanelHeader.tsx +8 -1
- package/client/components/ui/button.tsx +3 -3
- package/client/components/ui/dialog.tsx +1 -1
- package/client/components/ui/dropdown-menu.tsx +2 -2
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/resizable.tsx +40 -0
- package/client/features/chat/ChatEmptyState.tsx +9 -11
- package/client/features/chat/ChatPanel.tsx +76 -48
- package/client/features/chat/ChatPopup.tsx +16 -2
- package/client/features/chat/ChatPromptBubbles.tsx +6 -8
- package/client/features/chat/ChatSelector.tsx +24 -7
- package/client/features/chat/ModelPicker.tsx +5 -4
- package/client/features/chat/TurnView.tsx +108 -13
- package/client/features/chat/api.ts +1 -18
- package/client/features/chat/chat-send.ts +2 -2
- package/client/features/chat/{ChatComposer.tsx → composer/ChatComposer.tsx} +6 -5
- package/client/features/chat/composer/banners/ChatErrorBanner.tsx +28 -0
- package/client/features/chat/composer/banners/ComposerBanner.tsx +30 -0
- package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +91 -0
- package/client/features/{workspace → chat/composer/banners}/WorkspaceSkillUpdateBanner.tsx +9 -7
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +74 -0
- package/client/features/{workspace → chat/composer}/useWorkspaceSkillUpdates.ts +1 -1
- package/client/features/chat/group-turns.ts +46 -28
- package/client/features/chat/interleave-notices.ts +84 -0
- package/client/features/chat/model-order.ts +9 -3
- package/client/features/chat/tool-group/TimelineRow.tsx +23 -11
- package/client/features/chat/tool-group/ToolCallGroup.tsx +38 -3
- package/client/features/chat/tool-group/format.ts +23 -7
- package/client/features/chat/useAppletChatMessage.ts +11 -16
- package/client/features/chat/useChat.ts +3 -7
- package/client/features/dev/ChatStatesPage.tsx +428 -0
- package/client/features/dev/DevIndexPage.tsx +52 -0
- package/client/features/dev/DevRoutes.tsx +6 -3
- package/client/features/dev/HarnessDebugPage.tsx +3 -3
- package/client/features/dev/chat-states-fixtures.ts +744 -0
- package/client/features/scratchpad/Scratchpad.tsx +4 -0
- package/client/features/scratchpad/scratch-session.ts +71 -0
- package/client/features/views/ViewBuilderTab.tsx +5 -4
- package/client/features/views/useViewBuilderActions.ts +2 -2
- package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -2
- package/client/features/workspace/WorkspaceScreen.tsx +128 -146
- package/client/features/workspace/WorkspaceSplitLayout.tsx +111 -0
- package/client/features/workspace/api.ts +33 -8
- package/client/features/workspace/useFitsSplitLayout.ts +31 -5
- package/client/index.css +1 -1
- package/client/lib/flags.ts +4 -3
- package/client/runtime/useWorkspaceEvents.ts +18 -1
- package/client/store/ui.ts +5 -1
- package/dist/{chunk-0pcdwjkp.js → chunk-2vaafjp4.js} +1 -1
- package/dist/{chunk-9y2zbzqz.js → chunk-35fq49qa.js} +1 -1
- package/dist/chunk-gny990qx.css +1 -0
- package/dist/chunk-gt7n06ef.js +1 -0
- package/dist/{chunk-r5ce5cdg.js → chunk-kkj86722.js} +75 -75
- package/dist/chunk-n7pga5x3.js +80 -0
- package/dist/chunk-xeyxk7ep.js +10 -0
- package/dist/{chunk-h9h8f176.js → chunk-xzx7c9hq.js} +1 -1
- package/dist/index.html +1 -1
- package/lib/format.ts +17 -1
- package/lib/themes.ts +2 -2
- package/lib/types.ts +38 -8
- package/lib/workspace-layout.ts +2 -2
- package/package.json +2 -1
- package/server/agent.ts +199 -0
- package/server/api.ts +36 -17
- package/server/env-apply.ts +4 -0
- package/server/harness/README.md +28 -12
- package/server/harness/claude-code/auth.ts +54 -0
- package/server/harness/claude-code/index.ts +6 -1
- package/server/harness/codex/adapter.ts +9 -1
- package/server/harness/codex/auth.ts +50 -0
- package/server/harness/codex/index.ts +6 -1
- package/server/harness/codex/session.ts +33 -14
- package/server/harness/openclaw/NOTES.md +518 -187
- package/server/harness/openclaw/adapter.ts +125 -31
- package/server/harness/openclaw/compat.ts +99 -0
- package/server/harness/openclaw/cron-view.ts +78 -0
- package/server/harness/openclaw/discovery.ts +145 -52
- package/server/harness/openclaw/gateway.ts +224 -36
- package/server/harness/openclaw/index.ts +56 -21
- package/server/harness/openclaw/session.ts +971 -55
- package/server/harness/openclaw/strip.ts +87 -15
- package/server/harness/openclaw/thinking.ts +198 -0
- package/server/harness/types.ts +10 -5
- package/server/layout.ts +5 -2
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +19 -9
- package/client/features/dev/PixelPainter.tsx +0 -94
- package/client/features/dev/PlaygroundPage.tsx +0 -69
- package/dist/chunk-0k7brsms.js +0 -9
- package/dist/chunk-dfs36zgc.js +0 -1
- package/dist/chunk-dtwxpxbg.js +0 -51
- package/dist/chunk-ga7t9qsk.js +0 -2
- package/dist/chunk-tey2nq7c.js +0 -31
- package/dist/chunk-z73xpsa0.js +0 -50
- package/dist/chunk-zzgredta.css +0 -1
|
@@ -118,6 +118,11 @@ export type CodexModel = {
|
|
|
118
118
|
additionalSpeedTiers?: string[]
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
export function withCodexTurnDuration(turn: Turn, durationMs: number | null | undefined): Turn {
|
|
122
|
+
if (typeof durationMs !== 'number' || !Number.isFinite(durationMs) || durationMs < 0) return turn
|
|
123
|
+
return { ...turn, meta: { ...turn.meta, durationMs } }
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
// ---- discovery mappings ------------------------------------------------------
|
|
122
127
|
|
|
123
128
|
const CODEX_FAST_SERVICE_TIER = 'priority'
|
|
@@ -565,7 +570,10 @@ export function codexThreadToEvents(
|
|
|
565
570
|
const part = t.parts.find(p => p.type === 'tool-call')
|
|
566
571
|
if (sub && part?.type === 'tool-call') part.call.subagent = sub.record
|
|
567
572
|
}
|
|
568
|
-
events.push({
|
|
573
|
+
events.push({
|
|
574
|
+
kind: 'turn',
|
|
575
|
+
turn: t.role === 'assistant' ? withCodexTurnDuration(t, turn.durationMs) : t
|
|
576
|
+
})
|
|
569
577
|
continue
|
|
570
578
|
}
|
|
571
579
|
const n = codexItemToNotice(item, thread.id)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { HarnessAvailability, HarnessLogin } from '@/lib/types'
|
|
2
|
+
|
|
3
|
+
import { getCodexClient } from './client'
|
|
4
|
+
|
|
5
|
+
export type CodexAccountResponse = {
|
|
6
|
+
account: unknown | null
|
|
7
|
+
requiresOpenaiAuth: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type CodexLoginResponse = { type: string; authUrl?: string }
|
|
11
|
+
|
|
12
|
+
function needsCodexLogin(reason: string): HarnessAvailability {
|
|
13
|
+
return {
|
|
14
|
+
available: false,
|
|
15
|
+
reason,
|
|
16
|
+
loginCommand: 'codex login'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function codexAccountReadiness(response: CodexAccountResponse): HarnessAvailability {
|
|
21
|
+
// Non-OpenAI model providers can run without a Codex account. For OpenAI,
|
|
22
|
+
// an account object is the app-server's authoritative logged-in signal.
|
|
23
|
+
if (!response.requiresOpenaiAuth || response.account) return { available: true }
|
|
24
|
+
return needsCodexLogin('Codex is signed out. Sign in to send messages')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function getCodexAuthReadiness(workspacePath: string): Promise<HarnessAvailability> {
|
|
28
|
+
try {
|
|
29
|
+
const client = await getCodexClient(workspacePath)
|
|
30
|
+
const account = await client.rpc<CodexAccountResponse>('account/read', { refreshToken: true })
|
|
31
|
+
return codexAccountReadiness(account)
|
|
32
|
+
} catch {
|
|
33
|
+
return needsCodexLogin('Could not verify the Codex login')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function startCodexLogin(workspacePath: string): Promise<HarnessLogin> {
|
|
38
|
+
const client = await getCodexClient(workspacePath)
|
|
39
|
+
const login = await client.rpc<CodexLoginResponse>('account/login/start', {
|
|
40
|
+
type: 'chatgpt',
|
|
41
|
+
useHostedLoginSuccessPage: true,
|
|
42
|
+
appBrand: 'codex'
|
|
43
|
+
})
|
|
44
|
+
if (login.type !== 'chatgpt' || !login.authUrl) {
|
|
45
|
+
throw new Error('Codex did not return a browser login URL')
|
|
46
|
+
}
|
|
47
|
+
const url = new URL(login.authUrl)
|
|
48
|
+
if (url.protocol !== 'https:') throw new Error('Codex returned an unsafe login URL')
|
|
49
|
+
return { url: url.toString() }
|
|
50
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// ../types.ts for the contract and ../README.md for the architecture.
|
|
3
3
|
import type { Harness } from '../types'
|
|
4
4
|
import { findHarnessExecutable, pathHarnessAvailability } from '../executable'
|
|
5
|
+
import { getCodexAuthReadiness, startCodexLogin } from './auth'
|
|
5
6
|
import {
|
|
6
7
|
archiveCodexSession,
|
|
7
8
|
getCodexMcpStatus,
|
|
@@ -59,7 +60,11 @@ export const codexHarness: Harness = {
|
|
|
59
60
|
listModels: ws => getCodexModels(ws.path),
|
|
60
61
|
mcpStatus: ws => getCodexMcpStatus(ws.path),
|
|
61
62
|
discoverWorkspaces: registeredPaths => discoverCodexWorkspaces(registeredPaths),
|
|
62
|
-
availability: async
|
|
63
|
+
availability: async ws => {
|
|
64
|
+
const runtime = await pathHarnessAvailability('codex')
|
|
65
|
+
return runtime.available && ws ? getCodexAuthReadiness(ws.path) : runtime
|
|
66
|
+
},
|
|
67
|
+
startLogin: ws => startCodexLogin(ws.path),
|
|
63
68
|
|
|
64
69
|
onEnvChanged: workspacePath => killCodexWorkspace(workspacePath),
|
|
65
70
|
shutdown: () => killAllCodexClients(),
|
|
@@ -35,10 +35,12 @@ import {
|
|
|
35
35
|
codexServiceTierForFastMode,
|
|
36
36
|
codexItemToNotice,
|
|
37
37
|
codexItemToTurn,
|
|
38
|
-
codexThreadToEvents
|
|
38
|
+
codexThreadToEvents,
|
|
39
|
+
withCodexTurnDuration
|
|
39
40
|
} from './adapter'
|
|
40
41
|
import { type CodexClient, getCodexClient, interruptCodexTurn, readSubagentRecords } from './client'
|
|
41
42
|
import { generateCodexSessionTitle, renameCodexSessionIfUnchanged } from './session-title'
|
|
43
|
+
import { agentStore } from '../../agent'
|
|
42
44
|
import { debug } from '../../debug'
|
|
43
45
|
import { broadcast } from '../../state'
|
|
44
46
|
import { renameSelectedSession } from '../../selected-session'
|
|
@@ -243,30 +245,43 @@ function forwardPreview(
|
|
|
243
245
|
})
|
|
244
246
|
}
|
|
245
247
|
|
|
246
|
-
// Fold
|
|
247
|
-
//
|
|
248
|
-
function
|
|
248
|
+
// Fold native completion metadata into the newest assistant turn so replay and
|
|
249
|
+
// live rendering use the same display shape. Re-emits that turn (upsert-by-id).
|
|
250
|
+
function applyCompletionMeta(rec: SessionRecord, durationMs: number | null | undefined) {
|
|
249
251
|
const last = rec.lastUsage?.last
|
|
250
|
-
if (!last) return
|
|
251
252
|
for (let i = rec.view.turns.length - 1; i >= 0; i--) {
|
|
252
253
|
const t = rec.view.turns[i]
|
|
254
|
+
if (t.role === 'user' && t.origin.kind === 'user-input') return
|
|
253
255
|
if (t.role !== 'assistant') continue
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
...
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
let updated = withCodexTurnDuration(t, durationMs)
|
|
257
|
+
if (last) {
|
|
258
|
+
updated = {
|
|
259
|
+
...updated,
|
|
260
|
+
meta: {
|
|
261
|
+
...updated.meta,
|
|
262
|
+
usage: {
|
|
263
|
+
inputTokens: last.inputTokens,
|
|
264
|
+
outputTokens: last.outputTokens,
|
|
265
|
+
totalTokens: last.totalTokens
|
|
266
|
+
}
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
269
|
}
|
|
270
|
+
if (updated === t) return
|
|
265
271
|
emitTurnEvent(rec, { kind: 'turn', turn: updated })
|
|
266
272
|
return
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
275
|
|
|
276
|
+
// A send/turn failure can mean the account was signed out from outside moi —
|
|
277
|
+
// a `codex logout` in a terminal, say — which the cached availability
|
|
278
|
+
// snapshot won't reflect until its TTL expires. Force a fresh probe so the
|
|
279
|
+
// composer's availability banner flips right away instead of the next send
|
|
280
|
+
// failing the same way.
|
|
281
|
+
function refreshAvailability(workspaceId: string, workspacePath: string) {
|
|
282
|
+
void agentStore.refresh({ id: workspaceId, path: workspacePath, type: 'codex' })
|
|
283
|
+
}
|
|
284
|
+
|
|
270
285
|
function handleNotification(rec: SessionRecord, method: string, params: Record<string, unknown>) {
|
|
271
286
|
if (method === '__exit') {
|
|
272
287
|
// The app-server died (crash or env-change restart). Drop the record so
|
|
@@ -325,7 +340,7 @@ function handleNotification(rec: SessionRecord, method: string, params: Record<s
|
|
|
325
340
|
case 'turn/completed': {
|
|
326
341
|
const turn = params.turn as CodexTurn | undefined
|
|
327
342
|
rec.previews.clear()
|
|
328
|
-
|
|
343
|
+
applyCompletionMeta(rec, turn?.durationMs)
|
|
329
344
|
setProcessing(rec, false, null)
|
|
330
345
|
if (rec.refreshSessionsOnTurnComplete) {
|
|
331
346
|
rec.refreshSessionsOnTurnComplete = false
|
|
@@ -337,6 +352,7 @@ function handleNotification(rec: SessionRecord, method: string, params: Record<s
|
|
|
337
352
|
sessionId: rec.sessionId,
|
|
338
353
|
content: turn.error.message
|
|
339
354
|
})
|
|
355
|
+
refreshAvailability(rec.workspaceId, rec.workspacePath)
|
|
340
356
|
}
|
|
341
357
|
// An externally-interrupted turn otherwise ends silently, identical to a
|
|
342
358
|
// clean completion — surface the stop so the client can render it.
|
|
@@ -350,6 +366,7 @@ function handleNotification(rec: SessionRecord, method: string, params: Record<s
|
|
|
350
366
|
const message = err?.message ?? (typeof params.message === 'string' ? params.message : '')
|
|
351
367
|
if (message) {
|
|
352
368
|
broadcast(rec.workspaceId, { kind: 'error', sessionId: rec.sessionId, content: message })
|
|
369
|
+
refreshAvailability(rec.workspaceId, rec.workspacePath)
|
|
353
370
|
}
|
|
354
371
|
// A top-level error without a following turn/completed would otherwise
|
|
355
372
|
// leave the session busy forever — the error is terminal for the turn.
|
|
@@ -642,6 +659,7 @@ export async function sendCodexMessage(input: {
|
|
|
642
659
|
sessionId: input.sessionId,
|
|
643
660
|
content: err instanceof Error ? err.message : 'failed to start codex session'
|
|
644
661
|
})
|
|
662
|
+
refreshAvailability(input.workspaceId, input.workspacePath)
|
|
645
663
|
return
|
|
646
664
|
}
|
|
647
665
|
|
|
@@ -723,6 +741,7 @@ export async function sendCodexMessage(input: {
|
|
|
723
741
|
sessionId: rec.sessionId,
|
|
724
742
|
content: err instanceof Error ? err.message : 'send failed'
|
|
725
743
|
})
|
|
744
|
+
refreshAvailability(rec.workspaceId, rec.workspacePath)
|
|
726
745
|
}
|
|
727
746
|
}
|
|
728
747
|
|