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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { detectInstalledHarnesses } from '../harness/executable'
|
|
1
2
|
import { isMessageAttachments } from '@/lib/message-attachments'
|
|
2
3
|
import { Hono } from 'hono'
|
|
3
4
|
import { serveStatic } from 'hono/bun'
|
|
@@ -21,54 +22,60 @@ import type {
|
|
|
21
22
|
} from '@/lib/types'
|
|
22
23
|
import { isWorkspaceTabId } from '@/lib/workspace-tabs'
|
|
23
24
|
|
|
24
|
-
import { proxyUserState } from '
|
|
25
|
-
import { collabManager } from '
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
25
|
+
import { proxyUserState } from '../collab/cloudflare-access'
|
|
26
|
+
import { collabManager } from '../collab/manager'
|
|
27
|
+
import { harnessStore } from '../harness/auth'
|
|
28
|
+
import { harnesses } from './harnesses'
|
|
29
|
+
import { clientAppConfig, getAppConfig } from '../app-config'
|
|
30
|
+
import { getAppSettings, pickAppSettingsPatch, saveAppSettings } from '../app-settings'
|
|
31
|
+
import { appletForModule, recordAppletError } from '../applets/log'
|
|
32
|
+
import { apiBaseFor, parseAppletTail, serveWorkspaceFile } from '../applets'
|
|
33
|
+
import { applyEnvChanged } from '../workspaces/env-apply'
|
|
34
|
+
import { publishEvent } from '../events'
|
|
35
|
+
import { callFunction, parseFunctionPath } from '../applets/functions'
|
|
36
|
+
import { processIcon } from '../workspaces/icon'
|
|
37
|
+
import {
|
|
38
|
+
getWorkspacePreview,
|
|
39
|
+
loadLayout,
|
|
40
|
+
mergeLayoutForSave,
|
|
41
|
+
saveLayout
|
|
42
|
+
} from '../workspaces/layout'
|
|
36
43
|
import {
|
|
37
44
|
getAppletThumbnailRecords,
|
|
38
45
|
isValidAppletId,
|
|
39
46
|
saveAppletThumbnails,
|
|
40
47
|
serveAppletThumbnail
|
|
41
|
-
} from '
|
|
42
|
-
import { getClientFrameLog, getWireLog } from '
|
|
43
|
-
import {
|
|
48
|
+
} from '../applets/thumbnails'
|
|
49
|
+
import { getClientFrameLog, getWireLog } from '../harness/debug'
|
|
50
|
+
import { loginShellPath } from '../harness/shell-path'
|
|
51
|
+
import { allHarnesses, harnessFor, isHarnessType } from '../harness/registry'
|
|
44
52
|
import {
|
|
45
53
|
discoverWorkspaces,
|
|
46
54
|
getWorkspace,
|
|
47
55
|
listWorkspaces,
|
|
48
56
|
registerWorkspace,
|
|
49
57
|
removeWorkspace,
|
|
50
|
-
reorderWorkspaces
|
|
51
|
-
|
|
52
|
-
} from '
|
|
53
|
-
import {
|
|
54
|
-
import { MAX_ASSET_BYTES, scratchpadAssetFile, storeScratchpadAsset } from './scratchpad-assets'
|
|
58
|
+
reorderWorkspaces
|
|
59
|
+
} from '../workspaces/registry'
|
|
60
|
+
import { loadScratchpadDoc, saveScratchpadDoc } from '../scratchpad/document'
|
|
61
|
+
import { MAX_ASSET_BYTES, scratchpadAssetFile, storeScratchpadAsset } from '../scratchpad/assets'
|
|
55
62
|
import {
|
|
56
63
|
getPinnedSession,
|
|
57
64
|
getSelectedSession,
|
|
58
65
|
getWorkspaceSessionSelection,
|
|
59
66
|
pinSession,
|
|
60
67
|
saveSelectedSession
|
|
61
|
-
} from '
|
|
62
|
-
import type { SelectedSessionUpdate } from '
|
|
63
|
-
import { saveSessionConfig } from '
|
|
64
|
-
import type { SessionConfigPatch } from '
|
|
65
|
-
import { getSessionRecord, withSessionRecords } from '
|
|
66
|
-
import { archiveWorkspaceSession } from '
|
|
67
|
-
import { DIST_DIR, prebuilt } from '
|
|
68
|
-
import { getWorkspaceSkillsStatus, updateWorkspaceSkills } from '
|
|
69
|
-
import { serveWorkspaceImagePreview } from '
|
|
70
|
-
import { MAX_UPLOAD_BYTES, addUpload, addWorkspaceFileUpload, getUpload } from '
|
|
71
|
-
import { requiredEnvFor } from '
|
|
68
|
+
} from '../sessions/selected'
|
|
69
|
+
import type { SelectedSessionUpdate } from '../sessions/selected'
|
|
70
|
+
import { saveSessionConfig } from '../sessions/config'
|
|
71
|
+
import type { SessionConfigPatch } from '../sessions/config'
|
|
72
|
+
import { getSessionRecord, withSessionRecords } from '../sessions/store'
|
|
73
|
+
import { archiveWorkspaceSession } from '../sessions/archive'
|
|
74
|
+
import { DIST_DIR, prebuilt } from '../static'
|
|
75
|
+
import { getWorkspaceSkillsStatus, updateWorkspaceSkills } from '../skills/update'
|
|
76
|
+
import { serveWorkspaceImagePreview } from '../workspaces/preview'
|
|
77
|
+
import { MAX_UPLOAD_BYTES, addUpload, addWorkspaceFileUpload, getUpload } from '../uploads'
|
|
78
|
+
import { requiredEnvFor } from '../workspaces/required-env'
|
|
72
79
|
import {
|
|
73
80
|
deleteView,
|
|
74
81
|
listCompiledViews,
|
|
@@ -76,25 +83,25 @@ import {
|
|
|
76
83
|
serveView,
|
|
77
84
|
updateViewTitle,
|
|
78
85
|
ViewMutationError
|
|
79
|
-
} from '
|
|
86
|
+
} from '../applets/views'
|
|
80
87
|
import {
|
|
81
88
|
createPendingView,
|
|
82
89
|
discardPendingView,
|
|
83
90
|
getPendingView,
|
|
84
91
|
updatePendingView,
|
|
85
92
|
PendingViewError
|
|
86
|
-
} from '
|
|
87
|
-
import { submitView, ViewStartupError } from '
|
|
88
|
-
import { listWidgets, serveWidget } from '
|
|
89
|
-
import { getWorkspaceConfig, setWorkspaceConfig } from '
|
|
93
|
+
} from '../sessions/pending-views'
|
|
94
|
+
import { submitView, ViewStartupError } from '../sessions/view-sessions'
|
|
95
|
+
import { listWidgets, serveWidget } from '../applets/widgets'
|
|
96
|
+
import { getWorkspaceConfig, setWorkspaceConfig } from '../workspaces/config'
|
|
90
97
|
import {
|
|
91
98
|
createdWorkspacesRoot,
|
|
92
99
|
provisionWorkspace,
|
|
93
100
|
validateWorkspaceFolderName
|
|
94
|
-
} from '
|
|
95
|
-
import { resolveWorkspaceImportMetadata } from '
|
|
96
|
-
import type { WorkspaceImportMetadata } from '
|
|
97
|
-
import { getWorkspaceEnvView, parseEnvUpdate, updateWorkspaceEnv } from '
|
|
101
|
+
} from '../workspaces/init'
|
|
102
|
+
import { resolveWorkspaceImportMetadata } from '../workspaces/import'
|
|
103
|
+
import type { WorkspaceImportMetadata } from '../workspaces/import'
|
|
104
|
+
import { getWorkspaceEnvView, parseEnvUpdate, updateWorkspaceEnv } from '../workspaces/env'
|
|
98
105
|
import {
|
|
99
106
|
getCachedUpdateStatus,
|
|
100
107
|
hasRunningAgentSessions,
|
|
@@ -102,12 +109,18 @@ import {
|
|
|
102
109
|
restartPendingForUpdate,
|
|
103
110
|
scheduleRestartForUpdate,
|
|
104
111
|
updateInProgress
|
|
105
|
-
} from '
|
|
112
|
+
} from '../update'
|
|
106
113
|
|
|
107
114
|
// The resolved workspace is stashed on the context by `withWorkspace`, so every
|
|
108
115
|
// `/api/workspaces/:id/*` handler can read it without re-querying the registry.
|
|
109
116
|
type ApiEnv = { Variables: { ws: WorkspaceEntry } }
|
|
110
117
|
|
|
118
|
+
// The writing browser tab's id from a request body, echoed on the resulting
|
|
119
|
+
// event so that tab can skip it. See client/lib/browser-tab-id.ts.
|
|
120
|
+
function eventOrigin(value: unknown): string | undefined {
|
|
121
|
+
return typeof value === 'string' ? value : undefined
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
function publishSelectedSession(workspaceId: string, update: SelectedSessionUpdate): void {
|
|
112
125
|
if (!update.changed) return
|
|
113
126
|
publishEvent({
|
|
@@ -171,20 +184,6 @@ const withWorkspace = createMiddleware<ApiEnv>(async (c, next) => {
|
|
|
171
184
|
const one = new Hono<ApiEnv>()
|
|
172
185
|
one.use('*', withWorkspace)
|
|
173
186
|
|
|
174
|
-
one.get('/preview', async c => {
|
|
175
|
-
const ws = c.get('ws')
|
|
176
|
-
const views = await listCompiledViews(ws.path)
|
|
177
|
-
return c.json(
|
|
178
|
-
await getWorkspacePreview(ws.path, {
|
|
179
|
-
getProviderPreview: includeFirstUserMessage =>
|
|
180
|
-
harnessFor(ws).workspacePreview(ws, includeFirstUserMessage),
|
|
181
|
-
viewIds: views.map(view => view.id),
|
|
182
|
-
thumbnailUrl: (kind, id) =>
|
|
183
|
-
`/api/workspaces/${ws.id}/applet-thumbnails/${kind}/${encodeURIComponent(id)}`
|
|
184
|
-
})
|
|
185
|
-
)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
187
|
one.get('/widgets', c => listWidgets(c.get('ws').path))
|
|
189
188
|
|
|
190
189
|
// Widget bundle: the compiled ESM for one widget, dynamically imported by the
|
|
@@ -352,7 +351,7 @@ one.post('/rpc/*', c => {
|
|
|
352
351
|
// `moi debug logs` reads it back (docs/self-correction.md). Unauthenticated
|
|
353
352
|
// localhost route, so treat the payload as hostile: whitelist the browser-only
|
|
354
353
|
// sources (`build`/`rpc` are server-recorded and can't be spoofed by a tab),
|
|
355
|
-
// pattern-check the applet name, cap the batch size;
|
|
354
|
+
// pattern-check the applet name, cap the batch size; applets/log.ts caps string
|
|
356
355
|
// lengths.
|
|
357
356
|
one.post('/applet-log', async c => {
|
|
358
357
|
let body: { events?: unknown }
|
|
@@ -396,7 +395,7 @@ one.post('/applet-log', async c => {
|
|
|
396
395
|
|
|
397
396
|
// Downscaled image preview of a workspace file. The chat's expanded tool rows
|
|
398
397
|
// use this to show the picture an agent `Read` — same guards as /files/ above,
|
|
399
|
-
// images only, resized server-side (see server/preview.ts).
|
|
398
|
+
// images only, resized server-side (see server/workspaces/preview.ts).
|
|
400
399
|
one.get('/preview/*', c => {
|
|
401
400
|
const ws = c.get('ws')
|
|
402
401
|
const tail = new URL(c.req.url).pathname.split(`/api/workspaces/${ws.id}/preview/`)[1] ?? ''
|
|
@@ -455,7 +454,7 @@ one.post('/uploads/from-path', async c => {
|
|
|
455
454
|
if (error instanceof Error && 'code' in error) {
|
|
456
455
|
if (error.code === 'ENOENT') return c.text('This file no longer exists', 400)
|
|
457
456
|
if (error.code === 'EACCES' || error.code === 'EPERM')
|
|
458
|
-
return c.text('This file can’t be read by
|
|
457
|
+
return c.text('This file can’t be read by Moi', 400)
|
|
459
458
|
return c.text('Something went wrong while adding this file', 400)
|
|
460
459
|
}
|
|
461
460
|
return c.text(
|
|
@@ -654,20 +653,6 @@ one.put('/env', async c => {
|
|
|
654
653
|
return c.json(await getWorkspaceEnvView(ws.path, requiredEnvFor(ws.path)))
|
|
655
654
|
})
|
|
656
655
|
|
|
657
|
-
// Start a provider login ceremony. Codex returns a browser OAuth URL for the
|
|
658
|
-
// host to open; Claude launches its browser flow through the CLI itself.
|
|
659
|
-
// Browser-based logins reuse a pending URL; URL-less provider flows restart
|
|
660
|
-
// when requested again. Completion is pushed as `agent:updated`.
|
|
661
|
-
one.post('/auth/login', async c => {
|
|
662
|
-
const ws = c.get('ws')
|
|
663
|
-
if (!harnessFor(ws).startLogin) return c.text('This agent requires terminal sign-in', 409)
|
|
664
|
-
try {
|
|
665
|
-
return c.json(await agentStore.startLogin(ws))
|
|
666
|
-
} catch (err) {
|
|
667
|
-
return c.text(err instanceof Error ? err.message : 'Could not start sign-in', 500)
|
|
668
|
-
}
|
|
669
|
-
})
|
|
670
|
-
|
|
671
656
|
one.get('/skills', async c => {
|
|
672
657
|
const ws = c.get('ws')
|
|
673
658
|
return c.json(await getWorkspaceSkillsStatus(ws.path, ws.type))
|
|
@@ -680,31 +665,40 @@ one.post('/skills/update', async c => {
|
|
|
680
665
|
})
|
|
681
666
|
|
|
682
667
|
// The workspace's agent backend in one snapshot: provider, availability
|
|
683
|
-
// (runtime presence + auth,
|
|
684
|
-
//
|
|
685
|
-
// open; the volatile parts stay fresh afterwards via `agent:updated` events,
|
|
686
|
-
// not refetches.
|
|
668
|
+
// (runtime presence + auth), the model catalog, and capabilities.
|
|
669
|
+
// Workspace readiness stays fresh via `harness:updated` events and refetches.
|
|
687
670
|
one.get('/agent', async c => {
|
|
688
671
|
const ws = c.get('ws')
|
|
689
672
|
const harness = harnessFor(ws)
|
|
673
|
+
const capabilities = {
|
|
674
|
+
provider: harness.id,
|
|
675
|
+
supportsStreaming: harness.capabilities.supportsStreaming,
|
|
676
|
+
supportsArchiving: Boolean(harness.archiveSession)
|
|
677
|
+
}
|
|
678
|
+
if (!existsSync(ws.path)) {
|
|
679
|
+
return c.json({
|
|
680
|
+
...capabilities,
|
|
681
|
+
workspaceFolderMissing: true,
|
|
682
|
+
availability: { status: 'unavailable', reason: 'Workspace folder not found' },
|
|
683
|
+
models: []
|
|
684
|
+
} satisfies WorkspaceAgent)
|
|
685
|
+
}
|
|
686
|
+
const refresh = c.req.query('refresh') === 'true'
|
|
687
|
+
if (refresh) await loginShellPath({ refresh: true })
|
|
690
688
|
// A backend that can't answer (codex CLI missing, gateway down) degrades to
|
|
691
689
|
// an empty catalog — the picker hides and chat surfaces the real problem via
|
|
692
|
-
//
|
|
690
|
+
// workspace setup, instead of this endpoint failing on page load.
|
|
693
691
|
const [availability, models] = await Promise.all([
|
|
694
|
-
|
|
692
|
+
refresh ? harnessStore.refresh(ws) : harnessStore.getAvailability(ws),
|
|
695
693
|
harness.listModels(ws).catch(err => {
|
|
696
694
|
console.error(`[api] listModels failed for ${harness.id}`, err)
|
|
697
695
|
return []
|
|
698
696
|
})
|
|
699
697
|
])
|
|
700
|
-
const login = agentStore.getLogin(ws.id)
|
|
701
698
|
return c.json({
|
|
702
|
-
|
|
699
|
+
...capabilities,
|
|
703
700
|
availability,
|
|
704
|
-
|
|
705
|
-
models,
|
|
706
|
-
supportsStreaming: harness.capabilities.supportsStreaming,
|
|
707
|
-
supportsArchiving: Boolean(harness.archiveSession)
|
|
701
|
+
models
|
|
708
702
|
} satisfies WorkspaceAgent)
|
|
709
703
|
})
|
|
710
704
|
|
|
@@ -732,7 +726,7 @@ one.put('/config', async c => {
|
|
|
732
726
|
return c.text('Expected a workspace config field', 400)
|
|
733
727
|
}
|
|
734
728
|
await setWorkspaceConfig(ws.path, { name, icon })
|
|
735
|
-
publishEvent({ type: 'workspace:updated' })
|
|
729
|
+
publishEvent({ type: 'workspace:updated', origin: eventOrigin(body.origin) })
|
|
736
730
|
return c.json(await getWorkspaceConfig(ws.path))
|
|
737
731
|
})
|
|
738
732
|
|
|
@@ -741,7 +735,7 @@ one.put('/config', async c => {
|
|
|
741
735
|
// snapshot ({ document, origin }) and broadcasts so other open tabs reload.
|
|
742
736
|
// `origin` is the writing tab's id — echoed in the broadcast so that tab can
|
|
743
737
|
// ignore its own save. This is the browser's write path; the agent's draws are
|
|
744
|
-
// written server-side (see scratchpad
|
|
738
|
+
// written server-side (see server/scratchpad/executor.ts). See docs/moi-scratchpad.md.
|
|
745
739
|
one.get('/scratchpad', async c => {
|
|
746
740
|
return c.json(await loadScratchpadDoc(c.get('ws').path))
|
|
747
741
|
})
|
|
@@ -756,14 +750,14 @@ one.put('/scratchpad', async c => {
|
|
|
756
750
|
publishEvent({
|
|
757
751
|
type: 'scratchpad:updated',
|
|
758
752
|
workspaceId: ws.id,
|
|
759
|
-
origin:
|
|
753
|
+
origin: eventOrigin(body.origin)
|
|
760
754
|
})
|
|
761
755
|
return c.body(null, 204)
|
|
762
756
|
})
|
|
763
757
|
|
|
764
758
|
// Scratchpad assets: pasted/dropped image bytes live as content-addressed files
|
|
765
759
|
// in `.moi/.scratchpad/`, referenced from the snapshot by `asset:` srcs —
|
|
766
|
-
// never inlined as base64 in the JSON (see server/scratchpad
|
|
760
|
+
// never inlined as base64 in the JSON (see server/scratchpad/assets.ts). The
|
|
767
761
|
// browser's TLAssetStore POSTs the raw file here on paste and resolves `asset:`
|
|
768
762
|
// srcs back through the GET when rendering.
|
|
769
763
|
one.post('/scratchpad/assets', async c => {
|
|
@@ -848,11 +842,15 @@ one.get('/applet-thumbnails', async c =>
|
|
|
848
842
|
one.get('/applet-thumbnails/:kind/:name', c => {
|
|
849
843
|
const kind = c.req.param('kind')
|
|
850
844
|
if (kind !== 'widget' && kind !== 'view') return c.text('Not found', 404)
|
|
845
|
+
// `<id>` or `<id>:<version>`. Applet ids never contain `:`, and the version
|
|
846
|
+
// lives in the path rather than a query string so every CDN keys on it.
|
|
847
|
+
const [id, version] = c.req.param('name').split(':')
|
|
851
848
|
return serveAppletThumbnail(
|
|
852
849
|
c.get('ws').path,
|
|
853
850
|
kind,
|
|
854
|
-
|
|
855
|
-
c.req.header('if-none-match')
|
|
851
|
+
id!,
|
|
852
|
+
c.req.header('if-none-match'),
|
|
853
|
+
version !== undefined
|
|
856
854
|
)
|
|
857
855
|
})
|
|
858
856
|
|
|
@@ -886,16 +884,18 @@ one.put('/', async c => {
|
|
|
886
884
|
const ws = c.get('ws')
|
|
887
885
|
const body = await c.req.json()
|
|
888
886
|
if (!body || body.version !== 1) return c.text('Bad request', 400)
|
|
887
|
+
// `origin` is the writing tab's id, echoed so that tab skips its own event.
|
|
888
|
+
const { origin, ...layout } = body
|
|
889
889
|
// Preserve server-owned identity (name/icon) across a grid/theme save so the
|
|
890
890
|
// client's PUT can't erase a `moi config`-set name. See mergeLayoutForSave.
|
|
891
891
|
const existing = await loadLayout(ws.path)
|
|
892
|
-
const next = mergeLayoutForSave(existing,
|
|
892
|
+
const next = mergeLayoutForSave(existing, layout)
|
|
893
893
|
await saveLayout(next, ws.path)
|
|
894
894
|
if (
|
|
895
895
|
JSON.stringify(resolveWorkspaceTheme(existing.theme)) !==
|
|
896
896
|
JSON.stringify(resolveWorkspaceTheme(next.theme))
|
|
897
897
|
) {
|
|
898
|
-
publishEvent({ type: 'theme:updated' })
|
|
898
|
+
publishEvent({ type: 'theme:updated', origin: eventOrigin(origin) })
|
|
899
899
|
}
|
|
900
900
|
return c.body(null, 204)
|
|
901
901
|
})
|
|
@@ -943,7 +943,7 @@ workspaces.put('/order', async c => {
|
|
|
943
943
|
// List-only change: a narrow event so clients refetch just the sidebar
|
|
944
944
|
// list, not every per-workspace query (`workspace:updated` also triggers
|
|
945
945
|
// layout refetches in open workspaces).
|
|
946
|
-
publishEvent({ type: 'workspaces-list:updated' })
|
|
946
|
+
publishEvent({ type: 'workspaces-list:updated', origin: eventOrigin(body.origin) })
|
|
947
947
|
return c.json(await mergeWorkspaceList(entries))
|
|
948
948
|
} catch (err) {
|
|
949
949
|
const message = err instanceof Error ? err.message : String(err)
|
|
@@ -955,10 +955,10 @@ workspaces.put('/order', async c => {
|
|
|
955
955
|
// provisioned with its workspaces; the UI never sends these requests (it opens
|
|
956
956
|
// the cloud demo promo dialog instead), so a 403 here means the API was called
|
|
957
957
|
// directly.
|
|
958
|
-
const DEMO_CREATE_BLOCKED = 'Workspace creation is not available in the
|
|
958
|
+
const DEMO_CREATE_BLOCKED = 'Workspace creation is not available in the Moi demo'
|
|
959
959
|
|
|
960
960
|
workspaces.post('/', async c => {
|
|
961
|
-
if (getAppConfig().
|
|
961
|
+
if (getAppConfig().demo) return c.text(DEMO_CREATE_BLOCKED, 403)
|
|
962
962
|
const body = await c.req.json()
|
|
963
963
|
if (!body?.path) return c.text('Missing path', 400)
|
|
964
964
|
const requestedType: unknown = body?.type ?? 'claude-code'
|
|
@@ -992,6 +992,27 @@ workspaces.post('/', async c => {
|
|
|
992
992
|
|
|
993
993
|
workspaces.get('/discover', async c => c.json(await discoverWorkspaces()))
|
|
994
994
|
|
|
995
|
+
// Home-card previews for every workspace in one request, keyed by id, so the
|
|
996
|
+
// home page fetches them beside the list instead of one per card after it.
|
|
997
|
+
workspaces.get('/previews', async c => {
|
|
998
|
+
const entries = await listWorkspaces()
|
|
999
|
+
const previews = await Promise.all(
|
|
1000
|
+
entries.map(async ws => {
|
|
1001
|
+
const views = await listCompiledViews(ws.path).catch(() => [])
|
|
1002
|
+
const preview = await getWorkspacePreview(ws.path, {
|
|
1003
|
+
getProviderPreview: includeFirstUserMessage =>
|
|
1004
|
+
harnessFor(ws).workspacePreview(ws, includeFirstUserMessage),
|
|
1005
|
+
viewIds: views.map(view => view.id),
|
|
1006
|
+
// Capture time in base36 keeps the versioned segment short and URL-safe.
|
|
1007
|
+
thumbnailUrl: (kind, id, capturedAt) =>
|
|
1008
|
+
`/api/workspaces/${ws.id}/applet-thumbnails/${kind}/${id}:${Date.parse(capturedAt).toString(36)}`
|
|
1009
|
+
})
|
|
1010
|
+
return [ws.id, preview] as const
|
|
1011
|
+
})
|
|
1012
|
+
)
|
|
1013
|
+
return c.json(Object.fromEntries(previews))
|
|
1014
|
+
})
|
|
1015
|
+
|
|
995
1016
|
// Backends the create dialog can provision from scratch. OpenClaw workspaces
|
|
996
1017
|
// belong to their agents and arrive via discovery.
|
|
997
1018
|
const CREATABLE_TYPES = new Set<WorkspaceType>(['claude-code', 'codex'])
|
|
@@ -1000,31 +1021,16 @@ async function workspaceTypeAvailability(type: WorkspaceType): Promise<HarnessAv
|
|
|
1000
1021
|
return (await harnessFor(type).availability?.()) ?? { status: 'available' }
|
|
1001
1022
|
}
|
|
1002
1023
|
|
|
1003
|
-
//
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
out[h.id] = await workspaceTypeAvailability(h.id)
|
|
1009
|
-
}
|
|
1010
|
-
return out
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
// Where `/workspace/create` places new folders — the client shows the resolved
|
|
1014
|
-
// location while the user types a name. `availability` lets the dialog disable
|
|
1015
|
-
// backends whose runtime is missing.
|
|
1016
|
-
workspaces.get('/create', async c =>
|
|
1017
|
-
c.json({
|
|
1018
|
-
root: createdWorkspacesRoot(),
|
|
1019
|
-
displayRoot: tildify(createdWorkspacesRoot()),
|
|
1020
|
-
availability: await harnessAvailability()
|
|
1021
|
-
})
|
|
1022
|
-
)
|
|
1024
|
+
// Both workspace dialogs only need installation facts to offer agent choices.
|
|
1025
|
+
workspaces.get('/create', async c => {
|
|
1026
|
+
c.header('Cache-Control', 'no-store')
|
|
1027
|
+
return c.json({ installed: await detectInstalledHarnesses() })
|
|
1028
|
+
})
|
|
1023
1029
|
|
|
1024
1030
|
// Create a brand-new workspace: a fresh folder under createdWorkspacesRoot(),
|
|
1025
1031
|
// provisioned (skills + `.moi/` scaffold) and registered.
|
|
1026
1032
|
workspaces.post('/create', async c => {
|
|
1027
|
-
if (getAppConfig().
|
|
1033
|
+
if (getAppConfig().demo) return c.text(DEMO_CREATE_BLOCKED, 403)
|
|
1028
1034
|
const body = await c.req.json()
|
|
1029
1035
|
const requestedType: unknown = body?.type ?? 'claude-code'
|
|
1030
1036
|
if (!isHarnessType(requestedType)) {
|
|
@@ -1062,6 +1068,7 @@ workspaces.route('/:id', one)
|
|
|
1062
1068
|
export const api = new Hono()
|
|
1063
1069
|
|
|
1064
1070
|
api.route('/api/workspaces', workspaces)
|
|
1071
|
+
api.route('/api/harnesses', harnesses)
|
|
1065
1072
|
|
|
1066
1073
|
// Startup config (config.json in the data dir + MOI_* env), client-safe
|
|
1067
1074
|
// subset. Immutable for the process lifetime — clients cache it forever.
|
|
@@ -1087,7 +1094,7 @@ api.post('/api/update', async c => {
|
|
|
1087
1094
|
if (updateInProgress()) {
|
|
1088
1095
|
return c.text(
|
|
1089
1096
|
restartPendingForUpdate()
|
|
1090
|
-
? 'An update is installed —
|
|
1097
|
+
? 'An update is installed — Moi is restarting.'
|
|
1091
1098
|
: 'An update is already in progress.',
|
|
1092
1099
|
409
|
|
1093
1100
|
)
|
|
@@ -1102,7 +1109,7 @@ api.post('/api/update', async c => {
|
|
|
1102
1109
|
|
|
1103
1110
|
try {
|
|
1104
1111
|
const result = await installUpdate()
|
|
1105
|
-
if (!result) return c.text('This
|
|
1112
|
+
if (!result) return c.text('This Moi cannot be updated from the app', 409)
|
|
1106
1113
|
const response = c.json(result)
|
|
1107
1114
|
scheduleRestartForUpdate()
|
|
1108
1115
|
return response
|
package/server/app-config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs'
|
|
2
2
|
import { isAbsolute, join } from 'path'
|
|
3
3
|
|
|
4
|
-
import type { ClientAppConfig, ExperimentalFeatures } from '@/lib/types'
|
|
4
|
+
import type { AppEnvironment, ClientAppConfig, ExperimentalFeatures } from '@/lib/types'
|
|
5
5
|
import { EXPERIMENTAL_DEFAULTS } from '@/lib/experimental'
|
|
6
6
|
|
|
7
7
|
import { DATA_DIR } from './data-dir'
|
|
@@ -18,9 +18,10 @@ import { DATA_DIR } from './data-dir'
|
|
|
18
18
|
// warns on stderr and falls back per-key, so a broken config never takes the
|
|
19
19
|
// CLI or server down with it.
|
|
20
20
|
export type AppConfig = {
|
|
21
|
-
|
|
21
|
+
environment: AppEnvironment
|
|
22
|
+
// Demo mode: workspace creation is blocked (UI shows the
|
|
22
23
|
// cloud-demo promo dialog instead) and `moi` system commands are disabled.
|
|
23
|
-
|
|
24
|
+
demo: boolean
|
|
24
25
|
experimental: ExperimentalFeatures
|
|
25
26
|
// Link target for the cloud-demo promo dialog.
|
|
26
27
|
demoInstallUrl: string
|
|
@@ -49,7 +50,8 @@ export type CloudflareAccessConfig = {
|
|
|
49
50
|
type DeploymentConfig = Omit<AppConfig, 'experimental'>
|
|
50
51
|
|
|
51
52
|
const DEFAULTS: AppConfig = {
|
|
52
|
-
|
|
53
|
+
environment: 'local',
|
|
54
|
+
demo: false,
|
|
53
55
|
experimental: { ...EXPERIMENTAL_DEFAULTS },
|
|
54
56
|
demoInstallUrl: 'https://moi.computer',
|
|
55
57
|
cloudflareAccess: null,
|
|
@@ -74,6 +76,13 @@ function parseBool(raw: string | undefined): boolean | undefined {
|
|
|
74
76
|
return undefined
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
function parseEnvironment(raw: unknown): AppEnvironment | undefined {
|
|
80
|
+
if (raw === undefined) return undefined
|
|
81
|
+
if (raw === 'local' || raw === 'cloud') return raw
|
|
82
|
+
warn('ignoring environment — expected "local" or "cloud"')
|
|
83
|
+
return undefined
|
|
84
|
+
}
|
|
85
|
+
|
|
77
86
|
function parseString(raw: string | undefined): string | undefined {
|
|
78
87
|
if (raw === undefined || raw.trim() === '') return undefined
|
|
79
88
|
return raw.trim()
|
|
@@ -166,7 +175,7 @@ function readConfigFile(file: string): Record<string, unknown> {
|
|
|
166
175
|
// Only a missing file is silent (the normal local case). Anything else —
|
|
167
176
|
// permissions, mount errors — is loud: a deployment relying on config.json
|
|
168
177
|
// must not boot un-gated without a diagnostic. Deployments that need the
|
|
169
|
-
// demo gate guaranteed should pin
|
|
178
|
+
// demo gate guaranteed should pin MOI_DEMO=1 in the environment,
|
|
170
179
|
// which has no read-failure mode.
|
|
171
180
|
if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
|
|
172
181
|
warn(`could not read ${file}: ${err instanceof Error ? err.message : String(err)}`)
|
|
@@ -189,9 +198,11 @@ function readConfigFile(file: string): Record<string, unknown> {
|
|
|
189
198
|
|
|
190
199
|
function fileValues(raw: Record<string, unknown>): Partial<DeploymentConfig> {
|
|
191
200
|
const out: Partial<DeploymentConfig> = {}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
201
|
+
const environment = parseEnvironment(raw.environment)
|
|
202
|
+
if (environment !== undefined) out.environment = environment
|
|
203
|
+
if (raw.demo !== undefined) {
|
|
204
|
+
if (typeof raw.demo === 'boolean') out.demo = raw.demo
|
|
205
|
+
else warn('ignoring "demo" — expected a boolean')
|
|
195
206
|
}
|
|
196
207
|
if (raw.demoInstallUrl !== undefined) {
|
|
197
208
|
if (typeof raw.demoInstallUrl === 'string') out.demoInstallUrl = raw.demoInstallUrl
|
|
@@ -215,7 +226,8 @@ export function loadAppConfig(
|
|
|
215
226
|
const raw = readConfigFile(file)
|
|
216
227
|
const fromFile = fileValues(raw)
|
|
217
228
|
const fromEnv: Partial<DeploymentConfig> = {
|
|
218
|
-
|
|
229
|
+
environment: parseEnvironment(env.MOI_ENVIRONMENT),
|
|
230
|
+
demo: parseBool(env.MOI_DEMO),
|
|
219
231
|
demoInstallUrl: parseString(env.MOI_DEMO_INSTALL_URL)
|
|
220
232
|
}
|
|
221
233
|
const merged = { ...DEFAULTS, ...fromFile }
|
|
@@ -243,7 +255,7 @@ export function getAppConfig(): AppConfig {
|
|
|
243
255
|
}
|
|
244
256
|
|
|
245
257
|
// Test seam: drop the cached config so the next getAppConfig() re-resolves
|
|
246
|
-
// (tests point MOI_DATA_DIR elsewhere or set
|
|
258
|
+
// (tests point MOI_DATA_DIR elsewhere or set MOI_DEMO).
|
|
247
259
|
export function resetAppConfig(): void {
|
|
248
260
|
_config = null
|
|
249
261
|
}
|
|
@@ -251,6 +263,6 @@ export function resetAppConfig(): void {
|
|
|
251
263
|
// The only shape that reaches the browser (GET /api/config). Server-only keys
|
|
252
264
|
// added to AppConfig later stay out unless explicitly forwarded here.
|
|
253
265
|
export function clientAppConfig(): ClientAppConfig {
|
|
254
|
-
const {
|
|
255
|
-
return {
|
|
266
|
+
const { environment, demo, experimental, demoInstallUrl } = getAppConfig()
|
|
267
|
+
return { environment, demo, experimental: { ...experimental }, demoInstallUrl }
|
|
256
268
|
}
|
package/server/app-settings.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { AppSettings } from '@/lib/types'
|
|
|
4
4
|
|
|
5
5
|
import { DATA_DIR } from './data-dir'
|
|
6
6
|
|
|
7
|
-
// App-wide user settings, stored as `settings.json` in
|
|
7
|
+
// App-wide user settings, stored as `settings.json` in Moi's data dir next to
|
|
8
8
|
// the workspace registry. Backed by `conf`: atomic writes, per-key JSON-schema
|
|
9
9
|
// validation, and migrations when the settings shape evolves. Adding a key
|
|
10
10
|
// means extending `AppSettings` (lib/types.ts) and the schema here — with a
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
//
|
|
11
11
|
// The transform prefixes each selector with `[data-applet="<scope>"]` — the
|
|
12
12
|
// attribute the client puts on the applet's mount container (see
|
|
13
|
-
// client/features/applets/
|
|
13
|
+
// client/features/applets/applet-container.tsx). Selectors that address the page
|
|
14
14
|
// root (`:root`, `:host`, `html`, `body`) are mapped onto the container
|
|
15
15
|
// itself, so theme variables and preflight inheritance (line-height, font)
|
|
16
16
|
// land there and inherit down. Rules inside `@keyframes` are left alone —
|
|
@@ -92,7 +92,7 @@ async function validateServerExports(filePath: string): Promise<string[]> {
|
|
|
92
92
|
return runtimeExports
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// Server modules are keyed by their path relative to the
|
|
95
|
+
// Server modules are keyed by their path relative to the Moi root
|
|
96
96
|
// (`.moi/widgets/hello.server.ts` → `"widgets/hello"`), posix-normalized so
|
|
97
97
|
// keys are stable across platforms. Throws when the file escapes the root.
|
|
98
98
|
// Both sides are canonicalized first: Bun's resolver returns realpaths
|
|
@@ -112,7 +112,7 @@ function serverModuleKey(serverPath: string, moiRoot: string): string {
|
|
|
112
112
|
.split(sep)
|
|
113
113
|
.join('/')
|
|
114
114
|
if (key === '..' || key.startsWith('../')) {
|
|
115
|
-
throw new Error(`Server file "${serverPath}" escapes the
|
|
115
|
+
throw new Error(`Server file "${serverPath}" escapes the Moi root "${moiRoot}"`)
|
|
116
116
|
}
|
|
117
117
|
return key
|
|
118
118
|
}
|
|
@@ -172,7 +172,7 @@ function appletRuntimePlugin(
|
|
|
172
172
|
|
|
173
173
|
// Intercept .server imports (relative only). Resolved against the
|
|
174
174
|
// importing file's directory — server files may live anywhere under
|
|
175
|
-
// the
|
|
175
|
+
// the Moi root, e.g. `../lib/db.server`.
|
|
176
176
|
build.onResolve({ filter: /\.server(\.ts)?$/ }, args => {
|
|
177
177
|
if (!args.path.startsWith('.')) return
|
|
178
178
|
const baseDir =
|
|
@@ -210,7 +210,7 @@ function appletRuntimePlugin(
|
|
|
210
210
|
// provides the same texture utilities available to host components.
|
|
211
211
|
const HOST_THEME_PATH = join(import.meta.dir, '..', '..', 'client', 'theme.css')
|
|
212
212
|
|
|
213
|
-
// The shadcn styling vocabulary, text-inlined from
|
|
213
|
+
// The shadcn styling vocabulary, text-inlined from Moi's OWN node_modules the
|
|
214
214
|
// same way theme.css is. Tailwind v4 only emits utilities it can resolve:
|
|
215
215
|
// installed ui components lean on `tw-animate-css` (animate-in/out, fade,
|
|
216
216
|
// zoom, slide) and `shadcn/tailwind.css` (data-open/data-closed variants,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// `Bun.build` shares one process-wide resolver cache with the runtime module
|
|
4
4
|
// loader: `node_modules` directory listings, `package.json` contents, and —
|
|
5
5
|
// crucially — FAILED bare-specifier lookups are memoized for the life of the
|
|
6
|
-
// process and never invalidated (still true in Bun 1.4). The
|
|
6
|
+
// process and never invalidated (still true in Bun 1.4). The Moi server is
|
|
7
7
|
// long-lived, so an in-process build that once failed with `Could not resolve
|
|
8
8
|
// "pkg"` keeps failing for that specifier after the agent runs `bun add pkg`,
|
|
9
9
|
// and a workspace that gains its own `node_modules` (or bumps a package's
|
package/server/applets/config.ts
CHANGED
|
@@ -21,7 +21,7 @@ type ParsedConfig = {
|
|
|
21
21
|
// Static config analysis, shared by compilation and source editing. Never
|
|
22
22
|
// evaluate workspace code to resolve variables, spreads, or function calls.
|
|
23
23
|
// Parsed with @babel/parser: it handles TS + JSX with no peer dependencies, so
|
|
24
|
-
// it always resolves from
|
|
24
|
+
// it always resolves from Moi's own tree. A parser that peer-depends on
|
|
25
25
|
// `typescript` breaks under bun's shared global tree, where another globally
|
|
26
26
|
// installed package controls which `typescript` sits at the hoisted root.
|
|
27
27
|
function parseConfig(source: string, editing = false): ParsedConfig {
|
|
@@ -4,7 +4,7 @@ import { parse, stringify } from 'devalue'
|
|
|
4
4
|
import { join, resolve, sep } from 'path'
|
|
5
5
|
|
|
6
6
|
const MEI_DIR =
|
|
7
|
-
process.env.MEI_FUNCTIONS_DIR ?? join(import.meta.dir, '..', 'test-workspace', '.moi')
|
|
7
|
+
process.env.MEI_FUNCTIONS_DIR ?? join(import.meta.dir, '..', '..', 'test-workspace', '.moi')
|
|
8
8
|
|
|
9
9
|
// The parent spawns us from a neutral cwd so Bun never auto-loads the
|
|
10
10
|
// workspace's `.env` into this process — moi injects the resolved, scope-filtered
|
|
@@ -20,8 +20,8 @@ import { readFileSync } from 'node:fs'
|
|
|
20
20
|
import { tmpdir } from 'node:os'
|
|
21
21
|
import { join } from 'path'
|
|
22
22
|
|
|
23
|
-
import { agentCommand } from '
|
|
24
|
-
import { resolveWorkspaceEnv } from '
|
|
23
|
+
import { agentCommand } from '../agent-launcher'
|
|
24
|
+
import { resolveWorkspaceEnv } from '../workspaces/env'
|
|
25
25
|
|
|
26
26
|
const WORKER_PATH = join(import.meta.dir, 'functions-worker.ts')
|
|
27
27
|
const CALL_TIMEOUT_MS = 30_000
|