moi-computer 0.12.0 → 0.12.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -27
- package/bin/moi.mjs +2 -2
- package/client/AGENTS.md +7 -4
- package/client/api/app-config.ts +3 -2
- package/client/api/app-ui-keys.ts +1 -1
- package/client/api/workspace-keys.ts +2 -4
- 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} +20 -31
- package/client/app/shell/{SidebarLayout.tsx → sidebar-layout.tsx} +10 -10
- package/client/dev/index.html +43 -0
- package/client/dev/index.ts +15 -0
- package/client/features/applets/{AppletContainer.tsx → applet-container.tsx} +1 -1
- package/client/features/applets/applet-runtime.ts +11 -13
- 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 +33 -14
- package/client/features/chat/{ChatPanel.tsx → chat-panel.tsx} +80 -59
- package/client/features/chat/chat-popup.tsx +171 -0
- package/client/features/chat/chat-send.ts +33 -1
- package/client/features/chat/chat-store.ts +10 -0
- 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} +31 -33
- package/client/features/chat/composer/{ModelPicker.tsx → model-picker.tsx} +4 -4
- package/client/features/chat/composer/{useWorkspaceComposerState.tsx → use-workspace-composer-state.tsx} +14 -30
- package/client/features/chat/composer/{useWorkspaceSkillUpdates.ts → use-workspace-skill-updates.ts} +1 -1
- package/client/features/chat/connection/chat-frames.ts +15 -8
- package/client/features/chat/messages/{ChatEmptyState.tsx → chat-empty-state.tsx} +37 -23
- package/client/features/chat/messages/fork-history.ts +14 -0
- package/client/features/chat/messages/{MarkdownContent.tsx → markdown-content.tsx} +4 -4
- 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 +109 -19
- package/client/features/chat/sessions/browser-tab-state.ts +30 -7
- package/client/features/chat/sessions/{ChatSelector.tsx → chat-selector.tsx} +139 -80
- package/client/features/chat/sessions/use-selected-session.ts +351 -0
- package/client/features/chat/{useChat.ts → use-chat.ts} +46 -48
- package/client/features/collab/client.ts +10 -11
- package/client/features/collab/hooks.tsx +6 -11
- package/client/features/collab/host-state.ts +57 -128
- package/client/features/collab/provider.tsx +3 -3
- package/client/features/collab/proxy-user.ts +1 -1
- package/client/features/collab/testing/fake-engine.ts +6 -27
- package/client/features/collab/workspace-users-menu.tsx +3 -7
- package/client/features/connectors/mcp-icons.ts +1 -1
- package/client/features/connectors/{McpServerCards.tsx → mcp-server-cards.tsx} +1 -1
- package/client/features/{home/workspace-setup/DemoDialog.tsx → demo/demo-dialog.tsx} +6 -6
- package/client/features/dev/chat-states-fixtures.ts +4 -4
- package/client/features/dev/{ChatStatesPage.tsx → chat-states-page.tsx} +6 -6
- package/client/features/dev/collab/local-user-settings.tsx +4 -4
- package/client/features/dev/{DevIndexPage.tsx → dev-index-page.tsx} +7 -1
- package/client/features/dev/{DevRoutes.tsx → dev-routes.tsx} +8 -6
- package/client/features/dev/workspace-setup-mocks.ts +102 -0
- package/client/features/dev/workspace-setup-page.tsx +11 -0
- package/client/features/dev/workspace-setup-preview.tsx +226 -0
- package/client/features/drawings/{DrawingToolbar.tsx → drawing-toolbar.tsx} +1 -1
- package/client/features/drawings/{useChatAnnotation.ts → use-chat-annotation.ts} +29 -23
- package/client/features/drawings/{useDrawingLayer.ts → use-drawing-layer.ts} +1 -1
- package/client/features/drawings/{useViewBuilderSketch.ts → use-view-sketch.ts} +8 -8
- package/client/features/harness/api.ts +36 -0
- package/client/features/harness/device-login-steps.tsx +97 -0
- package/client/features/home/api.ts +1 -81
- package/client/features/home/{HomeLogo.tsx → home-logo.tsx} +1 -1
- package/client/features/home/{HomePage.tsx → home-page.tsx} +16 -20
- package/client/features/overview/api.ts +2 -2
- package/client/features/overview/default/registry.tsx +3 -5
- package/client/features/overview/default/{ViewsWidget.tsx → views-widget.tsx} +6 -13
- package/client/features/overview/{HiddenPanel.tsx → hidden-panel.tsx} +2 -2
- package/client/features/overview/{Overview.tsx → overview.tsx} +9 -12
- package/client/features/overview/{WidgetCanvas.tsx → widget-canvas.tsx} +1 -1
- package/client/features/overview/{WidgetFrame.tsx → widget-frame.tsx} +1 -1
- package/client/features/overview/workspace-name.tsx +55 -0
- package/client/features/scratchpad/{Scratchpad.tsx → scratchpad.tsx} +7 -7
- package/client/features/scratchpad/{useScratchpadSnapshot.tsx → use-scratchpad-snapshot.tsx} +3 -3
- package/client/features/settings/api.ts +1 -1
- package/client/features/settings/{ConnectorsSettings.tsx → connectors-settings.tsx} +3 -3
- package/client/features/settings/{EnvironmentSettings.tsx → environment-settings.tsx} +3 -3
- package/client/features/settings/{GeneralSettings.tsx → general-settings.tsx} +5 -5
- package/client/features/settings/{useEnvVars.ts → use-env-vars.ts} +1 -1
- package/client/features/settings/{WorkspaceIconPicker.tsx → workspace-icon-picker.tsx} +1 -1
- package/client/features/settings/{WorkspaceSettingsDialog.tsx → workspace-settings-dialog.tsx} +3 -3
- package/client/features/update/api.ts +1 -1
- package/client/features/views/api.ts +64 -131
- package/client/features/views/pending-view-screen.tsx +282 -0
- package/client/features/views/use-view-actions.ts +151 -0
- package/client/features/views/use-view-drafts.ts +88 -0
- package/client/features/views/{ViewManager.tsx → view-manager.tsx} +13 -13
- package/client/features/views/view-presentation.ts +4 -5
- package/client/features/views/view-submission.ts +88 -0
- package/client/features/workspace/add/api.ts +80 -0
- package/client/features/{home/workspace-setup/CreateWorkspaceDialog.tsx → workspace/add/create-workspace-dialog.tsx} +56 -42
- package/client/features/workspace/add/import-workspace-dialog.tsx +81 -0
- package/client/features/{home/workspace-setup/useWorkspaceImport.ts → workspace/add/use-workspace-import.ts} +1 -1
- package/client/features/workspace/add/workspace-agent-options.ts +53 -0
- package/client/features/{home/workspace-setup/WorkspaceAgentStep.tsx → workspace/add/workspace-agent-selector.tsx} +59 -98
- package/client/features/{home/workspace-setup/WorkspaceDialogContent.tsx → workspace/add/workspace-dialog-content.tsx} +1 -1
- package/client/features/workspace/api.ts +24 -15
- package/client/features/workspace/browser-tab-state.ts +16 -9
- package/client/features/workspace/moi-context.ts +14 -16
- package/client/features/workspace/setup/workspace-login-state.tsx +175 -0
- package/client/features/workspace/setup/workspace-recovery-states.tsx +125 -0
- package/client/features/workspace/setup/workspace-setup-panel.tsx +18 -0
- package/client/features/workspace/setup/workspace-setup.tsx +77 -0
- package/client/features/workspace/setup/workspace-welcome-state.tsx +81 -0
- package/client/features/workspace/tab-resolution.ts +16 -29
- package/client/features/workspace/{ThemePanel.tsx → theme-panel.tsx} +3 -3
- package/client/features/workspace/use-workspace-navigation.ts +245 -0
- package/client/features/workspace/workspace-content.tsx +641 -0
- package/client/features/workspace/workspace-identity.tsx +40 -0
- package/client/features/workspace/workspace-menu.tsx +63 -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 +1 -1
- package/client/index.tsx +5 -1
- package/client/lib/agent-availability.ts +0 -5
- package/client/main.tsx +1 -1
- package/client/runtime/{useWorkspaceEvents.ts → use-workspace-events.ts} +10 -18
- package/client/store/ui.ts +25 -29
- package/dist/chunk-08ndj2rg.js +2 -0
- package/dist/chunk-2x040tmg.js +68 -0
- package/dist/chunk-3smxq0ts.js +1 -0
- package/dist/chunk-68ch5hs8.js +2 -0
- package/dist/{chunk-z3byfve5.js → chunk-9vg3xa81.js} +2 -2
- package/dist/chunk-c2p00p9j.css +1 -0
- package/dist/chunk-cs833y9j.js +1 -0
- package/dist/{chunk-97eg9mjn.js → chunk-d7cbm65e.js} +1 -1
- package/dist/{chunk-efdyz6xp.js → chunk-hvh9f5h0.js} +1 -1
- package/dist/{chunk-vfpsc75k.js → chunk-jvyvwwv3.js} +1 -1
- package/dist/chunk-nwevqe86.js +10 -0
- package/dist/{chunk-3a48fyf7.js → chunk-q0gbdts4.js} +4 -4
- package/dist/chunk-rt30jbcm.js +1 -0
- package/dist/chunk-y5y3kj67.js +1 -0
- package/dist/index.html +2 -2
- package/lib/format.ts +1 -1
- package/lib/harness-instructions.ts +30 -0
- package/lib/ids.ts +3 -6
- package/lib/moi-context.ts +102 -75
- package/lib/navigation.ts +48 -87
- package/lib/scratchpad-skew.ts +3 -3
- package/lib/session-drafts.ts +10 -0
- package/lib/types.ts +92 -51
- package/lib/update.ts +1 -1
- package/lib/view-build-directives.ts +12 -0
- package/lib/workspace-layout.ts +1 -1
- package/lib/workspace-tabs.ts +12 -7
- package/package.json +7 -2
- package/server/AGENTS.md +10 -4
- package/server/README.md +102 -0
- package/server/agent-launcher.ts +27 -0
- package/server/api/harnesses.ts +56 -0
- package/server/{api.ts → api/index.ts} +197 -299
- package/server/app-config.ts +45 -14
- 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 +3 -2
- 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} +3 -2
- package/server/applets/index.ts +2 -2
- package/server/{thumbnails.ts → applets/thumbnails.ts} +1 -1
- package/server/{applet-typecheck.ts → applets/typecheck.ts} +4 -4
- package/server/{ui-components.ts → applets/ui-components.ts} +2 -2
- package/server/applets/view-source.ts +7 -1
- package/server/{views.ts → applets/views.ts} +35 -46
- 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} +78 -56
- 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 -3215
- package/server/collab/manager.ts +3 -3
- package/server/collab/skill/index.ts +2 -2
- package/server/control.ts +97 -78
- package/server/data-dir.ts +13 -0
- package/server/harness/README.md +55 -25
- package/server/harness/acp/NOTES.md +11 -11
- package/server/harness/acp/adapter.ts +2 -2
- package/server/harness/acp/archived.ts +3 -3
- package/server/harness/acp/client.ts +4 -3
- package/server/harness/acp/discovery.ts +3 -3
- package/server/harness/acp/run-durations.ts +1 -1
- package/server/harness/acp/session.ts +9 -12
- package/server/harness/auth.ts +303 -0
- package/server/harness/claude-code/NOTES.md +9 -7
- package/server/harness/claude-code/adapter.ts +13 -8
- package/server/harness/claude-code/auth.ts +127 -18
- package/server/harness/claude-code/cli.ts +3 -1
- package/server/harness/claude-code/git-worktree.ts +5 -2
- package/server/harness/claude-code/index.ts +7 -1
- package/server/harness/claude-code/mcp.ts +3 -1
- package/server/harness/claude-code/models.ts +2 -0
- package/server/harness/claude-code/session.ts +13 -39
- package/server/harness/claude-code/sessions.ts +8 -12
- package/server/harness/codex/NOTES.md +35 -16
- package/server/harness/codex/adapter.ts +5 -3
- package/server/harness/codex/auth.ts +86 -19
- package/server/harness/codex/client.ts +30 -34
- package/server/harness/codex/index.ts +20 -1
- package/server/harness/codex/permissions.ts +3 -3
- package/server/harness/codex/probe.ts +3 -5
- package/server/harness/codex/session.ts +20 -25
- package/server/harness/codex/thread-list.ts +74 -0
- package/server/harness/codex/transport.ts +5 -5
- package/server/harness/executable.ts +42 -18
- package/server/harness/fork.ts +12 -0
- 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 +4 -4
- package/server/harness/openclaw/compat.ts +1 -1
- package/server/harness/openclaw/session.ts +6 -31
- package/server/harness/registry.ts +1 -1
- package/server/harness/session-title.ts +12 -3
- package/server/harness/shell-path.ts +31 -21
- package/server/harness/types.ts +17 -5
- 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 +18 -4
- package/server/sessions/archive.ts +32 -0
- package/server/{attachment-message.ts → sessions/attachment-message.ts} +1 -1
- package/server/sessions/config.ts +41 -0
- package/server/sessions/lifecycle.ts +17 -0
- package/server/sessions/pending-views.ts +164 -0
- package/server/sessions/selected.ts +199 -0
- package/server/sessions/store.ts +127 -0
- package/server/sessions/view-sessions.ts +267 -0
- package/server/{skills-template.ts → skills/template.ts} +1 -1
- package/server/{skill-update.ts → skills/update.ts} +5 -5
- package/server/{skill-version.ts → skills/version.ts} +4 -4
- package/server/static.ts +1 -1
- package/server/status.ts +6 -4
- package/server/web.ts +58 -49
- package/server/{env-apply.ts → workspaces/env-apply.ts} +5 -5
- package/server/{workspace-env.ts → workspaces/env.ts} +30 -3
- package/server/{workspace-import.ts → workspaces/import.ts} +4 -4
- package/server/{workspace-init.ts → workspaces/init.ts} +10 -6
- package/server/{layout.ts → workspaces/layout.ts} +2 -2
- package/server/{preview.ts → workspaces/preview.ts} +1 -1
- package/server/{registry.ts → workspaces/registry.ts} +17 -7
- package/server/{required-env.ts → workspaces/required-env.ts} +3 -3
- package/server/{moi-scaffold.ts → workspaces/scaffold.ts} +4 -3
- package/server/{tabs.ts → workspaces/tabs.ts} +7 -10
- 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 +61 -32
- package/workspace/.claude/skills/moi-workspace/references/COLLAB.md +4 -7
- 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/ChatPopup.tsx +0 -98
- package/client/features/chat/composer/banners/AgentAvailabilityBanner.tsx +0 -101
- package/client/features/chat/sessions/useSelectedSession.ts +0 -185
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +0 -92
- package/client/features/overview/WorkspaceName.tsx +0 -60
- package/client/features/views/ViewBuilder.tsx +0 -239
- package/client/features/views/useViewBuilderActions.ts +0 -103
- package/client/features/views/useViewBuilderDrafts.ts +0 -68
- package/client/features/workspace/WorkspaceScreen.tsx +0 -839
- package/client/features/workspace/useWorkspaceNavigation.ts +0 -203
- package/dist/chunk-2jncyq65.js +0 -1
- package/dist/chunk-e2q5ken7.js +0 -68
- package/dist/chunk-h2kj1ysj.js +0 -1
- package/dist/chunk-jf6czgrz.js +0 -2
- package/dist/chunk-nez8sdta.js +0 -1
- package/dist/chunk-nzwgm8vc.css +0 -1
- package/dist/chunk-ph0h6h86.js +0 -1
- package/dist/chunk-ryg9z3kn.js +0 -10
- package/dist/chunk-tpn177bt.js +0 -2
- package/lib/view-builder-directives.ts +0 -16
- package/server/agent.ts +0 -223
- package/server/chat-selection.ts +0 -22
- package/server/selected-session.ts +0 -152
- package/server/session-config.ts +0 -136
- package/server/view-builders.ts +0 -453
- /package/client/components/shared/{AgentBlobatar.tsx → agent-blobatar.tsx} +0 -0
- /package/client/components/shared/{BottomPanel.tsx → bottom-panel.tsx} +0 -0
- /package/client/components/shared/{Composer.tsx → composer.tsx} +0 -0
- /package/client/components/shared/{LedLogo.tsx → led-logo.tsx} +0 -0
- /package/client/components/shared/{PanelHeader.tsx → panel-header.tsx} +0 -0
- /package/client/components/shared/{ReorderableList.tsx → reorderable-list.tsx} +0 -0
- /package/client/components/shared/{WorkspaceIcon.tsx → workspace-icon.tsx} +0 -0
- /package/client/features/applets/{WidgetErrorBoundary.tsx → widget-error-boundary.tsx} +0 -0
- /package/client/features/chat/composer/attachments/{AttachmentChip.tsx → attachment-chip.tsx} +0 -0
- /package/client/features/chat/messages/{ChatPromptBubbles.tsx → chat-prompt-bubbles.tsx} +0 -0
- /package/client/features/chat/messages/{ShimmerText.tsx → shimmer-text.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{CodeBlock.tsx → code-block.tsx} +0 -0
- /package/client/features/chat/messages/tool-group/{Collapse.tsx → collapse.tsx} +0 -0
- /package/client/features/chat/messages/{useStickToBottom.ts → use-stick-to-bottom.ts} +0 -0
- /package/client/features/connectors/{IconMcp.tsx → icon-mcp.tsx} +0 -0
- /package/client/features/dev/{BlobatarShapesPage.tsx → blobatar-shapes-page.tsx} +0 -0
- /package/client/features/dev/{HarnessDebugPage.tsx → harness-debug-page.tsx} +0 -0
- /package/client/features/dev/{TextureLabPage.tsx → texture-lab-page.tsx} +0 -0
- /package/client/features/dev/{ToolCallsPage.tsx → tool-calls-page.tsx} +0 -0
- /package/client/features/drawings/{DrawingLayer.tsx → drawing-layer.tsx} +0 -0
- /package/client/features/home/{WorkspacePreview.tsx → workspace-preview.tsx} +0 -0
- /package/client/features/overview/{useGridReconcile.ts → use-grid-reconcile.ts} +0 -0
- /package/client/features/scratchpad/{ScratchpadControls.tsx → scratchpad-controls.tsx} +0 -0
- /package/client/features/settings/{SettingsLayout.tsx → settings-layout.tsx} +0 -0
- /package/client/features/update/{UpdateControl.tsx → update-control.tsx} +0 -0
- /package/client/features/workspace/{UnavailablePage.tsx → unavailable-page.tsx} +0 -0
- /package/client/features/workspace/{useFitsSplitLayout.ts → use-fits-split-layout.ts} +0 -0
- /package/client/features/workspace/{WorkspaceContext.tsx → workspace-context.tsx} +0 -0
- /package/client/features/workspace/{WorkspaceLayoutContext.tsx → workspace-layout-context.tsx} +0 -0
- /package/server/{bundle-queue.ts → applets/bundle-queue.ts} +0 -0
- /package/server/{applet-log.ts → applets/log.ts} +0 -0
- /package/server/{cli-ui.ts → cli/ui.ts} +0 -0
- /package/server/{workspace-config.ts → workspaces/config.ts} +0 -0
- /package/server/{icon.ts → workspaces/icon.ts} +0 -0
- /package/server/{theme.ts → workspaces/theme.ts} +0 -0
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
// is protocol. See ./wire.ts for the message shapes.
|
|
11
11
|
import type { InitializeResponse, RequestPermissionRequest } from './wire'
|
|
12
12
|
|
|
13
|
+
import { agentCommand } from '../../agent-launcher'
|
|
13
14
|
import { debug } from '../../debug'
|
|
14
15
|
import { tapWire } from '../debug'
|
|
15
|
-
import { resolveWorkspaceEnv } from '../../
|
|
16
|
+
import { resolveWorkspaceEnv } from '../../workspaces/env'
|
|
16
17
|
|
|
17
18
|
const REQUEST_TIMEOUT_MS = 120_000
|
|
18
19
|
|
|
@@ -76,7 +77,7 @@ const CLIENT_CAPABILITIES = { fs: { readTextFile: false, writeTextFile: false }
|
|
|
76
77
|
async function startClient(spec: AcpSpawnSpec): Promise<ClientRecord> {
|
|
77
78
|
const { provider, command, args, workspacePath } = spec
|
|
78
79
|
const workspaceEnv = await resolveWorkspaceEnv(workspacePath)
|
|
79
|
-
const proc = Bun.spawn([command, ...args], {
|
|
80
|
+
const proc = Bun.spawn(agentCommand([command, ...args]), {
|
|
80
81
|
cwd: workspacePath,
|
|
81
82
|
stdin: 'pipe',
|
|
82
83
|
stdout: 'pipe',
|
|
@@ -149,7 +150,7 @@ async function startClient(spec: AcpSpawnSpec): Promise<ClientRecord> {
|
|
|
149
150
|
send({
|
|
150
151
|
jsonrpc: '2.0',
|
|
151
152
|
id: msg.id,
|
|
152
|
-
error: { code: -32601, message: `
|
|
153
|
+
error: { code: -32601, message: `Moi does not handle ${method}` }
|
|
153
154
|
})
|
|
154
155
|
}
|
|
155
156
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Session list, model catalog and home-card preview over ACP. Provider-agnostic.
|
|
2
|
-
import type { Model,
|
|
2
|
+
import type { Model, SessionSummary } from '@/lib/types'
|
|
3
3
|
|
|
4
4
|
import { type AcpProviderConfig, type AcpSpawnContext } from './session'
|
|
5
5
|
import { acpSessionToSessionInfo } from './adapter'
|
|
@@ -17,13 +17,13 @@ const PAGE_LIMIT = 5
|
|
|
17
17
|
export async function listAcpSessions(
|
|
18
18
|
config: AcpProviderConfig,
|
|
19
19
|
ctx: AcpSpawnContext
|
|
20
|
-
): Promise<
|
|
20
|
+
): Promise<SessionSummary[]> {
|
|
21
21
|
try {
|
|
22
22
|
const client = await getAcpClient(await config.spawn(ctx))
|
|
23
23
|
// Archiving is moi-side (see ./archived.ts) — the backend still lists the
|
|
24
24
|
// chat, so it is filtered here rather than by the agent.
|
|
25
25
|
const archived = await archivedAcpSessions(ctx.workspacePath)
|
|
26
|
-
const out:
|
|
26
|
+
const out: SessionSummary[] = []
|
|
27
27
|
let cursor: string | undefined
|
|
28
28
|
for (let page = 0; page < PAGE_LIMIT; page++) {
|
|
29
29
|
const res: ListSessionsResponse = await client.rpc('session/list', {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// the durations itself and re-attaches them on replay. Without a recording the
|
|
5
5
|
// label falls back to a plain "Worked".
|
|
6
6
|
//
|
|
7
|
-
// Stored OUTSIDE the workspace in ONE global JSON file in
|
|
7
|
+
// Stored OUTSIDE the workspace in ONE global JSON file in Moi's data dir
|
|
8
8
|
// (same choice, shape and locking as ./archived.ts), keyed by workspace path
|
|
9
9
|
// then session id, one entry per prompt run in prompt order:
|
|
10
10
|
// { "<workspacePath>": { "<sessionId>": [12100, 3400, …] } }
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
materializeAttachmentPaths,
|
|
24
24
|
prepareAttachmentMessage,
|
|
25
25
|
type PreparedAttachmentMessage
|
|
26
|
-
} from '../../attachment-message'
|
|
26
|
+
} from '../../sessions/attachment-message'
|
|
27
27
|
import { type MoiContext, appendMoiContext, renderMoiContext } from '@/lib/moi-context'
|
|
28
28
|
import { type Part, applyEvent, emptyViewState } from '@/lib/format'
|
|
29
29
|
import type { Model, SessionActivity, StreamEvent, ViewState, WorkspaceType } from '@/lib/types'
|
|
@@ -49,12 +49,11 @@ import {
|
|
|
49
49
|
type ToolCallUpdate,
|
|
50
50
|
isTextBlock
|
|
51
51
|
} from './wire'
|
|
52
|
-
import {
|
|
52
|
+
import { harnessStore } from '../auth'
|
|
53
53
|
import { debug } from '../../debug'
|
|
54
54
|
import { broadcast } from '../../state'
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import { renameViewBuilderSession } from '../../view-builders'
|
|
55
|
+
import { hasSessionConfig, saveSessionConfig } from '../../sessions/config'
|
|
56
|
+
import { renameSessionReferences } from '../../sessions/lifecycle'
|
|
58
57
|
|
|
59
58
|
export type AcpSpawnContext = {
|
|
60
59
|
workspaceId: string
|
|
@@ -366,7 +365,7 @@ function refreshAvailability(
|
|
|
366
365
|
rec: Pick<SessionRecord, 'workspaceId' | 'workspacePath'>,
|
|
367
366
|
id: WorkspaceType
|
|
368
367
|
) {
|
|
369
|
-
void
|
|
368
|
+
void harnessStore.refresh({ id: rec.workspaceId, path: rec.workspacePath, type: id })
|
|
370
369
|
}
|
|
371
370
|
|
|
372
371
|
function createRecord(input: {
|
|
@@ -541,11 +540,12 @@ async function runPrompt(
|
|
|
541
540
|
content: err instanceof Error ? err.message : 'send failed'
|
|
542
541
|
})
|
|
543
542
|
refreshAvailability(rec, config.id)
|
|
543
|
+
throw err
|
|
544
544
|
} finally {
|
|
545
545
|
void appendRunDuration(rec.workspacePath, rec.sessionId, Date.now() - startedAt)
|
|
546
546
|
const next = rec.queue.shift()
|
|
547
547
|
if (next) {
|
|
548
|
-
void runPrompt(config, rec, next.blocks)
|
|
548
|
+
void runPrompt(config, rec, next.blocks).catch(() => {})
|
|
549
549
|
} else {
|
|
550
550
|
setProcessing(rec, false)
|
|
551
551
|
}
|
|
@@ -608,15 +608,12 @@ export async function sendAcpMessage(
|
|
|
608
608
|
const model = input.model ?? created.models?.currentModelId
|
|
609
609
|
if (realId !== input.sessionId) {
|
|
610
610
|
aliases.set(recKey(input.workspaceId, input.sessionId), realId)
|
|
611
|
-
await
|
|
612
|
-
await renameSelectedSession(input.workspacePath, input.sessionId, realId)
|
|
613
|
-
await renameViewBuilderSession(
|
|
611
|
+
await renameSessionReferences(
|
|
614
612
|
input.workspaceId,
|
|
615
613
|
input.workspacePath,
|
|
616
614
|
input.sessionId,
|
|
617
615
|
realId
|
|
618
616
|
)
|
|
619
|
-
broadcast(input.workspaceId, { type: 'session_renamed', from: input.sessionId, to: realId })
|
|
620
617
|
}
|
|
621
618
|
rec = createRecord({
|
|
622
619
|
workspaceId: input.workspaceId,
|
|
@@ -650,7 +647,7 @@ export async function sendAcpMessage(
|
|
|
650
647
|
{ workspaceId: input.workspaceId, workspacePath: input.workspacePath },
|
|
651
648
|
config.id
|
|
652
649
|
)
|
|
653
|
-
|
|
650
|
+
throw err
|
|
654
651
|
}
|
|
655
652
|
|
|
656
653
|
rec.stream = input.stream === true
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// Login is global per harness. Workspace readiness is checked independently
|
|
2
|
+
// using each workspace’s environment.
|
|
3
|
+
import type {
|
|
4
|
+
HarnessLoginState,
|
|
5
|
+
HarnessAvailability,
|
|
6
|
+
HarnessLogin,
|
|
7
|
+
WorkspaceType
|
|
8
|
+
} from '@/lib/types'
|
|
9
|
+
|
|
10
|
+
import { listWorkspaces } from '../workspaces/registry'
|
|
11
|
+
import { publishEvent } from '../events'
|
|
12
|
+
import { harnessFor } from './registry'
|
|
13
|
+
import type { HarnessWorkspace, HarnessLoginAttempt } from './types'
|
|
14
|
+
|
|
15
|
+
export type HarnessUpdatedEvent = {
|
|
16
|
+
type: 'harness:updated'
|
|
17
|
+
workspaceId: string
|
|
18
|
+
availability: HarnessAvailability
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Readiness can target a harness account or an individual workspace.
|
|
22
|
+
type HarnessTarget = WorkspaceType | HarnessWorkspace
|
|
23
|
+
|
|
24
|
+
function entryKey(context: HarnessTarget): string {
|
|
25
|
+
return typeof context === 'string' ? `default:${context}` : `workspace:${context.id}`
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type HarnessStoreOptions = {
|
|
29
|
+
probe: (ws: HarnessTarget) => Promise<HarnessAvailability>
|
|
30
|
+
startLogin: (type: WorkspaceType) => Promise<HarnessLoginAttempt>
|
|
31
|
+
publish: (event: HarnessUpdatedEvent) => void
|
|
32
|
+
onAuthChanged?: (type: WorkspaceType) => Promise<void>
|
|
33
|
+
availabilityTtlMs?: number
|
|
34
|
+
loginPollMs?: number
|
|
35
|
+
loginDeadlineMs?: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type LoginCeremony = {
|
|
39
|
+
state: HarnessLoginState
|
|
40
|
+
// The in-flight provider call; joiners await it instead of starting a
|
|
41
|
+
// second flow. Cleared once settled.
|
|
42
|
+
starting?: Promise<HarnessLogin>
|
|
43
|
+
stop: () => void
|
|
44
|
+
attempt?: HarnessLoginAttempt
|
|
45
|
+
completed?: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type HarnessEntry = {
|
|
49
|
+
cached?: { value: HarnessAvailability; checkedAt: number }
|
|
50
|
+
// In-flight probe, shared by concurrent callers.
|
|
51
|
+
probe?: Promise<HarnessAvailability>
|
|
52
|
+
login?: LoginCeremony
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function failedProbeAvailability(ws: HarnessTarget, err: unknown): HarnessAvailability {
|
|
56
|
+
console.error(`[harness-auth] availability probe failed for ${harnessFor(ws).id}`, err)
|
|
57
|
+
return { status: 'unavailable', reason: 'Could not check agent availability' }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function sameAvailability(a: HarnessAvailability, b: HarnessAvailability): boolean {
|
|
61
|
+
if (a.status !== b.status) return false
|
|
62
|
+
if (a.status === 'available' || b.status === 'available') return true
|
|
63
|
+
return (
|
|
64
|
+
a.reason === b.reason &&
|
|
65
|
+
(a.status !== 'unavailable' || b.status !== 'unavailable' || a.code === b.code)
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function createHarnessStore(options: HarnessStoreOptions) {
|
|
70
|
+
const ttlMs = options.availabilityTtlMs ?? 30_000
|
|
71
|
+
const pollMs = options.loginPollMs ?? 2_000
|
|
72
|
+
const deadlineMs = options.loginDeadlineMs ?? 10 * 60_000
|
|
73
|
+
const entries = new Map<string, HarnessEntry>()
|
|
74
|
+
|
|
75
|
+
function entryFor(context: HarnessTarget): HarnessEntry {
|
|
76
|
+
const key = entryKey(context)
|
|
77
|
+
let entry = entries.get(key)
|
|
78
|
+
if (!entry) {
|
|
79
|
+
entry = {}
|
|
80
|
+
entries.set(key, entry)
|
|
81
|
+
}
|
|
82
|
+
return entry
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function publish(context: HarnessTarget, availability: HarnessAvailability) {
|
|
86
|
+
if (typeof context === 'string') return options.onAuthChanged?.(context)
|
|
87
|
+
options.publish({
|
|
88
|
+
type: 'harness:updated',
|
|
89
|
+
workspaceId: context.id,
|
|
90
|
+
availability
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function probeFresh(ws: HarnessTarget): Promise<HarnessAvailability> {
|
|
95
|
+
const entry = entryFor(ws)
|
|
96
|
+
if (!entry.probe) {
|
|
97
|
+
entry.probe = Promise.resolve()
|
|
98
|
+
.then(() => options.probe(ws))
|
|
99
|
+
.catch(err => failedProbeAvailability(ws, err))
|
|
100
|
+
.finally(() => {
|
|
101
|
+
entry.probe = undefined
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
const value = await entry.probe
|
|
105
|
+
entry.cached = { value, checkedAt: Date.now() }
|
|
106
|
+
return value
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function getAvailability(ws: HarnessTarget): Promise<HarnessAvailability> {
|
|
110
|
+
const entry = entryFor(ws)
|
|
111
|
+
if (entry.cached && Date.now() - entry.cached.checkedAt < ttlMs) {
|
|
112
|
+
return entry.cached.value
|
|
113
|
+
}
|
|
114
|
+
return probeFresh(ws)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Bypass the TTL and push the result even if it's unchanged. For callers
|
|
118
|
+
// that suspect the cached snapshot is stale for a reason other than an env
|
|
119
|
+
// change (e.g. a send just failed, which can mean the provider was signed
|
|
120
|
+
// out from outside moi — a `codex logout` in a terminal, say).
|
|
121
|
+
async function refresh(ws: HarnessTarget): Promise<HarnessAvailability> {
|
|
122
|
+
const value = await probeFresh(ws)
|
|
123
|
+
await publish(ws, value)
|
|
124
|
+
return value
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getLogin(context: WorkspaceType): HarnessLoginState | undefined {
|
|
128
|
+
return entries.get(entryKey(context))?.login?.state
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Re-probe until the login lands or the deadline passes. One loop per
|
|
132
|
+
// ceremony; a replaced or completed ceremony stops its loop.
|
|
133
|
+
function watch(
|
|
134
|
+
type: WorkspaceType,
|
|
135
|
+
login: LoginCeremony,
|
|
136
|
+
initialAvailability: HarnessAvailability
|
|
137
|
+
) {
|
|
138
|
+
const deadline = Date.now() + deadlineMs
|
|
139
|
+
let stopped = false
|
|
140
|
+
let publishedAvailability = initialAvailability
|
|
141
|
+
let timer: ReturnType<typeof setTimeout>
|
|
142
|
+
login.stop = () => {
|
|
143
|
+
stopped = true
|
|
144
|
+
clearTimeout(timer)
|
|
145
|
+
}
|
|
146
|
+
const tick = async () => {
|
|
147
|
+
const value = await probeFresh(type)
|
|
148
|
+
if (stopped) return
|
|
149
|
+
const entry = entryFor(type)
|
|
150
|
+
if (value.status === 'available' && (!login.attempt?.completed || login.completed)) {
|
|
151
|
+
entry.login = undefined
|
|
152
|
+
await publish(type, value)
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
if (Date.now() >= deadline) {
|
|
156
|
+
// Keep the failed state so the connection panel can show it; the next
|
|
157
|
+
// startLogin replaces it.
|
|
158
|
+
stopLogin(login)
|
|
159
|
+
login.state = { state: 'failed', reason: 'Sign-in did not complete. Try again' }
|
|
160
|
+
await publish(type, value)
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
if (!sameAvailability(value, publishedAvailability)) {
|
|
164
|
+
publishedAvailability = value
|
|
165
|
+
await publish(type, value)
|
|
166
|
+
}
|
|
167
|
+
timer = setTimeout(tick, pollMs)
|
|
168
|
+
timer.unref?.()
|
|
169
|
+
}
|
|
170
|
+
// Unref'd so a pending ceremony never keeps the process alive on its own.
|
|
171
|
+
timer = setTimeout(tick, pollMs)
|
|
172
|
+
timer.unref?.()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function startLogin(type: WorkspaceType): Promise<HarnessLogin> {
|
|
176
|
+
const entry = entryFor(type)
|
|
177
|
+
// Concurrent starts share the provider call; active attempts reuse their instructions.
|
|
178
|
+
const current = entry.login
|
|
179
|
+
if (current?.starting) return current.starting
|
|
180
|
+
if (current?.state.state === 'pending') {
|
|
181
|
+
const { state: _state, ...instructions } = current.state
|
|
182
|
+
return instructions
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (current) stopLogin(current)
|
|
186
|
+
const starting = options.startLogin(type).then(attempt => {
|
|
187
|
+
const { completed, cancel: _cancel, submitCode: _submitCode, ...instructions } = attempt
|
|
188
|
+
login.attempt = attempt
|
|
189
|
+
if (entry.login !== login) {
|
|
190
|
+
stopLogin(login)
|
|
191
|
+
}
|
|
192
|
+
void completed?.then(
|
|
193
|
+
() => {
|
|
194
|
+
login.completed = true
|
|
195
|
+
},
|
|
196
|
+
() => {
|
|
197
|
+
if (entry.login !== login) return
|
|
198
|
+
stopLogin(login)
|
|
199
|
+
login.state = { state: 'failed', reason: 'Sign-in failed or expired. Try again' }
|
|
200
|
+
void refresh(type)
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
return instructions
|
|
204
|
+
})
|
|
205
|
+
const login: LoginCeremony = { state: { state: 'starting' }, starting, stop: () => {} }
|
|
206
|
+
entry.login = login
|
|
207
|
+
try {
|
|
208
|
+
const result = await starting
|
|
209
|
+
if (entry.login !== login) return result
|
|
210
|
+
login.starting = undefined
|
|
211
|
+
if (login.state.state === 'starting') login.state = { state: 'pending', ...result }
|
|
212
|
+
const availability = entry.cached?.value ?? {
|
|
213
|
+
status: 'login-required',
|
|
214
|
+
reason: 'Waiting for sign-in'
|
|
215
|
+
}
|
|
216
|
+
await publish(type, availability)
|
|
217
|
+
if (login.state.state === 'pending') watch(type, login, availability)
|
|
218
|
+
return result
|
|
219
|
+
} catch (err) {
|
|
220
|
+
if (entry.login === login) entry.login = undefined
|
|
221
|
+
throw err
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Drop the cached snapshot so the next read re-probes (e.g. after an env
|
|
226
|
+
// change swaps credentials).
|
|
227
|
+
function invalidate(context: HarnessTarget) {
|
|
228
|
+
const entry = entries.get(entryKey(context))
|
|
229
|
+
if (!entry) return
|
|
230
|
+
entry.cached = undefined
|
|
231
|
+
if (entry.login) stopLogin(entry.login)
|
|
232
|
+
entry.login = undefined
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function stopLogin(login: LoginCeremony) {
|
|
236
|
+
login.stop()
|
|
237
|
+
void Promise.resolve()
|
|
238
|
+
.then(() => login.attempt?.cancel?.())
|
|
239
|
+
.catch(() => {})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function activeLogin(type: WorkspaceType, id: string) {
|
|
243
|
+
const login = entryFor(type).login
|
|
244
|
+
if (!login || login.state.state !== 'pending' || login.state.id !== id) {
|
|
245
|
+
throw new Error('This sign-in attempt has ended. Start again')
|
|
246
|
+
}
|
|
247
|
+
return login
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function submitCode(type: WorkspaceType, id: string, code: string) {
|
|
251
|
+
const login = activeLogin(type, id)
|
|
252
|
+
if (!login.attempt?.submitCode) throw new Error('This sign-in does not accept a code')
|
|
253
|
+
await login.attempt.submitCode(code)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function shutdown() {
|
|
257
|
+
for (const entry of entries.values()) {
|
|
258
|
+
if (entry.login) stopLogin(entry.login)
|
|
259
|
+
entry.login = undefined
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
getAvailability,
|
|
265
|
+
refresh,
|
|
266
|
+
getLogin,
|
|
267
|
+
startLogin,
|
|
268
|
+
submitCode,
|
|
269
|
+
invalidate,
|
|
270
|
+
shutdown
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export type HarnessStore = ReturnType<typeof createHarnessStore>
|
|
275
|
+
|
|
276
|
+
export const harnessStore = createHarnessStore({
|
|
277
|
+
probe: async context => {
|
|
278
|
+
const harness = harnessFor(context)
|
|
279
|
+
if (typeof context !== 'string') {
|
|
280
|
+
return (await harness.availability?.(context)) ?? { status: 'available' }
|
|
281
|
+
}
|
|
282
|
+
if (!harness.authStatus)
|
|
283
|
+
return { status: 'unavailable', reason: 'This agent requires terminal sign-in' }
|
|
284
|
+
return harness.authStatus()
|
|
285
|
+
},
|
|
286
|
+
startLogin: type => {
|
|
287
|
+
const start = harnessFor(type).startLogin
|
|
288
|
+
if (!start) throw new Error('This agent requires terminal sign-in')
|
|
289
|
+
return start()
|
|
290
|
+
},
|
|
291
|
+
publish: publishEvent,
|
|
292
|
+
onAuthChanged: async type => {
|
|
293
|
+
// Shared credentials still need an independent check in each workspace.
|
|
294
|
+
try {
|
|
295
|
+
const workspaces = await listWorkspaces()
|
|
296
|
+
await Promise.all(
|
|
297
|
+
workspaces.filter(ws => harnessFor(ws).id === type).map(ws => harnessStore.refresh(ws))
|
|
298
|
+
)
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.error('[harness-auth] could not refresh workspaces after login', error)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
})
|
|
@@ -10,7 +10,7 @@ spec for the CC adapter.
|
|
|
10
10
|
> their wire examples are not an exhaustive list of today's SDK messages, and
|
|
11
11
|
> the migration proposed in §14 has shipped. Current display types live in
|
|
12
12
|
> `lib/format.ts`, mapping in `adapter.ts`, and rendering in
|
|
13
|
-
> `client/features/chat/messages/
|
|
13
|
+
> `client/features/chat/messages/turn-view.tsx`. Use the installed `sdk.d.ts` for current
|
|
14
14
|
> wire types.
|
|
15
15
|
|
|
16
16
|
Evidence drawn from:
|
|
@@ -19,7 +19,9 @@ Evidence drawn from:
|
|
|
19
19
|
- Upstream nested content types: `node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts`
|
|
20
20
|
- SDK bundled source: `sdk.mjs` (for undocumented behavior around `isSynthetic` / `isReplay`)
|
|
21
21
|
- Official docs: <https://code.claude.com/docs/en/agent-sdk/typescript>
|
|
22
|
-
-
|
|
22
|
+
- Historical repo code at capture time: `server/agent.ts`, `server/state.ts`,
|
|
23
|
+
`lib/types.ts`, `client/components/MessageBlock.tsx`. These are research-era
|
|
24
|
+
locations; current module ownership is described in the status note above.
|
|
23
25
|
- Captured live: `workspace/raw-sdk-messages.jsonl` (skill load + sub-agent run)
|
|
24
26
|
|
|
25
27
|
---
|
|
@@ -29,14 +31,14 @@ Evidence drawn from:
|
|
|
29
31
|
The Agent SDK remains the transport layer, but every `query()` explicitly uses
|
|
30
32
|
the `claude` executable through `pathToClaudeCodeExecutable`. Lookup goes
|
|
31
33
|
through `../executable.ts`: the server's PATH merged with the user's
|
|
32
|
-
login-shell PATH (`../shell-path.ts`, probed once at startup), so a
|
|
34
|
+
login-shell PATH (`../shell-path.ts`, probed once at startup), so a Moi server
|
|
33
35
|
launched outside a terminal still finds CLIs from `~/.local/bin`, homebrew,
|
|
34
36
|
and version-manager shims. There is no SDK bundled-executable fallback. If the
|
|
35
37
|
command is missing, setup and existing workspaces report:
|
|
36
|
-
`Run curl -fsSL https://claude.ai/install.sh | sh
|
|
38
|
+
`Run in terminal to install Claude Code: curl -fsSL https://claude.ai/install.sh | sh`.
|
|
37
39
|
|
|
38
40
|
**In-place updates.** Claude Code can replace its binary at the same path
|
|
39
|
-
while
|
|
41
|
+
while Moi keeps running, changing which models are available.
|
|
40
42
|
|
|
41
43
|
- Every spawn resolves the executable afresh, so new sessions run the new
|
|
42
44
|
binary. A live session keeps the subprocess it started with until it is torn
|
|
@@ -50,7 +52,7 @@ while moi keeps running, changing which models are available.
|
|
|
50
52
|
jobs to finish, replaces the subprocess, and resumes the same session from
|
|
51
53
|
disk. Replacement happens on demand.
|
|
52
54
|
- Pending messages and their model, effort, fast-mode, and streaming settings
|
|
53
|
-
stay in
|
|
55
|
+
stay in Moi's per-session queue. Only one user message enters the SDK per
|
|
54
56
|
turn. Matching result IDs prevent an autonomous background turn from
|
|
55
57
|
releasing a waiting user prompt. When the CLI emits lifecycle events,
|
|
56
58
|
dispatch also waits for `idle`. The queue follows session ID renames and
|
|
@@ -60,7 +62,7 @@ while moi keeps running, changing which models are available.
|
|
|
60
62
|
An absent effort or fast-mode value clears that flag with `null`, restoring
|
|
61
63
|
provider defaults.
|
|
62
64
|
- Background jobs retain their subprocess. Messages requiring a replacement
|
|
63
|
-
wait in
|
|
65
|
+
wait in Moi until those jobs finish, including replacements for streaming
|
|
64
66
|
changes. `background_tasks_changed` replaces the complete task set, including
|
|
65
67
|
backgrounded subagents and ambient watchers. Task start/update/completion
|
|
66
68
|
events are a fallback only until the process emits its first snapshot; their
|
|
@@ -267,7 +267,7 @@ export class ClaudeAdapter {
|
|
|
267
267
|
events.push({
|
|
268
268
|
kind: 'notice',
|
|
269
269
|
notice: {
|
|
270
|
-
id: noticeId('rate-limit'),
|
|
270
|
+
id: msg.uuid ?? noticeId('rate-limit'),
|
|
271
271
|
kind: 'rate-limit',
|
|
272
272
|
at: new Date().toISOString(),
|
|
273
273
|
info: msg.rate_limit_info
|
|
@@ -774,20 +774,25 @@ export class ClaudeAdapter {
|
|
|
774
774
|
// -----------------------------------------------------------------------
|
|
775
775
|
|
|
776
776
|
private buildSystemNotice(msg: SdkMessage): SystemNotice | undefined {
|
|
777
|
-
const at = new Date().toISOString()
|
|
777
|
+
const at = msg.timestamp ?? new Date().toISOString()
|
|
778
778
|
switch (msg.subtype) {
|
|
779
779
|
case 'session_state_changed':
|
|
780
780
|
return {
|
|
781
|
-
id: noticeId('session-state'),
|
|
781
|
+
id: msg.uuid ?? noticeId('session-state'),
|
|
782
782
|
kind: 'session-state',
|
|
783
783
|
at,
|
|
784
784
|
state: (msg.state as 'idle' | 'running' | 'requires-action') ?? 'idle'
|
|
785
785
|
}
|
|
786
786
|
case 'compact_boundary':
|
|
787
|
-
return {
|
|
787
|
+
return {
|
|
788
|
+
id: msg.uuid ?? noticeId('compact'),
|
|
789
|
+
kind: 'compact',
|
|
790
|
+
at,
|
|
791
|
+
metadata: msg.compact_metadata
|
|
792
|
+
}
|
|
788
793
|
case 'api_retry':
|
|
789
794
|
return {
|
|
790
|
-
id: noticeId('api-retry'),
|
|
795
|
+
id: msg.uuid ?? noticeId('api-retry'),
|
|
791
796
|
kind: 'api-retry',
|
|
792
797
|
at,
|
|
793
798
|
attempt: msg.attempt ?? 0,
|
|
@@ -799,7 +804,7 @@ export class ClaudeAdapter {
|
|
|
799
804
|
case 'hook_progress':
|
|
800
805
|
case 'hook_response':
|
|
801
806
|
return {
|
|
802
|
-
id: noticeId('hook'),
|
|
807
|
+
id: msg.uuid ?? noticeId('hook'),
|
|
803
808
|
kind: 'hook',
|
|
804
809
|
at,
|
|
805
810
|
hookId: msg.hook_id ?? '',
|
|
@@ -817,7 +822,7 @@ export class ClaudeAdapter {
|
|
|
817
822
|
}
|
|
818
823
|
case 'files_persisted':
|
|
819
824
|
return {
|
|
820
|
-
id: noticeId('files-persisted'),
|
|
825
|
+
id: msg.uuid ?? noticeId('files-persisted'),
|
|
821
826
|
kind: 'files-persisted',
|
|
822
827
|
at,
|
|
823
828
|
files: (msg.files ?? []).map(f => f.filename),
|
|
@@ -825,7 +830,7 @@ export class ClaudeAdapter {
|
|
|
825
830
|
}
|
|
826
831
|
case 'elicitation_complete':
|
|
827
832
|
return {
|
|
828
|
-
id: noticeId('elicitation'),
|
|
833
|
+
id: msg.uuid ?? noticeId('elicitation'),
|
|
829
834
|
kind: 'elicitation',
|
|
830
835
|
at,
|
|
831
836
|
server: msg.mcp_server_name ?? '',
|