moi-computer 0.12.1-next.2 → 0.12.1-next.4
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 +6 -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 +10 -0
- package/client/app/routes/workspace-route.tsx +21 -19
- package/client/app/shell/sidebar-layout.tsx +34 -53
- 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-menu.tsx +96 -0
- package/client/features/account/account-provider.tsx +142 -0
- package/client/features/account/account-test-utils.tsx +294 -0
- package/client/features/account/api.ts +142 -0
- package/client/features/account/identity.ts +23 -0
- package/client/features/app-settings/api.ts +33 -0
- package/client/features/app-settings/general-settings.tsx +39 -0
- package/client/features/app-settings/profile-settings.tsx +95 -0
- package/client/features/app-settings/settings-page.tsx +48 -0
- package/client/features/app-settings/settings-section.tsx +26 -0
- package/client/features/app-settings/users-settings.tsx +195 -0
- 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/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/applet-api.ts +15 -14
- package/client/features/collab/components/cursors.tsx +61 -24
- package/client/features/collab/components/presence-avatars.tsx +25 -12
- package/client/features/collab/components/presence-frame.tsx +20 -24
- package/client/features/collab/components/presence-group.tsx +15 -7
- package/client/features/collab/components/user-avatar-group.tsx +21 -8
- package/client/features/collab/components/user-avatar.tsx +38 -7
- package/client/features/collab/components/user.tsx +31 -12
- package/client/features/collab/users.ts +0 -5
- package/client/features/collab/workspace-users-menu.tsx +4 -4
- package/client/features/demo/demo-dialog.tsx +11 -3
- package/client/features/dev/collab/collab-playground.tsx +7 -7
- package/client/features/dev/collab/local-user-settings.tsx +7 -53
- 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/update/update-control.tsx +1 -1
- 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 +11 -7
- 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 +88 -0
- package/client/features/{settings → workspace/settings}/api.ts +1 -34
- package/client/features/{settings → workspace/settings}/connectors-settings.tsx +3 -3
- package/client/features/{settings → workspace/settings}/environment-settings.tsx +3 -3
- package/client/features/{settings → workspace/settings}/general-settings.tsx +77 -3
- 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/lib/user-display-name.ts +6 -0
- package/client/main.tsx +4 -1
- 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-0mjzg20x.js +2 -0
- package/dist/chunk-2y59vrxg.js +5 -0
- package/dist/chunk-58dyt9bk.js +2 -0
- package/dist/chunk-5aj040e5.css +1 -0
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-71fn6rmj.js +546 -0
- package/dist/chunk-7yg1m8hx.js +2 -0
- package/dist/chunk-825hys3h.js +1 -0
- package/dist/chunk-9bb8m9rx.js +2 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-g0tcwqxc.js +1 -0
- package/dist/chunk-n0nab26d.js +1 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-v88n1bay.js +74 -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 +72 -63
- 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 +9 -8
- package/server/README.md +27 -25
- package/server/api/harnesses.ts +31 -8
- package/server/api/index.ts +164 -131
- package/server/api/onboarding.ts +46 -0
- package/server/app-config.ts +23 -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 +2 -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 +14 -9
- package/server/harness/codex/adapter.ts +14 -17
- package/server/harness/codex/index.ts +2 -0
- 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/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 +26 -2
- 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 +23 -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 -16
- package/server/workspaces/layout.ts +3 -0
- package/server/workspaces/registry.ts +58 -10
- 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 +148 -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/workspace/setup/workspace-setup-panel.tsx +0 -18
- package/dist/chunk-00rh9df4.js +0 -2
- package/dist/chunk-4nh7y1hq.css +0 -1
- package/dist/chunk-am4agx6v.js +0 -2
- package/dist/chunk-d7cbm65e.js +0 -2
- package/dist/chunk-hbpdv7vd.js +0 -1
- package/dist/chunk-hmka9rt5.js +0 -2
- package/dist/chunk-hvh9f5h0.js +0 -14
- package/dist/chunk-mjjregkn.js +0 -10
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-rt30jbcm.js +0 -1
- package/dist/chunk-vt6zybej.js +0 -2
- package/dist/chunk-wbkwf6cc.js +0 -68
- package/dist/chunk-xjyfyz64.js +0 -1
- package/dist/chunk-y8nbwp21.js +0 -546
- package/dist/chunk-ysfdcew7.js +0 -1
- package/lib/experimental.ts +0 -14
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +0 -157
- /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
package/server/app-settings.ts
CHANGED
|
@@ -16,7 +16,10 @@ export type AppSettingsPatch = Partial<AppSettings>
|
|
|
16
16
|
// Whitelist of fields the API may update. Type validation is NOT duplicated
|
|
17
17
|
// here — `saveAppSettings` validates the merged store against the conf schema
|
|
18
18
|
// before anything is written, so a bad value throws with nothing persisted.
|
|
19
|
-
const API_UPDATABLE = [
|
|
19
|
+
const API_UPDATABLE = [
|
|
20
|
+
'autoUpdateSkills',
|
|
21
|
+
'showOnboarding'
|
|
22
|
+
] as const satisfies readonly (keyof AppSettings)[]
|
|
20
23
|
|
|
21
24
|
// Pick the API-updatable fields out of an untrusted body; unknown keys are
|
|
22
25
|
// dropped. Values are intentionally unchecked — the conf schema rejects wrong
|
|
@@ -44,7 +47,8 @@ function store(): Conf<AppSettings> {
|
|
|
44
47
|
cwd: _dir,
|
|
45
48
|
configName: 'settings',
|
|
46
49
|
schema: {
|
|
47
|
-
autoUpdateSkills: { type: 'boolean', default: false }
|
|
50
|
+
autoUpdateSkills: { type: 'boolean', default: false },
|
|
51
|
+
showOnboarding: { type: 'boolean', default: true }
|
|
48
52
|
}
|
|
49
53
|
})
|
|
50
54
|
return _store
|
package/server/applets/config.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { parse } from '@babel/parser'
|
|
|
2
2
|
import type { ObjectExpression, ObjectProperty, StringLiteral } from '@babel/types'
|
|
3
3
|
import { basename } from 'node:path'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { IDENTITY_ICON_IDS, isIdentityIconId } from '@/lib/identity-icons'
|
|
6
6
|
import type { ViewConfig, WidgetConfig } from '@/lib/types'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const IDENTITY_ICON_NAMES: readonly string[] = IDENTITY_ICON_IDS
|
|
9
9
|
|
|
10
10
|
const DEFAULT_CONFIG: WidgetConfig = { rowSpan: 1, colSpan: 2 }
|
|
11
11
|
const VALID_SPANS = [1, 2, 3, 4] as const
|
|
@@ -108,7 +108,7 @@ export async function extractWidgetConfig(srcPath: string): Promise<WidgetConfig
|
|
|
108
108
|
return { ...DEFAULT_CONFIG, ...result }
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
// A view's config: `title` +
|
|
111
|
+
// A view's config: `title` + identity icon registry id + advisory `requiredEnv`.
|
|
112
112
|
// No sizing — views are full-screen. Returns null when no `config` export is present.
|
|
113
113
|
export async function extractViewConfig(srcPath: string): Promise<ViewConfig | null> {
|
|
114
114
|
const source = await Bun.file(srcPath).text()
|
|
@@ -131,9 +131,9 @@ export async function extractViewConfig(srcPath: string): Promise<ViewConfig | n
|
|
|
131
131
|
if (key === 'icon') {
|
|
132
132
|
if (prop.value.type === 'StringLiteral') {
|
|
133
133
|
const icon = prop.value.value
|
|
134
|
-
if (!
|
|
134
|
+
if (!isIdentityIconId(icon)) {
|
|
135
135
|
throw new Error(
|
|
136
|
-
`Unknown view icon id "${icon}". Use one of: ${
|
|
136
|
+
`Unknown view icon id "${icon}". Use one of: ${IDENTITY_ICON_NAMES.join(', ')}`
|
|
137
137
|
)
|
|
138
138
|
}
|
|
139
139
|
result.icon = icon
|
package/server/applets/views.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { reloadModules } from './functions'
|
|
|
17
17
|
import { loadLayout, saveLayout } from '../workspaces/layout'
|
|
18
18
|
import { completeViewBuild, listPendingViews } from '../sessions/pending-views'
|
|
19
19
|
import { archiveViewSessions } from '../sessions/archive'
|
|
20
|
+
import type { WorkspaceRef } from '../workspace-state'
|
|
20
21
|
import { setViewSourceTitle } from './config'
|
|
21
22
|
import { deleteViewSourceFiles, readViewSource, ViewSourceInUseError } from './view-source'
|
|
22
23
|
|
|
@@ -172,15 +173,17 @@ export async function collectViewRequiredEnv(
|
|
|
172
173
|
return out
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
export async function getWorkspaceViews(
|
|
176
|
-
const compiled = await listCompiledViews(
|
|
176
|
+
export async function getWorkspaceViews(ws: WorkspaceRef): Promise<ViewInfo[]> {
|
|
177
|
+
const compiled = await listCompiledViews(ws.path)
|
|
177
178
|
const ids = new Set(compiled.map(view => view.id))
|
|
178
|
-
const pending = (await listPendingViews(
|
|
179
|
+
const pending = (await listPendingViews(ws)).filter(view => !ids.has(view.id))
|
|
179
180
|
return [...compiled, ...pending]
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
// The API lists compiled views only; clients read pending views from the
|
|
184
|
+
// workspace state, which `state:changed` keeps current.
|
|
182
185
|
export async function listViews(workspacePath: string): Promise<Response> {
|
|
183
|
-
return Response.json({ views: await
|
|
186
|
+
return Response.json({ views: await listCompiledViews(workspacePath) })
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
export async function handleBundleViews(
|
|
@@ -200,23 +203,27 @@ export async function handleBundleViews(
|
|
|
200
203
|
// superseded by a successful rebuild (see docs/self-correction.md).
|
|
201
204
|
syncAppletLogAfterBuild(workspacePath, 'view', results)
|
|
202
205
|
|
|
203
|
-
const identityChanged = results.some(
|
|
204
|
-
r =>
|
|
205
|
-
r.status === 'built' &&
|
|
206
|
-
((before.config[r.name]?.title ?? '') !== (r.config?.title ?? '') ||
|
|
207
|
-
(before.config[r.name]?.icon ?? '') !== (r.config?.icon ?? ''))
|
|
208
|
-
)
|
|
209
206
|
const orderChanged = before.order.join('\0') !== after.order.join('\0')
|
|
210
207
|
const membershipChanged =
|
|
211
208
|
beforeBuilt.size !== afterBuilt.size ||
|
|
212
209
|
[...beforeBuilt].some(n => !afterBuilt.has(n)) ||
|
|
213
210
|
[...afterBuilt].some(n => !beforeBuilt.has(n))
|
|
214
211
|
|
|
212
|
+
// Install compiled views in the browser before removing their pending entries.
|
|
213
|
+
// Otherwise tab cleanup can mistake the handoff for a deleted view.
|
|
214
|
+
if (results.some(r => r.status === 'built') || orderChanged || membershipChanged) {
|
|
215
|
+
publish({
|
|
216
|
+
type: 'view-layout:updated',
|
|
217
|
+
workspaceId,
|
|
218
|
+
views: await listCompiledViews(workspacePath)
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
|
|
215
222
|
const changedServerModules = new Set<string>()
|
|
216
223
|
for (const r of results) {
|
|
217
224
|
if (r.status === 'built') {
|
|
218
225
|
publish({ type: 'view:updated', name: r.name, config: r.config ?? null })
|
|
219
|
-
await completeViewBuild(workspaceId, workspacePath, r.name)
|
|
226
|
+
await completeViewBuild({ id: workspaceId, path: workspacePath }, r.name)
|
|
220
227
|
for (const m of r.serverModules ?? []) changedServerModules.add(m)
|
|
221
228
|
}
|
|
222
229
|
}
|
|
@@ -225,11 +232,6 @@ export async function handleBundleViews(
|
|
|
225
232
|
reloadModules([...changedServerModules], workspacePath)
|
|
226
233
|
}
|
|
227
234
|
|
|
228
|
-
const views = await listCompiledViews(workspacePath)
|
|
229
|
-
if (identityChanged || orderChanged || membershipChanged) {
|
|
230
|
-
publish({ type: 'view-layout:updated', views })
|
|
231
|
-
}
|
|
232
|
-
|
|
233
235
|
return results
|
|
234
236
|
}
|
|
235
237
|
|
|
@@ -304,7 +306,7 @@ export async function deleteView(
|
|
|
304
306
|
throw error
|
|
305
307
|
}
|
|
306
308
|
reloadModules([`views/${viewId}`], workspacePath)
|
|
307
|
-
await completeViewBuild(
|
|
309
|
+
await completeViewBuild(ws, viewId)
|
|
308
310
|
const layout = await loadLayout(workspacePath)
|
|
309
311
|
const tab = viewTabId(viewId)
|
|
310
312
|
await saveLayout(
|
|
@@ -137,7 +137,7 @@ export const init = defineCommand({
|
|
|
137
137
|
default: false,
|
|
138
138
|
description: 'Start the web server if not already running'
|
|
139
139
|
},
|
|
140
|
-
|
|
140
|
+
collab: {
|
|
141
141
|
type: 'boolean',
|
|
142
142
|
default: false,
|
|
143
143
|
description: 'Include the optional collaboration guide and applet types'
|
|
@@ -204,10 +204,10 @@ export const init = defineCommand({
|
|
|
204
204
|
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
205
205
|
console.log()
|
|
206
206
|
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
|
|
207
|
-
if (args['
|
|
207
|
+
if (args['collab']) {
|
|
208
208
|
const { referencePath } = await installCollabSkill(target, type)
|
|
209
209
|
console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
|
|
210
|
-
console.log(pc.dim(' Live presence
|
|
210
|
+
console.log(pc.dim(' Live presence is available in the cloud environment'))
|
|
211
211
|
}
|
|
212
212
|
if (scaffold !== 'exists') {
|
|
213
213
|
if (scaffold === 'installing') {
|
|
@@ -2,6 +2,8 @@ import type { WorkspaceSkillStatus } from '@/lib/types'
|
|
|
2
2
|
import { defineCommand } from 'citty'
|
|
3
3
|
import { resolve } from 'path'
|
|
4
4
|
import { updateWorkspaceSkills } from '../../skills/update'
|
|
5
|
+
import type { WorkspaceSkillUpdateResult } from '../../skills/update'
|
|
6
|
+
import { displaySkillPath } from '../../skills/locations'
|
|
5
7
|
import { isBehind, isMinorBehind, resolveWorkspace, skillStatuses } from '../../skills/version'
|
|
6
8
|
import { dirArg } from '../args'
|
|
7
9
|
import pc from '../pc'
|
|
@@ -11,38 +13,34 @@ import { columns } from '../ui'
|
|
|
11
13
|
// filesystem op — no running server needed. Resolves the workspace root the
|
|
12
14
|
// same way `moi bundle` does, so it works from `.moi/` or any subdirectory.
|
|
13
15
|
async function runSkillUpdate(cwd: string): Promise<void> {
|
|
14
|
-
//
|
|
15
|
-
// update must target the same dir the agent actually loads from.
|
|
16
|
+
// Include the primary harness destination and existing copies for other agents.
|
|
16
17
|
const { root, type } = await resolveWorkspace(cwd)
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
type ?? 'claude-code'
|
|
20
|
-
)
|
|
21
|
-
const after = status.skills
|
|
18
|
+
const result = await updateWorkspaceSkills(root, type)
|
|
19
|
+
const { changedSkills, updatedAppletTypes } = result
|
|
22
20
|
const heading = changedSkills.length > 0 ? 'Skills updated in ' : 'Skills unchanged in '
|
|
23
21
|
|
|
24
22
|
console.log('\n' + pc.green('✓') + ' ' + heading + pc.bold(root) + '\n')
|
|
25
|
-
printSkillUpdateTable(
|
|
23
|
+
printSkillUpdateTable(root, result)
|
|
26
24
|
for (const file of updatedAppletTypes) {
|
|
27
25
|
console.log(pc.dim(' Applet types regenerated: ') + pc.bold(`.moi/${file}\n`))
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
function printSkillUpdateTable(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
changedSkills: string[]
|
|
30
|
+
root: string,
|
|
31
|
+
{ before, status, changedSkills, changedSkillPaths }: WorkspaceSkillUpdateResult
|
|
35
32
|
): void {
|
|
36
|
-
const
|
|
33
|
+
const changedPaths = new Set(changedSkillPaths)
|
|
37
34
|
console.log(
|
|
38
35
|
columns(
|
|
39
|
-
['skill', 'from', 'to'].map(h => pc.dim(h)),
|
|
40
|
-
|
|
41
|
-
const prev = before.find(b => b.name === s.name)?.installed ?? null
|
|
36
|
+
['skill', 'path', 'from', 'to'].map(h => pc.dim(h)),
|
|
37
|
+
status.skills.map(s => {
|
|
38
|
+
const prev = before.find(b => b.name === s.name && b.path === s.path)?.installed ?? null
|
|
42
39
|
const versionChanged = prev !== s.installed
|
|
43
|
-
const filesChanged =
|
|
40
|
+
const filesChanged = changedPaths.has(s.path)
|
|
44
41
|
return [
|
|
45
42
|
s.name,
|
|
43
|
+
displaySkillPath(root, s.path),
|
|
46
44
|
prev ?? pc.dim('none'),
|
|
47
45
|
versionChanged
|
|
48
46
|
? pc.green(s.installed ?? '?')
|
|
@@ -105,9 +103,10 @@ export const skill = defineCommand({
|
|
|
105
103
|
console.log('\n' + pc.bold('moi skill') + pc.dim(' — workspace skills') + '\n')
|
|
106
104
|
console.log(
|
|
107
105
|
columns(
|
|
108
|
-
['skill', 'installed', 'bundled', 'status'].map(h => pc.dim(h)),
|
|
106
|
+
['skill', 'path', 'installed', 'bundled', 'status'].map(h => pc.dim(h)),
|
|
109
107
|
statuses.map(s => [
|
|
110
108
|
s.name,
|
|
109
|
+
displaySkillPath(root, s.path),
|
|
111
110
|
s.installed ?? pc.dim('—'),
|
|
112
111
|
s.bundled ?? pc.dim('—'),
|
|
113
112
|
skillState(s)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ExperimentalFeatures } from '@/lib/experimental'
|
|
2
|
-
import { EXPERIMENTAL_FEATURES, experimentalFlagName } from '@/lib/experimental'
|
|
3
1
|
import { defineCommand } from 'citty'
|
|
4
2
|
import { getAppConfig, initializeAppConfig } from '../../app-config'
|
|
5
3
|
import { CONTROL_PORT, PORT } from '../../constants'
|
|
@@ -9,15 +7,7 @@ import { superviseServerUpdates } from '../../update'
|
|
|
9
7
|
import { PACKAGE_ROOT } from '../../version'
|
|
10
8
|
import { isServerRunning } from '../control'
|
|
11
9
|
import pc from '../pc'
|
|
12
|
-
import { runDevSupervisor, spawnServer } from '../server'
|
|
13
|
-
|
|
14
|
-
const experimentalArgs = Object.fromEntries(
|
|
15
|
-
EXPERIMENTAL_FEATURES.map(feature => {
|
|
16
|
-
const name = experimentalFlagName(feature)
|
|
17
|
-
const label = name.slice('experimental-'.length).replaceAll('-', ' ')
|
|
18
|
-
return [name, { type: 'boolean' as const, description: `Enable experimental ${label}` }]
|
|
19
|
-
})
|
|
20
|
-
)
|
|
10
|
+
import { assertDevRuntime, runDevSupervisor, spawnServer } from '../server'
|
|
21
11
|
|
|
22
12
|
export const start = defineCommand({
|
|
23
13
|
meta: { name: 'start', description: 'Start the Moi web server' },
|
|
@@ -25,27 +15,13 @@ export const start = defineCommand({
|
|
|
25
15
|
port: {
|
|
26
16
|
type: 'string',
|
|
27
17
|
description: 'HTTP port to listen on (default: 13337)'
|
|
28
|
-
},
|
|
29
|
-
...experimentalArgs
|
|
30
|
-
},
|
|
31
|
-
async run({ args, rawArgs }) {
|
|
32
|
-
const knownFlags = new Set(EXPERIMENTAL_FEATURES.map(experimentalFlagName))
|
|
33
|
-
for (const arg of rawArgs) {
|
|
34
|
-
if (arg.startsWith('--experimental-') && !knownFlags.has(arg.slice(2))) {
|
|
35
|
-
throw new Error(`Unknown experimental feature: ${arg.slice('--experimental-'.length)}`)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const experimental: Partial<ExperimentalFeatures> = {}
|
|
39
|
-
const experimentalFlags: string[] = []
|
|
40
|
-
for (const feature of EXPERIMENTAL_FEATURES) {
|
|
41
|
-
const flag = experimentalFlagName(feature)
|
|
42
|
-
if (args[flag] !== true) continue
|
|
43
|
-
experimental[feature] = true
|
|
44
|
-
experimentalFlags.push(`--${flag}`)
|
|
45
18
|
}
|
|
19
|
+
},
|
|
20
|
+
async run({ args }) {
|
|
46
21
|
const projectRoot = PACKAGE_ROOT
|
|
47
22
|
// Undocumented: --dev runs the watch-and-full-restart dev supervisor.
|
|
48
23
|
const dev = process.argv.includes('--dev')
|
|
24
|
+
if (dev) assertDevRuntime()
|
|
49
25
|
// Undocumented: --debug turns on the messaging trace (MOI_DEBUG) in the
|
|
50
26
|
// server — console lines for each message/session/turn in the chat pipeline.
|
|
51
27
|
const debug = process.argv.includes('--debug')
|
|
@@ -94,20 +70,18 @@ export const start = defineCommand({
|
|
|
94
70
|
...(debug ? { MOI_DEBUG: '1' } : {})
|
|
95
71
|
}
|
|
96
72
|
if (dev) {
|
|
97
|
-
await runDevSupervisor(projectRoot, env
|
|
73
|
+
await runDevSupervisor(projectRoot, env)
|
|
98
74
|
return
|
|
99
75
|
}
|
|
100
76
|
const cwd = serverCwd(projectRoot, dev)
|
|
101
|
-
const proc = spawnServer(cwd, env
|
|
102
|
-
process.exit(
|
|
103
|
-
await superviseServerUpdates(proc, () => spawnServer(cwd, env, experimentalFlags))
|
|
104
|
-
)
|
|
77
|
+
const proc = spawnServer(cwd, env)
|
|
78
|
+
process.exit(await superviseServerUpdates(proc, () => spawnServer(cwd, env)))
|
|
105
79
|
}
|
|
106
80
|
|
|
107
81
|
// This IS the server process (MOI_SERVER=1). cwd is the package root when the
|
|
108
82
|
// dev bundler runs (bunfig loaded at Bun startup) or a neutral dir for a
|
|
109
83
|
// prebuilt install — see serverCwd().
|
|
110
|
-
initializeAppConfig(
|
|
84
|
+
initializeAppConfig()
|
|
111
85
|
try {
|
|
112
86
|
await import('../../web')
|
|
113
87
|
} catch (err) {
|
package/server/cli/server.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { join } from 'path'
|
|
2
|
+
import { packageManager } from '../../package.json'
|
|
2
3
|
import { PACKAGE_ROOT } from '../version'
|
|
3
4
|
import pc from './pc'
|
|
4
5
|
|
|
6
|
+
export function assertDevRuntime(version = Bun.version): void {
|
|
7
|
+
// Reuse CI's baseline; packageManager does not select the local executable.
|
|
8
|
+
const requiredVersion = packageManager.slice('bun@'.length)
|
|
9
|
+
if (!Bun.semver.satisfies(version, `>=${requiredVersion}`)) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Moi development requires Bun ${requiredVersion} or newer (running ${version}). ` +
|
|
12
|
+
`Run \`bun upgrade --version ${requiredVersion}\`, then restart \`bun run dev\`.`
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
// Spawn the server as a child. MOI_SERVER=1 tells the child it is the actual
|
|
6
18
|
// server process. No `--hot`: frontend HMR comes from Bun.serve's dev bundler,
|
|
7
19
|
// and server reloads are a full process restart driven by the dev supervisor
|
|
@@ -9,9 +21,10 @@ import pc from './pc'
|
|
|
9
21
|
export function spawnServer(
|
|
10
22
|
cwd: string,
|
|
11
23
|
env: Record<string, string | undefined> = process.env,
|
|
12
|
-
|
|
24
|
+
args: string[] = []
|
|
13
25
|
): ReturnType<typeof Bun.spawn> {
|
|
14
|
-
|
|
26
|
+
// Keep the checked runtime instead of resolving a different Bun on PATH.
|
|
27
|
+
const argv = [process.execPath, join(PACKAGE_ROOT, 'server', 'cli.ts'), 'start', ...args]
|
|
15
28
|
return Bun.spawn(argv, {
|
|
16
29
|
stdin: 'inherit',
|
|
17
30
|
stdout: 'inherit',
|
|
@@ -31,12 +44,11 @@ export function spawnServer(
|
|
|
31
44
|
// (closing servers + killing function workers), so restarts leak nothing.
|
|
32
45
|
export async function runDevSupervisor(
|
|
33
46
|
projectRoot: string,
|
|
34
|
-
env: Record<string, string | undefined
|
|
35
|
-
experimentalFlags: string[]
|
|
47
|
+
env: Record<string, string | undefined>
|
|
36
48
|
): Promise<void> {
|
|
37
49
|
const { watch } = await import('node:fs')
|
|
38
50
|
|
|
39
|
-
let child = spawnServer(projectRoot, env
|
|
51
|
+
let child = spawnServer(projectRoot, env)
|
|
40
52
|
let restarting = false
|
|
41
53
|
let debounce: ReturnType<typeof setTimeout> | undefined
|
|
42
54
|
|
|
@@ -55,7 +67,7 @@ export async function runDevSupervisor(
|
|
|
55
67
|
await child.exited
|
|
56
68
|
clearTimeout(sigkill)
|
|
57
69
|
restarting = false
|
|
58
|
-
child = spawnServer(projectRoot, env
|
|
70
|
+
child = spawnServer(projectRoot, env)
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
for (const dir of ['server', 'lib']) {
|
package/server/collab/config.ts
CHANGED
|
@@ -3,9 +3,8 @@ import type { WorkspaceType } from '@/lib/types'
|
|
|
3
3
|
import { getAppConfig } from '../app-config'
|
|
4
4
|
import { collabSkillReferencePath } from './skill'
|
|
5
5
|
|
|
6
|
-
// Only an explicit startup CLI flag enables this process setting.
|
|
7
6
|
export function isCollabEnabled(): boolean {
|
|
8
|
-
return getAppConfig().
|
|
7
|
+
return getAppConfig().collab
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export async function getCollabReferencePath(
|
package/server/collab/manager.ts
CHANGED
|
@@ -108,7 +108,10 @@ export class CollabManager {
|
|
|
108
108
|
binding.workspacePaths.add(canonicalPath)
|
|
109
109
|
if (binding.closed) throw new CollabRuntimeError('unavailable', 'Collab connection closed')
|
|
110
110
|
if (!(await (this.options.enabled ?? isCollabEnabled)(canonicalPath))) {
|
|
111
|
-
throw new CollabRuntimeError(
|
|
111
|
+
throw new CollabRuntimeError(
|
|
112
|
+
'unavailable',
|
|
113
|
+
'Collaboration is only available in the cloud environment'
|
|
114
|
+
)
|
|
112
115
|
}
|
|
113
116
|
if (this.closed || binding.closed)
|
|
114
117
|
throw new CollabRuntimeError('unavailable', 'Collab connection closed')
|
|
@@ -27,7 +27,7 @@ async function writeChanged(path: string, contents: string): Promise<void> {
|
|
|
27
27
|
await Bun.write(path, contents)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
// Only an explicit `moi init --
|
|
30
|
+
// Only an explicit `moi init --collab` installs the guide and types.
|
|
31
31
|
export async function installCollabSkill(
|
|
32
32
|
workspacePath: string,
|
|
33
33
|
type?: WorkspaceType
|
package/server/control.ts
CHANGED
|
@@ -300,7 +300,7 @@ export const control = Bun.serve({
|
|
|
300
300
|
return
|
|
301
301
|
}
|
|
302
302
|
try {
|
|
303
|
-
const view = await updatePendingView(match
|
|
303
|
+
const view = await updatePendingView(match, appletId, {
|
|
304
304
|
title,
|
|
305
305
|
icon
|
|
306
306
|
})
|
|
@@ -321,7 +321,7 @@ export const control = Bun.serve({
|
|
|
321
321
|
if (!match) return
|
|
322
322
|
const [layout, views] = await Promise.all([
|
|
323
323
|
loadLayout(match.path),
|
|
324
|
-
getWorkspaceViews(match
|
|
324
|
+
getWorkspaceViews(match)
|
|
325
325
|
])
|
|
326
326
|
ws.send(JSON.stringify({ ok: true, tabs: assembleTabRows(views, layout.tabs.active) }))
|
|
327
327
|
return
|
|
@@ -336,7 +336,7 @@ export const control = Bun.serve({
|
|
|
336
336
|
if (!href.startsWith('moi:/') || href.startsWith('moi:/files/'))
|
|
337
337
|
throw new Error('Navigation needs a workspace page address')
|
|
338
338
|
const tab = href.slice(5).split('?', 1)[0]
|
|
339
|
-
if (isWorkspaceTabId(tab)) assertNavigableTab(tab, await getWorkspaceViews(match
|
|
339
|
+
if (isWorkspaceTabId(tab)) assertNavigableTab(tab, await getWorkspaceViews(match))
|
|
340
340
|
await navigationRelay.navigate(match.id, href)
|
|
341
341
|
ws.send(JSON.stringify({ ok: true, href }))
|
|
342
342
|
} catch (error) {
|
package/server/data-dir.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Single source of truth for the OS data dir holding moi's global state
|
|
2
|
-
// (workspaces.json, settings.json,
|
|
2
|
+
// (workspaces.json, settings.json, workspaces/<id>/state.json, …).
|
|
3
3
|
//
|
|
4
4
|
// MOI_DATA_DIR overrides it wholesale. This is the isolation seam for CLI
|
|
5
5
|
// e2e tests: env-paths only honors XDG_DATA_HOME on Linux, so on macOS a
|
package/server/harness/README.md
CHANGED
|
@@ -224,7 +224,10 @@ workspace's environment. Login credentials remain owned by the provider CLI.
|
|
|
224
224
|
`account/login/start` uses browser OAuth locally and `chatgptDeviceCode` in
|
|
225
225
|
cloud. Local login opens the browser; cloud returns a URL and device code.
|
|
226
226
|
|
|
227
|
-
`GET /api/harnesses
|
|
227
|
+
`GET /api/harnesses/status` returns one status map for all harnesses, including
|
|
228
|
+
installation availability and login state. Checks run concurrently.
|
|
229
|
+
Normal reads reuse the server’s 30-second availability cache. Explicit retries use
|
|
230
|
+
`?refresh=true` to recheck external sign-in/sign-out and installation changes.
|
|
228
231
|
`POST /api/harnesses/:type/auth/login` starts or reuses an attempt;
|
|
229
232
|
`POST /api/harnesses/:type/auth/login/:id/code` submits a manual authorization
|
|
230
233
|
code. The attempt ID rejects submissions from an older login. Startup reports
|
|
@@ -232,12 +235,15 @@ code. The attempt ID rejects submissions from an older login. Startup reports
|
|
|
232
235
|
|
|
233
236
|
During login, the server rechecks readiness until the provider confirms
|
|
234
237
|
completion and readiness succeeds, or the attempt fails or reaches its
|
|
235
|
-
ten-minute deadline. Shutdown cancels active attempts. Auth changes
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
ten-minute deadline. Shutdown cancels active attempts. Auth changes publish `harness-status:changed` once for all consumers. The client
|
|
239
|
+
shares one status query across onboarding and workspace navigation. It
|
|
240
|
+
reads cached status on focus, reconnect, and authentication changes, and polls only during
|
|
241
|
+
an active login.
|
|
242
|
+
|
|
243
|
+
`GET /api/workspaces/:id/harness` returns the workspace model catalog, capabilities,
|
|
244
|
+
and folder checks. Only workspaces with credential environment overrides or gateway-backed
|
|
245
|
+
harnesses probe workspace readiness; ordinary Claude and Codex workspaces use
|
|
246
|
+
the shared account status. Adding `?refresh=true` refreshes the shell PATH and bypasses the
|
|
241
247
|
readiness cache.
|
|
242
248
|
|
|
243
249
|
## What a harness adapter must support
|
|
@@ -348,7 +354,17 @@ describes what Moi exposes, not every RPC available in the upstream protocol.
|
|
|
348
354
|
| Home card preview | ✅ session file scan | ✅ cached first message | ⚠️ live app-server only | ⚠️ live process only |
|
|
349
355
|
| MCP status | ✅ `mcpServerStatus()` | n/a | ✅ `mcpServerStatus/list` | ⚠️ per-session config, no status RPC |
|
|
350
356
|
| Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ per-turn tokens and duration | ✅ tokens per turn |
|
|
351
|
-
| Structured output |
|
|
357
|
+
| Structured output | ✅ ephemeral actions | ❌ | ✅ ephemeral actions via Codex exec | ❌ |
|
|
358
|
+
|
|
359
|
+
## Ephemeral actions
|
|
360
|
+
|
|
361
|
+
Claude and Codex support `Harness.runAction` for read/search tasks without a workspace
|
|
362
|
+
or visible chat. Pass a prompt, Zod `resultSchema`, and cancellation signal to get a
|
|
363
|
+
validated, typed result. For progress updates, supply `progressSchema` and `onProgress`
|
|
364
|
+
together. See [the action runner](run-action.ts) for implementation details.
|
|
365
|
+
|
|
366
|
+
Optional `model: 'fast' | 'normal' | 'smart'` selects a harness-owned model and
|
|
367
|
+
reasoning effort. Omission uses `normal`.
|
|
352
368
|
|
|
353
369
|
## Design lessons so far
|
|
354
370
|
|
|
@@ -609,8 +609,7 @@ export async function sendAcpMessage(
|
|
|
609
609
|
if (realId !== input.sessionId) {
|
|
610
610
|
aliases.set(recKey(input.workspaceId, input.sessionId), realId)
|
|
611
611
|
await renameSessionReferences(
|
|
612
|
-
input.workspaceId,
|
|
613
|
-
input.workspacePath,
|
|
612
|
+
{ id: input.workspaceId, path: input.workspacePath },
|
|
614
613
|
input.sessionId,
|
|
615
614
|
realId
|
|
616
615
|
)
|
|
@@ -626,8 +625,13 @@ export async function sendAcpMessage(
|
|
|
626
625
|
})
|
|
627
626
|
await applyNoPromptMode(client, config, realId)
|
|
628
627
|
if (input.model) await setSessionModel(config, rec, client, input.model)
|
|
629
|
-
if (
|
|
630
|
-
|
|
628
|
+
if (
|
|
629
|
+
input.model &&
|
|
630
|
+
!(await hasSessionConfig({ id: input.workspaceId, path: input.workspacePath }, realId))
|
|
631
|
+
) {
|
|
632
|
+
await saveSessionConfig({ id: input.workspaceId, path: input.workspacePath }, realId, {
|
|
633
|
+
model: input.model
|
|
634
|
+
})
|
|
631
635
|
}
|
|
632
636
|
} else {
|
|
633
637
|
rec = await resumeSession(config, input)
|
package/server/harness/auth.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathHarnessAvailability } from './executable'
|
|
1
2
|
// Login is global per harness. Workspace readiness is checked independently
|
|
2
3
|
// using each workspace’s environment.
|
|
3
4
|
import type {
|
|
@@ -7,7 +8,6 @@ import type {
|
|
|
7
8
|
WorkspaceType
|
|
8
9
|
} from '@/lib/types'
|
|
9
10
|
|
|
10
|
-
import { listWorkspaces } from '../workspaces/registry'
|
|
11
11
|
import { publishEvent } from '../events'
|
|
12
12
|
import { harnessFor } from './registry'
|
|
13
13
|
import type { HarnessWorkspace, HarnessLoginAttempt } from './types'
|
|
@@ -29,7 +29,7 @@ export type HarnessStoreOptions = {
|
|
|
29
29
|
probe: (ws: HarnessTarget) => Promise<HarnessAvailability>
|
|
30
30
|
startLogin: (type: WorkspaceType) => Promise<HarnessLoginAttempt>
|
|
31
31
|
publish: (event: HarnessUpdatedEvent) => void
|
|
32
|
-
onAuthChanged?: (type: WorkspaceType) => Promise<void>
|
|
32
|
+
onAuthChanged?: (type: WorkspaceType, availability: HarnessAvailability) => Promise<void>
|
|
33
33
|
availabilityTtlMs?: number
|
|
34
34
|
loginPollMs?: number
|
|
35
35
|
loginDeadlineMs?: number
|
|
@@ -83,7 +83,7 @@ export function createHarnessStore(options: HarnessStoreOptions) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
async function publish(context: HarnessTarget, availability: HarnessAvailability) {
|
|
86
|
-
if (typeof context === 'string') return options.onAuthChanged?.(context)
|
|
86
|
+
if (typeof context === 'string') return options.onAuthChanged?.(context, availability)
|
|
87
87
|
options.publish({
|
|
88
88
|
type: 'harness:updated',
|
|
89
89
|
workspaceId: context.id,
|
|
@@ -106,9 +106,9 @@ export function createHarnessStore(options: HarnessStoreOptions) {
|
|
|
106
106
|
return value
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
async function getAvailability(ws: HarnessTarget): Promise<HarnessAvailability> {
|
|
109
|
+
async function getAvailability(ws: HarnessTarget, fresh = false): Promise<HarnessAvailability> {
|
|
110
110
|
const entry = entryFor(ws)
|
|
111
|
-
if (entry.cached && Date.now() - entry.cached.checkedAt < ttlMs) {
|
|
111
|
+
if (!fresh && entry.cached && Date.now() - entry.cached.checkedAt < ttlMs) {
|
|
112
112
|
return entry.cached.value
|
|
113
113
|
}
|
|
114
114
|
return probeFresh(ws)
|
|
@@ -279,8 +279,9 @@ export const harnessStore = createHarnessStore({
|
|
|
279
279
|
if (typeof context !== 'string') {
|
|
280
280
|
return (await harness.availability?.(context)) ?? { status: 'available' }
|
|
281
281
|
}
|
|
282
|
-
if (!harness.authStatus)
|
|
283
|
-
|
|
282
|
+
if (!harness.authStatus) return pathHarnessAvailability(harness.id)
|
|
283
|
+
const runtime = await harness.availability?.()
|
|
284
|
+
if (runtime && runtime.status !== 'available') return runtime
|
|
284
285
|
return harness.authStatus()
|
|
285
286
|
},
|
|
286
287
|
startLogin: type => {
|
|
@@ -289,15 +290,11 @@ export const harnessStore = createHarnessStore({
|
|
|
289
290
|
return start()
|
|
290
291
|
},
|
|
291
292
|
publish: publishEvent,
|
|
292
|
-
onAuthChanged: async type => {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
)
|
|
299
|
-
} catch (error) {
|
|
300
|
-
console.error('[harness-auth] could not refresh workspaces after login', error)
|
|
301
|
-
}
|
|
293
|
+
onAuthChanged: async (type, availability) => {
|
|
294
|
+
publishEvent({
|
|
295
|
+
type: 'harness-status:changed',
|
|
296
|
+
harness: type,
|
|
297
|
+
status: { availability, login: harnessStore.getLogin(type) }
|
|
298
|
+
})
|
|
302
299
|
}
|
|
303
300
|
})
|
|
@@ -59,8 +59,9 @@ while Moi keeps running, changing which models are available.
|
|
|
59
59
|
survives planned subprocess replacement.
|
|
60
60
|
- Settings apply immediately before dispatch. Rejected setters fail the send.
|
|
61
61
|
Model uses `setModel`; effort and fast mode use `applyFlagSettings` together.
|
|
62
|
-
An absent effort
|
|
63
|
-
|
|
62
|
+
An absent effort clears that flag with `null`, restoring the provider default.
|
|
63
|
+
Moi speed mode maps to the SDK boolean: Fast is `true`; Normal, unset, and
|
|
64
|
+
unsupported Ultrafast are `false`.
|
|
64
65
|
- Background jobs retain their subprocess. Messages requiring a replacement
|
|
65
66
|
wait in Moi until those jobs finish, including replacements for streaming
|
|
66
67
|
changes. `background_tasks_changed` replaces the complete task set, including
|
|
@@ -71,7 +72,7 @@ while Moi keeps running, changing which models are available.
|
|
|
71
72
|
chat busy.
|
|
72
73
|
- Stop cancels queued messages and waits for interrupt acknowledgement and
|
|
73
74
|
turn completion. An unexpected process exit rejects pending sends.
|
|
74
|
-
- The picker gets the new lineup on the client's next `/
|
|
75
|
+
- The picker gets the new lineup on the client's next `/harness` refetch (window
|
|
75
76
|
focus, reconnect). `moi status` prints the version the catalog was probed
|
|
76
77
|
for next to the executable path.
|
|
77
78
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Claude Code as a Harness. Thin wiring over this folder's modules — see
|
|
2
2
|
// ../types.ts for the contract and ../README.md for the architecture.
|
|
3
|
+
import { runClaudeAction } from './run-action'
|
|
3
4
|
import { join } from 'node:path'
|
|
4
5
|
import { forkSession } from '@anthropic-ai/claude-agent-sdk'
|
|
5
6
|
|
|
@@ -82,6 +83,7 @@ onClaudeCliChanged(() => retireCCSessionsOnCliChange())
|
|
|
82
83
|
|
|
83
84
|
export const claudeCodeHarness: Harness = {
|
|
84
85
|
id: 'claude-code',
|
|
86
|
+
runAction: runClaudeAction,
|
|
85
87
|
capabilities: {
|
|
86
88
|
supportsStreaming: true,
|
|
87
89
|
imagesInline: 'base64',
|