moi-computer 0.12.1-next.3 → 0.13.0
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/bunfig.toml +1 -5
- package/client/api/app-config.ts +1 -2
- package/client/api/app-ui-keys.ts +3 -1
- package/client/api/http.ts +4 -1
- package/client/api/workspace-keys.ts +3 -3
- package/client/app/app-provider.tsx +22 -2
- package/client/app/app-router.tsx +4 -0
- package/client/app/routes/home-route.tsx +14 -0
- package/client/app/routes/onboarding-route.tsx +11 -0
- package/client/app/routes/settings-route.tsx +1 -1
- package/client/app/routes/workspace-route.tsx +21 -19
- package/client/components/shared/screen-shell.tsx +23 -0
- package/client/components/shared/ultrafast-icon.tsx +61 -0
- package/client/components/shared/workspace-icon.tsx +2 -2
- package/client/features/account/account-test-utils.tsx +4 -3
- package/client/features/app-settings/api.ts +33 -0
- package/client/features/app-settings/general-settings.tsx +39 -0
- package/client/features/{settings → app-settings}/settings-page.tsx +5 -1
- package/client/features/chat/applet-chat-intents.ts +4 -20
- package/client/features/chat/chat-send.ts +17 -13
- package/client/features/chat/composer/model-order.ts +8 -4
- package/client/features/chat/composer/model-picker.tsx +88 -34
- package/client/features/chat/composer/use-workspace-composer-state.tsx +11 -3
- package/client/features/chat/composer/use-workspace-skill-updates.ts +1 -1
- package/client/features/chat/connection/chat-frames.ts +3 -15
- package/client/features/chat/messages/chat-empty-state.tsx +1 -4
- package/client/features/chat/messages/fork-history.ts +5 -5
- package/client/features/chat/messages/tool-group/subagent-card.tsx +1 -0
- package/client/features/chat/messages/turn-view.tsx +3 -12
- package/client/features/chat/messages/user-message-bubble.tsx +63 -0
- package/client/features/chat/sessions/api.ts +121 -80
- package/client/features/chat/sessions/browser-tab-state.ts +14 -12
- package/client/features/chat/sessions/chat-selector.tsx +5 -6
- package/client/features/chat/sessions/use-selected-session.ts +172 -257
- package/client/features/chat/use-chat.ts +14 -19
- package/client/features/collab/components/user-avatar.tsx +4 -10
- package/client/features/collab/workspace-users-menu.tsx +1 -1
- package/client/features/connectors/api.ts +12 -4
- package/client/features/connectors/mcp-server-cards.tsx +17 -7
- package/client/features/connectors/read-connectors.ts +35 -0
- package/client/features/demo/demo-dialog.tsx +11 -3
- package/client/features/dev/collab/local-user-settings.tsx +1 -1
- package/client/features/dev/dev-index-page.tsx +5 -0
- package/client/features/dev/dev-routes.tsx +2 -0
- package/client/features/dev/harness-debug-page.tsx +3 -3
- package/client/features/dev/onboarding-preview-page.tsx +76 -0
- package/client/features/dev/workspace-setup-mocks.ts +16 -14
- package/client/features/dev/workspace-setup-preview.tsx +11 -17
- package/client/features/harness/api.ts +45 -15
- package/client/features/harness/device-login-steps.tsx +9 -3
- package/client/features/harness/harness-login-panel.tsx +228 -0
- package/client/features/harness/harness-presentation.ts +15 -0
- package/client/features/harness/harness-selector.tsx +119 -0
- package/client/features/harness/use-harness-login.ts +77 -0
- package/client/features/home/home-page.tsx +7 -7
- package/client/features/onboarding/agent-setup-step.tsx +57 -0
- package/client/features/onboarding/api.ts +42 -0
- package/client/features/onboarding/onboarding-idea-disk.tsx +129 -0
- package/client/features/onboarding/onboarding-page.tsx +32 -0
- package/client/features/onboarding/onboarding-screen.tsx +20 -0
- package/client/features/onboarding/onboarding-status.tsx +24 -0
- package/client/features/onboarding/workspace-setup-step.tsx +239 -0
- package/client/features/overview/default/registry.tsx +2 -2
- package/client/features/overview/default/views-widget.tsx +6 -5
- package/client/features/overview/overview.tsx +9 -11
- package/client/features/overview/widget-canvas.tsx +1 -1
- package/client/features/overview/workspace-name.tsx +2 -2
- package/client/features/views/api.ts +69 -16
- package/client/features/views/pending-view-screen.tsx +30 -9
- package/client/features/views/use-view-actions.ts +19 -20
- package/client/features/views/view-presentation.ts +2 -2
- package/client/features/views/view-submission.ts +28 -41
- package/client/features/workspace/add/api.ts +3 -23
- package/client/features/workspace/add/create-workspace-dialog.tsx +6 -5
- package/client/features/workspace/add/import-workspace-dialog.tsx +3 -3
- package/client/features/workspace/add/workspace-agent-options.ts +11 -12
- package/client/features/workspace/add/workspace-agent-selector.tsx +3 -132
- package/client/features/workspace/api.ts +32 -36
- package/client/features/workspace/harness-transition.ts +89 -0
- package/client/features/{settings → workspace/settings}/api.ts +1 -34
- package/client/features/{settings → workspace/settings}/connectors-settings.tsx +31 -10
- package/client/features/workspace/settings/general-settings.tsx +180 -0
- package/client/features/{settings → workspace/settings}/use-env-vars.ts +1 -1
- package/client/features/{settings → workspace/settings}/workspace-icon-picker.tsx +3 -3
- package/client/features/workspace/setup/workspace-login-state.tsx +37 -156
- package/client/features/workspace/setup/workspace-recovery-states.tsx +0 -12
- package/client/features/workspace/setup/workspace-setup.tsx +34 -14
- package/client/features/workspace/setup/workspace-welcome-state.tsx +2 -2
- package/client/features/workspace/use-workspace-navigation.ts +25 -9
- package/client/features/workspace/workspace-content.tsx +11 -8
- package/client/features/workspace/workspace-frame.tsx +2 -1
- package/client/features/workspace/workspace-layout-context.tsx +5 -2
- package/client/features/workspace/workspace-menu.tsx +12 -8
- package/client/features/workspace/workspace-pending-screen.tsx +10 -10
- package/client/features/workspace/workspace-presentation.tsx +5 -13
- package/client/features/workspace/workspace-state.ts +169 -0
- package/client/features/workspace/workspace-tabs.tsx +22 -2
- package/client/index.css +2 -0
- package/client/index.tsx +3 -3
- package/client/lib/flags.ts +1 -1
- package/client/lib/{app-icon-registry.ts → identity-icon-registry.ts} +10 -14
- package/client/runtime/workspace-events.ts +21 -4
- package/client/runtime/workspace-theme.ts +9 -0
- package/client/tailwind-config.ts +43 -0
- package/dist/chunk-2y59vrxg.js +5 -0
- package/dist/chunk-58dyt9bk.js +2 -0
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-bncc7heg.js +1 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-cqt3s31j.js +546 -0
- package/dist/chunk-dcmks9sm.js +75 -0
- package/dist/chunk-md45evr2.css +1 -0
- package/dist/chunk-n0nab26d.js +1 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-nmzhgyp9.js +2 -0
- package/dist/chunk-q37knr3m.js +2 -0
- package/dist/chunk-s90m4qkz.js +1 -0
- package/dist/chunk-wjvd4byz.js +2 -0
- package/dist/index.html +1 -1
- package/lib/harness-instructions.ts +1 -1
- package/lib/{app-icons.ts → identity-icons.ts} +6 -7
- package/lib/onboarding.ts +41 -0
- package/lib/speed-mode.ts +5 -0
- package/lib/types.ts +75 -64
- package/lib/view-build-directives.ts +1 -2
- package/lib/workspace-icon.ts +2 -2
- package/lib/workspace-layout.ts +1 -1
- package/lib/workspace-name.ts +15 -12
- package/package.json +11 -8
- package/server/README.md +27 -25
- package/server/api/harnesses.ts +31 -8
- package/server/api/index.ts +189 -127
- package/server/api/onboarding.ts +46 -0
- package/server/app-config.ts +16 -24
- package/server/app-settings.ts +6 -2
- package/server/applets/config.ts +5 -5
- package/server/applets/views.ts +19 -17
- package/server/cli/commands/init.ts +3 -3
- package/server/cli/commands/skill.ts +16 -17
- package/server/cli/commands/start.ts +8 -34
- package/server/cli/server.ts +18 -6
- package/server/collab/config.ts +1 -2
- package/server/collab/manager.ts +4 -1
- package/server/collab/skill/index.ts +1 -1
- package/server/control.ts +3 -3
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +24 -8
- package/server/harness/acp/session.ts +8 -4
- package/server/harness/auth.ts +14 -17
- package/server/harness/claude-code/NOTES.md +4 -3
- package/server/harness/claude-code/index.ts +5 -6
- package/server/harness/claude-code/mcp.ts +17 -0
- package/server/harness/claude-code/models.ts +2 -20
- package/server/harness/claude-code/run-action.ts +123 -0
- package/server/harness/claude-code/session-title.ts +5 -7
- package/server/harness/claude-code/session.ts +24 -16
- package/server/harness/codex/NOTES.md +22 -10
- package/server/harness/codex/adapter.ts +14 -17
- package/server/harness/codex/client.ts +8 -5
- package/server/harness/codex/connectors.ts +92 -0
- package/server/harness/codex/index.ts +4 -1
- package/server/harness/codex/pagination.ts +8 -5
- package/server/harness/codex/run-action.ts +93 -0
- package/server/harness/codex/session-title.ts +6 -8
- package/server/harness/codex/session.ts +11 -11
- package/server/harness/codex/transport.ts +13 -6
- package/server/harness/command.ts +45 -0
- package/server/harness/executable.ts +5 -0
- package/server/harness/fork.ts +6 -4
- package/server/harness/install.ts +49 -0
- package/server/harness/openclaw/session.ts +1 -2
- package/server/harness/run-action.ts +85 -0
- package/server/harness/session-title.ts +0 -46
- package/server/harness/types.ts +30 -3
- package/server/onboarding/brief.ts +29 -0
- package/server/onboarding/ideas.ts +48 -0
- package/server/onboarding/jobs.ts +291 -0
- package/server/onboarding/prompt.md +49 -0
- package/server/sessions/archive.ts +5 -14
- package/server/sessions/config.ts +17 -16
- package/server/sessions/lifecycle.ts +15 -13
- package/server/sessions/pending-views.ts +79 -108
- package/server/sessions/selected.ts +75 -161
- package/server/sessions/store.ts +40 -113
- package/server/sessions/view-sessions.ts +128 -111
- package/server/skills/locations.ts +82 -0
- package/server/skills/lock.ts +29 -0
- package/server/skills/template.ts +36 -25
- package/server/skills/update.ts +52 -5
- package/server/skills/version.ts +17 -22
- package/server/skills/workspace.ts +121 -0
- package/server/web.ts +22 -8
- package/server/workspace-state/file.ts +177 -0
- package/server/workspace-state/index.ts +162 -0
- package/server/workspace-state/legacy-migration.ts +79 -0
- package/server/workspace-state/lock.ts +42 -0
- package/server/workspace-state/types.ts +16 -0
- package/server/workspaces/change-harness.ts +88 -0
- package/server/workspaces/harness-transition.ts +29 -0
- package/server/workspaces/init.ts +29 -6
- package/server/workspaces/layout.ts +3 -0
- package/server/workspaces/registry.ts +27 -1
- package/{workspace/.claude/skills/moi-workspace → skill}/SKILL.md +7 -5
- package/{workspace/.claude/skills/moi-workspace → skill}/references/COLLAB.md +4 -8
- package/skill/references/DESIGN.md +167 -0
- package/{workspace/.claude/skills/moi-workspace → skill}/references/SCRATCHPAD.md +2 -2
- package/{workspace/.claude/skills/moi-workspace → skill}/references/UI-COMPONENTS.md +3 -0
- package/ui-components/badge.tsx +1 -1
- package/client/accept-hmr-dependencies.ts +0 -22
- package/client/features/settings/general-settings.tsx +0 -103
- package/client/features/workspace/setup/workspace-setup-panel.tsx +0 -18
- package/dist/chunk-20ynagd4.js +0 -2
- package/dist/chunk-42tde9a6.js +0 -1
- package/dist/chunk-9w543s0r.js +0 -2
- package/dist/chunk-a5372n61.js +0 -546
- package/dist/chunk-aja9y1vn.js +0 -68
- package/dist/chunk-fvcvrh3d.css +0 -1
- package/dist/chunk-gtfjw3nx.js +0 -1
- package/dist/chunk-j39y2aky.js +0 -14
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-pja30km3.js +0 -1
- package/dist/chunk-rm894bc2.js +0 -2
- package/dist/chunk-tevvtfbk.js +0 -10
- package/dist/chunk-tgt9zd0r.js +0 -2
- package/dist/chunk-tv5k5z00.js +0 -1
- package/dist/chunk-zq2ae5dx.js +0 -2
- package/lib/experimental.ts +0 -14
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
- /package/client/features/{settings → app-settings}/profile-settings.tsx +0 -0
- /package/client/features/{settings → app-settings}/settings-section.tsx +0 -0
- /package/client/features/{settings → app-settings}/users-settings.tsx +0 -0
- /package/client/features/{settings → workspace/settings}/environment-settings.tsx +0 -0
- /package/client/features/{settings → workspace/settings}/icon-picker-options.ts +0 -0
- /package/client/features/{settings → workspace/settings}/settings-layout.tsx +0 -0
- /package/client/features/{settings → workspace/settings}/workspace-settings-dialog.tsx +0 -0
- /package/{workspace/.claude/skills/moi-workspace → skill}/references/INTENTS.md +0 -0
|
@@ -8,7 +8,7 @@ type HarnessInstruction = {
|
|
|
8
8
|
export const HARNESS_INSTRUCTIONS: Record<WorkspaceType, HarnessInstruction> = {
|
|
9
9
|
'claude-code': {
|
|
10
10
|
reason: 'Run in terminal to install Claude:',
|
|
11
|
-
command: 'curl -fsSL https://claude.ai/install.sh |
|
|
11
|
+
command: 'curl -fsSL https://claude.ai/install.sh | bash'
|
|
12
12
|
},
|
|
13
13
|
codex: {
|
|
14
14
|
reason: 'Run in terminal to install ChatGPT:',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Identity glyphs for workspaces and views. UI controls use Tabler icons directly.
|
|
2
|
+
export const IDENTITY_ICON_IDS = [
|
|
2
3
|
'rocket',
|
|
3
4
|
'sparkles',
|
|
4
5
|
'bolt',
|
|
@@ -23,8 +24,6 @@ export const APP_ICON_IDS = [
|
|
|
23
24
|
'hexagon',
|
|
24
25
|
'plug',
|
|
25
26
|
'tool',
|
|
26
|
-
'settings',
|
|
27
|
-
'dots',
|
|
28
27
|
'bug',
|
|
29
28
|
'activity',
|
|
30
29
|
'chart',
|
|
@@ -65,10 +64,10 @@ export const APP_ICON_IDS = [
|
|
|
65
64
|
'chef'
|
|
66
65
|
] as const
|
|
67
66
|
|
|
68
|
-
export type
|
|
67
|
+
export type IdentityIconId = (typeof IDENTITY_ICON_IDS)[number]
|
|
69
68
|
|
|
70
|
-
const
|
|
69
|
+
const identityIconIds = new Set<string>(IDENTITY_ICON_IDS)
|
|
71
70
|
|
|
72
|
-
export function
|
|
73
|
-
return
|
|
71
|
+
export function isIdentityIconId(id: string): id is IdentityIconId {
|
|
72
|
+
return identityIconIds.has(id)
|
|
74
73
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IdentityIconId } from './identity-icons'
|
|
2
|
+
import type { WorkspaceTheme } from './themes'
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
|
|
5
|
+
export const discoveryProgressSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
message: z.string().trim().min(1).max(50)
|
|
8
|
+
})
|
|
9
|
+
.strict()
|
|
10
|
+
export type DiscoveryProgress = z.infer<typeof discoveryProgressSchema>
|
|
11
|
+
|
|
12
|
+
export type OnboardingHarness = 'claude-code' | 'codex'
|
|
13
|
+
export type OnboardingAppletPlan = {
|
|
14
|
+
name: string
|
|
15
|
+
description: string
|
|
16
|
+
features: string[]
|
|
17
|
+
}
|
|
18
|
+
export type OnboardingViewPlan = OnboardingAppletPlan & { icon: IdentityIconId }
|
|
19
|
+
export type OnboardingIdea = {
|
|
20
|
+
id: string
|
|
21
|
+
name: string
|
|
22
|
+
icon: IdentityIconId
|
|
23
|
+
theme: Pick<WorkspaceTheme, 'font' | 'color'>
|
|
24
|
+
description: string
|
|
25
|
+
views: OnboardingViewPlan[]
|
|
26
|
+
widgets: OnboardingAppletPlan[]
|
|
27
|
+
}
|
|
28
|
+
export type IdeaDiscovery = { harness: OnboardingHarness; runId: string }
|
|
29
|
+
export type WorkspaceBuild = {
|
|
30
|
+
harness: OnboardingHarness
|
|
31
|
+
operationId: string
|
|
32
|
+
idea: OnboardingIdea
|
|
33
|
+
}
|
|
34
|
+
export type OnboardingJobResult = {
|
|
35
|
+
status: 'running' | 'done' | 'failed'
|
|
36
|
+
progress?: DiscoveryProgress
|
|
37
|
+
ideas?: OnboardingIdea[]
|
|
38
|
+
workspaceId?: string
|
|
39
|
+
sessionId?: string
|
|
40
|
+
error?: string
|
|
41
|
+
}
|
package/lib/types.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PreviewBlock, StreamEvent } from './format'
|
|
2
|
-
import type {
|
|
3
|
-
import type { ExperimentalFeatures } from './experimental'
|
|
2
|
+
import type { IdentityIconId } from './identity-icons'
|
|
4
3
|
import type { MoiContext } from './moi-context'
|
|
5
4
|
import type { WorkspaceTheme } from './themes'
|
|
6
5
|
import type { AttachmentInput, WidgetConfig } from 'moi'
|
|
@@ -39,8 +38,9 @@ export type PendingView = {
|
|
|
39
38
|
title?: string
|
|
40
39
|
icon?: string
|
|
41
40
|
requirements: string
|
|
42
|
-
//
|
|
43
|
-
|
|
41
|
+
// The chat running the build: usually the view tab's own chat, or the
|
|
42
|
+
// pinned chat when one is pinned. Ownership lives in the chat's `tabId`.
|
|
43
|
+
buildSessionId?: string
|
|
44
44
|
error?: string
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -257,9 +257,8 @@ export type ClientMessage =
|
|
|
257
257
|
// Omitted means the provider default. Harnesses apply changes before the
|
|
258
258
|
// next send (see server/harness/claude-code/session.ts).
|
|
259
259
|
effort?: string
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
fastMode?: boolean
|
|
260
|
+
// Select processing speed. Omitted uses normal, overriding provider defaults.
|
|
261
|
+
speedMode?: SpeedMode
|
|
263
262
|
// Opt into live token-by-token streaming for this turn. Omitted/false runs
|
|
264
263
|
// the current whole-block behavior. Only honored for providers that report
|
|
265
264
|
// `supportsStreaming` (Claude Code); ignored otherwise. Like effort, a
|
|
@@ -290,82 +289,76 @@ export type SessionSummary = {
|
|
|
290
289
|
flavor?: 'chat' | 'cron' | 'subagent'
|
|
291
290
|
}
|
|
292
291
|
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
//
|
|
297
|
-
//
|
|
292
|
+
// Missing speed mode behaves as normal.
|
|
293
|
+
export type SpeedMode = 'normal' | 'fast' | 'ultrafast'
|
|
294
|
+
|
|
295
|
+
// Per-chat agent settings, overriding the workspace defaults in
|
|
296
|
+
// `.moi/.workspace.json`. A chat reopens with the model/effort/speed mode it
|
|
297
|
+
// last ran with; a brand-new chat is seeded from the workspace defaults.
|
|
298
298
|
export type SessionConfig = {
|
|
299
299
|
model?: string
|
|
300
300
|
effort?: string
|
|
301
|
-
|
|
301
|
+
speedMode?: SpeedMode
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
type
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
| {
|
|
311
|
-
forkedFromSessionId: string
|
|
312
|
-
// Last copied turn in the child. Without a cutoff, show its full history.
|
|
313
|
-
forkedThroughMessageId?: string
|
|
314
|
-
forkedNoticeIds?: string[]
|
|
315
|
-
}
|
|
304
|
+
export type SessionFork = {
|
|
305
|
+
fromSessionId: string
|
|
306
|
+
// Last copied turn in the child. Without a cutoff, show its full history.
|
|
307
|
+
throughMessageId?: string
|
|
308
|
+
noticeIds?: string[]
|
|
309
|
+
}
|
|
316
310
|
|
|
317
|
-
//
|
|
318
|
-
type
|
|
311
|
+
// Moi's own record of one chat. Titles and history stay with the agent.
|
|
312
|
+
export type WorkspaceSessionState = {
|
|
313
|
+
// The view tab that owns this chat; absent means the overview.
|
|
319
314
|
tabId?: WorkspaceTabId
|
|
320
|
-
} & SessionForkFields
|
|
321
|
-
|
|
322
|
-
export type SessionRecord = SessionMetadata & {
|
|
323
315
|
config?: SessionConfig
|
|
316
|
+
fork?: SessionFork
|
|
324
317
|
}
|
|
325
318
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
319
|
+
// Per-user chat state for one workspace, kept in Moi's data dir and served by
|
|
320
|
+
// GET /api/workspaces/:id/state. Every write returns it and publishes it as
|
|
321
|
+
// `state:changed`.
|
|
322
|
+
export type WorkspaceState = {
|
|
323
|
+
// Goes up by one with every saved change. Lets clients drop an older copy
|
|
324
|
+
// that arrives after a newer one.
|
|
325
|
+
revision: number
|
|
326
|
+
// Applies to every tab and overrides `selected`.
|
|
327
|
+
pinnedSessionId?: string
|
|
328
|
+
// The chat each tab shows.
|
|
329
|
+
selected: Partial<Record<WorkspaceTabId, string>>
|
|
330
|
+
sessions: Record<string, WorkspaceSessionState>
|
|
331
|
+
// Views not compiled yet, keyed by view id.
|
|
332
|
+
pendingViews: Record<string, Omit<PendingView, 'id'>>
|
|
334
333
|
}
|
|
335
334
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
// inherits the server selection, including CLI-created view handoffs.
|
|
339
|
-
selected: Partial<Record<WorkspaceTabId, string | null>>
|
|
340
|
-
pinned: string | null
|
|
341
|
-
}
|
|
335
|
+
// A chat-list row: the agent's session plus the tab that owns it.
|
|
336
|
+
export type SessionInfo = SessionSummary & { tabId?: WorkspaceTabId }
|
|
342
337
|
|
|
343
338
|
// App-wide settings, persisted server-side as `settings.json` in Moi's data
|
|
344
339
|
// dir and exposed via GET/PATCH /api/settings. Every key has a default, so
|
|
345
340
|
// GET always returns a complete object.
|
|
346
341
|
export type AppSettings = {
|
|
342
|
+
showOnboarding: boolean
|
|
347
343
|
// Apply bundled workspace-skill updates automatically when a workspace
|
|
348
344
|
// with outdated skills is opened, instead of prompting each time.
|
|
349
345
|
autoUpdateSkills: boolean
|
|
350
346
|
}
|
|
351
347
|
|
|
352
348
|
// Client-safe startup config, served by GET /api/config. Deployment settings
|
|
353
|
-
// come from config.json and MOI_* env overrides
|
|
354
|
-
// explicit CLI options. See server/app-config.ts.
|
|
349
|
+
// come from config.json and MOI_* env overrides. See server/app-config.ts.
|
|
355
350
|
export type AppEnvironment = 'local' | 'cloud'
|
|
356
351
|
|
|
357
352
|
export type ClientAppConfig = {
|
|
358
353
|
environment: AppEnvironment
|
|
354
|
+
collab: boolean
|
|
359
355
|
// Demo mode: workspace creation is blocked; the UI offers the
|
|
360
356
|
// cloud-demo promo dialog instead.
|
|
361
357
|
demo: boolean
|
|
362
|
-
experimental: ExperimentalFeatures
|
|
363
358
|
// Link target for the cloud-demo promo dialog.
|
|
364
359
|
demoInstallUrl: string
|
|
365
360
|
}
|
|
366
361
|
|
|
367
|
-
export type { ExperimentalFeatures } from './experimental'
|
|
368
|
-
|
|
369
362
|
export type UpdateStatus = {
|
|
370
363
|
runningVersion: string
|
|
371
364
|
availableVersion: string | null
|
|
@@ -474,6 +467,7 @@ export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
|
|
|
474
467
|
|
|
475
468
|
export type WorkspaceSkillStatus = {
|
|
476
469
|
name: string
|
|
470
|
+
path: string
|
|
477
471
|
installed: string | null
|
|
478
472
|
bundled: string | null
|
|
479
473
|
}
|
|
@@ -489,8 +483,10 @@ export type WorkspaceSkillsUpdateFailure = WorkspaceSkillsStatus & {
|
|
|
489
483
|
|
|
490
484
|
export type HarnessInstallations = Record<WorkspaceType, boolean>
|
|
491
485
|
|
|
492
|
-
//
|
|
493
|
-
|
|
486
|
+
// Shared runtime/account readiness and the current sign-in attempt.
|
|
487
|
+
export type HarnessStatus = { availability: HarnessAvailability; login?: HarnessLoginState }
|
|
488
|
+
export type HarnessStatuses = Record<WorkspaceType, HarnessStatus>
|
|
489
|
+
|
|
494
490
|
export type HarnessAvailability =
|
|
495
491
|
| { status: 'available' }
|
|
496
492
|
| { status: 'login-required'; reason: string }
|
|
@@ -513,16 +509,18 @@ export type HarnessLoginState =
|
|
|
513
509
|
|
|
514
510
|
export type WorkspaceIcon =
|
|
515
511
|
| { type: 'emoji'; value: string; background?: 'theme' }
|
|
516
|
-
| { type: 'glyph'; value:
|
|
512
|
+
| { type: 'glyph'; value: IdentityIconId; background?: 'theme' }
|
|
517
513
|
| { type: 'upload'; value: string }
|
|
518
514
|
|
|
519
|
-
// One
|
|
520
|
-
//
|
|
515
|
+
// One connector's status, as surfaced by GET /api/workspaces/:id/mcp.
|
|
516
|
+
// Includes standalone MCP servers and individual hosted apps.
|
|
521
517
|
export type McpServerState = 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled'
|
|
522
518
|
|
|
523
519
|
export type McpServer = {
|
|
524
520
|
name: string
|
|
525
521
|
status: McpServerState
|
|
522
|
+
displayName?: string
|
|
523
|
+
iconUrl?: string
|
|
526
524
|
}
|
|
527
525
|
|
|
528
526
|
export type WorkspaceEntry = {
|
|
@@ -629,7 +627,11 @@ export type WorkspaceTabsState = {
|
|
|
629
627
|
|
|
630
628
|
export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
|
|
631
629
|
|
|
632
|
-
export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & {
|
|
630
|
+
export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & {
|
|
631
|
+
tabs?: WorkspaceTabsState
|
|
632
|
+
// Captured when the edit is made, so delayed saves cannot restore another harness's defaults.
|
|
633
|
+
harness?: WorkspaceType
|
|
634
|
+
}
|
|
633
635
|
|
|
634
636
|
export type WorkspaceLayout = {
|
|
635
637
|
version: 1
|
|
@@ -649,18 +651,26 @@ export type WorkspaceLayout = {
|
|
|
649
651
|
// the transcript records the *resolved* id (e.g. `claude-sonnet-4-6`), which
|
|
650
652
|
// doesn't map back to these aliases — hence we persist the pick here.
|
|
651
653
|
//
|
|
652
|
-
// This (with `selectedEffort` and `
|
|
654
|
+
// This (with `selectedEffort` and `selectedSpeedMode`) is the *workspace
|
|
653
655
|
// default*: the value the picker edits when no session is open, and the seed a
|
|
654
656
|
// brand-new session copies. Once a session exists it carries its own per-session
|
|
655
657
|
// override (see `SessionConfig`).
|
|
656
658
|
selectedModel?: string
|
|
657
659
|
// Reasoning-effort default for new sessions (a `supportedEffortLevels` value).
|
|
658
660
|
selectedEffort?: string
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
+
// Speed default for new sessions. Undefined behaves as normal.
|
|
662
|
+
selectedSpeedMode?: SpeedMode
|
|
661
663
|
theme?: WorkspaceTheme
|
|
662
664
|
}
|
|
663
665
|
|
|
666
|
+
// GET /api/workspaces/:id: layout plus the local workspace registration.
|
|
667
|
+
export type WorkspaceLayoutResponse = WorkspaceLayout & {
|
|
668
|
+
cwd: string
|
|
669
|
+
name: string
|
|
670
|
+
provider?: WorkspaceType
|
|
671
|
+
agentId?: string
|
|
672
|
+
}
|
|
673
|
+
|
|
664
674
|
// One applet's thumbnail freshness record. Image bytes live as files in the
|
|
665
675
|
// workspace's `.moi/.cache/thumbnails/` (server/applets/thumbnails.ts), never in
|
|
666
676
|
// `.workspace.json` — the layout file stays small and commit-safe.
|
|
@@ -761,16 +771,17 @@ export type Model = {
|
|
|
761
771
|
defaultEffort?: string
|
|
762
772
|
supportsAdaptiveThinking?: boolean
|
|
763
773
|
supportsFastMode?: boolean
|
|
764
|
-
|
|
765
|
-
defaultFastMode?: boolean
|
|
774
|
+
supportsUltrafastMode?: boolean
|
|
766
775
|
supportsAutoMode?: boolean
|
|
767
776
|
}
|
|
768
777
|
|
|
769
|
-
// GET /api/workspaces/:id/
|
|
778
|
+
// GET /api/workspaces/:id/harness. Model changes arrive on refetch;
|
|
770
779
|
// `harness:updated` events refresh availability.
|
|
771
|
-
export type
|
|
772
|
-
|
|
773
|
-
|
|
780
|
+
export type WorkspaceHarness = {
|
|
781
|
+
/** Credential overrides require workspace readiness instead of shared account status. */
|
|
782
|
+
hasAuthOverrides?: boolean
|
|
783
|
+
isFolderMissing?: boolean
|
|
784
|
+
// The harness that produced this snapshot — matches the workspace
|
|
774
785
|
// provider.
|
|
775
786
|
provider: WorkspaceType
|
|
776
787
|
// Runtime presence and provider auth state, from the server-side cache.
|
|
@@ -6,7 +6,6 @@ export function viewBuildDirectives(viewId: string, availableIcons: readonly str
|
|
|
6
6
|
`The view id is \`${viewId}\`. Write the view source to \`.moi/views/${viewId}.tsx\`.`,
|
|
7
7
|
`Before building, set a provisional title and icon: \`moi views set ${viewId} --title "<title>" --icon <icon-id>\`. Use sentence case for the title.`,
|
|
8
8
|
`Available view icons: ${availableIcons.join(', ')}`,
|
|
9
|
-
'If the user asks for an additional view, create it with: `moi views create --requirements "<complete requirements>"`.'
|
|
10
|
-
`When done, do not navigate. Keep the user's current tab open and end your reply with \`[Open the view](moi:/views/${viewId})\`.`
|
|
9
|
+
'If the user asks for an additional view, create it with: `moi views create --requirements "<complete requirements>"`.'
|
|
11
10
|
]
|
|
12
11
|
}
|
package/lib/workspace-icon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isIdentityIconId } from './identity-icons'
|
|
2
2
|
import type { WorkspaceIcon } from './types'
|
|
3
3
|
|
|
4
4
|
export function isWorkspaceIcon(value: unknown): value is WorkspaceIcon {
|
|
@@ -11,7 +11,7 @@ export function isWorkspaceIcon(value: unknown): value is WorkspaceIcon {
|
|
|
11
11
|
case 'emoji':
|
|
12
12
|
return icon.value.length > 0 && icon.value.length <= 64
|
|
13
13
|
case 'glyph':
|
|
14
|
-
return
|
|
14
|
+
return isIdentityIconId(icon.value)
|
|
15
15
|
case 'upload':
|
|
16
16
|
return icon.background === undefined
|
|
17
17
|
default:
|
package/lib/workspace-layout.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { WorkspaceLayout, WorkspaceTabsState } from './types'
|
|
|
3
3
|
import { isWorkspaceTabId } from './workspace-tabs'
|
|
4
4
|
|
|
5
5
|
export function createDefaultWorkspaceTabs(): WorkspaceTabsState {
|
|
6
|
-
return { open: ['overview'
|
|
6
|
+
return { open: ['overview'], active: 'overview' }
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function normalizeWorkspaceTabs(value: unknown): WorkspaceTabsState {
|
package/lib/workspace-name.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function validateWorkspaceFolderName(name: string): string | null {
|
|
5
|
-
if (!name) return 'Folder name is required'
|
|
6
|
-
if (name.length > 64) return 'Folder name is too long (max 64 characters)'
|
|
7
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9._ -]*$/.test(name)) {
|
|
8
|
-
return 'Use letters, numbers, dots, dashes, underscores and spaces, starting with a letter or number'
|
|
9
|
-
}
|
|
10
|
-
if (name.endsWith('.') || name.endsWith(' ')) {
|
|
11
|
-
return 'Folder name cannot end with a dot or space'
|
|
12
|
-
}
|
|
1
|
+
export function validateWorkspaceName(name: string): string | null {
|
|
2
|
+
if (!name.trim()) return 'Workspace name is required'
|
|
3
|
+
if (name.length > 100) return 'Workspace name is too long (max 100 characters)'
|
|
13
4
|
return null
|
|
14
5
|
}
|
|
6
|
+
|
|
7
|
+
export function workspaceIdFromName(name: string): string {
|
|
8
|
+
return (
|
|
9
|
+
name
|
|
10
|
+
.normalize('NFKD')
|
|
11
|
+
.replace(/\p{M}/gu, '')
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
14
|
+
.slice(0, 60)
|
|
15
|
+
.replace(/^-|-$/g, '') || 'workspace'
|
|
16
|
+
)
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moi-computer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"workspace",
|
|
22
22
|
"cli"
|
|
23
23
|
],
|
|
24
|
-
"packageManager": "bun@1.
|
|
24
|
+
"packageManager": "bun@1.4.4",
|
|
25
25
|
"engines": {
|
|
26
26
|
"bun": ">=1.3"
|
|
27
27
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"server",
|
|
34
34
|
"client",
|
|
35
35
|
"lib",
|
|
36
|
-
"
|
|
36
|
+
"skill",
|
|
37
37
|
"registry.json",
|
|
38
38
|
"ui-components",
|
|
39
39
|
"bunfig.toml",
|
|
@@ -41,10 +41,7 @@
|
|
|
41
41
|
"dist",
|
|
42
42
|
"!**/*.test.ts",
|
|
43
43
|
"!**/*.test.tsx",
|
|
44
|
-
"!server/test"
|
|
45
|
-
"!workspace/.env",
|
|
46
|
-
"!workspace/.claude/settings.local.json",
|
|
47
|
-
"!workspace/.moi"
|
|
44
|
+
"!server/test"
|
|
48
45
|
],
|
|
49
46
|
"scripts": {
|
|
50
47
|
"dev": "bun server/cli.ts start --dev --debug",
|
|
@@ -55,18 +52,20 @@
|
|
|
55
52
|
"lint:fix": "oxlint --fix",
|
|
56
53
|
"registry:validate": "shadcn registry validate",
|
|
57
54
|
"typecheck": "tsc -p tsconfig.json",
|
|
55
|
+
"test:visual": "bun tests/visual/run.ts",
|
|
58
56
|
"format": "oxfmt",
|
|
59
57
|
"format:check": "oxfmt --check",
|
|
60
58
|
"prepare": "git config core.hooksPath .githooks",
|
|
61
59
|
"check:repo": "bun scripts/check-repo.ts"
|
|
62
60
|
},
|
|
63
61
|
"dependencies": {
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
62
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.317",
|
|
65
63
|
"@anthropic-ai/sdk": "^0.109.1",
|
|
66
64
|
"@babel/parser": "^7.29.8",
|
|
67
65
|
"@base-ui/react": "^1.8.0",
|
|
68
66
|
"@blobatar/react": "^2.7.0",
|
|
69
67
|
"@dnd-kit/core": "^6.3.1",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
70
69
|
"@tabler/icons-react": "^3.46.0",
|
|
71
70
|
"@tailwindcss/typography": "^0.5.20",
|
|
72
71
|
"@tanstack/react-query": "^5.102.8",
|
|
@@ -74,6 +73,7 @@
|
|
|
74
73
|
"@tldraw/tlschema": "5.2.3",
|
|
75
74
|
"@tldraw/utils": "5.2.3",
|
|
76
75
|
"@types/bun": "1.3.10",
|
|
76
|
+
"async-mutex": "0.5.0",
|
|
77
77
|
"blobatar": "^2.7.0",
|
|
78
78
|
"bun-plugin-tailwind": "^0.1.2",
|
|
79
79
|
"citty": "^0.2.2",
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"tw-animate-css": "^1.4.0",
|
|
115
115
|
"typescript": "^5.9.3",
|
|
116
116
|
"wouter": "^3.11.0",
|
|
117
|
+
"zod": "^4.3.6",
|
|
117
118
|
"zustand": "^5.0.15"
|
|
118
119
|
},
|
|
119
120
|
"optionalDependencies": {
|
|
@@ -127,6 +128,8 @@
|
|
|
127
128
|
"@types/react-dom": "^19.2.7",
|
|
128
129
|
"@types/react-grid-layout": "^2.1.0",
|
|
129
130
|
"@types/react-resizable": "^3.0.8",
|
|
131
|
+
"@uiverify/bun": "1.0.0",
|
|
132
|
+
"bun": ">=1.4.4",
|
|
130
133
|
"date-fns": "^4.4.0",
|
|
131
134
|
"embla-carousel-react": "^8.6.0",
|
|
132
135
|
"linkedom": "0.18.12",
|
package/server/README.md
CHANGED
|
@@ -5,19 +5,21 @@ WebSocket handlers, and CLI commands call the same feature modules.
|
|
|
5
5
|
|
|
6
6
|
## Where code belongs
|
|
7
7
|
|
|
8
|
-
| Location
|
|
9
|
-
|
|
|
10
|
-
| `api/`
|
|
11
|
-
| `cli/commands/`
|
|
12
|
-
| `cli/`
|
|
13
|
-
| `workspaces/`
|
|
14
|
-
| `sessions/`
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
8
|
+
| Location | Owns |
|
|
9
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| `api/` | Hono HTTP routes, request validation, workspace lookup middleware, and API tests. `index.ts` assembles and defines the main routes; `harnesses.ts` defines login routes. |
|
|
11
|
+
| `cli/commands/` | One module per top-level CLI command, with its subcommands and private helpers. |
|
|
12
|
+
| `cli/` | Command registration, help, CLI access gates, terminal formatting, control requests, and server launching. |
|
|
13
|
+
| `workspaces/` | Workspace discovery and registration, creation/import, `.moi/` scaffolding, layout, tabs, theme, icons, file previews, and environment settings. |
|
|
14
|
+
| `sessions/` | Moi's session metadata, selection and pin state, archiving, ID renames, message attachments, and pending-view chat handoffs. Provider-owned history stays in the harnesses. |
|
|
15
|
+
| `workspace-state/` | Per-workspace `state.json` storage: one writer per workspace, transactions, atomic writes, lock timeout, a revision and a `state:changed` event per change, re-adoption of a removed workspace's id, and the one-time legacy migration. |
|
|
16
|
+
| `applets/` | View/widget manifests, source analysis, builds, CSS scoping, typechecking, bundle serving, server-function workers, thumbnails, UI component installation, and the error journal. |
|
|
17
|
+
| `scratchpad/` | Canvas documents, assets, headless drawing, and browser screenshot requests. |
|
|
18
|
+
| `skills/` | Bundled workspace skill installation, version checks, and updates. These modules manage the copies shipped under `workspace/`. |
|
|
19
|
+
| `harness/` | Provider adapters, transports, sessions, discovery, authentication, and readiness. See [the harness guide](harness/README.md). |
|
|
20
|
+
| `collab/` | Cloud collaboration workers, presence, proxy identity, and the optional collaboration skill. |
|
|
21
|
+
| `onboarding/` | Idea discovery, its prompt and output validation, and workspace creation jobs. HTTP handlers live in [api/onboarding.ts](api/onboarding.ts). |
|
|
22
|
+
| `test/` | Integration tests and existing tests that share fixtures. Other unit tests live beside their modules. |
|
|
21
23
|
|
|
22
24
|
Use direct module imports such as `workspaces/registry` or `sessions/store`.
|
|
23
25
|
Keep shared helpers in the feature that owns them. A folder does not imply a
|
|
@@ -54,18 +56,18 @@ corresponding directory above.
|
|
|
54
56
|
|
|
55
57
|
## Storage ownership
|
|
56
58
|
|
|
57
|
-
| State
|
|
58
|
-
|
|
|
59
|
-
| Workspace layout, theme, and tab configuration
|
|
60
|
-
| Applet source
|
|
61
|
-
| Generated bundles and thumbnails
|
|
62
|
-
| Scratchpad document and image bytes
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
| Workspace environment preferences and secrets
|
|
68
|
-
| Provider credentials and conversation history
|
|
59
|
+
| State | Location and owner |
|
|
60
|
+
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| Workspace layout, theme, and tab configuration | `.moi/.workspace.json`, read and written by `workspaces/layout.ts` |
|
|
62
|
+
| Applet source | `.moi/views/`, `.moi/widgets/`, and shared workspace source |
|
|
63
|
+
| Generated bundles and thumbnails | `.moi/.build/` and `.moi/.cache/`; re-creatable |
|
|
64
|
+
| Scratchpad document and image bytes | `.moi/.scratchpad.json` and `.moi/.scratchpad/`; preserve both |
|
|
65
|
+
| Installation-wide app settings, including `showOnboarding` | `DATA_DIR/settings.json`, owned by `app-settings.ts` |
|
|
66
|
+
| Onboarding discovery results and workspace creation operation records | `DATA_DIR/onboarding/`, owned by [onboarding/jobs.ts](onboarding/jobs.ts) |
|
|
67
|
+
| Registered workspaces | `DATA_DIR/workspaces.json`, owned by `workspaces/registry.ts` |
|
|
68
|
+
| Session attribution, settings, and fork metadata; selected and pinned sessions; pending view creation | `DATA_DIR/workspaces/<workspace id>/state.json`, stored by `workspace-state/`; meaning owned by `sessions/store.ts`, `sessions/selected.ts`, and `sessions/pending-views.ts` |
|
|
69
|
+
| Workspace environment preferences and secrets | `workspaces/env.ts`; metadata in `DATA_DIR`, secrets in the OS keychain or file fallback |
|
|
70
|
+
| Provider credentials and conversation history | Owned by each provider; see `harness/README.md` |
|
|
69
71
|
|
|
70
72
|
Client-local UI choices are documented in [the root instructions](../AGENTS.md)
|
|
71
73
|
and [view/chat behavior](../docs/view-chats.md). Changing a module's location
|
package/server/api/harnesses.ts
CHANGED
|
@@ -2,12 +2,30 @@ import { Hono } from 'hono'
|
|
|
2
2
|
|
|
3
3
|
import type { WorkspaceType } from '@/lib/types'
|
|
4
4
|
|
|
5
|
+
import { loginShellPath } from '../harness/shell-path'
|
|
6
|
+
import { installHarness } from '../harness/install'
|
|
5
7
|
import { harnessStore } from '../harness/auth'
|
|
6
|
-
import { harnessFor, isHarnessType } from '../harness/registry'
|
|
8
|
+
import { allHarnesses, harnessFor, isHarnessType } from '../harness/registry'
|
|
7
9
|
|
|
8
10
|
export const harnesses = new Hono<{ Variables: { harnessType: WorkspaceType } }>()
|
|
9
11
|
|
|
10
|
-
harnesses.
|
|
12
|
+
harnesses.get('/status', async c => {
|
|
13
|
+
c.header('Cache-Control', 'no-store')
|
|
14
|
+
const fresh = c.req.query('refresh') === 'true'
|
|
15
|
+
if (fresh) await loginShellPath({ refresh: true })
|
|
16
|
+
const statuses = await Promise.all(
|
|
17
|
+
allHarnesses().map(async ({ id }) => [
|
|
18
|
+
id,
|
|
19
|
+
{
|
|
20
|
+
availability: await harnessStore.getAvailability(id, fresh),
|
|
21
|
+
login: harnessStore.getLogin(id)
|
|
22
|
+
}
|
|
23
|
+
])
|
|
24
|
+
)
|
|
25
|
+
return c.json(Object.fromEntries(statuses))
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
harnesses.use('/:type/*', async (c, next) => {
|
|
11
29
|
const type = c.req.param('type')
|
|
12
30
|
if (!isHarnessType(type)) return c.text('Unknown agent', 404)
|
|
13
31
|
const harness = harnessFor(type)
|
|
@@ -19,12 +37,17 @@ harnesses.use('/:type/auth/*', async (c, next) => {
|
|
|
19
37
|
await next()
|
|
20
38
|
})
|
|
21
39
|
|
|
22
|
-
harnesses.
|
|
23
|
-
const
|
|
24
|
-
return c.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
harnesses.post('/:type/auth/install', async c => {
|
|
41
|
+
const origin = c.req.header('Origin')
|
|
42
|
+
if (origin && origin !== new URL(c.req.url).origin) return c.text('Invalid origin', 403)
|
|
43
|
+
try {
|
|
44
|
+
const type = c.get('harnessType')
|
|
45
|
+
await installHarness(type)
|
|
46
|
+
await harnessStore.refresh(type)
|
|
47
|
+
return c.json({ ok: true })
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return c.text(error instanceof Error ? error.message : 'Could not install agent', 400)
|
|
50
|
+
}
|
|
28
51
|
})
|
|
29
52
|
|
|
30
53
|
harnesses.post('/:type/auth/login', async c => {
|