moi-computer 0.12.1-next.0 → 0.12.1-next.2
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 +7 -3
- package/client/api/app-config.ts +5 -10
- package/client/api/workspace-keys.ts +3 -2
- package/client/app/app-provider.tsx +25 -0
- 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} +22 -23
- package/client/app/shell/{SidebarLayout.tsx → sidebar-layout.tsx} +29 -23
- package/client/dev/index.html +43 -0
- package/client/dev/index.ts +15 -0
- package/client/features/applets/api.ts +1 -1
- 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 +3 -3
- 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 +3 -3
- 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} +4 -4
- package/client/features/collab/host-state.ts +24 -7
- package/client/features/collab/local-user.ts +1 -1
- package/client/features/collab/proxy-user.ts +4 -9
- 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} +26 -80
- 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 +253 -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 +29 -89
- package/client/features/home/{HomeLogo.tsx → home-logo.tsx} +1 -1
- package/client/features/home/{HomePage.tsx → home-page.tsx} +13 -14
- 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} +10 -13
- package/client/features/scratchpad/{useScratchpadSnapshot.tsx → use-scratchpad-snapshot.tsx} +3 -3
- package/client/features/settings/api.ts +15 -9
- 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 +31 -26
- 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 +78 -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} +37 -80
- package/client/features/workspace/workspace-frame.tsx +76 -0
- package/client/features/workspace/workspace-identity.tsx +40 -0
- package/client/features/workspace/{WorkspaceLayoutContext.tsx → workspace-layout-context.tsx} +2 -0
- package/client/features/workspace/{WorkspaceMenu.tsx → workspace-menu.tsx} +3 -3
- package/client/features/workspace/workspace-pending-screen.tsx +26 -0
- 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 +29 -10
- package/client/index.tsx +7 -2
- package/client/lib/agent-availability.ts +0 -5
- package/client/lib/browser-tab-id.ts +4 -0
- package/client/main.tsx +10 -7
- package/client/runtime/app-context.ts +20 -0
- package/client/runtime/use-workspace-events.ts +56 -0
- package/client/runtime/workspace-events.ts +151 -0
- package/dist/chunk-00rh9df4.js +2 -0
- package/dist/chunk-4nh7y1hq.css +1 -0
- package/dist/{chunk-vqpkqtdr.js → chunk-am4agx6v.js} +1 -1
- package/dist/{chunk-gps4qc38.js → chunk-d7cbm65e.js} +1 -1
- package/dist/chunk-hbpdv7vd.js +1 -0
- package/dist/chunk-hmka9rt5.js +2 -0
- package/dist/{chunk-j905va8r.js → chunk-hvh9f5h0.js} +1 -1
- package/dist/chunk-mjjregkn.js +10 -0
- package/dist/chunk-rt30jbcm.js +1 -0
- package/dist/chunk-vt6zybej.js +2 -0
- package/dist/chunk-wbkwf6cc.js +68 -0
- package/dist/chunk-xjyfyz64.js +1 -0
- package/dist/{chunk-hzwr8dp8.js → chunk-y8nbwp21.js} +71 -71
- package/dist/chunk-ysfdcew7.js +1 -0
- package/dist/index.html +30 -11
- package/lib/format.ts +1 -1
- package/lib/harness-instructions.ts +30 -0
- package/lib/ids.ts +3 -3
- 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} +125 -118
- 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} +9 -6
- 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/thread-list.ts +4 -0
- 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 +5 -3
- package/server/status.ts +3 -3
- package/server/vendor.ts +23 -30
- package/server/web.ts +17 -9
- 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} +13 -8
- 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/client/runtime/useWorkspaceEvents.ts +0 -189
- package/dist/chunk-1zhnhy00.js +0 -1
- package/dist/chunk-27501vke.js +0 -1
- package/dist/chunk-9xtv6djt.js +0 -2
- package/dist/chunk-am1x230f.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/dist/chunk-yvzhwtfa.js +0 -2
- 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/vendor/react/{development → 19.2.4/development}/_impl/react-dom-client.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/_impl/react-dom.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/_impl/react-jsx-dev-runtime.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/_impl/react-jsx-runtime.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/_impl/react.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/react-dom-client.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/react-dom.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/react-jsx-dev-runtime.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/react-jsx-runtime.js +0 -0
- /package/client/vendor/react/{development → 19.2.4/development}/react.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/_impl/react-dom-client.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/_impl/react-dom.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/_impl/react-jsx-dev-runtime.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/_impl/react-jsx-runtime.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/_impl/react.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/react-dom-client.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/react-dom.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/react-jsx-dev-runtime.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/react-jsx-runtime.js +0 -0
- /package/client/vendor/react/{production → 19.2.4/production}/react.js +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
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
4
|
+
import { Router, useLocation } from 'wouter'
|
|
5
|
+
import { memoryLocation } from 'wouter/memory-location'
|
|
6
|
+
|
|
7
|
+
import { loadAppConfig } from '@/client/api/app-config'
|
|
8
|
+
import { Button } from '@/client/components/ui/button'
|
|
9
|
+
import { Input } from '@/client/components/ui/input'
|
|
10
|
+
import {
|
|
11
|
+
Dialog,
|
|
12
|
+
DialogContent,
|
|
13
|
+
DialogDescription,
|
|
14
|
+
DialogTitle
|
|
15
|
+
} from '@/client/components/ui/dialog'
|
|
16
|
+
import { TooltipProvider } from '@/client/components/ui/tooltip'
|
|
17
|
+
import { Toaster } from '@/client/components/ui/toast'
|
|
18
|
+
import { WorkspacePendingScreen } from '@/client/features/workspace/workspace-pending-screen'
|
|
19
|
+
import { WorkspaceLayoutContext } from '@/client/features/workspace/workspace-layout-context'
|
|
20
|
+
import { createDefaultWorkspaceLayout } from '@/lib/workspace-layout'
|
|
21
|
+
import { useWorkspaceSetup } from '@/client/features/workspace/setup/workspace-setup'
|
|
22
|
+
import { WorkspaceWelcomeState } from '@/client/features/workspace/setup/workspace-welcome-state'
|
|
23
|
+
import { WorkspaceLoadingState } from '@/client/features/workspace/setup/workspace-recovery-states'
|
|
24
|
+
import type { AppEnvironment } from '@/lib/types'
|
|
25
|
+
import { workspaceTypeLabel } from '@/client/features/workspace/workspace-presentation'
|
|
26
|
+
import { useHarnessAuth, type LoginHarness } from '@/client/features/harness/api'
|
|
27
|
+
import {
|
|
28
|
+
createSetupMocks,
|
|
29
|
+
MOCK_SIGN_IN_URL,
|
|
30
|
+
MOCK_CODE_SIGN_IN_URL,
|
|
31
|
+
PREVIEW_WORKSPACE_ID,
|
|
32
|
+
SETUP_SCENARIOS
|
|
33
|
+
} from './workspace-setup-mocks'
|
|
34
|
+
import type { SetupScenario } from './workspace-setup-mocks'
|
|
35
|
+
|
|
36
|
+
const scenarioLabels: Record<SetupScenario, string> = {
|
|
37
|
+
welcome: 'Welcome',
|
|
38
|
+
login: 'Login',
|
|
39
|
+
'missing-agent': 'Agent missing',
|
|
40
|
+
'missing-folder': 'Folder missing',
|
|
41
|
+
loading: 'Loading'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type SetupPreviewProps = {
|
|
45
|
+
mocks: ReturnType<typeof createSetupMocks>
|
|
46
|
+
client: QueryClient
|
|
47
|
+
environment: AppEnvironment
|
|
48
|
+
harness: LoginHarness
|
|
49
|
+
scenario: SetupScenario
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function SetupPreview({ mocks, client, environment, harness, scenario }: SetupPreviewProps) {
|
|
53
|
+
const [provider, setProvider] = useState<'browser' | 'code' | 'closed'>()
|
|
54
|
+
const [deviceCode, setDeviceCode] = useState('')
|
|
55
|
+
const [layout, setLayout] = useState(createDefaultWorkspaceLayout)
|
|
56
|
+
const auth = useHarnessAuth(harness)
|
|
57
|
+
const pendingId = auth.data?.login?.state === 'pending' ? auth.data.login.id : undefined
|
|
58
|
+
// Both local harnesses open the browser automatically.
|
|
59
|
+
const providerPage = provider ?? (environment === 'local' && pendingId ? 'browser' : 'closed')
|
|
60
|
+
|
|
61
|
+
function restart(next: Record<string, string> = {}) {
|
|
62
|
+
const params = new URLSearchParams({ environment, harness, scenario, ...next })
|
|
63
|
+
window.location.assign(`?${params.toString()}`)
|
|
64
|
+
}
|
|
65
|
+
function update(action: () => void) {
|
|
66
|
+
action()
|
|
67
|
+
void client.invalidateQueries()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
className="flex h-dvh flex-col bg-background text-foreground"
|
|
73
|
+
onClickCapture={event => {
|
|
74
|
+
const link = (event.target as Element).closest('a')
|
|
75
|
+
if (link?.href === MOCK_SIGN_IN_URL || link?.href === MOCK_CODE_SIGN_IN_URL) {
|
|
76
|
+
event.preventDefault()
|
|
77
|
+
setProvider(link.href === MOCK_CODE_SIGN_IN_URL ? 'code' : 'browser')
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<header className="flex shrink-0 flex-wrap items-center gap-3 border-b border-border p-3 text-sm">
|
|
82
|
+
<div className="flex flex-wrap gap-2" role="group" aria-label="Environment">
|
|
83
|
+
{(['local', 'cloud'] as const).map(value => (
|
|
84
|
+
<Button
|
|
85
|
+
key={value}
|
|
86
|
+
size="sm"
|
|
87
|
+
variant={environment === value ? 'default' : 'secondary'}
|
|
88
|
+
onClick={() => restart({ environment: value })}
|
|
89
|
+
>
|
|
90
|
+
{value === 'local' ? 'Local' : 'Cloud'}
|
|
91
|
+
</Button>
|
|
92
|
+
))}
|
|
93
|
+
</div>
|
|
94
|
+
<div className="flex flex-wrap gap-2" role="group" aria-label="Agent">
|
|
95
|
+
{(['claude-code', 'codex'] as const).map(value => (
|
|
96
|
+
<Button
|
|
97
|
+
key={value}
|
|
98
|
+
size="sm"
|
|
99
|
+
variant={harness === value ? 'default' : 'secondary'}
|
|
100
|
+
onClick={() => restart({ harness: value })}
|
|
101
|
+
>
|
|
102
|
+
{workspaceTypeLabel[value]}
|
|
103
|
+
</Button>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
<div className="flex flex-wrap gap-2" role="group" aria-label="Scenario">
|
|
107
|
+
{SETUP_SCENARIOS.map(value => (
|
|
108
|
+
<Button
|
|
109
|
+
key={value}
|
|
110
|
+
size="sm"
|
|
111
|
+
variant={scenario === value ? 'default' : 'secondary'}
|
|
112
|
+
onClick={() => restart({ scenario: value })}
|
|
113
|
+
>
|
|
114
|
+
{scenarioLabels[value]}
|
|
115
|
+
</Button>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
<div className="flex flex-wrap gap-2" role="group" aria-label="Layout">
|
|
119
|
+
{(['split', 'fullscreen'] as const).map(layoutMode => (
|
|
120
|
+
<Button
|
|
121
|
+
key={layoutMode}
|
|
122
|
+
size="sm"
|
|
123
|
+
variant={layout.layoutMode === layoutMode ? 'default' : 'secondary'}
|
|
124
|
+
onClick={() => setLayout(current => ({ ...current, layoutMode }))}
|
|
125
|
+
>
|
|
126
|
+
{layoutMode === 'split' ? 'Split' : 'Fullscreen'}
|
|
127
|
+
</Button>
|
|
128
|
+
))}
|
|
129
|
+
</div>
|
|
130
|
+
</header>
|
|
131
|
+
<WorkspaceLayoutContext
|
|
132
|
+
value={{
|
|
133
|
+
workspaceId: PREVIEW_WORKSPACE_ID,
|
|
134
|
+
layout,
|
|
135
|
+
setLayout: update => setLayout(current => ({ ...current, ...update })),
|
|
136
|
+
name: 'My workspace',
|
|
137
|
+
cwd: null,
|
|
138
|
+
provider: harness,
|
|
139
|
+
isLoading: false
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<main className="flex min-h-0 flex-1 overflow-y-auto bg-muted">
|
|
143
|
+
{scenario === 'welcome' ? (
|
|
144
|
+
<WorkspacePendingScreen setupRequired>
|
|
145
|
+
<WorkspaceWelcomeState name="My workspace" workspaceType={harness} />
|
|
146
|
+
</WorkspacePendingScreen>
|
|
147
|
+
) : scenario === 'loading' ? (
|
|
148
|
+
<WorkspacePendingScreen>
|
|
149
|
+
<WorkspaceLoadingState />
|
|
150
|
+
</WorkspacePendingScreen>
|
|
151
|
+
) : (
|
|
152
|
+
<SetupScreen />
|
|
153
|
+
)}
|
|
154
|
+
</main>
|
|
155
|
+
</WorkspaceLayoutContext>
|
|
156
|
+
<Dialog
|
|
157
|
+
open={providerPage !== 'closed'}
|
|
158
|
+
onOpenChange={open => !open && setProvider('closed')}
|
|
159
|
+
>
|
|
160
|
+
<DialogContent>
|
|
161
|
+
<DialogTitle>Mock sign-in page</DialogTitle>
|
|
162
|
+
<DialogDescription>
|
|
163
|
+
This simulates the agent’s browser sign-in. No credentials are needed.
|
|
164
|
+
</DialogDescription>
|
|
165
|
+
{providerPage === 'code' ? (
|
|
166
|
+
<>
|
|
167
|
+
<p className="text-sm">
|
|
168
|
+
Copy this authorization code, close this dialog, and submit it in the login screen:
|
|
169
|
+
</p>
|
|
170
|
+
<code>MOCK-AUTH-CODE</code>
|
|
171
|
+
<Button onClick={() => setProvider('closed')}>Back to Moi</Button>
|
|
172
|
+
</>
|
|
173
|
+
) : (
|
|
174
|
+
<>
|
|
175
|
+
{environment === 'cloud' && (
|
|
176
|
+
<Input
|
|
177
|
+
aria-label="Device code"
|
|
178
|
+
placeholder="Paste MOCK-1234"
|
|
179
|
+
value={deviceCode}
|
|
180
|
+
onChange={event => setDeviceCode(event.target.value)}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
<Button
|
|
184
|
+
disabled={environment === 'cloud' && deviceCode !== 'MOCK-1234'}
|
|
185
|
+
onClick={() => {
|
|
186
|
+
update(mocks.complete)
|
|
187
|
+
setProvider('closed')
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
Authorize
|
|
191
|
+
</Button>
|
|
192
|
+
</>
|
|
193
|
+
)}
|
|
194
|
+
</DialogContent>
|
|
195
|
+
</Dialog>
|
|
196
|
+
</div>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function SetupScreen() {
|
|
201
|
+
const [path] = useLocation()
|
|
202
|
+
const { content, ready, setupRequired } = useWorkspaceSetup(PREVIEW_WORKSPACE_ID)
|
|
203
|
+
if (ready) return null
|
|
204
|
+
return path === '/' ? (
|
|
205
|
+
<div
|
|
206
|
+
role="status"
|
|
207
|
+
className="flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground"
|
|
208
|
+
>
|
|
209
|
+
Workspace removed
|
|
210
|
+
</div>
|
|
211
|
+
) : (
|
|
212
|
+
<WorkspacePendingScreen setupRequired={setupRequired}>{content}</WorkspacePendingScreen>
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export async function mountSetupPreview(element: HTMLElement) {
|
|
217
|
+
const params = new URLSearchParams(location.search)
|
|
218
|
+
const environment = params.get('environment') === 'cloud' ? 'cloud' : 'local'
|
|
219
|
+
const harness = params.get('harness') === 'codex' ? 'codex' : 'claude-code'
|
|
220
|
+
const scenario = SETUP_SCENARIOS.find(value => value === params.get('scenario')) ?? 'welcome'
|
|
221
|
+
const mocks = createSetupMocks(environment, harness, scenario)
|
|
222
|
+
// Scoped to this separate document. No fallback to the real fetch or socket.
|
|
223
|
+
window.fetch = Object.assign(mocks.request, { preconnect: fetch.preconnect })
|
|
224
|
+
Object.defineProperty(window, 'WebSocket', {
|
|
225
|
+
value: class extends EventTarget {
|
|
226
|
+
static OPEN = 1
|
|
227
|
+
readyState = 0
|
|
228
|
+
send() {}
|
|
229
|
+
close() {}
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
await loadAppConfig()
|
|
233
|
+
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
234
|
+
const locationHook = memoryLocation({
|
|
235
|
+
path: `/workspace/${PREVIEW_WORKSPACE_ID}`
|
|
236
|
+
})
|
|
237
|
+
createRoot(element).render(
|
|
238
|
+
<QueryClientProvider client={client}>
|
|
239
|
+
<TooltipProvider>
|
|
240
|
+
<Router hook={locationHook.hook}>
|
|
241
|
+
<SetupPreview
|
|
242
|
+
mocks={mocks}
|
|
243
|
+
client={client}
|
|
244
|
+
environment={environment}
|
|
245
|
+
harness={harness}
|
|
246
|
+
scenario={scenario}
|
|
247
|
+
/>
|
|
248
|
+
</Router>
|
|
249
|
+
<Toaster />
|
|
250
|
+
</TooltipProvider>
|
|
251
|
+
</QueryClientProvider>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
@@ -5,7 +5,7 @@ import { Button } from '@/client/components/ui/button'
|
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
6
6
|
import { cn } from '@/client/lib/cn'
|
|
7
7
|
|
|
8
|
-
import { type DrawingControls, useDrawingHistoryState } from './
|
|
8
|
+
import { type DrawingControls, useDrawingHistoryState } from './use-drawing-layer'
|
|
9
9
|
|
|
10
10
|
type DrawingToolbarProps = {
|
|
11
11
|
controls: DrawingControls
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'
|
|
2
2
|
|
|
3
3
|
import { toast } from '@/client/components/ui/toast'
|
|
4
4
|
import {
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
stageDrawingDraft
|
|
7
7
|
} from '@/client/features/chat/composer/attachments/draft-attachments'
|
|
8
8
|
import { liveStore } from '@/client/features/chat/chat-store'
|
|
9
|
-
import type { ComposerAnnotationControls } from '@/client/features/chat/composer/
|
|
9
|
+
import type { ComposerAnnotationControls } from '@/client/features/chat/composer/chat-composer'
|
|
10
10
|
import { useLatestRef } from '@/client/lib/use-latest-ref'
|
|
11
11
|
import type { LayoutMode, WorkspaceTabId } from '@/lib/types'
|
|
12
12
|
|
|
13
|
-
import { type DrawingController, useDrawingLayer } from './
|
|
13
|
+
import { type DrawingController, useDrawingLayer } from './use-drawing-layer'
|
|
14
14
|
|
|
15
15
|
type AnnotationOrigin = 'docked' | 'popup'
|
|
16
16
|
|
|
@@ -47,7 +47,6 @@ export function useChatAnnotation({
|
|
|
47
47
|
openPopup
|
|
48
48
|
}: UseChatAnnotationOptions): ChatAnnotationController {
|
|
49
49
|
const draftRef = useRef<ChatAnnotationDraft | null>(null)
|
|
50
|
-
const latestBlobRef = useRef<Blob | null>(null)
|
|
51
50
|
const uploadRevisionsRef = useRef(new Map<string, number>())
|
|
52
51
|
const closePopupRef = useLatestRef(closePopup)
|
|
53
52
|
const openPopupRef = useLatestRef(openPopup)
|
|
@@ -59,7 +58,6 @@ export function useChatAnnotation({
|
|
|
59
58
|
const draft = draftRef.current
|
|
60
59
|
if (!draft) return
|
|
61
60
|
|
|
62
|
-
latestBlobRef.current = blob
|
|
63
61
|
if (!blob) {
|
|
64
62
|
liveStore.getState().removeAttachment(draft.workspaceId, draft.attachmentId)
|
|
65
63
|
return
|
|
@@ -75,36 +73,51 @@ export function useChatAnnotation({
|
|
|
75
73
|
})
|
|
76
74
|
}, [])
|
|
77
75
|
|
|
78
|
-
const
|
|
76
|
+
const save = useCallback(async (result: Blob | null | Promise<Blob | null>) => {
|
|
77
|
+
const draft = draftRef.current
|
|
78
|
+
if (!draft) return
|
|
79
|
+
// Claim the draft before awaiting export so finish, cancel, and unmount
|
|
80
|
+
// cannot upload it twice.
|
|
81
|
+
draftRef.current = null
|
|
79
82
|
const revision = (uploadRevisionsRef.current.get(draft.attachmentId) ?? 0) + 1
|
|
80
83
|
uploadRevisionsRef.current.set(draft.attachmentId, revision)
|
|
81
|
-
|
|
84
|
+
const isCurrent = () => uploadRevisionsRef.current.get(draft.attachmentId) === revision
|
|
85
|
+
const blob = await result
|
|
86
|
+
if (!blob || !isCurrent()) return
|
|
87
|
+
await stageDrawing({
|
|
82
88
|
workspaceId: draft.workspaceId,
|
|
83
89
|
sessionId: draft.sourceSessionId,
|
|
84
90
|
localId: draft.attachmentId,
|
|
85
91
|
purpose: 'annotation',
|
|
86
92
|
source: draft.source,
|
|
87
93
|
blob,
|
|
88
|
-
isCurrent
|
|
94
|
+
isCurrent
|
|
89
95
|
})
|
|
90
96
|
}, [])
|
|
91
97
|
|
|
92
98
|
const complete = useCallback(
|
|
93
99
|
async (blob: Blob | null) => {
|
|
94
100
|
const draft = draftRef.current
|
|
95
|
-
draftRef.current = null
|
|
96
|
-
latestBlobRef.current = null
|
|
97
101
|
// Awaited so a send that finishes the drawing only dispatches once the
|
|
98
102
|
// attachment is uploaded and ready.
|
|
99
|
-
|
|
103
|
+
await save(blob)
|
|
100
104
|
if (draft?.origin === 'popup') openPopupRef.current()
|
|
101
105
|
},
|
|
102
|
-
[openPopupRef,
|
|
106
|
+
[openPopupRef, save]
|
|
103
107
|
)
|
|
104
108
|
|
|
105
109
|
const annotation = useDrawingLayer({ onChange: change, onFinish: complete })
|
|
106
110
|
const { controls } = annotation
|
|
107
|
-
const { active, starting, open, finish, cancel: cancelLayer } = controls
|
|
111
|
+
const { active, starting, open, finish, flush, cancel: cancelLayer } = controls
|
|
112
|
+
|
|
113
|
+
useLayoutEffect(
|
|
114
|
+
() => () => {
|
|
115
|
+
// Capture committed strokes before the drawing layer's passive cleanup
|
|
116
|
+
// clears its session. flush() also waits for an export already in progress.
|
|
117
|
+
if (draftRef.current) void save(flush())
|
|
118
|
+
},
|
|
119
|
+
[flush, save]
|
|
120
|
+
)
|
|
108
121
|
|
|
109
122
|
const start = useCallback(
|
|
110
123
|
async (origin: AnnotationOrigin) => {
|
|
@@ -135,16 +148,10 @@ export function useChatAnnotation({
|
|
|
135
148
|
)
|
|
136
149
|
|
|
137
150
|
const cancel = useCallback(async () => {
|
|
138
|
-
const
|
|
151
|
+
const pendingSave = draftRef.current ? save(flush()) : undefined
|
|
139
152
|
await cancelLayer()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const blob = latestBlobRef.current
|
|
143
|
-
latestBlobRef.current = null
|
|
144
|
-
// An implicit cancel (tab/session switch) keeps the drawn-so-far
|
|
145
|
-
// annotation as an attachment, so it gets its one deferred upload here.
|
|
146
|
-
if (draft && blob) void upload(draft, blob)
|
|
147
|
-
}, [cancelLayer, upload])
|
|
153
|
+
await pendingSave
|
|
154
|
+
}, [cancelLayer, flush, save])
|
|
148
155
|
|
|
149
156
|
const remove = useCallback(
|
|
150
157
|
(localId: string) => {
|
|
@@ -153,7 +160,6 @@ export function useChatAnnotation({
|
|
|
153
160
|
liveStore.getState().removeAttachment(workspaceId, localId)
|
|
154
161
|
if (draftRef.current?.attachmentId === localId) {
|
|
155
162
|
draftRef.current = null
|
|
156
|
-
latestBlobRef.current = null
|
|
157
163
|
void cancelLayer()
|
|
158
164
|
}
|
|
159
165
|
},
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
import { toast } from '@/client/components/ui/toast'
|
|
17
17
|
import { useLatestRef } from '@/client/lib/use-latest-ref'
|
|
18
18
|
|
|
19
|
-
import type { DrawingCanvasPointerProps, DrawingLayerProps } from './
|
|
19
|
+
import type { DrawingCanvasPointerProps, DrawingLayerProps } from './drawing-layer'
|
|
20
20
|
import { captureElement, drawingCaptureScale } from './capture-element'
|
|
21
21
|
|
|
22
22
|
export type DrawingPoint = {
|
|
@@ -8,7 +8,7 @@ import { attachmentKey, liveStore } from '@/client/features/chat/chat-store'
|
|
|
8
8
|
import { useLatestRef } from '@/client/lib/use-latest-ref'
|
|
9
9
|
import type { WorkspaceTabId } from '@/lib/types'
|
|
10
10
|
|
|
11
|
-
import { useDrawingLayer } from './
|
|
11
|
+
import { useDrawingLayer } from './use-drawing-layer'
|
|
12
12
|
|
|
13
13
|
type UseViewSketchOptions = {
|
|
14
14
|
active: boolean
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
3
|
+
import type {
|
|
4
|
+
HarnessAvailability,
|
|
5
|
+
HarnessLogin,
|
|
6
|
+
HarnessLoginState,
|
|
7
|
+
WorkspaceType
|
|
8
|
+
} from '@/lib/types'
|
|
9
|
+
|
|
10
|
+
export function startHarnessLogin(type: WorkspaceType): Promise<HarnessLogin> {
|
|
11
|
+
return requestJson(
|
|
12
|
+
`/api/harnesses/${type}/auth/login`,
|
|
13
|
+
{ method: 'POST' },
|
|
14
|
+
'Could not start sign-in'
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type LoginHarness = 'claude-code' | 'codex'
|
|
19
|
+
|
|
20
|
+
export type HarnessAuth = {
|
|
21
|
+
availability: HarnessAvailability
|
|
22
|
+
login?: HarnessLoginState
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function useHarnessAuth(type: WorkspaceType) {
|
|
26
|
+
return useQuery({
|
|
27
|
+
queryKey: ['harness-auth', type],
|
|
28
|
+
queryFn: () => requestJson<HarnessAuth>(`/api/harnesses/${type}/auth`),
|
|
29
|
+
staleTime: 2_000,
|
|
30
|
+
refetchInterval: 2_000
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function submitHarnessLoginCode(type: WorkspaceType, id: string, code: string) {
|
|
35
|
+
return requestVoid(`/api/harnesses/${type}/auth/login/${id}/code`, jsonRequest('POST', { code }))
|
|
36
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
IconChevronRight,
|
|
5
|
+
IconCopy,
|
|
6
|
+
IconCheck,
|
|
7
|
+
IconCircleNumber1,
|
|
8
|
+
IconCircleNumber2,
|
|
9
|
+
IconCircleNumber3
|
|
10
|
+
} from '@tabler/icons-react'
|
|
11
|
+
|
|
12
|
+
import { buttonVariants } from '@/client/components/ui/button'
|
|
13
|
+
import { cn } from '@/client/lib/cn'
|
|
14
|
+
|
|
15
|
+
type DeviceLoginStepsProps = {
|
|
16
|
+
code: string
|
|
17
|
+
url: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function DeviceLoginSteps({ code, url }: DeviceLoginStepsProps) {
|
|
21
|
+
const [copied, setCopied] = useState(false)
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!copied) return
|
|
25
|
+
const timer = setTimeout(() => setCopied(false), 3000)
|
|
26
|
+
return () => clearTimeout(timer)
|
|
27
|
+
}, [copied])
|
|
28
|
+
|
|
29
|
+
const copyCode = () => {
|
|
30
|
+
navigator.clipboard
|
|
31
|
+
?.writeText(code)
|
|
32
|
+
.then(() => setCopied(true))
|
|
33
|
+
.catch(() => {})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ol className="mx-auto grid w-full max-w-64 gap-6 text-left text-sm lg:max-w-3xl lg:grid-cols-3 lg:text-center">
|
|
38
|
+
<li className="flex flex-col items-start gap-3 lg:items-center">
|
|
39
|
+
<IconCircleNumber1 size={24} stroke={1.5} className="shrink-0" />
|
|
40
|
+
<div className="flex min-w-0 flex-col items-start gap-3 lg:items-center">
|
|
41
|
+
<p>Enable device code sign-in for Codex in ChatGPT settings</p>
|
|
42
|
+
<a
|
|
43
|
+
href="https://chatgpt.com/settings/security"
|
|
44
|
+
target="_blank"
|
|
45
|
+
rel="noopener noreferrer"
|
|
46
|
+
className="inline-flex h-8 flex-wrap items-center gap-1 font-semibold focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
47
|
+
>
|
|
48
|
+
Settings
|
|
49
|
+
<IconChevronRight size={16} stroke={2} aria-hidden="true" />
|
|
50
|
+
Security and login
|
|
51
|
+
</a>
|
|
52
|
+
</div>
|
|
53
|
+
</li>
|
|
54
|
+
<li className="flex flex-col items-start gap-3 lg:items-center">
|
|
55
|
+
<IconCircleNumber2 size={24} stroke={1.5} className="shrink-0" />
|
|
56
|
+
<div className="flex min-w-0 flex-col items-start gap-3 lg:items-center">
|
|
57
|
+
<p>Copy the one-time device code provided below</p>
|
|
58
|
+
<div className="flex h-8 items-center gap-2 rounded-lg border border-input bg-accent pr-2 pl-3">
|
|
59
|
+
<code className="cursor-text text-sm font-medium select-text">{code}</code>
|
|
60
|
+
<button
|
|
61
|
+
type="button"
|
|
62
|
+
className="relative size-4 cursor-pointer text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground"
|
|
63
|
+
aria-label={copied ? 'Code copied' : 'Copy code'}
|
|
64
|
+
onClick={copyCode}
|
|
65
|
+
>
|
|
66
|
+
<IconCopy
|
|
67
|
+
className={cn(
|
|
68
|
+
'absolute inset-0 transition-[opacity,filter] duration-200 motion-reduce:transition-none',
|
|
69
|
+
copied && 'opacity-0 blur-[2px]'
|
|
70
|
+
)}
|
|
71
|
+
stroke={1.75}
|
|
72
|
+
size={16}
|
|
73
|
+
/>
|
|
74
|
+
<IconCheck
|
|
75
|
+
className={cn(
|
|
76
|
+
'absolute inset-0 transition-[opacity,filter] duration-200 motion-reduce:transition-none',
|
|
77
|
+
!copied && 'opacity-0 blur-[2px]'
|
|
78
|
+
)}
|
|
79
|
+
stroke={1.75}
|
|
80
|
+
size={16}
|
|
81
|
+
/>
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</li>
|
|
86
|
+
<li className="flex flex-col items-start gap-3 lg:items-center">
|
|
87
|
+
<IconCircleNumber3 size={24} stroke={1.5} className="shrink-0" />
|
|
88
|
+
<div className="flex min-w-0 flex-col items-start gap-3 lg:items-center">
|
|
89
|
+
<p>Sign in to ChatGPT, paste the code, and then come back to Moi</p>
|
|
90
|
+
<a href={url} target="_blank" rel="noopener noreferrer" className={buttonVariants()}>
|
|
91
|
+
Open ChatGPT
|
|
92
|
+
</a>
|
|
93
|
+
</div>
|
|
94
|
+
</li>
|
|
95
|
+
</ol>
|
|
96
|
+
)
|
|
97
|
+
}
|