moi-computer 0.12.1-next.0 → 0.12.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/README.md +26 -26
- package/bin/moi.mjs +2 -2
- package/client/AGENTS.md +5 -2
- package/client/api/app-config.ts +3 -2
- package/client/api/workspace-keys.ts +1 -1
- package/client/app/{AppRouter.tsx → app-router.tsx} +4 -4
- package/client/app/routes/{HomeRoute.tsx → home-route.tsx} +2 -2
- package/client/app/routes/{WorkspaceRoute.tsx → workspace-route.tsx} +18 -23
- package/client/app/shell/{SidebarLayout.tsx → sidebar-layout.tsx} +10 -10
- package/client/dev/index.html +43 -0
- package/client/dev/index.ts +15 -0
- package/client/features/applets/{AppletContainer.tsx → applet-container.tsx} +1 -1
- package/client/features/applets/applet-thumbnail.ts +1 -1
- package/client/features/applets/{useApplet.ts → use-applet.ts} +2 -2
- package/client/features/applets/{WidgetShell.tsx → widget-shell.tsx} +4 -4
- package/client/features/chat/applet-chat-intents.ts +4 -4
- package/client/features/chat/{ChatPanel.tsx → chat-panel.tsx} +11 -11
- package/client/features/chat/{ChatPopup.tsx → chat-popup.tsx} +1 -1
- package/client/features/chat/composer/attachments/{DrawingAttachmentChip.tsx → drawing-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/attachments/{FileAttachmentChip.tsx → file-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/attachments/{TextAttachmentChip.tsx → text-attachment-chip.tsx} +1 -1
- package/client/features/chat/composer/banners/{ComposerBanner.tsx → composer-banner.tsx} +0 -14
- package/client/features/chat/composer/banners/{ErrorBanner.tsx → error-banner.tsx} +1 -1
- package/client/features/chat/composer/banners/{SkillUpdateBanner.tsx → skill-update-banner.tsx} +3 -3
- package/client/features/chat/composer/{ChatComposer.tsx → chat-composer.tsx} +8 -7
- package/client/features/chat/composer/{ModelPicker.tsx → model-picker.tsx} +1 -1
- package/client/features/chat/composer/{useWorkspaceComposerState.tsx → use-workspace-composer-state.tsx} +12 -28
- package/client/features/chat/composer/{useWorkspaceSkillUpdates.ts → use-workspace-skill-updates.ts} +1 -1
- package/client/features/chat/connection/chat-frames.ts +1 -1
- package/client/features/chat/messages/{ChatEmptyState.tsx → chat-empty-state.tsx} +4 -4
- package/client/features/chat/messages/{MarkdownContent.tsx → markdown-content.tsx} +1 -1
- package/client/features/chat/messages/tool-group/index.ts +1 -1
- package/client/features/chat/messages/tool-group/{ReadImagePreview.tsx → read-image-preview.tsx} +2 -2
- package/client/features/chat/messages/tool-group/{SubagentCard.tsx → subagent-card.tsx} +3 -3
- package/client/features/chat/messages/tool-group/{TimelineRow.tsx → timeline-row.tsx} +1 -1
- package/client/features/chat/messages/tool-group/{ToolCallGroup.tsx → tool-call-group.tsx} +8 -8
- package/client/features/chat/messages/tool-group/{ToolOutput.tsx → tool-output.tsx} +1 -1
- package/client/features/chat/messages/{TurnView.tsx → turn-view.tsx} +4 -4
- package/client/features/chat/sessions/api.ts +2 -2
- package/client/features/chat/sessions/{ChatSelector.tsx → chat-selector.tsx} +2 -2
- package/client/features/chat/sessions/{useSelectedSession.ts → use-selected-session.ts} +2 -2
- package/client/features/chat/{useChat.ts → use-chat.ts} +3 -3
- package/client/features/collab/proxy-user.ts +1 -1
- package/client/features/connectors/mcp-icons.ts +1 -1
- package/client/features/connectors/{McpServerCards.tsx → mcp-server-cards.tsx} +1 -1
- package/client/features/{home/workspace-setup/DemoDialog.tsx → demo/demo-dialog.tsx} +6 -6
- package/client/features/dev/chat-states-fixtures.ts +4 -4
- package/client/features/dev/{ChatStatesPage.tsx → chat-states-page.tsx} +6 -6
- package/client/features/dev/collab/local-user-settings.tsx +4 -4
- package/client/features/dev/{DevIndexPage.tsx → dev-index-page.tsx} +7 -1
- package/client/features/dev/{DevRoutes.tsx → dev-routes.tsx} +8 -6
- package/client/features/dev/workspace-setup-mocks.ts +102 -0
- package/client/features/dev/workspace-setup-page.tsx +11 -0
- package/client/features/dev/workspace-setup-preview.tsx +226 -0
- package/client/features/drawings/{DrawingToolbar.tsx → drawing-toolbar.tsx} +1 -1
- package/client/features/drawings/{useChatAnnotation.ts → use-chat-annotation.ts} +29 -23
- package/client/features/drawings/{useDrawingLayer.ts → use-drawing-layer.ts} +1 -1
- package/client/features/drawings/{useViewSketch.ts → use-view-sketch.ts} +1 -1
- package/client/features/harness/api.ts +36 -0
- package/client/features/harness/device-login-steps.tsx +97 -0
- package/client/features/home/api.ts +1 -81
- package/client/features/home/{HomeLogo.tsx → home-logo.tsx} +1 -1
- package/client/features/home/{HomePage.tsx → home-page.tsx} +14 -18
- package/client/features/overview/api.ts +2 -2
- package/client/features/overview/default/registry.tsx +1 -1
- package/client/features/overview/default/{ViewsWidget.tsx → views-widget.tsx} +1 -1
- package/client/features/overview/{HiddenPanel.tsx → hidden-panel.tsx} +2 -2
- package/client/features/overview/{Overview.tsx → overview.tsx} +6 -6
- package/client/features/overview/{WidgetCanvas.tsx → widget-canvas.tsx} +1 -1
- package/client/features/overview/{WidgetFrame.tsx → widget-frame.tsx} +1 -1
- package/client/features/overview/workspace-name.tsx +55 -0
- package/client/features/scratchpad/{Scratchpad.tsx → scratchpad.tsx} +7 -7
- package/client/features/scratchpad/{useScratchpadSnapshot.tsx → use-scratchpad-snapshot.tsx} +3 -3
- package/client/features/settings/api.ts +1 -1
- package/client/features/settings/{ConnectorsSettings.tsx → connectors-settings.tsx} +3 -3
- package/client/features/settings/{EnvironmentSettings.tsx → environment-settings.tsx} +3 -3
- package/client/features/settings/{GeneralSettings.tsx → general-settings.tsx} +5 -5
- package/client/features/settings/{useEnvVars.ts → use-env-vars.ts} +1 -1
- package/client/features/settings/{WorkspaceIconPicker.tsx → workspace-icon-picker.tsx} +1 -1
- package/client/features/settings/{WorkspaceSettingsDialog.tsx → workspace-settings-dialog.tsx} +3 -3
- package/client/features/update/api.ts +1 -1
- package/client/features/views/api.ts +1 -1
- package/client/features/views/{PendingViewScreen.tsx → pending-view-screen.tsx} +7 -4
- package/client/features/views/{useViewActions.ts → use-view-actions.ts} +2 -2
- package/client/features/views/{useViewDrafts.ts → use-view-drafts.ts} +15 -6
- package/client/features/views/{ViewManager.tsx → view-manager.tsx} +3 -3
- package/client/features/views/view-submission.ts +1 -1
- package/client/features/workspace/add/api.ts +80 -0
- package/client/features/{home/workspace-setup/CreateWorkspaceDialog.tsx → workspace/add/create-workspace-dialog.tsx} +56 -42
- package/client/features/workspace/add/import-workspace-dialog.tsx +81 -0
- package/client/features/{home/workspace-setup/useWorkspaceImport.ts → workspace/add/use-workspace-import.ts} +1 -1
- package/client/features/workspace/add/workspace-agent-options.ts +53 -0
- package/client/features/{home/workspace-setup/WorkspaceAgentStep.tsx → workspace/add/workspace-agent-selector.tsx} +59 -98
- package/client/features/{home/workspace-setup/WorkspaceDialogContent.tsx → workspace/add/workspace-dialog-content.tsx} +1 -1
- package/client/features/workspace/api.ts +24 -15
- package/client/features/workspace/browser-tab-state.ts +1 -1
- package/client/features/workspace/moi-context.ts +1 -1
- package/client/features/workspace/setup/workspace-login-state.tsx +175 -0
- package/client/features/workspace/setup/workspace-recovery-states.tsx +125 -0
- package/client/features/workspace/setup/workspace-setup-panel.tsx +18 -0
- package/client/features/workspace/setup/workspace-setup.tsx +77 -0
- package/client/features/workspace/setup/workspace-welcome-state.tsx +81 -0
- package/client/features/workspace/{ThemePanel.tsx → theme-panel.tsx} +3 -3
- package/client/features/workspace/{useWorkspaceNavigation.ts → use-workspace-navigation.ts} +2 -2
- package/client/features/workspace/{WorkspaceScreen.tsx → workspace-content.tsx} +27 -30
- package/client/features/workspace/workspace-identity.tsx +40 -0
- package/client/features/workspace/{WorkspaceMenu.tsx → workspace-menu.tsx} +3 -3
- package/client/features/{home → workspace}/workspace-presentation.tsx +10 -3
- package/client/features/workspace/workspace-screen.tsx +28 -0
- package/client/features/workspace/{WorkspaceSplitLayout.tsx → workspace-split-layout.tsx} +1 -1
- package/client/features/workspace/{WorkspaceTabs.tsx → workspace-tabs.tsx} +2 -2
- package/client/index.css +2 -2
- package/client/index.html +1 -1
- package/client/lib/agent-availability.ts +0 -5
- package/client/main.tsx +1 -1
- package/client/runtime/{useWorkspaceEvents.ts → use-workspace-events.ts} +3 -12
- package/dist/chunk-08ndj2rg.js +2 -0
- package/dist/chunk-2x040tmg.js +68 -0
- package/dist/chunk-3smxq0ts.js +1 -0
- package/dist/{chunk-am1x230f.js → chunk-68ch5hs8.js} +1 -1
- package/dist/{chunk-yvzhwtfa.js → chunk-9vg3xa81.js} +2 -2
- package/dist/chunk-c2p00p9j.css +1 -0
- package/dist/chunk-cs833y9j.js +1 -0
- package/dist/{chunk-gps4qc38.js → chunk-d7cbm65e.js} +1 -1
- package/dist/{chunk-j905va8r.js → chunk-hvh9f5h0.js} +1 -1
- package/dist/{chunk-vqpkqtdr.js → chunk-jvyvwwv3.js} +1 -1
- package/dist/chunk-nwevqe86.js +10 -0
- package/dist/{chunk-hzwr8dp8.js → chunk-q0gbdts4.js} +3 -3
- package/dist/chunk-rt30jbcm.js +1 -0
- package/dist/chunk-y5y3kj67.js +1 -0
- package/dist/index.html +2 -2
- package/lib/format.ts +1 -1
- package/lib/harness-instructions.ts +30 -0
- package/lib/ids.ts +1 -1
- package/lib/moi-context.ts +2 -2
- package/lib/scratchpad-skew.ts +3 -3
- package/lib/types.ts +28 -20
- package/lib/update.ts +1 -1
- package/package.json +5 -2
- package/server/AGENTS.md +10 -4
- package/server/README.md +102 -0
- package/server/api/harnesses.ts +56 -0
- package/server/{api.ts → api/index.ts} +85 -97
- package/server/app-config.ts +24 -12
- package/server/app-settings.ts +1 -1
- package/server/applets/applet-css.ts +1 -1
- package/server/applets/build-applet.ts +4 -4
- package/server/applets/build-worker.ts +1 -1
- package/server/applets/config.ts +1 -1
- package/server/{functions-worker.ts → applets/functions-worker.ts} +1 -1
- package/server/{functions.ts → applets/functions.ts} +2 -2
- package/server/applets/index.ts +2 -2
- package/server/{thumbnails.ts → applets/thumbnails.ts} +1 -1
- package/server/{applet-typecheck.ts → applets/typecheck.ts} +4 -4
- package/server/{ui-components.ts → applets/ui-components.ts} +2 -2
- package/server/{views.ts → applets/views.ts} +7 -7
- package/server/{widgets.ts → applets/widgets.ts} +2 -2
- package/server/cli/applet-selector.ts +19 -0
- package/server/cli/args.ts +5 -0
- package/server/{cli-colors.ts → cli/colors.ts} +1 -1
- package/server/cli/commands/bundle.ts +119 -0
- package/server/cli/commands/call-server-fn.ts +42 -0
- package/server/cli/commands/check.ts +53 -0
- package/server/cli/commands/config.ts +132 -0
- package/server/cli/commands/debug.ts +119 -0
- package/server/cli/commands/env.ts +162 -0
- package/server/cli/commands/hermes.ts +149 -0
- package/server/cli/commands/init.ts +286 -0
- package/server/cli/commands/navigate.ts +35 -0
- package/server/cli/commands/openclaw.ts +168 -0
- package/server/cli/commands/refresh.ts +39 -0
- package/server/cli/commands/scratch.ts +496 -0
- package/server/cli/commands/service.ts +298 -0
- package/server/cli/commands/skill.ts +122 -0
- package/server/cli/commands/start.ts +138 -0
- package/server/cli/commands/status.ts +80 -0
- package/server/cli/commands/tabs.ts +43 -0
- package/server/cli/commands/theme.ts +192 -0
- package/server/cli/commands/ui-components.ts +15 -0
- package/server/cli/commands/update.ts +192 -0
- package/server/cli/commands/version.ts +9 -0
- package/server/cli/commands/views.ts +87 -0
- package/server/cli/control.ts +89 -0
- package/server/{cli-env.ts → cli/env.ts} +9 -9
- package/server/cli/index.ts +171 -0
- package/server/{cli-pc.ts → cli/pc.ts} +1 -1
- package/server/cli/provider.ts +25 -0
- package/server/cli/server-version.ts +16 -0
- package/server/cli/server.ts +81 -0
- package/server/{cli-ui-components.ts → cli/ui-components.ts} +5 -5
- package/server/cli.ts +2 -3252
- package/server/collab/manager.ts +3 -3
- package/server/collab/skill/index.ts +2 -2
- package/server/control.ts +20 -20
- package/server/harness/README.md +47 -25
- package/server/harness/acp/NOTES.md +11 -11
- package/server/harness/acp/archived.ts +3 -3
- package/server/harness/acp/client.ts +2 -2
- package/server/harness/acp/run-durations.ts +1 -1
- package/server/harness/acp/session.ts +5 -5
- package/server/harness/auth.ts +303 -0
- package/server/harness/claude-code/NOTES.md +9 -7
- package/server/harness/claude-code/auth.ts +125 -17
- package/server/harness/claude-code/index.ts +2 -1
- package/server/harness/claude-code/mcp.ts +1 -1
- package/server/harness/claude-code/session.ts +10 -7
- package/server/harness/codex/NOTES.md +12 -12
- package/server/harness/codex/auth.ts +86 -19
- package/server/harness/codex/client.ts +17 -13
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/permissions.ts +3 -3
- package/server/harness/codex/probe.ts +3 -5
- package/server/harness/codex/session.ts +16 -13
- package/server/harness/codex/transport.ts +5 -5
- package/server/harness/executable.ts +42 -18
- package/server/harness/hermes/NOTES.md +70 -70
- package/server/harness/hermes/discovery.ts +1 -1
- package/server/harness/openclaw/NOTES.md +24 -24
- package/server/harness/openclaw/adapter.ts +1 -1
- package/server/harness/openclaw/compat.ts +1 -1
- package/server/harness/openclaw/session.ts +5 -2
- package/server/harness/registry.ts +1 -1
- package/server/harness/shell-path.ts +31 -21
- package/server/harness/types.ts +9 -2
- package/server/navigation-relay.ts +1 -1
- package/server/open-browser.ts +7 -0
- package/server/{scratchpad-assets.ts → scratchpad/assets.ts} +4 -4
- package/server/{scratchpad.ts → scratchpad/document.ts} +8 -8
- package/server/{scratchpad-executor.ts → scratchpad/executor.ts} +7 -7
- package/server/{scratchpad-relay.ts → scratchpad/relay.ts} +4 -5
- package/server/{scratchpad-shape-defaults.ts → scratchpad/shape-defaults.ts} +2 -2
- package/server/server-cwd.ts +1 -1
- package/server/service.ts +2 -2
- package/server/{session-archive.ts → sessions/archive.ts} +5 -5
- package/server/{attachment-message.ts → sessions/attachment-message.ts} +1 -1
- package/server/{session-config.ts → sessions/config.ts} +1 -1
- package/server/{session-lifecycle.ts → sessions/lifecycle.ts} +3 -3
- package/server/{pending-views.ts → sessions/pending-views.ts} +3 -3
- package/server/{selected-session.ts → sessions/selected.ts} +1 -1
- package/server/{session-store.ts → sessions/store.ts} +1 -1
- package/server/{view-sessions.ts → sessions/view-sessions.ts} +9 -9
- package/server/{skills-template.ts → skills/template.ts} +1 -1
- package/server/{skill-update.ts → skills/update.ts} +5 -5
- package/server/{skill-version.ts → skills/version.ts} +4 -4
- package/server/static.ts +1 -1
- package/server/status.ts +3 -3
- package/server/web.ts +14 -7
- package/server/{env-apply.ts → workspaces/env-apply.ts} +5 -5
- package/server/{workspace-env.ts → workspaces/env.ts} +3 -3
- package/server/{workspace-import.ts → workspaces/import.ts} +4 -4
- package/server/{workspace-init.ts → workspaces/init.ts} +5 -5
- package/server/{layout.ts → workspaces/layout.ts} +2 -2
- package/server/{preview.ts → workspaces/preview.ts} +1 -1
- package/server/{registry.ts → workspaces/registry.ts} +3 -3
- package/server/{required-env.ts → workspaces/required-env.ts} +3 -3
- package/server/{moi-scaffold.ts → workspaces/scaffold.ts} +3 -3
- package/ui-components/button.tsx +1 -1
- package/ui-components/docs/attachment.md +2 -2
- package/ui-components/docs/button.md +1 -1
- package/ui-components/docs/calendar.md +1 -1
- package/ui-components/docs/chart.md +4 -4
- package/ui-components/docs/data-table.md +1 -1
- package/ui-components/docs/drawer.md +1 -1
- package/ui-components/docs/field.md +1 -1
- package/ui-components/docs/input.md +2 -2
- package/ui-components/docs/label.md +2 -2
- package/ui-components/docs/table.md +2 -2
- package/workspace/.claude/skills/moi-workspace/SKILL.md +12 -12
- package/workspace/.claude/skills/moi-workspace/references/COLLAB.md +2 -2
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +2 -2
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +2 -2
- package/client/features/chat/composer/banners/AgentAvailabilityBanner.tsx +0 -101
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +0 -92
- package/client/features/overview/WorkspaceName.tsx +0 -60
- package/dist/chunk-1zhnhy00.js +0 -1
- package/dist/chunk-27501vke.js +0 -1
- package/dist/chunk-9xtv6djt.js +0 -2
- package/dist/chunk-darpsw65.js +0 -1
- package/dist/chunk-n33w9y38.js +0 -10
- package/dist/chunk-r63ks44z.js +0 -68
- package/dist/chunk-wd46nk26.css +0 -1
- package/dist/chunk-xgt7vxt9.js +0 -1
- package/server/agent.ts +0 -223
- /package/client/components/shared/{AgentBlobatar.tsx → agent-blobatar.tsx} +0 -0
- /package/client/components/shared/{BottomPanel.tsx → bottom-panel.tsx} +0 -0
- /package/client/components/shared/{Composer.tsx → composer.tsx} +0 -0
- /package/client/components/shared/{LedLogo.tsx → led-logo.tsx} +0 -0
- /package/client/components/shared/{PanelHeader.tsx → panel-header.tsx} +0 -0
- /package/client/components/shared/{ReorderableList.tsx → reorderable-list.tsx} +0 -0
- /package/client/components/shared/{WorkspaceIcon.tsx → workspace-icon.tsx} +0 -0
- /package/client/features/applets/{WidgetErrorBoundary.tsx → widget-error-boundary.tsx} +0 -0
- /package/client/features/chat/composer/attachments/{AttachmentChip.tsx → attachment-chip.tsx} +0 -0
- /package/client/features/chat/messages/{ChatPromptBubbles.tsx → chat-prompt-bubbles.tsx} +0 -0
- /package/client/features/chat/messages/{ShimmerText.tsx → shimmer-text.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{CodeBlock.tsx → code-block.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{Collapse.tsx → collapse.tsx} +0 -0
- /package/client/features/chat/messages/{useStickToBottom.ts → use-stick-to-bottom.ts} +0 -0
- /package/client/features/connectors/{IconMcp.tsx → icon-mcp.tsx} +0 -0
- /package/client/features/dev/{BlobatarShapesPage.tsx → blobatar-shapes-page.tsx} +0 -0
- /package/client/features/dev/{HarnessDebugPage.tsx → harness-debug-page.tsx} +0 -0
- /package/client/features/dev/{TextureLabPage.tsx → texture-lab-page.tsx} +0 -0
- /package/client/features/dev/{ToolCallsPage.tsx → tool-calls-page.tsx} +0 -0
- /package/client/features/drawings/{DrawingLayer.tsx → drawing-layer.tsx} +0 -0
- /package/client/features/home/{WorkspacePreview.tsx → workspace-preview.tsx} +0 -0
- /package/client/features/overview/{useGridReconcile.ts → use-grid-reconcile.ts} +0 -0
- /package/client/features/scratchpad/{ScratchpadControls.tsx → scratchpad-controls.tsx} +0 -0
- /package/client/features/settings/{SettingsLayout.tsx → settings-layout.tsx} +0 -0
- /package/client/features/update/{UpdateControl.tsx → update-control.tsx} +0 -0
- /package/client/features/workspace/{UnavailablePage.tsx → unavailable-page.tsx} +0 -0
- /package/client/features/workspace/{useFitsSplitLayout.ts → use-fits-split-layout.ts} +0 -0
- /package/client/features/workspace/{WorkspaceContext.tsx → workspace-context.tsx} +0 -0
- /package/client/features/workspace/{WorkspaceLayoutContext.tsx → workspace-layout-context.tsx} +0 -0
- /package/server/{bundle-queue.ts → applets/bundle-queue.ts} +0 -0
- /package/server/{applet-log.ts → applets/log.ts} +0 -0
- /package/server/{cli-ui.ts → cli/ui.ts} +0 -0
- /package/server/{workspace-config.ts → workspaces/config.ts} +0 -0
- /package/server/{icon.ts → workspaces/icon.ts} +0 -0
- /package/server/{tabs.ts → workspaces/tabs.ts} +0 -0
- /package/server/{theme.ts → workspaces/theme.ts} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
readSelectedSession,
|
|
7
7
|
writeSelectedSession
|
|
8
8
|
} from '@/client/features/chat/sessions/browser-tab-state'
|
|
9
|
-
import { selectedSessionKey } from '@/client/features/chat/sessions/
|
|
9
|
+
import { selectedSessionKey } from '@/client/features/chat/sessions/use-selected-session'
|
|
10
10
|
import { moveChatDraft } from '@/client/features/chat/chat-send'
|
|
11
11
|
import { liveStore } from '@/client/features/chat/chat-store'
|
|
12
12
|
import { useUiStore } from '@/client/store/ui'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
2
|
+
|
|
3
|
+
import { jsonRequest, requestJson } from '@/client/api/http'
|
|
4
|
+
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
5
|
+
import { useUiStore } from '@/client/store/ui'
|
|
6
|
+
import type {
|
|
7
|
+
DiscoveredWorkspace,
|
|
8
|
+
HarnessInstallations,
|
|
9
|
+
WorkspaceEntry,
|
|
10
|
+
WorkspaceType
|
|
11
|
+
} from '@/lib/types'
|
|
12
|
+
|
|
13
|
+
export function upsertWorkspaceEntry(
|
|
14
|
+
entries: WorkspaceEntry[] | undefined,
|
|
15
|
+
entry: WorkspaceEntry
|
|
16
|
+
): WorkspaceEntry[] {
|
|
17
|
+
const current = entries ?? []
|
|
18
|
+
const existing = current.findIndex(item => item.id === entry.id || item.path === entry.path)
|
|
19
|
+
if (existing === -1) return [entry, ...current]
|
|
20
|
+
return current.map((item, index) => (index === existing ? { ...item, ...entry } : item))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useImportWorkspace() {
|
|
24
|
+
const queryClient = useQueryClient()
|
|
25
|
+
return useMutation<WorkspaceEntry, Error, ImportWorkspaceInput>({
|
|
26
|
+
mutationFn: input =>
|
|
27
|
+
requestJson('/api/workspaces', jsonRequest('POST', input), 'Failed to add workspace'),
|
|
28
|
+
onSuccess: (entry, input) => {
|
|
29
|
+
useUiStore.getState().markWorkspacePendingAnalysis(entry.id)
|
|
30
|
+
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
31
|
+
upsertWorkspaceEntry(previous, entry)
|
|
32
|
+
)
|
|
33
|
+
queryClient.setQueryData<DiscoveredWorkspace[]>(workspaceKeys.discover, previous =>
|
|
34
|
+
(previous ?? []).filter(item => item.path !== input.path)
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ImportWorkspaceInput = {
|
|
41
|
+
path: string
|
|
42
|
+
type: WorkspaceType
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type WorkspaceCreationInfo = {
|
|
46
|
+
installed: HarnessInstallations
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function useWorkspaceCreationInfo() {
|
|
50
|
+
return useQuery<WorkspaceCreationInfo>({
|
|
51
|
+
queryKey: workspaceKeys.creationInfo,
|
|
52
|
+
// Installations can change while the app is open (the user installs the
|
|
53
|
+
// agent CLI) — refetch on mount instead of caching forever.
|
|
54
|
+
queryFn: () => requestJson('/api/workspaces/create'),
|
|
55
|
+
staleTime: 30_000,
|
|
56
|
+
refetchOnMount: 'always'
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type CreateWorkspaceInput = {
|
|
61
|
+
name: string
|
|
62
|
+
type: WorkspaceType
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function useCreateWorkspace() {
|
|
66
|
+
const queryClient = useQueryClient()
|
|
67
|
+
return useMutation<WorkspaceEntry, Error, CreateWorkspaceInput>({
|
|
68
|
+
mutationFn: input =>
|
|
69
|
+
requestJson(
|
|
70
|
+
'/api/workspaces/create',
|
|
71
|
+
jsonRequest('POST', input),
|
|
72
|
+
'Failed to create workspace'
|
|
73
|
+
),
|
|
74
|
+
onSuccess: entry => {
|
|
75
|
+
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
76
|
+
upsertWorkspaceEntry(previous, entry)
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
@@ -2,7 +2,7 @@ import { type FormEvent, type ReactElement, useState } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { useLocation } from 'wouter'
|
|
4
4
|
|
|
5
|
-
import { useCreateWorkspace,
|
|
5
|
+
import { useCreateWorkspace, useWorkspaceCreationInfo } from '@/client/features/workspace/add/api'
|
|
6
6
|
import { useAppConfig } from '@/client/api/app-config'
|
|
7
7
|
import { Button } from '@/client/components/ui/button'
|
|
8
8
|
import {
|
|
@@ -17,9 +17,11 @@ import { validateWorkspaceFolderName } from '@/lib/workspace-name'
|
|
|
17
17
|
import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
|
|
18
18
|
import type { WorkspaceType } from '@/lib/types'
|
|
19
19
|
|
|
20
|
-
import { DemoDialog } from '
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { DemoDialog } from '@/client/features/demo/demo-dialog'
|
|
21
|
+
import { welcomeNewWorkspace } from '../setup/workspace-welcome-state'
|
|
22
|
+
import { WorkspaceAgentSelector } from './workspace-agent-selector'
|
|
23
|
+
import { getWorkspaceAgentOptions } from './workspace-agent-options'
|
|
24
|
+
import { WorkspaceDialogContent } from './workspace-dialog-content'
|
|
23
25
|
|
|
24
26
|
type CreateWorkspaceDialogProps = {
|
|
25
27
|
trigger: ReactElement
|
|
@@ -32,43 +34,51 @@ const DEFAULT_WORKSPACE_TYPE = WORKSPACE_TYPE_ORDER[0]
|
|
|
32
34
|
export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
|
|
33
35
|
const [, navigate] = useLocation()
|
|
34
36
|
const appConfig = useAppConfig()
|
|
35
|
-
const info =
|
|
37
|
+
const info = useWorkspaceCreationInfo()
|
|
36
38
|
const createMutation = useCreateWorkspace()
|
|
37
39
|
|
|
38
40
|
const [open, setOpen] = useState(false)
|
|
39
|
-
const [step, setStep] = useState<CreateWorkspaceStep>('
|
|
41
|
+
const [step, setStep] = useState<CreateWorkspaceStep>('name')
|
|
40
42
|
const [type, setType] = useState<WorkspaceType>(DEFAULT_WORKSPACE_TYPE)
|
|
41
43
|
const [name, setName] = useState('')
|
|
42
44
|
|
|
43
45
|
const trimmedName = name.trim()
|
|
44
46
|
const nameError = trimmedName ? validateWorkspaceFolderName(trimmedName) : null
|
|
45
47
|
const isCreating = createMutation.isPending
|
|
48
|
+
const isChecking = info.isPending || info.isFetching
|
|
49
|
+
const installed = info.isError ? undefined : info.data?.installed
|
|
50
|
+
const options = getWorkspaceAgentOptions(installed)
|
|
51
|
+
const selectedAvailable = options.some(option => option.type === type && !option.disabled)
|
|
52
|
+
const detectionError = !isChecking && !installed ? 'Could not check installed agents.' : undefined
|
|
53
|
+
const canUseAgent = !isChecking && !detectionError && selectedAvailable
|
|
46
54
|
|
|
47
55
|
// Cloud demo: creating workspaces is off — the same trigger opens the
|
|
48
56
|
// cloud-demo promo dialog instead. After every hook so the hook order is stable.
|
|
49
|
-
if (appConfig.
|
|
57
|
+
if (appConfig.demo) {
|
|
50
58
|
return <DemoDialog trigger={trigger} />
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
function finish(workspaceId: string) {
|
|
62
|
+
welcomeNewWorkspace(workspaceId)
|
|
54
63
|
setOpen(false)
|
|
55
64
|
navigate(`/workspace/${workspaceId}`)
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
function resetDialog() {
|
|
59
|
-
setStep('
|
|
68
|
+
setStep('name')
|
|
60
69
|
setType(DEFAULT_WORKSPACE_TYPE)
|
|
61
70
|
setName('')
|
|
62
71
|
createMutation.reset()
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
function
|
|
74
|
+
function continueToAgent() {
|
|
75
|
+
if (!trimmedName || nameError) return
|
|
66
76
|
createMutation.reset()
|
|
67
|
-
setStep('
|
|
77
|
+
setStep('agent')
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
function createWorkspace() {
|
|
71
|
-
if (!trimmedName || nameError || isCreating) return
|
|
81
|
+
if (!trimmedName || nameError || isCreating || !canUseAgent) return
|
|
72
82
|
createMutation.reset()
|
|
73
83
|
createMutation.mutate({ name: trimmedName, type }, { onSuccess: entry => finish(entry.id) })
|
|
74
84
|
}
|
|
@@ -76,31 +86,41 @@ export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
|
|
|
76
86
|
return (
|
|
77
87
|
<Dialog
|
|
78
88
|
open={open}
|
|
79
|
-
onOpenChange={
|
|
89
|
+
onOpenChange={nextOpen => {
|
|
90
|
+
if (!nextOpen && isCreating) return
|
|
91
|
+
setOpen(nextOpen)
|
|
92
|
+
if (nextOpen) void info.refetch({ cancelRefetch: false })
|
|
93
|
+
}}
|
|
80
94
|
onOpenChangeComplete={nextOpen => {
|
|
81
95
|
if (!nextOpen) resetDialog()
|
|
82
96
|
}}
|
|
83
97
|
>
|
|
84
98
|
<DialogTrigger render={trigger} />
|
|
85
|
-
<WorkspaceDialogContent>
|
|
86
|
-
{step === '
|
|
87
|
-
<WorkspaceAgentStep
|
|
88
|
-
title="Create new workspace"
|
|
89
|
-
selectedType={type}
|
|
90
|
-
availability={info.data?.availability}
|
|
91
|
-
isPending={false}
|
|
92
|
-
secondaryAction={<ExistingFolderButton />}
|
|
93
|
-
primaryLabel="Next"
|
|
94
|
-
onTypeChange={setType}
|
|
95
|
-
onSubmit={continueToName}
|
|
96
|
-
/>
|
|
97
|
-
) : (
|
|
99
|
+
<WorkspaceDialogContent showCloseButton={!isCreating}>
|
|
100
|
+
{step === 'name' ? (
|
|
98
101
|
<WorkspaceNameStep
|
|
99
102
|
name={name}
|
|
100
103
|
validationError={nameError}
|
|
101
|
-
requestError={createMutation.error?.message}
|
|
102
|
-
isPending={isCreating}
|
|
103
104
|
onNameChange={setName}
|
|
105
|
+
onSubmit={continueToAgent}
|
|
106
|
+
/>
|
|
107
|
+
) : (
|
|
108
|
+
<WorkspaceAgentSelector
|
|
109
|
+
title="Create new workspace"
|
|
110
|
+
selectedType={type}
|
|
111
|
+
options={options}
|
|
112
|
+
isLoading={isChecking && !installed}
|
|
113
|
+
errorMessage={detectionError ?? createMutation.error?.message}
|
|
114
|
+
emptyMessage="Install at least one agent to create a new workspace"
|
|
115
|
+
isPending={isCreating || isChecking || Boolean(detectionError)}
|
|
116
|
+
secondaryAction={
|
|
117
|
+
<Button variant="secondary" disabled={isCreating} onClick={() => setStep('name')}>
|
|
118
|
+
Back
|
|
119
|
+
</Button>
|
|
120
|
+
}
|
|
121
|
+
primaryLabel="Create workspace"
|
|
122
|
+
pendingLabel={isCreating ? 'Creating…' : undefined}
|
|
123
|
+
onTypeChange={setType}
|
|
104
124
|
onSubmit={createWorkspace}
|
|
105
125
|
/>
|
|
106
126
|
)}
|
|
@@ -112,8 +132,6 @@ export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
|
|
|
112
132
|
type WorkspaceNameStepProps = {
|
|
113
133
|
name: string
|
|
114
134
|
validationError: string | null
|
|
115
|
-
requestError?: string
|
|
116
|
-
isPending: boolean
|
|
117
135
|
onNameChange: (name: string) => void
|
|
118
136
|
onSubmit: () => void
|
|
119
137
|
}
|
|
@@ -121,8 +139,6 @@ type WorkspaceNameStepProps = {
|
|
|
121
139
|
function WorkspaceNameStep({
|
|
122
140
|
name,
|
|
123
141
|
validationError,
|
|
124
|
-
requestError,
|
|
125
|
-
isPending,
|
|
126
142
|
onNameChange,
|
|
127
143
|
onSubmit
|
|
128
144
|
}: WorkspaceNameStepProps) {
|
|
@@ -132,7 +148,10 @@ function WorkspaceNameStep({
|
|
|
132
148
|
}
|
|
133
149
|
|
|
134
150
|
return (
|
|
135
|
-
<form
|
|
151
|
+
<form
|
|
152
|
+
className="flex min-w-[min(22rem,calc(100vw-5rem))] flex-col gap-5"
|
|
153
|
+
onSubmit={handleSubmit}
|
|
154
|
+
>
|
|
136
155
|
<div className="flex flex-col gap-0.5 pr-8">
|
|
137
156
|
<DialogTitle>Create new workspace</DialogTitle>
|
|
138
157
|
<DialogDescription>Give it a short and recognizable name</DialogDescription>
|
|
@@ -146,7 +165,7 @@ function WorkspaceNameStep({
|
|
|
146
165
|
id="workspace-name"
|
|
147
166
|
value={name}
|
|
148
167
|
onChange={event => onNameChange(event.target.value)}
|
|
149
|
-
placeholder="
|
|
168
|
+
placeholder="Workspace name"
|
|
150
169
|
autoFocus
|
|
151
170
|
aria-invalid={Boolean(validationError)}
|
|
152
171
|
aria-describedby={validationError ? 'workspace-name-error' : undefined}
|
|
@@ -160,15 +179,10 @@ function WorkspaceNameStep({
|
|
|
160
179
|
)}
|
|
161
180
|
</div>
|
|
162
181
|
|
|
163
|
-
{requestError && (
|
|
164
|
-
<p role="alert" className="text-xs text-destructive">
|
|
165
|
-
{requestError}
|
|
166
|
-
</p>
|
|
167
|
-
)}
|
|
168
|
-
|
|
169
182
|
<div className="flex items-center justify-end gap-2">
|
|
170
|
-
<
|
|
171
|
-
|
|
183
|
+
<ExistingFolderButton />
|
|
184
|
+
<Button type="submit" disabled={!name.trim() || Boolean(validationError)}>
|
|
185
|
+
Next
|
|
172
186
|
</Button>
|
|
173
187
|
</div>
|
|
174
188
|
</form>
|
|
@@ -184,7 +198,7 @@ function ExistingFolderButton() {
|
|
|
184
198
|
variant="secondary"
|
|
185
199
|
aria-disabled
|
|
186
200
|
onClick={event => event.preventDefault()}
|
|
187
|
-
className="cursor-not-allowed
|
|
201
|
+
className="cursor-not-allowed bg-accent text-muted-foreground hover:bg-accent"
|
|
188
202
|
>
|
|
189
203
|
Use existing folder
|
|
190
204
|
</Button>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@/client/components/ui/button'
|
|
4
|
+
import { Dialog, DialogClose } from '@/client/components/ui/dialog'
|
|
5
|
+
import { workspaceDisplayName } from '@/client/features/workspace/workspace-presentation'
|
|
6
|
+
import type { WorkspaceType } from '@/lib/types'
|
|
7
|
+
|
|
8
|
+
import { WorkspaceAgentSelector } from './workspace-agent-selector'
|
|
9
|
+
import { useWorkspaceCreationInfo } from './api'
|
|
10
|
+
import { getWorkspaceAgentOptions } from './workspace-agent-options'
|
|
11
|
+
import { WorkspaceDialogContent } from './workspace-dialog-content'
|
|
12
|
+
import type { WorkspaceImportChoice } from './use-workspace-import'
|
|
13
|
+
|
|
14
|
+
type ImportWorkspaceDialogProps = {
|
|
15
|
+
choice: WorkspaceImportChoice
|
|
16
|
+
isPending: boolean
|
|
17
|
+
errorMessage?: string
|
|
18
|
+
onTypeChange: (type: WorkspaceType) => void
|
|
19
|
+
onSubmit: () => void
|
|
20
|
+
onReset: () => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function ImportWorkspaceDialog({
|
|
24
|
+
choice,
|
|
25
|
+
isPending,
|
|
26
|
+
errorMessage,
|
|
27
|
+
onTypeChange,
|
|
28
|
+
onSubmit,
|
|
29
|
+
onReset
|
|
30
|
+
}: ImportWorkspaceDialogProps) {
|
|
31
|
+
const [open, setOpen] = useState(true)
|
|
32
|
+
const info = useWorkspaceCreationInfo()
|
|
33
|
+
const isChecking = info.isPending || info.isFetching
|
|
34
|
+
const installed = info.isError ? undefined : info.data?.installed
|
|
35
|
+
const options = getWorkspaceAgentOptions(installed, choice.workspace.types)
|
|
36
|
+
const detectionError = !isChecking && !installed ? 'Could not check installed agents.' : undefined
|
|
37
|
+
const canImport =
|
|
38
|
+
!isPending &&
|
|
39
|
+
!isChecking &&
|
|
40
|
+
!detectionError &&
|
|
41
|
+
options.some(option => option.type === choice.selectedType && !option.disabled)
|
|
42
|
+
|
|
43
|
+
function handleOpenChange(nextOpen: boolean) {
|
|
44
|
+
if (!nextOpen && isPending) return
|
|
45
|
+
setOpen(nextOpen)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function handleOpenChangeComplete(nextOpen: boolean) {
|
|
49
|
+
if (!nextOpen) onReset()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Dialog
|
|
54
|
+
open={open}
|
|
55
|
+
onOpenChange={handleOpenChange}
|
|
56
|
+
onOpenChangeComplete={handleOpenChangeComplete}
|
|
57
|
+
>
|
|
58
|
+
<WorkspaceDialogContent showCloseButton={!isPending}>
|
|
59
|
+
<WorkspaceAgentSelector
|
|
60
|
+
title={`Import ${workspaceDisplayName(choice.workspace)}`}
|
|
61
|
+
selectedType={choice.selectedType}
|
|
62
|
+
options={options}
|
|
63
|
+
isLoading={isChecking && !installed}
|
|
64
|
+
isPending={isPending || isChecking || Boolean(detectionError)}
|
|
65
|
+
errorMessage={detectionError ?? errorMessage}
|
|
66
|
+
secondaryAction={
|
|
67
|
+
<DialogClose render={<Button variant="secondary" />} disabled={isPending}>
|
|
68
|
+
Cancel
|
|
69
|
+
</DialogClose>
|
|
70
|
+
}
|
|
71
|
+
primaryLabel="Add workspace"
|
|
72
|
+
pendingLabel={isPending ? 'Adding…' : undefined}
|
|
73
|
+
onTypeChange={onTypeChange}
|
|
74
|
+
onSubmit={() => {
|
|
75
|
+
if (canImport) onSubmit()
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
</WorkspaceDialogContent>
|
|
79
|
+
</Dialog>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
|
|
3
|
-
import { useImportWorkspace } from '
|
|
3
|
+
import { useImportWorkspace } from '@/client/features/workspace/add/api'
|
|
4
4
|
import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
|
|
5
5
|
import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/types'
|
|
6
6
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { workspaceTypeDescription } from '@/client/features/workspace/workspace-presentation'
|
|
2
|
+
import { HARNESS_INSTRUCTIONS } from '@/lib/harness-instructions'
|
|
3
|
+
import type { HarnessInstallations, WorkspaceType } from '@/lib/types'
|
|
4
|
+
import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
|
|
5
|
+
|
|
6
|
+
type WorkspaceAgentConfig = {
|
|
7
|
+
importOnly: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const workspaceAgents: Record<WorkspaceType, WorkspaceAgentConfig> = {
|
|
11
|
+
'claude-code': { importOnly: false },
|
|
12
|
+
codex: { importOnly: false },
|
|
13
|
+
openclaw: { importOnly: true },
|
|
14
|
+
hermes: { importOnly: true }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type WorkspaceAgentOption = {
|
|
18
|
+
type: WorkspaceType
|
|
19
|
+
description: string
|
|
20
|
+
disabled: boolean
|
|
21
|
+
disabledReason?: string
|
|
22
|
+
disabledCommand?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getWorkspaceAgentOptions(
|
|
26
|
+
installed?: HarnessInstallations,
|
|
27
|
+
detectedTypes: WorkspaceType[] = []
|
|
28
|
+
): WorkspaceAgentOption[] {
|
|
29
|
+
if (!installed) return []
|
|
30
|
+
return WORKSPACE_TYPE_ORDER.filter(
|
|
31
|
+
type => installed[type] || !workspaceAgents[type].importOnly
|
|
32
|
+
).map(type => {
|
|
33
|
+
const config = workspaceAgents[type]
|
|
34
|
+
const instruction = HARNESS_INSTRUCTIONS[type]
|
|
35
|
+
const disabled = !installed[type] || (config.importOnly && !detectedTypes.includes(type))
|
|
36
|
+
return {
|
|
37
|
+
type,
|
|
38
|
+
description: workspaceTypeDescription[type],
|
|
39
|
+
disabled,
|
|
40
|
+
disabledReason: disabled ? instruction.reason : undefined,
|
|
41
|
+
disabledCommand: disabled ? instruction.command : undefined
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function resolveWorkspaceAgentSelection(
|
|
47
|
+
options: WorkspaceAgentOption[],
|
|
48
|
+
selectedType: WorkspaceType
|
|
49
|
+
): WorkspaceType | undefined {
|
|
50
|
+
const selected = options.find(option => option.type === selectedType)
|
|
51
|
+
if (selected && !selected.disabled) return selected.type
|
|
52
|
+
return options.find(option => !option.disabled)?.type
|
|
53
|
+
}
|