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,162 @@
|
|
|
1
|
+
import { defineCommand } from 'citty'
|
|
2
|
+
import { isValidEnvKey } from '../../workspaces/env'
|
|
3
|
+
import {
|
|
4
|
+
execWithEnv,
|
|
5
|
+
readEnvView,
|
|
6
|
+
readSecretValue,
|
|
7
|
+
renderEnvView,
|
|
8
|
+
resolveCwdWorkspace,
|
|
9
|
+
writeEnv
|
|
10
|
+
} from '../env'
|
|
11
|
+
import pc from '../pc'
|
|
12
|
+
|
|
13
|
+
function envFail(message: string): never {
|
|
14
|
+
console.error('\n' + pc.red('✗') + ' ' + message + '\n')
|
|
15
|
+
process.exit(1)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const envSet = defineCommand({
|
|
19
|
+
meta: {
|
|
20
|
+
name: 'set',
|
|
21
|
+
description:
|
|
22
|
+
'Set custom secrets: `moi env set KEY=value [KEY=value...]`, or `moi env set KEY` to read one value from stdin'
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
key: {
|
|
26
|
+
type: 'positional',
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'KEY=value pair(s), or a single bare KEY to read the value from stdin'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
async run({ args }) {
|
|
32
|
+
const entry = await resolveCwdWorkspace()
|
|
33
|
+
const pairs = args._
|
|
34
|
+
const set: Record<string, string> = {}
|
|
35
|
+
|
|
36
|
+
if (pairs.length === 1 && !pairs[0].includes('=')) {
|
|
37
|
+
// Bare-KEY form: one key, value from stdin (hidden prompt on a TTY).
|
|
38
|
+
const key = pairs[0]
|
|
39
|
+
if (!isValidEnvKey(key)) envFail(`Invalid env key: ${key}`)
|
|
40
|
+
let value: string
|
|
41
|
+
try {
|
|
42
|
+
value = await readSecretValue(key)
|
|
43
|
+
} catch {
|
|
44
|
+
// Ctrl-C at the hidden prompt.
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
|
47
|
+
// An empty value is almost always an unset variable on the piping side —
|
|
48
|
+
// storing '' would silently shadow a real .env value with nothing.
|
|
49
|
+
if (value === '')
|
|
50
|
+
envFail(`Empty value for ${key} — pipe a non-empty value or pass ${key}=value`)
|
|
51
|
+
set[key] = value
|
|
52
|
+
} else {
|
|
53
|
+
for (const pair of pairs) {
|
|
54
|
+
const eq = pair.indexOf('=')
|
|
55
|
+
if (eq === -1) {
|
|
56
|
+
envFail(
|
|
57
|
+
`Missing value for ${pair} — use KEY=value (bare KEY reads stdin only when set alone)`
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
const key = pair.slice(0, eq)
|
|
61
|
+
const value = pair.slice(eq + 1)
|
|
62
|
+
if (!isValidEnvKey(key)) envFail(`Invalid env key: ${key}`)
|
|
63
|
+
if (value === '')
|
|
64
|
+
envFail(`Empty value for ${key} — use \`moi env unset ${key}\` to remove a key`)
|
|
65
|
+
set[key] = value
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const backend = await writeEnv(entry.path, { set })
|
|
70
|
+
for (const key of Object.keys(set)) {
|
|
71
|
+
console.log(pc.green('✓') + ` Set ${pc.bold(key)} ${pc.dim('(custom)')}`)
|
|
72
|
+
}
|
|
73
|
+
// A plaintext fallback should never go unnoticed at write time.
|
|
74
|
+
if (backend === 'file') {
|
|
75
|
+
console.log(pc.dim(' Stored in a 0600 file — OS keychain unavailable.'))
|
|
76
|
+
}
|
|
77
|
+
process.exit(0)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const envUnset = defineCommand({
|
|
82
|
+
meta: { name: 'unset', description: 'Remove custom secrets: `moi env unset KEY [KEY...]`' },
|
|
83
|
+
args: {
|
|
84
|
+
key: { type: 'positional', required: true, description: 'Key(s) to remove' }
|
|
85
|
+
},
|
|
86
|
+
async run({ args }) {
|
|
87
|
+
const entry = await resolveCwdWorkspace()
|
|
88
|
+
const view = await readEnvView(entry.path)
|
|
89
|
+
const byKey = new Map(view.vars.map(v => [v.key, v]))
|
|
90
|
+
|
|
91
|
+
// Only custom secrets are removable; a dotenv-sourced key lives in its file.
|
|
92
|
+
const removable: string[] = []
|
|
93
|
+
let hadError = false
|
|
94
|
+
for (const key of args._) {
|
|
95
|
+
const v = byKey.get(key)
|
|
96
|
+
if (!v) {
|
|
97
|
+
console.warn(pc.yellow('!') + ` ${key} is not set — skipping`)
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
if (v.source === 'dotenv') {
|
|
101
|
+
console.error(
|
|
102
|
+
pc.red('✗') +
|
|
103
|
+
` ${key} comes from ${(v.files ?? []).join(', ')} — edit that file instead` +
|
|
104
|
+
pc.dim(' (moi env unset only removes custom secrets)')
|
|
105
|
+
)
|
|
106
|
+
hadError = true
|
|
107
|
+
continue
|
|
108
|
+
}
|
|
109
|
+
removable.push(key)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (removable.length > 0) {
|
|
113
|
+
await writeEnv(entry.path, { remove: removable })
|
|
114
|
+
for (const key of removable) {
|
|
115
|
+
const v = byKey.get(key)
|
|
116
|
+
const unshadow =
|
|
117
|
+
v?.source === 'both' ? pc.dim(` (falls back to ${(v.files ?? []).join(', ')})`) : ''
|
|
118
|
+
console.log(pc.green('✓') + ` Removed ${pc.bold(key)}${unshadow}`)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
process.exit(hadError ? 1 : 0)
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
const envExec = defineCommand({
|
|
126
|
+
meta: {
|
|
127
|
+
name: 'exec',
|
|
128
|
+
description: 'Run a command with the workspace env: `moi env exec -- <cmd> [args...]`'
|
|
129
|
+
},
|
|
130
|
+
async run({ rawArgs }) {
|
|
131
|
+
// Everything after `--` is the child command, untouched by flag parsing.
|
|
132
|
+
const sep = rawArgs.indexOf('--')
|
|
133
|
+
const cmd = sep === -1 ? [] : rawArgs.slice(sep + 1)
|
|
134
|
+
if (cmd.length === 0) {
|
|
135
|
+
console.error('\n' + pc.red('✗') + ' Usage: moi env exec -- <cmd> [args...]\n')
|
|
136
|
+
process.exit(1)
|
|
137
|
+
}
|
|
138
|
+
const entry = await resolveCwdWorkspace()
|
|
139
|
+
process.exit(await execWithEnv(entry.path, cmd))
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
const envSubCommands = { set: envSet, unset: envUnset, exec: envExec }
|
|
144
|
+
|
|
145
|
+
export const env = defineCommand({
|
|
146
|
+
meta: {
|
|
147
|
+
name: 'env',
|
|
148
|
+
description: 'Show the workspace env (key names only — never values)'
|
|
149
|
+
},
|
|
150
|
+
subCommands: envSubCommands,
|
|
151
|
+
async run({ rawArgs }) {
|
|
152
|
+
// citty invokes the parent run even after dispatching a subcommand — only
|
|
153
|
+
// render the table when no subcommand ran. Object.hasOwn so prototype
|
|
154
|
+
// names ('constructor', 'toString') never count as a dispatched command.
|
|
155
|
+
const first = rawArgs.find(a => !a.startsWith('-'))
|
|
156
|
+
if (first && Object.hasOwn(envSubCommands, first)) return
|
|
157
|
+
const entry = await resolveCwdWorkspace()
|
|
158
|
+
const view = await readEnvView(entry.path)
|
|
159
|
+
console.log('\n' + renderEnvView(entry, view) + '\n')
|
|
160
|
+
process.exit(0)
|
|
161
|
+
}
|
|
162
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { defineCommand } from 'citty'
|
|
2
|
+
import { PORT } from '../../constants'
|
|
3
|
+
import type { HermesProfile } from '../../harness/hermes/discovery'
|
|
4
|
+
import { discoverHermesProfiles, matchHermesProfile } from '../../harness/hermes/discovery'
|
|
5
|
+
import { openBrowser } from '../../open-browser'
|
|
6
|
+
import { registerWorkspace } from '../../workspaces/registry'
|
|
7
|
+
import { provisionWorkspace } from '../../workspaces/init'
|
|
8
|
+
import { isServerRunning, registerViaControl } from '../control'
|
|
9
|
+
import pc from '../pc'
|
|
10
|
+
import { initHint, printProviderCommands } from '../provider'
|
|
11
|
+
import { columns } from '../ui'
|
|
12
|
+
|
|
13
|
+
function printProfileTable(profiles: HermesProfile[]) {
|
|
14
|
+
console.log(
|
|
15
|
+
columns(
|
|
16
|
+
['', 'profile', 'model', 'workspace'].map(h => pc.dim(h)),
|
|
17
|
+
profiles.map(p => [
|
|
18
|
+
p.isDefault ? pc.green('●') : ' ',
|
|
19
|
+
p.isDefault ? pc.bold(p.agentId) : p.agentId,
|
|
20
|
+
p.model ?? pc.dim('—'),
|
|
21
|
+
pc.dim(p.path)
|
|
22
|
+
])
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const hermesInit = defineCommand({
|
|
28
|
+
meta: {
|
|
29
|
+
name: 'init',
|
|
30
|
+
description:
|
|
31
|
+
'Install Moi skills into a Hermes profile workspace. Run without args to list discovered profiles.'
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
profile: {
|
|
35
|
+
type: 'positional',
|
|
36
|
+
required: false,
|
|
37
|
+
description: 'Profile id or description (omit to list profiles)'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async run({ args }) {
|
|
41
|
+
const profiles = await discoverHermesProfiles()
|
|
42
|
+
if (profiles.length === 0) {
|
|
43
|
+
console.error(
|
|
44
|
+
'\n' +
|
|
45
|
+
pc.red('✗') +
|
|
46
|
+
' No Hermes profiles discovered.\n' +
|
|
47
|
+
pc.dim(' Install Hermes and run ' + pc.bold('hermes setup') + ' first.\n')
|
|
48
|
+
)
|
|
49
|
+
process.exit(1)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// No argument: with a single profile there is nothing to choose, so
|
|
53
|
+
// install into it. Only an ambiguous choice needs the list.
|
|
54
|
+
if (!args.profile && profiles.length > 1) {
|
|
55
|
+
console.log('\n' + pc.bold('Hermes profiles'))
|
|
56
|
+
console.log(pc.dim(' Run ' + pc.bold('moi hermes init <profile>') + ' to install skills.\n'))
|
|
57
|
+
printProfileTable(profiles)
|
|
58
|
+
console.log()
|
|
59
|
+
process.exit(0)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const target = args.profile ? matchHermesProfile(profiles, args.profile) : profiles[0]
|
|
63
|
+
if (!target) {
|
|
64
|
+
console.error('\n' + pc.red('✗') + ' Profile not found: ' + pc.bold(args.profile) + '\n')
|
|
65
|
+
console.log(' Available:\n')
|
|
66
|
+
printProfileTable(profiles)
|
|
67
|
+
console.log()
|
|
68
|
+
process.exit(1)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Shared provisioning path with `moi init`: skills land in
|
|
72
|
+
// <profile>/workspace/skills/<name>/ (Hermes resolves the workspace skills
|
|
73
|
+
// dir with the highest precedence, so these win over bundled ones), plus
|
|
74
|
+
// the `.moi/` bootstrap. The default profile has no workspace directory
|
|
75
|
+
// until now — provisionWorkspace creates it.
|
|
76
|
+
const {
|
|
77
|
+
scaffold,
|
|
78
|
+
skillsDir: skillsRoot,
|
|
79
|
+
installLogPath
|
|
80
|
+
} = await provisionWorkspace(target.path, 'hermes')
|
|
81
|
+
if (scaffold !== 'exists') {
|
|
82
|
+
if (scaffold === 'installing') {
|
|
83
|
+
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
84
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
85
|
+
} else if (scaffold === 0) {
|
|
86
|
+
console.log('\n' + pc.dim(' Installed widget dependencies in .moi/'))
|
|
87
|
+
} else {
|
|
88
|
+
console.warn(
|
|
89
|
+
'\n' + pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
90
|
+
)
|
|
91
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const entry = await registerWorkspace(target.path, {
|
|
96
|
+
type: 'hermes',
|
|
97
|
+
name: target.name,
|
|
98
|
+
agentId: target.agentId,
|
|
99
|
+
isDefault: target.isDefault
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
console.log('\n' + pc.green('✓') + ' Installed skills to ' + pc.bold(skillsRoot))
|
|
103
|
+
console.log(
|
|
104
|
+
pc.dim(' Profile: ') +
|
|
105
|
+
pc.bold(target.agentId) +
|
|
106
|
+
(target.model ? pc.dim(' (' + target.model + ')') : '')
|
|
107
|
+
)
|
|
108
|
+
const isInteractive = process.stdout.isTTY
|
|
109
|
+
const running = await isServerRunning()
|
|
110
|
+
if (running) {
|
|
111
|
+
const url = `http://localhost:${PORT}/workspace/${entry.id}`
|
|
112
|
+
await registerViaControl(target.path)
|
|
113
|
+
if (isInteractive) {
|
|
114
|
+
console.log(' Opening ' + pc.bold(url) + '\n')
|
|
115
|
+
await openBrowser(url)
|
|
116
|
+
} else {
|
|
117
|
+
console.log(' Ready at ' + pc.bold(url) + '\n')
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
console.log(' Run ' + pc.bold('moi start') + ' to open in the browser\n')
|
|
121
|
+
}
|
|
122
|
+
process.exit(0)
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
export const hermes = defineCommand({
|
|
127
|
+
meta: { name: 'hermes', description: 'Hermes Agent integration commands' },
|
|
128
|
+
async run({ rawArgs }) {
|
|
129
|
+
// citty runs the parent even after dispatching a subcommand — the bare
|
|
130
|
+
// form is the only one this handles.
|
|
131
|
+
if (rawArgs.some(arg => !arg.startsWith('-'))) return
|
|
132
|
+
console.log('\n' + pc.bold('Hermes'))
|
|
133
|
+
printProviderCommands('hermes', '[profile]')
|
|
134
|
+
const profiles = await discoverHermesProfiles().catch(() => [])
|
|
135
|
+
if (profiles.length === 0) {
|
|
136
|
+
console.log(
|
|
137
|
+
'\n ' +
|
|
138
|
+
pc.dim('No profiles discovered — install Hermes and run ') +
|
|
139
|
+
pc.dim('hermes setup') +
|
|
140
|
+
'\n'
|
|
141
|
+
)
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
console.log('\n' + pc.bold(' Profiles'))
|
|
145
|
+
printProfileTable(profiles)
|
|
146
|
+
console.log(pc.dim('\n Run ') + pc.bold(initHint('hermes', profiles.length, 'profile')) + '\n')
|
|
147
|
+
},
|
|
148
|
+
subCommands: { init: hermesInit }
|
|
149
|
+
})
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type { WorkspaceType } from '@/lib/types'
|
|
2
|
+
import { defineCommand } from 'citty'
|
|
3
|
+
import { existsSync } from 'node:fs'
|
|
4
|
+
import { join, resolve } from 'path'
|
|
5
|
+
import { installCollabSkill } from '../../collab/skill'
|
|
6
|
+
import { PORT } from '../../constants'
|
|
7
|
+
import type { DetectedAgent } from '../../harness/detect'
|
|
8
|
+
import {
|
|
9
|
+
agentBindingFor,
|
|
10
|
+
detectHarness,
|
|
11
|
+
HARNESS_TYPES,
|
|
12
|
+
harnessLabel,
|
|
13
|
+
isHarnessName
|
|
14
|
+
} from '../../harness/detect'
|
|
15
|
+
import { openBrowser } from '../../open-browser'
|
|
16
|
+
import {
|
|
17
|
+
assertWorkspaceIdAvailable,
|
|
18
|
+
liftToWorkspaceRoot,
|
|
19
|
+
listWorkspaces,
|
|
20
|
+
registerWorkspace
|
|
21
|
+
} from '../../workspaces/registry'
|
|
22
|
+
import { serverCwd } from '../../server-cwd'
|
|
23
|
+
import { superviseServerUpdates } from '../../update'
|
|
24
|
+
import { PACKAGE_ROOT } from '../../version'
|
|
25
|
+
import { provisionWorkspace } from '../../workspaces/init'
|
|
26
|
+
import { isServerRunning, registerViaControl, waitForServer } from '../control'
|
|
27
|
+
import pc from '../pc'
|
|
28
|
+
import { spawnServer } from '../server'
|
|
29
|
+
import { keyValue } from '../ui'
|
|
30
|
+
|
|
31
|
+
// `moi init`'s harness decision: an explicit `--harness` wins, otherwise
|
|
32
|
+
// auto-detection (harness/detect.ts). Exits when neither settles it — silently
|
|
33
|
+
// defaulting to Claude Code would install skills into `.claude/skills/` for an
|
|
34
|
+
// agent that reads from somewhere else entirely, which fails later and quietly.
|
|
35
|
+
async function resolveInitHarness(
|
|
36
|
+
target: string,
|
|
37
|
+
requested: string | undefined
|
|
38
|
+
): Promise<{ type: WorkspaceType; agent: DetectedAgent | null }> {
|
|
39
|
+
if (requested !== undefined) {
|
|
40
|
+
const value = requested.trim()
|
|
41
|
+
if (!isHarnessName(value)) {
|
|
42
|
+
console.error('\n' + pc.red('✗') + ' Unknown harness: ' + pc.bold(requested))
|
|
43
|
+
console.error(pc.dim(' Valid values: ' + HARNESS_TYPES.join(', ')) + '\n')
|
|
44
|
+
process.exit(1)
|
|
45
|
+
}
|
|
46
|
+
// An explicit choice still picks up the agent binding when the provider
|
|
47
|
+
// can confirm it. It often can't — OpenClaw needs a running gateway — so a
|
|
48
|
+
// miss warns rather than blocking a deliberate override.
|
|
49
|
+
const agent = await agentBindingFor(value, target)
|
|
50
|
+
if (!agent && (value === 'openclaw' || value === 'hermes')) {
|
|
51
|
+
const noun = value === 'hermes' ? 'profile' : 'agent'
|
|
52
|
+
console.log(
|
|
53
|
+
'\n' +
|
|
54
|
+
pc.yellow('⚠') +
|
|
55
|
+
' No ' +
|
|
56
|
+
harnessLabel[value] +
|
|
57
|
+
' ' +
|
|
58
|
+
noun +
|
|
59
|
+
' found at this path — registering without one.\n' +
|
|
60
|
+
pc.dim(' Run ') +
|
|
61
|
+
pc.bold('moi ' + value + ' init') +
|
|
62
|
+
pc.dim(' to bind it once ' + harnessLabel[value] + ' can see the workspace.')
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
return { type: value, agent }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// A registered workspace has already answered this question, and may carry no
|
|
69
|
+
// on-disk signal at all (a folder created from the UI whose agent has never
|
|
70
|
+
// run in it), so the registry outranks detection when re-running `moi init`
|
|
71
|
+
// to refresh skills.
|
|
72
|
+
const known = (await listWorkspaces()).find(e => e.path === target)
|
|
73
|
+
if (known) {
|
|
74
|
+
const type = known.type ?? 'claude-code'
|
|
75
|
+
console.log(
|
|
76
|
+
'\n' + pc.dim(' Already registered — initializing for ') + pc.bold(harnessLabel[type])
|
|
77
|
+
)
|
|
78
|
+
return {
|
|
79
|
+
type,
|
|
80
|
+
agent: known.agentId
|
|
81
|
+
? {
|
|
82
|
+
agentId: known.agentId,
|
|
83
|
+
...(known.name ? { name: known.name } : {}),
|
|
84
|
+
isDefault: known.isDefault ?? false,
|
|
85
|
+
...(known.lastRunAt ? { lastRunAt: known.lastRunAt } : {})
|
|
86
|
+
}
|
|
87
|
+
: null
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const detected = await detectHarness(target)
|
|
92
|
+
if (detected) {
|
|
93
|
+
console.log(
|
|
94
|
+
'\n' +
|
|
95
|
+
pc.yellow('◆') +
|
|
96
|
+
' Detected ' +
|
|
97
|
+
detected.reason +
|
|
98
|
+
' — initializing for ' +
|
|
99
|
+
pc.bold(harnessLabel[detected.type]) +
|
|
100
|
+
'.'
|
|
101
|
+
)
|
|
102
|
+
return { type: detected.type, agent: detected.agent ?? null }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.error('\n' + pc.red('✗') + ' No agent harness detected in ' + pc.bold(target))
|
|
106
|
+
console.error(
|
|
107
|
+
pc.dim(' Looked for a Hermes profile, an OpenClaw agent, and Codex or Claude Code history.\n')
|
|
108
|
+
)
|
|
109
|
+
console.error(' Pick one:\n')
|
|
110
|
+
console.error(
|
|
111
|
+
keyValue(
|
|
112
|
+
HARNESS_TYPES.map(t => [pc.bold('moi init --harness=' + t), harnessLabel[t]]),
|
|
113
|
+
' '
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
console.error()
|
|
117
|
+
process.exit(1)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const init = defineCommand({
|
|
121
|
+
meta: {
|
|
122
|
+
name: 'init',
|
|
123
|
+
description: 'Initialize workspace, copy skills and scaffold folder with widgets'
|
|
124
|
+
},
|
|
125
|
+
args: {
|
|
126
|
+
dir: {
|
|
127
|
+
type: 'positional',
|
|
128
|
+
default: '.',
|
|
129
|
+
description: 'Target directory (default: current)'
|
|
130
|
+
},
|
|
131
|
+
harness: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Agent harness: ' + HARNESS_TYPES.join(', ') + ' (default: auto-detect)'
|
|
134
|
+
},
|
|
135
|
+
web: {
|
|
136
|
+
type: 'boolean',
|
|
137
|
+
default: false,
|
|
138
|
+
description: 'Start the web server if not already running'
|
|
139
|
+
},
|
|
140
|
+
'experimental-collab': {
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
default: false,
|
|
143
|
+
description: 'Include the optional collaboration guide and applet types'
|
|
144
|
+
},
|
|
145
|
+
id: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
description:
|
|
148
|
+
'Register under this id instead of a generated one — fails if the workspace is already registered'
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
async run({ args }) {
|
|
152
|
+
const requested = resolve(args.dir)
|
|
153
|
+
// Locate the workspace root first: if invoked from inside a `.moi/` (or a
|
|
154
|
+
// deeper accidental `.moi/.moi/…`), lift to the directory that owns it
|
|
155
|
+
// instead of scaffolding a nested workspace. This is what stops the
|
|
156
|
+
// `.moi/.moi` bug at the source.
|
|
157
|
+
const target = liftToWorkspaceRoot(requested)
|
|
158
|
+
if (target !== requested) {
|
|
159
|
+
console.log(
|
|
160
|
+
'\n' +
|
|
161
|
+
pc.yellow('◆') +
|
|
162
|
+
' Ran inside ' +
|
|
163
|
+
pc.bold('.moi') +
|
|
164
|
+
' — using the workspace root ' +
|
|
165
|
+
pc.bold(target) +
|
|
166
|
+
' instead (no nested .moi created).'
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
// Flag a stray nested `.moi/.moi` left by the old cwd bug — harmless but
|
|
170
|
+
// confusing, and easy to remove.
|
|
171
|
+
const stray = join(target, '.moi', '.moi')
|
|
172
|
+
if (existsSync(stray)) {
|
|
173
|
+
console.log(
|
|
174
|
+
'\n' +
|
|
175
|
+
pc.yellow('⚠') +
|
|
176
|
+
' Found a stray nested ' +
|
|
177
|
+
pc.bold('.moi/.moi') +
|
|
178
|
+
' (from an older bug). Safe to remove:\n' +
|
|
179
|
+
pc.dim(' rm -rf ' + stray)
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// A chosen id is only assignable at first registration, so refuse it here —
|
|
184
|
+
// before any skills are copied or `.moi/` is scaffolded.
|
|
185
|
+
if (args.id) {
|
|
186
|
+
try {
|
|
187
|
+
await assertWorkspaceIdAvailable(target, args.id)
|
|
188
|
+
} catch (err) {
|
|
189
|
+
console.error('\n' + pc.red('✗') + ' ' + (err as Error).message + '\n')
|
|
190
|
+
process.exit(1)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const projectRoot = PACKAGE_ROOT
|
|
195
|
+
const isInteractive = process.stdout.isTTY
|
|
196
|
+
|
|
197
|
+
// Which backend this workspace is for has to be settled before
|
|
198
|
+
// provisioning: each harness reads skills from a different directory, and
|
|
199
|
+
// agent-owned ones (OpenClaw, Hermes) need their agent metadata on the
|
|
200
|
+
// registry entry — same as `moi <provider> init`.
|
|
201
|
+
const { type, agent } = await resolveInitHarness(target, args.harness)
|
|
202
|
+
|
|
203
|
+
// Provision: bundled skills + the `.moi/` bootstrap (widgets dir +
|
|
204
|
+
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
205
|
+
console.log()
|
|
206
|
+
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
|
|
207
|
+
if (args['experimental-collab']) {
|
|
208
|
+
const { referencePath } = await installCollabSkill(target, type)
|
|
209
|
+
console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
|
|
210
|
+
console.log(pc.dim(' Live presence requires moi start --experimental-collab'))
|
|
211
|
+
}
|
|
212
|
+
if (scaffold !== 'exists') {
|
|
213
|
+
if (scaffold === 'installing') {
|
|
214
|
+
console.log(pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
215
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
216
|
+
} else if (scaffold === 0) {
|
|
217
|
+
console.log(pc.dim(' Installed widget dependencies in .moi/'))
|
|
218
|
+
} else {
|
|
219
|
+
console.warn(
|
|
220
|
+
pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
221
|
+
)
|
|
222
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Always register the workspace in the persistent registry
|
|
227
|
+
const entry = await registerWorkspace(target, {
|
|
228
|
+
...(args.id ? { id: args.id } : {}),
|
|
229
|
+
type,
|
|
230
|
+
...(agent
|
|
231
|
+
? {
|
|
232
|
+
name: agent.name,
|
|
233
|
+
agentId: agent.agentId,
|
|
234
|
+
isDefault: agent.isDefault,
|
|
235
|
+
lastRunAt: agent.lastRunAt
|
|
236
|
+
}
|
|
237
|
+
: {})
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
console.log(pc.green('✓') + ' Initialized ' + pc.bold(target) + pc.dim(' (' + type + ')'))
|
|
241
|
+
console.log(
|
|
242
|
+
' Skills installed to ' +
|
|
243
|
+
pc.dim(skillsDir) +
|
|
244
|
+
' — ask ' +
|
|
245
|
+
(type === 'claude-code' ? 'Claude' : 'your agent') +
|
|
246
|
+
' to build a widget or a view to get started\n'
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
// If --web and server not running, start it (stay alive as wrapper)
|
|
250
|
+
let running = await isServerRunning()
|
|
251
|
+
|
|
252
|
+
if (!running && args.web) {
|
|
253
|
+
console.log(pc.dim(' Starting server…'))
|
|
254
|
+
const cwd = serverCwd(projectRoot, false)
|
|
255
|
+
const proc = spawnServer(cwd)
|
|
256
|
+
running = await waitForServer()
|
|
257
|
+
if (!running) {
|
|
258
|
+
console.error(pc.red(' Server failed to start\n'))
|
|
259
|
+
await proc.exited
|
|
260
|
+
process.exit(1)
|
|
261
|
+
}
|
|
262
|
+
const url = `http://localhost:${PORT}/workspace/${entry.id}`
|
|
263
|
+
console.log(pc.green('✓') + ' Server started on http://localhost:' + PORT)
|
|
264
|
+
if (isInteractive) console.log(' Opening ' + pc.bold(url))
|
|
265
|
+
console.log(pc.dim(' Press Ctrl+C to stop\n'))
|
|
266
|
+
if (isInteractive) await openBrowser(url)
|
|
267
|
+
process.exit(await superviseServerUpdates(proc, () => spawnServer(cwd)))
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (running) {
|
|
271
|
+
// Server already running — notify it and open (browser only in interactive mode)
|
|
272
|
+
await registerViaControl(target)
|
|
273
|
+
const url = `http://localhost:${PORT}/workspace/${entry.id}`
|
|
274
|
+
if (isInteractive) {
|
|
275
|
+
console.log(' Opening ' + pc.bold(url) + '\n')
|
|
276
|
+
await openBrowser(url)
|
|
277
|
+
} else {
|
|
278
|
+
console.log(' Ready at ' + pc.bold(url) + '\n')
|
|
279
|
+
}
|
|
280
|
+
process.exit(0)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Server not running and --web not passed
|
|
284
|
+
console.log(' Run ' + pc.bold('moi start') + ' to open in the browser\n')
|
|
285
|
+
}
|
|
286
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveUrl } from '@/lib/navigation'
|
|
2
|
+
import { defineCommand } from 'citty'
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
import { dirArg } from '../args'
|
|
5
|
+
import { sendControl } from '../control'
|
|
6
|
+
import pc from '../pc'
|
|
7
|
+
|
|
8
|
+
export const navigate = defineCommand({
|
|
9
|
+
meta: {
|
|
10
|
+
name: 'navigate',
|
|
11
|
+
description: 'Navigate the last active browser showing this workspace'
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
href: {
|
|
15
|
+
type: 'positional',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Workspace address, e.g. moi:/views/events?eventId=123'
|
|
18
|
+
},
|
|
19
|
+
dir: dirArg
|
|
20
|
+
},
|
|
21
|
+
run({ args }) {
|
|
22
|
+
try {
|
|
23
|
+
const href = resolveUrl(args.href)
|
|
24
|
+
if (!href.startsWith('moi:/') || href.startsWith('moi:/files/'))
|
|
25
|
+
throw new Error('Navigation needs a workspace page address')
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error instanceof Error ? error.message : 'Invalid workspace address')
|
|
28
|
+
process.exit(1)
|
|
29
|
+
}
|
|
30
|
+
const path = resolve(args.dir)
|
|
31
|
+
sendControl(path, { type: 'navigate', path, href: args.href }, res => {
|
|
32
|
+
console.log('\n' + pc.green('✓') + ' Navigated to ' + pc.bold(String(res.href)) + '\n')
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
})
|