moi-computer 0.3.1-next.0 → 0.3.1-next.1
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 +2 -2
- package/client/app/AppRouter.tsx +0 -2
- package/client/app/shell/SidebarLayout.tsx +3 -16
- package/client/assets/openai.svg +1 -3
- package/client/components/shared/Composer.tsx +53 -2
- package/client/components/ui/button.tsx +1 -1
- package/client/components/ui/tooltip.tsx +12 -15
- package/client/features/chat/ChatComposer.tsx +25 -15
- package/client/features/chat/ChatPanel.tsx +5 -2
- package/client/features/chat/MarkdownContent.tsx +20 -2
- package/client/features/chat/ModelPicker.tsx +5 -3
- package/client/features/chat/TurnView.tsx +2 -2
- package/client/features/chat/chat-frames.ts +13 -6
- package/client/features/chat/chat-send.ts +1 -1
- package/client/features/chat/chat-store.ts +22 -17
- package/client/features/chat/tool-group/ToolOutput.tsx +4 -12
- package/client/features/chat/tool-group/format.ts +0 -6
- package/client/features/chat/useChat.ts +11 -2
- package/client/features/connectors/McpServerCards.tsx +95 -0
- package/client/features/connectors/api.ts +0 -11
- package/client/features/home/HomePage.tsx +33 -28
- package/client/features/home/api.ts +24 -12
- package/client/features/home/workspace-presentation.tsx +17 -15
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +243 -0
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +95 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +230 -0
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +35 -0
- package/client/features/home/workspace-setup/useWorkspaceImport.ts +61 -0
- package/client/features/settings/ConnectorsSettings.tsx +89 -0
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceSettings.tsx +8 -4
- package/client/features/views/ViewBuilderTab.tsx +19 -15
- package/client/features/views/useViewBuilderActions.ts +1 -1
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -4
- package/client/features/workspace/WorkspaceScreen.tsx +11 -3
- package/client/features/workspace/api.ts +19 -1
- package/client/features/workspace/moi-context.ts +85 -0
- package/client/main.tsx +7 -4
- package/dist/{chunk-cs8vbert.js → chunk-1dfbr7n2.js} +2 -2
- package/dist/chunk-339jds4x.js +15 -0
- package/dist/chunk-3xsvsnhr.css +1 -0
- package/dist/{chunk-zpxrb1ce.js → chunk-anqmsbjt.js} +2 -2
- package/dist/chunk-hbvfb6sk.js +63 -0
- package/dist/{chunk-kxmvv1ax.js → chunk-qwm5f6qk.js} +1 -1
- package/dist/{chunk-axszxe4c.js → chunk-sxbfh73c.js} +1 -1
- package/dist/chunk-yp4srgqt.js +10 -0
- package/dist/index.html +1 -1
- package/dist/openai-ep9ht2pq.svg +1 -0
- package/lib/ids.ts +15 -0
- package/lib/moi-context.ts +170 -0
- package/lib/types.ts +29 -11
- package/lib/view-builder-directives.ts +16 -0
- package/lib/workspace-types.ts +12 -0
- package/package.json +2 -1
- package/server/api.ts +92 -30
- package/server/harness/README.md +25 -9
- package/server/harness/claude-code/NOTES.md +20 -6
- package/server/harness/claude-code/adapter.ts +2 -2
- package/server/harness/claude-code/git-worktree.ts +32 -0
- package/server/harness/claude-code/index.ts +32 -12
- package/server/harness/claude-code/mcp.ts +16 -65
- package/server/harness/claude-code/models.ts +3 -0
- package/server/harness/claude-code/session.ts +196 -61
- package/server/harness/codex/NOTES.md +41 -11
- package/server/harness/codex/adapter.ts +21 -7
- package/server/harness/codex/client.ts +33 -17
- package/server/harness/codex/discovery.ts +114 -0
- package/server/harness/codex/index.ts +9 -5
- package/server/harness/codex/probe.ts +4 -2
- package/server/harness/codex/session.ts +57 -5
- package/server/harness/executable.ts +82 -0
- package/server/harness/openclaw/adapter.ts +8 -1
- package/server/harness/openclaw/index.ts +8 -14
- package/server/harness/openclaw/session.ts +50 -10
- package/server/harness/openclaw/strip.ts +2 -2
- package/server/harness/shell-path.ts +79 -0
- package/server/harness/types.ts +22 -5
- package/server/registry.ts +57 -12
- package/server/view-builders.ts +3 -2
- package/server/web.ts +24 -8
- package/server/workspace-import.ts +45 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +3 -3
- package/client/features/connectors/ConnectorsPage.tsx +0 -92
- package/client/features/connectors/McpMenu.tsx +0 -145
- package/client/features/home/CreateWorkspaceDialog.tsx +0 -130
- package/client/features/home/CreateWorkspaceDialogSteps.tsx +0 -234
- package/dist/chunk-4vf1t6v1.js +0 -10
- package/dist/chunk-b3ynfk4g.js +0 -62
- package/dist/chunk-b4b276wx.js +0 -15
- package/dist/chunk-npwq6jmr.css +0 -1
- package/dist/openai-h13pza4b.svg +0 -3
- package/lib/view-builder-meta.ts +0 -35
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import { ChatPanel } from '@/client/features/chat/ChatPanel'
|
|
15
15
|
import { ChatPopup } from '@/client/features/chat/ChatPopup'
|
|
16
16
|
import { CustomizePanel } from '@/client/features/workspace/CustomizePanel'
|
|
17
|
-
import { McpMenu } from '@/client/features/connectors/McpMenu'
|
|
18
17
|
import { AppletMount } from '@/client/features/applets/AppletMount'
|
|
19
18
|
import { WidgetErrorBoundary } from '@/client/features/applets/WidgetErrorBoundary'
|
|
20
19
|
import { Widgets } from '@/client/features/widgets/Widgets'
|
|
@@ -28,6 +27,7 @@ import { useView } from '@/client/features/applets/useApplet'
|
|
|
28
27
|
import { ViewBuilderTab } from '@/client/features/views/ViewBuilderTab'
|
|
29
28
|
import { useViewBuilderActions } from '@/client/features/views/useViewBuilderActions'
|
|
30
29
|
import { useFitsSplitLayout } from '@/client/features/workspace/useFitsSplitLayout'
|
|
30
|
+
import { useWorkspaceAvailability } from '@/client/features/workspace/api'
|
|
31
31
|
import { useWorkspaceTheme } from '@/client/features/workspace/useWorkspaceTheme'
|
|
32
32
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
33
33
|
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
@@ -157,7 +157,7 @@ type WorkspaceCustomizeActionProps = {
|
|
|
157
157
|
|
|
158
158
|
function WorkspaceCustomizeAction({ active, onToggle }: WorkspaceCustomizeActionProps) {
|
|
159
159
|
return (
|
|
160
|
-
<Tooltip
|
|
160
|
+
<Tooltip>
|
|
161
161
|
<TooltipTrigger
|
|
162
162
|
render={
|
|
163
163
|
<Button
|
|
@@ -274,6 +274,11 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
274
274
|
dismissError
|
|
275
275
|
} = useChat()
|
|
276
276
|
const { layout, setLayout, name, icon, provider, workspaceId } = useWorkspaceLayoutCtx()
|
|
277
|
+
// Keep the composer read/write, but block sends when its agent executable is
|
|
278
|
+
// missing. The Send button explains how to install it.
|
|
279
|
+
const availability = useWorkspaceAvailability(workspaceId).data
|
|
280
|
+
const unavailableReason =
|
|
281
|
+
availability === undefined ? undefined : availability.available ? null : availability.reason
|
|
277
282
|
const builderActions = useViewBuilderActions()
|
|
278
283
|
const { ref: rowRef, fits: canUseSplit } = useFitsSplitLayout<HTMLDivElement>()
|
|
279
284
|
const [widgetMode, setWidgetMode] = useState<WidgetMode>('idle')
|
|
@@ -524,6 +529,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
524
529
|
processing={processing}
|
|
525
530
|
error={error}
|
|
526
531
|
onDismissError={dismissError}
|
|
532
|
+
unavailableReason={unavailableReason}
|
|
527
533
|
send={send}
|
|
528
534
|
stop={stop}
|
|
529
535
|
onSwitchThread={switchThread}
|
|
@@ -540,6 +546,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
540
546
|
processing={processing}
|
|
541
547
|
error={error}
|
|
542
548
|
onDismissError={dismissError}
|
|
549
|
+
unavailableReason={unavailableReason}
|
|
543
550
|
send={send}
|
|
544
551
|
stop={stop}
|
|
545
552
|
onSwitchThread={switchThread}
|
|
@@ -588,7 +595,6 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
588
595
|
setWidgetMode(widgetMode === 'customizing' ? 'idle' : 'customizing')
|
|
589
596
|
}
|
|
590
597
|
/>
|
|
591
|
-
<McpMenu />
|
|
592
598
|
<WorkspaceSettings />
|
|
593
599
|
{hasWorkspaceContent && canUseSplit && (
|
|
594
600
|
<SectionControls
|
|
@@ -616,6 +622,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
616
622
|
<ViewBuilderTab
|
|
617
623
|
key={activeBuilder.id}
|
|
618
624
|
builder={activeBuilder}
|
|
625
|
+
unavailableReason={unavailableReason}
|
|
619
626
|
onSave={requirements => builderActions.save(activeBuilder.id, requirements)}
|
|
620
627
|
onSubmit={requirements => {
|
|
621
628
|
if (mode === 'fullscreen') setFloatingChatOpen(true)
|
|
@@ -669,6 +676,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
|
|
|
669
676
|
processing={processing}
|
|
670
677
|
error={error}
|
|
671
678
|
onDismissError={dismissError}
|
|
679
|
+
unavailableReason={unavailableReason}
|
|
672
680
|
send={send}
|
|
673
681
|
stop={stop}
|
|
674
682
|
onSwitchThread={switchThread}
|
|
@@ -3,7 +3,13 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
|
3
3
|
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
4
4
|
import { WORKSPACE_RESOURCE_OPTIONS } from '@/client/api/query-options'
|
|
5
5
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
HarnessAvailability,
|
|
8
|
+
ViewInfo,
|
|
9
|
+
WidgetInfo,
|
|
10
|
+
WorkspaceLayout,
|
|
11
|
+
WorkspaceType
|
|
12
|
+
} from '@/lib/types'
|
|
7
13
|
|
|
8
14
|
export type WorkspaceLayoutResponse = WorkspaceLayout & {
|
|
9
15
|
cwd: string
|
|
@@ -20,6 +26,18 @@ export function useWorkspaceLayout(workspaceId: string) {
|
|
|
20
26
|
})
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
// Is the workspace's agent executable installed? Drives the Send button's
|
|
30
|
+
// disabled state and tooltip. Refetches on window focus so installing the
|
|
31
|
+
// missing runtime and returning to the tab unlocks the composer.
|
|
32
|
+
export function useWorkspaceAvailability(workspaceId: string) {
|
|
33
|
+
return useQuery<HarnessAvailability>({
|
|
34
|
+
queryKey: workspaceKeys.availability(workspaceId),
|
|
35
|
+
queryFn: () => requestJson(`/api/workspaces/${workspaceId}/availability`),
|
|
36
|
+
staleTime: 30_000,
|
|
37
|
+
refetchOnWindowFocus: true
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
23
41
|
export function useWorkspaceWidgets(workspaceId: string) {
|
|
24
42
|
return useQuery<WidgetInfo[]>({
|
|
25
43
|
queryKey: workspaceKeys.widgets(workspaceId),
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Central assembly of the moi context sent with every chat message — the one
|
|
2
|
+
// place that snapshots the workspace's primary UI state (active tab, view
|
|
3
|
+
// titles) and drains queued one-shot directives. The structured `MoiContext`
|
|
4
|
+
// travels to the server as-is; harnesses render it (lib/moi-context.ts).
|
|
5
|
+
//
|
|
6
|
+
// Quick API:
|
|
7
|
+
//
|
|
8
|
+
// pushChatDirective(workspaceId, 'The user clicked "Sync now" on the stock-ticker widget.')
|
|
9
|
+
// Queue a one-shot instruction from anywhere in the app — event handlers,
|
|
10
|
+
// stores, non-React code. It rides the NEXT chat message's
|
|
11
|
+
// "# This message only" section and is delivered exactly once.
|
|
12
|
+
//
|
|
13
|
+
// useMoiUserMessageContext()
|
|
14
|
+
// Hook for the chat send path: returns a builder that snapshots ambient
|
|
15
|
+
// state (active tab, view title) and drains the directive queue. Call
|
|
16
|
+
// the builder only for a message that actually goes out.
|
|
17
|
+
//
|
|
18
|
+
// Adding a new ambient field (e.g. scratchpad selection): extend the
|
|
19
|
+
// `MoiContext` type and its renderer in lib/moi-context.ts, then supply
|
|
20
|
+
// the field in `useMoiUserMessageContext`'s builder below.
|
|
21
|
+
import { useCallback } from 'react'
|
|
22
|
+
|
|
23
|
+
import { useViewBuilders } from '@/client/features/views/api'
|
|
24
|
+
import { useWorkspaceViews } from '@/client/features/workspace/api'
|
|
25
|
+
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
26
|
+
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
27
|
+
import type { MoiContext } from '@/lib/moi-context'
|
|
28
|
+
import type { ViewBuilder, ViewInfo, WorkspaceTabId } from '@/lib/types'
|
|
29
|
+
|
|
30
|
+
// One-shot directives queued per workspace, drained into the NEXT chat
|
|
31
|
+
// message's `# This message only` section. Module-level (not React state):
|
|
32
|
+
// contributors may not live under a workspace React tree, and the queue must
|
|
33
|
+
// survive re-renders without causing any.
|
|
34
|
+
const directiveQueues = new Map<string, string[]>()
|
|
35
|
+
|
|
36
|
+
// Queue a one-shot instruction for the next message sent from `workspaceId`.
|
|
37
|
+
// Write a complete sentence; it reaches the agent once and is not re-sent.
|
|
38
|
+
export function pushChatDirective(workspaceId: string, directive: string): void {
|
|
39
|
+
const queue = directiveQueues.get(workspaceId) ?? []
|
|
40
|
+
queue.push(directive)
|
|
41
|
+
directiveQueues.set(workspaceId, queue)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Exported for unit tests; production code drains only via `useMoiUserMessageContext`.
|
|
45
|
+
export function drainChatDirectives(workspaceId: string): string[] {
|
|
46
|
+
const queue = directiveQueues.get(workspaceId) ?? []
|
|
47
|
+
directiveQueues.delete(workspaceId)
|
|
48
|
+
return queue
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The UI label of the active tab when it has one beyond its id: a view's
|
|
52
|
+
// configured title, or a builder's claimed title while the build runs.
|
|
53
|
+
// Undefined otherwise (the envelope then falls back to the id, like the tab
|
|
54
|
+
// bar).
|
|
55
|
+
export function activeTabTitle(
|
|
56
|
+
tab: WorkspaceTabId,
|
|
57
|
+
views: ViewInfo[] | undefined,
|
|
58
|
+
builders: ViewBuilder[] | undefined
|
|
59
|
+
): string | undefined {
|
|
60
|
+
if (tab.startsWith('view:'))
|
|
61
|
+
return views?.find(v => v.id === tab.slice('view:'.length))?.config.title || undefined
|
|
62
|
+
if (tab.startsWith('view-builder:'))
|
|
63
|
+
return builders?.find(b => b.id === tab.slice('view-builder:'.length))?.title || undefined
|
|
64
|
+
return undefined
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Returns a builder that snapshots the workspace state at call time — invoke
|
|
68
|
+
// it when the message is actually sent, not at render. Draining the
|
|
69
|
+
// directive queue is part of the snapshot, so only call it for a message
|
|
70
|
+
// that will really go out.
|
|
71
|
+
export function useMoiUserMessageContext(): () => MoiContext {
|
|
72
|
+
const workspaceId = useWorkspaceId()
|
|
73
|
+
const { layout } = useWorkspaceLayoutCtx()
|
|
74
|
+
const views = useWorkspaceViews(workspaceId).data
|
|
75
|
+
const builders = useViewBuilders(workspaceId).data
|
|
76
|
+
const activeTab = layout.tabs.active
|
|
77
|
+
return useCallback(() => {
|
|
78
|
+
const directives = drainChatDirectives(workspaceId)
|
|
79
|
+
return {
|
|
80
|
+
activeTab,
|
|
81
|
+
tabTitle: activeTabTitle(activeTab, views, builders),
|
|
82
|
+
...(directives.length > 0 ? { directives } : {})
|
|
83
|
+
}
|
|
84
|
+
}, [workspaceId, activeTab, views, builders])
|
|
85
|
+
}
|
package/client/main.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Agentation } from 'agentation'
|
|
|
3
3
|
import { createRoot } from 'react-dom/client'
|
|
4
4
|
import { Router } from 'wouter'
|
|
5
5
|
|
|
6
|
+
import { TooltipProvider } from '@/client/components/ui/tooltip'
|
|
6
7
|
import { installAppletErrorHook } from '@/client/features/applets/applet-log'
|
|
7
8
|
import { initConnection } from '@/client/features/chat/chat-connection'
|
|
8
9
|
import { AppRouter } from './app/AppRouter'
|
|
@@ -22,10 +23,12 @@ export function mount(el: HTMLElement) {
|
|
|
22
23
|
function Root() {
|
|
23
24
|
return (
|
|
24
25
|
<QueryClientProvider client={queryClient}>
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<TooltipProvider>
|
|
27
|
+
<Router>
|
|
28
|
+
<AppRouter />
|
|
29
|
+
</Router>
|
|
30
|
+
{process.env.NODE_ENV === 'development' && <Agentation />}
|
|
31
|
+
</TooltipProvider>
|
|
29
32
|
</QueryClientProvider>
|
|
30
33
|
)
|
|
31
34
|
}
|