moi-computer 0.9.0 → 0.9.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/client/api/app-config.ts +51 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/routes/WorkspaceRoute.tsx +4 -2
- package/client/assets/hermes.png +0 -0
- package/client/components/shared/IconGhost.tsx +15 -18
- package/client/components/ui/button.tsx +2 -2
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +3 -1
- package/client/features/applets/api.ts +38 -0
- package/client/features/applets/applet-thumbnail.ts +208 -0
- package/client/features/chat/ChatEmptyState.tsx +30 -10
- package/client/features/chat/ChatPanel.tsx +67 -31
- package/client/features/chat/ChatPopup.tsx +3 -2
- package/client/features/chat/ChatPromptBubbles.tsx +1 -1
- package/client/features/chat/ChatSelector.tsx +29 -10
- package/client/features/chat/MarkdownContent.tsx +3 -3
- package/client/features/chat/attachment-staging.ts +153 -0
- package/client/features/chat/chat-send.ts +55 -0
- package/client/features/chat/chat-store.ts +32 -8
- package/client/features/chat/composer/ChatComposer.tsx +190 -77
- package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
- package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
- package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
- package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
- package/client/features/chat/tool-group/format/claude.ts +48 -0
- package/client/features/chat/tool-group/format/codex.ts +126 -0
- package/client/features/chat/tool-group/format/hermes.ts +68 -0
- package/client/features/chat/tool-group/format/index.ts +34 -0
- package/client/features/chat/tool-group/format/mcp.ts +64 -0
- package/client/features/chat/tool-group/format/openclaw.ts +116 -0
- package/client/features/chat/tool-group/format/shared.ts +49 -0
- package/client/features/chat/useChat.ts +5 -10
- package/client/features/drawings/DrawingLayer.tsx +49 -0
- package/client/features/drawings/DrawingToolbar.tsx +95 -0
- package/client/features/drawings/capture-element.ts +45 -0
- package/client/features/drawings/useChatAnnotation.ts +222 -0
- package/client/features/drawings/useDrawingLayer.ts +758 -0
- package/client/features/drawings/useViewBuilderSketch.ts +151 -0
- package/client/features/home/HomePage.tsx +13 -0
- package/client/features/home/WorkspacePreview.tsx +10 -5
- package/client/features/home/workspace-presentation.tsx +6 -2
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +13 -7
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
- package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
- package/client/features/views/ViewBuilder.tsx +238 -0
- package/client/features/views/ViewManager.tsx +18 -2
- package/client/features/views/api.ts +1 -0
- package/client/features/views/useViewBuilderActions.ts +24 -3
- package/client/features/views/useViewBuilderDrafts.ts +66 -0
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/WidgetGrid.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +39 -54
- package/client/features/workspace/CustomizePanel.tsx +30 -9
- package/client/features/workspace/WorkspaceScreen.tsx +158 -64
- package/client/features/workspace/WorkspaceTabs.tsx +3 -3
- package/client/features/workspace/useFitsSplitLayout.ts +14 -8
- package/client/index.css +8 -0
- package/client/index.tsx +6 -1
- package/client/runtime/useWorkspaceEvents.ts +17 -0
- package/client/runtime/workspace-theme.ts +29 -6
- package/client/store/ui.ts +19 -0
- package/client/theme.css +33 -8
- package/dist/chunk-5c19v3zr.js +10 -0
- package/dist/chunk-6wx91x8j.js +1 -0
- package/dist/chunk-8s41nd3g.js +1 -0
- package/dist/{chunk-kkj86722.js → chunk-a7fzp0z0.js} +78 -78
- package/dist/{chunk-2vaafjp4.js → chunk-b959mdkj.js} +1 -1
- package/dist/chunk-cagtq45k.js +1 -0
- package/dist/chunk-cva7jpt4.js +82 -0
- package/dist/chunk-sapvd7he.css +1 -0
- package/dist/{chunk-35fq49qa.js → chunk-zbeq02yc.js} +1 -1
- package/dist/chunk-zbt8emsw.js +2 -0
- package/dist/chunk-zfz3b4xg.js +2 -0
- package/dist/hermes-pznd63x9.png +0 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +1 -1
- package/lib/themes.ts +8 -8
- package/lib/types.ts +68 -42
- package/lib/workspace-types.ts +2 -1
- package/package.json +2 -1
- package/server/api.ts +90 -33
- package/server/app-config.ts +144 -0
- package/server/applets.ts +17 -0
- package/server/cli.ts +235 -14
- package/server/harness/README.md +64 -17
- package/server/harness/acp/adapter.ts +220 -0
- package/server/harness/acp/archived.ts +88 -0
- package/server/harness/acp/client.ts +328 -0
- package/server/harness/acp/discovery.ts +130 -0
- package/server/harness/acp/run-durations.ts +68 -0
- package/server/harness/acp/session.ts +788 -0
- package/server/harness/acp/wire.ts +132 -0
- package/server/harness/executable.ts +15 -1
- package/server/harness/hermes/NOTES.md +815 -0
- package/server/harness/hermes/discovery.ts +155 -0
- package/server/harness/hermes/index.ts +155 -0
- package/server/harness/hermes/models.ts +79 -0
- package/server/harness/registry.ts +3 -1
- package/server/layout.ts +40 -45
- package/server/moi-scaffold.ts +37 -1
- package/server/thumbnails.ts +197 -0
- package/server/view-builders.ts +4 -2
- package/server/views.ts +10 -1
- package/server/widgets.ts +4 -18
- package/server/workspace-import.ts +30 -1
- package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
- package/client/features/chat/tool-group/format.ts +0 -384
- package/client/features/views/ViewBuilderTab.tsx +0 -152
- package/client/features/widgets/api.ts +0 -47
- package/client/features/widgets/useWidgetThumbnails.ts +0 -107
- package/client/features/widgets/widget-snapshot.ts +0 -71
- package/dist/chunk-3b3rkjet.js +0 -1
- package/dist/chunk-gt7n06ef.js +0 -1
- package/dist/chunk-ty1sqbmn.js +0 -80
- package/dist/chunk-xeyxk7ep.js +0 -10
- package/dist/chunk-yz6wd5vc.css +0 -1
package/server/applets.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
buildApplet,
|
|
24
24
|
scanRelativeImports
|
|
25
25
|
} from './bundler/build-applet'
|
|
26
|
+
import { pruneAppletThumbnails } from './thumbnails'
|
|
26
27
|
|
|
27
28
|
export type AppletPaths = {
|
|
28
29
|
moiRoot: string
|
|
@@ -40,6 +41,20 @@ export function getAppletPaths(workspacePath: string, kind: AppletKind): AppletP
|
|
|
40
41
|
return { moiRoot, sourceDir, buildDir, manifestPath }
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
export function getAppletRevision(
|
|
45
|
+
workspacePath: string,
|
|
46
|
+
kind: AppletKind,
|
|
47
|
+
id: string
|
|
48
|
+
): string | undefined {
|
|
49
|
+
try {
|
|
50
|
+
const { buildDir } = getAppletPaths(workspacePath, kind)
|
|
51
|
+
const stat = statSync(join(buildDir, id, 'index.js'))
|
|
52
|
+
return `${stat.size}-${Math.trunc(stat.mtimeMs)}`
|
|
53
|
+
} catch {
|
|
54
|
+
return undefined
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
43
58
|
// Source module names in a kind's directory: `*.tsx`/`*.ts` minus `.server.ts`
|
|
44
59
|
// and minus `_`-prefixed files (`_utils.tsx`) — those are shared modules for
|
|
45
60
|
// entries to import, never entry points themselves.
|
|
@@ -580,6 +595,8 @@ export async function buildApplets<C>(
|
|
|
580
595
|
await mkdir(buildDir, { recursive: true })
|
|
581
596
|
}
|
|
582
597
|
await pruneStaleBuilds(buildDir, new Set(names))
|
|
598
|
+
// A deleted applet's thumbnail dies with its bundle.
|
|
599
|
+
await pruneAppletThumbnails(workspacePath, kind, names)
|
|
583
600
|
|
|
584
601
|
const jobs = await Promise.all(
|
|
585
602
|
names.map(async name => {
|
package/server/cli.ts
CHANGED
|
@@ -5,10 +5,11 @@ import { formatHex } from 'culori'
|
|
|
5
5
|
import { parse as devalueParse } from 'devalue'
|
|
6
6
|
import { existsSync } from 'node:fs'
|
|
7
7
|
import { tmpdir } from 'node:os'
|
|
8
|
-
import { join, resolve } from 'path'
|
|
8
|
+
import { dirname, join, resolve } from 'path'
|
|
9
9
|
import pc from './cli-pc'
|
|
10
10
|
|
|
11
11
|
import { isAgentCaller } from './agent-caller'
|
|
12
|
+
import { getAppConfig } from './app-config'
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
COLOR_THEMES,
|
|
@@ -39,9 +40,14 @@ import {
|
|
|
39
40
|
renderEnvView,
|
|
40
41
|
resolveCwdWorkspace
|
|
41
42
|
} from './cli-env'
|
|
42
|
-
import { columns } from './cli-ui'
|
|
43
|
+
import { columns, keyValue } from './cli-ui'
|
|
43
44
|
import { CONTROL_HOST, CONTROL_PORT, CONTROL_URL, PORT } from './constants'
|
|
44
45
|
import { type ControlProbe, controlFailureMessage, probeControlServer } from './control-client'
|
|
46
|
+
import {
|
|
47
|
+
type HermesProfile,
|
|
48
|
+
discoverHermesProfiles,
|
|
49
|
+
matchHermesProfile
|
|
50
|
+
} from './harness/hermes/discovery'
|
|
45
51
|
import { type OpenClawAgent, discoverOpenClawAgents } from './harness/openclaw/discovery'
|
|
46
52
|
import { liftToWorkspaceRoot, registerWorkspace } from './registry'
|
|
47
53
|
import { serverCwd } from './server-cwd'
|
|
@@ -56,6 +62,7 @@ import { updateWorkspaceSkills } from './skill-update'
|
|
|
56
62
|
import {
|
|
57
63
|
ServiceError,
|
|
58
64
|
analyzeInstall,
|
|
65
|
+
captureServiceEnv,
|
|
59
66
|
installService,
|
|
60
67
|
queryServerInfo,
|
|
61
68
|
restartService,
|
|
@@ -1062,6 +1069,31 @@ const env = defineCommand({
|
|
|
1062
1069
|
}
|
|
1063
1070
|
})
|
|
1064
1071
|
|
|
1072
|
+
// ---- provider commands (openclaw / hermes) ----------------------------------
|
|
1073
|
+
|
|
1074
|
+
// `moi <provider>` on its own lists the commands AND what they can be run
|
|
1075
|
+
// against, so discovering the installable agents never requires `init`.
|
|
1076
|
+
function printProviderCommands(provider: string, argHint: string) {
|
|
1077
|
+
console.log('\n' + pc.bold(' Commands'))
|
|
1078
|
+
console.log(
|
|
1079
|
+
keyValue(
|
|
1080
|
+
[
|
|
1081
|
+
[
|
|
1082
|
+
pc.bold(`moi ${provider} init`) + ' ' + pc.dim(argHint),
|
|
1083
|
+
'Install moi skills and register the workspace'
|
|
1084
|
+
]
|
|
1085
|
+
],
|
|
1086
|
+
' '
|
|
1087
|
+
)
|
|
1088
|
+
)
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
// The argument is optional when there is exactly one candidate, so the hint
|
|
1092
|
+
// should not demand one that isn't needed.
|
|
1093
|
+
function initHint(provider: string, count: number, label: string): string {
|
|
1094
|
+
return count === 1 ? `moi ${provider} init` : `moi ${provider} init <${label}>`
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1065
1097
|
// ---- openclaw subcommands ---------------------------------------------------
|
|
1066
1098
|
|
|
1067
1099
|
// Match an `agent` argument against `agentId` (exact) or `name`
|
|
@@ -1114,7 +1146,9 @@ const openclawInit = defineCommand({
|
|
|
1114
1146
|
process.exit(1)
|
|
1115
1147
|
}
|
|
1116
1148
|
|
|
1117
|
-
|
|
1149
|
+
// No argument: with a single agent there is nothing to choose, so install
|
|
1150
|
+
// into it. Only an ambiguous choice needs the list.
|
|
1151
|
+
if (!args.agent && agents.length > 1) {
|
|
1118
1152
|
console.log('\n' + pc.bold('OpenClaw agents'))
|
|
1119
1153
|
console.log(
|
|
1120
1154
|
pc.dim(' Run ' + pc.bold('moi openclaw init <agentId>') + ' to install skills.\n')
|
|
@@ -1124,7 +1158,7 @@ const openclawInit = defineCommand({
|
|
|
1124
1158
|
process.exit(0)
|
|
1125
1159
|
}
|
|
1126
1160
|
|
|
1127
|
-
const target = findAgent(agents, args.agent)
|
|
1161
|
+
const target = args.agent ? findAgent(agents, args.agent) : agents[0]
|
|
1128
1162
|
if (!target) {
|
|
1129
1163
|
console.error('\n' + pc.red('✗') + ' Agent not found: ' + pc.bold(args.agent) + '\n')
|
|
1130
1164
|
console.log(' Available:\n')
|
|
@@ -1188,9 +1222,161 @@ const openclawInit = defineCommand({
|
|
|
1188
1222
|
|
|
1189
1223
|
const openclaw = defineCommand({
|
|
1190
1224
|
meta: { name: 'openclaw', description: 'OpenClaw integration commands' },
|
|
1225
|
+
async run({ rawArgs }) {
|
|
1226
|
+
// citty runs the parent even after dispatching a subcommand — the bare
|
|
1227
|
+
// form is the only one this handles.
|
|
1228
|
+
if (rawArgs.some(arg => !arg.startsWith('-'))) return
|
|
1229
|
+
console.log('\n' + pc.bold('OpenClaw'))
|
|
1230
|
+
printProviderCommands('openclaw', '[agent]')
|
|
1231
|
+
const agents = await discoverOpenClawAgents().catch(() => [])
|
|
1232
|
+
if (agents.length === 0) {
|
|
1233
|
+
console.log(
|
|
1234
|
+
'\n ' +
|
|
1235
|
+
pc.dim('No agents discovered — start the OpenClaw gateway and check ') +
|
|
1236
|
+
pc.dim('~/.openclaw/openclaw.json') +
|
|
1237
|
+
'\n'
|
|
1238
|
+
)
|
|
1239
|
+
return
|
|
1240
|
+
}
|
|
1241
|
+
console.log('\n' + pc.bold(' Agents'))
|
|
1242
|
+
printAgentTable(agents)
|
|
1243
|
+
console.log(pc.dim('\n Run ') + pc.bold(initHint('openclaw', agents.length, 'agentId')) + '\n')
|
|
1244
|
+
},
|
|
1191
1245
|
subCommands: { init: openclawInit }
|
|
1192
1246
|
})
|
|
1193
1247
|
|
|
1248
|
+
// ---- hermes subcommands -----------------------------------------------------
|
|
1249
|
+
|
|
1250
|
+
function printProfileTable(profiles: HermesProfile[]) {
|
|
1251
|
+
console.log(
|
|
1252
|
+
columns(
|
|
1253
|
+
['', 'profile', 'model', 'workspace'].map(h => pc.dim(h)),
|
|
1254
|
+
profiles.map(p => [
|
|
1255
|
+
p.isDefault ? pc.green('●') : ' ',
|
|
1256
|
+
p.isDefault ? pc.bold(p.agentId) : p.agentId,
|
|
1257
|
+
p.model ?? pc.dim('—'),
|
|
1258
|
+
pc.dim(p.path)
|
|
1259
|
+
])
|
|
1260
|
+
)
|
|
1261
|
+
)
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
const hermesInit = defineCommand({
|
|
1265
|
+
meta: {
|
|
1266
|
+
name: 'init',
|
|
1267
|
+
description:
|
|
1268
|
+
'Install moi skills into a Hermes profile workspace. Run without args to list discovered profiles.'
|
|
1269
|
+
},
|
|
1270
|
+
args: {
|
|
1271
|
+
profile: {
|
|
1272
|
+
type: 'positional',
|
|
1273
|
+
required: false,
|
|
1274
|
+
description: 'Profile id or description (omit to list profiles)'
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
async run({ args }) {
|
|
1278
|
+
const profiles = await discoverHermesProfiles()
|
|
1279
|
+
if (profiles.length === 0) {
|
|
1280
|
+
console.error(
|
|
1281
|
+
'\n' +
|
|
1282
|
+
pc.red('✗') +
|
|
1283
|
+
' No Hermes profiles discovered.\n' +
|
|
1284
|
+
pc.dim(' Install Hermes and run ' + pc.bold('hermes setup') + ' first.\n')
|
|
1285
|
+
)
|
|
1286
|
+
process.exit(1)
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// No argument: with a single profile there is nothing to choose, so
|
|
1290
|
+
// install into it. Only an ambiguous choice needs the list.
|
|
1291
|
+
if (!args.profile && profiles.length > 1) {
|
|
1292
|
+
console.log('\n' + pc.bold('Hermes profiles'))
|
|
1293
|
+
console.log(pc.dim(' Run ' + pc.bold('moi hermes init <profile>') + ' to install skills.\n'))
|
|
1294
|
+
printProfileTable(profiles)
|
|
1295
|
+
console.log()
|
|
1296
|
+
process.exit(0)
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
const target = args.profile ? matchHermesProfile(profiles, args.profile) : profiles[0]
|
|
1300
|
+
if (!target) {
|
|
1301
|
+
console.error('\n' + pc.red('✗') + ' Profile not found: ' + pc.bold(args.profile) + '\n')
|
|
1302
|
+
console.log(' Available:\n')
|
|
1303
|
+
printProfileTable(profiles)
|
|
1304
|
+
console.log()
|
|
1305
|
+
process.exit(1)
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// Shared provisioning path with `moi init`: skills land in
|
|
1309
|
+
// <profile>/workspace/skills/<name>/ (Hermes resolves the workspace skills
|
|
1310
|
+
// dir with the highest precedence, so these win over bundled ones), plus
|
|
1311
|
+
// the `.moi/` bootstrap. The default profile has no workspace directory
|
|
1312
|
+
// until now — provisionWorkspace creates it.
|
|
1313
|
+
const { scaffold, skillsDir: skillsRoot } = await provisionWorkspace(target.path, 'hermes')
|
|
1314
|
+
if (scaffold !== 'exists') {
|
|
1315
|
+
if (scaffold === 'installing') {
|
|
1316
|
+
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
1317
|
+
} else if (scaffold === 0) {
|
|
1318
|
+
console.log('\n' + pc.dim(' Installed widget dependencies in .moi/'))
|
|
1319
|
+
} else {
|
|
1320
|
+
console.warn('\n' + pc.yellow(' bun install failed — run it manually in .moi/'))
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const entry = await registerWorkspace(target.path, {
|
|
1325
|
+
type: 'hermes',
|
|
1326
|
+
name: target.name,
|
|
1327
|
+
agentId: target.agentId,
|
|
1328
|
+
isDefault: target.isDefault
|
|
1329
|
+
})
|
|
1330
|
+
|
|
1331
|
+
console.log('\n' + pc.green('✓') + ' Installed skills to ' + pc.bold(skillsRoot))
|
|
1332
|
+
console.log(
|
|
1333
|
+
pc.dim(' Profile: ') +
|
|
1334
|
+
pc.bold(target.agentId) +
|
|
1335
|
+
(target.model ? pc.dim(' (' + target.model + ')') : '')
|
|
1336
|
+
)
|
|
1337
|
+
const isInteractive = process.stdout.isTTY
|
|
1338
|
+
const running = await isServerRunning()
|
|
1339
|
+
if (running) {
|
|
1340
|
+
const url = `http://localhost:${PORT}/workspace/${entry.id}`
|
|
1341
|
+
await registerViaControl(target.path)
|
|
1342
|
+
if (isInteractive) {
|
|
1343
|
+
console.log(' Opening ' + pc.bold(url) + '\n')
|
|
1344
|
+
await openBrowser(url)
|
|
1345
|
+
} else {
|
|
1346
|
+
console.log(' Ready at ' + pc.bold(url) + '\n')
|
|
1347
|
+
}
|
|
1348
|
+
} else {
|
|
1349
|
+
console.log(' Run ' + pc.bold('moi start') + ' to open in the browser\n')
|
|
1350
|
+
}
|
|
1351
|
+
process.exit(0)
|
|
1352
|
+
}
|
|
1353
|
+
})
|
|
1354
|
+
|
|
1355
|
+
const hermes = defineCommand({
|
|
1356
|
+
meta: { name: 'hermes', description: 'Hermes Agent integration commands' },
|
|
1357
|
+
async run({ rawArgs }) {
|
|
1358
|
+
// citty runs the parent even after dispatching a subcommand — the bare
|
|
1359
|
+
// form is the only one this handles.
|
|
1360
|
+
if (rawArgs.some(arg => !arg.startsWith('-'))) return
|
|
1361
|
+
console.log('\n' + pc.bold('Hermes'))
|
|
1362
|
+
printProviderCommands('hermes', '[profile]')
|
|
1363
|
+
const profiles = await discoverHermesProfiles().catch(() => [])
|
|
1364
|
+
if (profiles.length === 0) {
|
|
1365
|
+
console.log(
|
|
1366
|
+
'\n ' +
|
|
1367
|
+
pc.dim('No profiles discovered — install Hermes and run ') +
|
|
1368
|
+
pc.dim('hermes setup') +
|
|
1369
|
+
'\n'
|
|
1370
|
+
)
|
|
1371
|
+
return
|
|
1372
|
+
}
|
|
1373
|
+
console.log('\n' + pc.bold(' Profiles'))
|
|
1374
|
+
printProfileTable(profiles)
|
|
1375
|
+
console.log(pc.dim('\n Run ') + pc.bold(initHint('hermes', profiles.length, 'profile')) + '\n')
|
|
1376
|
+
},
|
|
1377
|
+
subCommands: { init: hermesInit }
|
|
1378
|
+
})
|
|
1379
|
+
|
|
1194
1380
|
async function sendConfig(payload: {
|
|
1195
1381
|
path: string
|
|
1196
1382
|
name?: string
|
|
@@ -2209,6 +2395,25 @@ const serviceInstall = defineCommand({
|
|
|
2209
2395
|
serviceFail(err)
|
|
2210
2396
|
}
|
|
2211
2397
|
}
|
|
2398
|
+
const port = args.port ? Number(args.port) : undefined
|
|
2399
|
+
if (port !== undefined && (!Number.isInteger(port) || port < 1 || port > 65535)) {
|
|
2400
|
+
serviceFail(new ServiceError(`Invalid --port value "${args.port}" — use a port number.`))
|
|
2401
|
+
}
|
|
2402
|
+
// citty hands back an array when the flag repeats — accept both shapes.
|
|
2403
|
+
const envArg = Array.isArray(args.env) ? args.env.join(',') : args.env
|
|
2404
|
+
const extraEnv = (envArg ?? '')
|
|
2405
|
+
.split(',')
|
|
2406
|
+
.map(k => k.trim())
|
|
2407
|
+
.filter(Boolean)
|
|
2408
|
+
const serviceEnv = captureServiceEnv(process.env, dirname(process.execPath), extraEnv)
|
|
2409
|
+
const missingEnv = extraEnv.filter(key => !(key in serviceEnv))
|
|
2410
|
+
if (missingEnv.length > 0) {
|
|
2411
|
+
serviceFail(
|
|
2412
|
+
new ServiceError(
|
|
2413
|
+
`--env ${missingEnv.join(', ')}: not set in this shell (or the value is not capturable).`
|
|
2414
|
+
)
|
|
2415
|
+
)
|
|
2416
|
+
}
|
|
2212
2417
|
// A foreground `moi start` holds the same ports the service needs. Refuse
|
|
2213
2418
|
// rather than install a unit that instantly fails on bind.
|
|
2214
2419
|
const runningInfo = await queryServerInfo()
|
|
@@ -2222,16 +2427,6 @@ const serviceInstall = defineCommand({
|
|
|
2222
2427
|
)
|
|
2223
2428
|
)
|
|
2224
2429
|
}
|
|
2225
|
-
const port = args.port ? Number(args.port) : undefined
|
|
2226
|
-
if (port !== undefined && (!Number.isInteger(port) || port < 1 || port > 65535)) {
|
|
2227
|
-
serviceFail(new ServiceError(`Invalid --port value "${args.port}" — use a port number.`))
|
|
2228
|
-
}
|
|
2229
|
-
// citty hands back an array when the flag repeats — accept both shapes.
|
|
2230
|
-
const envArg = Array.isArray(args.env) ? args.env.join(',') : args.env
|
|
2231
|
-
const extraEnv = (envArg ?? '')
|
|
2232
|
-
.split(',')
|
|
2233
|
-
.map(k => k.trim())
|
|
2234
|
-
.filter(Boolean)
|
|
2235
2430
|
try {
|
|
2236
2431
|
const result = await installService({ port, extraEnv })
|
|
2237
2432
|
console.log(
|
|
@@ -2641,6 +2836,7 @@ const systemCommands = {
|
|
|
2641
2836
|
service,
|
|
2642
2837
|
update,
|
|
2643
2838
|
openclaw,
|
|
2839
|
+
hermes,
|
|
2644
2840
|
version
|
|
2645
2841
|
}
|
|
2646
2842
|
|
|
@@ -2655,6 +2851,31 @@ const main = defineCommand({
|
|
|
2655
2851
|
subCommands: { ...workspaceCommands, ...systemCommands }
|
|
2656
2852
|
})
|
|
2657
2853
|
|
|
2854
|
+
// Cloud demo: system commands manage moi itself (service, updates, agent
|
|
2855
|
+
// runtimes) — in a demo container the instance is provisioned, not managed,
|
|
2856
|
+
// so they print a pointer to the real thing instead of running. Two stay:
|
|
2857
|
+
// `start`, because it is how the demo (container or a local test run) boots
|
|
2858
|
+
// at all — against an already-running server it just reports and exits — and
|
|
2859
|
+
// `version`, which is harmless and useful in bug reports.
|
|
2860
|
+
function exitIfDemoBlocked(): void {
|
|
2861
|
+
const invoked = process.argv[2]
|
|
2862
|
+
if (!invoked || invoked === 'version' || invoked === 'start') return
|
|
2863
|
+
if (!(invoked in systemCommands)) return
|
|
2864
|
+
const config = getAppConfig()
|
|
2865
|
+
if (!config.cloudDemo) return
|
|
2866
|
+
console.log(
|
|
2867
|
+
'\n' +
|
|
2868
|
+
pc.yellow('◆') +
|
|
2869
|
+
` moi ${invoked} is not available in the demo.\n` +
|
|
2870
|
+
pc.dim(' Get moi on your computer: ') +
|
|
2871
|
+
pc.bold(config.demoInstallUrl) +
|
|
2872
|
+
'\n'
|
|
2873
|
+
)
|
|
2874
|
+
process.exit(1)
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
exitIfDemoBlocked()
|
|
2878
|
+
|
|
2658
2879
|
type HelpCommand = { meta?: unknown }
|
|
2659
2880
|
|
|
2660
2881
|
async function commandDescription(cmd: HelpCommand): Promise<string> {
|
package/server/harness/README.md
CHANGED
|
@@ -97,6 +97,36 @@ Current harnesses:
|
|
|
97
97
|
| Claude Code (Agent SDK) | `claude-code/session.ts` | `claude-code/adapter.ts` | shipped, primary |
|
|
98
98
|
| OpenClaw (gateway) | `openclaw/session.ts` | `openclaw/adapter.ts` | shipped, experimental |
|
|
99
99
|
| Codex (app-server) | `codex/session.ts` | `codex/adapter.ts` | shipped, experimental |
|
|
100
|
+
| Hermes (ACP) | `acp/session.ts` | `acp/adapter.ts` | shipped, experimental |
|
|
101
|
+
|
|
102
|
+
`acp/` is the odd one out: it is **not** a harness, it is the shared
|
|
103
|
+
implementation of the Agent Client Protocol (stdio JSON-RPC), and `hermes/`
|
|
104
|
+
is the first provider built on it. Any other ACP-speaking agent (Gemini CLI,
|
|
105
|
+
opencode, Zed's agents) should become another thin folder next to `hermes/`
|
|
106
|
+
rather than a copy of the protocol. The split is:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
acp/ provider-agnostic protocol
|
|
110
|
+
wire.ts ACP message types (re-exported from the official SDK)
|
|
111
|
+
client.ts spawn + stdio JSON-RPC framing, one process per workspace
|
|
112
|
+
adapter.ts session/update → Turn/ToolCall (+ chunk accumulation)
|
|
113
|
+
session.ts per-session state machine, driven by AcpProviderConfig
|
|
114
|
+
discovery.ts session/list, model catalog, home-card preview
|
|
115
|
+
hermes/ provider specifics only
|
|
116
|
+
discovery.ts profile discovery (the importable "agents")
|
|
117
|
+
index.ts the Harness object + AcpProviderConfig
|
|
118
|
+
NOTES.md protocol research + backend quirks
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
A new ACP provider supplies an `AcpProviderConfig`: an id, the spawn spec
|
|
122
|
+
(binary + args), the no-prompt mode id, and whether images ride inline.
|
|
123
|
+
|
|
124
|
+
`wire.ts` re-exports the schema-generated types from
|
|
125
|
+
`@agentclientprotocol/sdk` — a **types-only, dev-only** dependency, since
|
|
126
|
+
importing values from it would pull zod in at runtime. It adds one labelled
|
|
127
|
+
"pre-1.0 additions" block for the model-selection surface the spec dropped and
|
|
128
|
+
Hermes still implements; delete that block when agents move to
|
|
129
|
+
`session/set_config_option`. See `hermes/NOTES.md` §12.
|
|
100
130
|
|
|
101
131
|
Dev tooling: `/dev/harness` (live wire log + client frames + trigger
|
|
102
132
|
scenarios for any workspace, backed by `GET /api/workspaces/:id/harness/debug`
|
|
@@ -134,6 +164,23 @@ replayed against the real session code by `openclaw/wire-replay.test.ts`. Known
|
|
|
134
164
|
`sessions.send`), and the gateway is the sole source of truth (no local
|
|
135
165
|
persistence; cold restarts re-seed).
|
|
136
166
|
|
|
167
|
+
**Hermes — shipped, experimental.** Chat over `hermes acp` (stdio JSON-RPC,
|
|
168
|
+
one process per workspace so `workspaceEnv` injects at spawn — `acp/client.ts`),
|
|
169
|
+
built on the provider-agnostic `acp/` layer. Session create/resume with temp-id
|
|
170
|
+
rename, `session/load` history replay, interrupt via `session/cancel`, per-turn
|
|
171
|
+
token usage, token streaming for thinking _and_ text, inline base64 images,
|
|
172
|
+
per-chat model switching from the catalog `session/new` returns inline, and
|
|
173
|
+
backend-generated session titles surfaced through `sessions_changed`. Agents are
|
|
174
|
+
Hermes **profiles** — discovered from `$HERMES_HOME`, imported with
|
|
175
|
+
`moi hermes init <profile>`, never created from the UI (OpenClaw's model).
|
|
176
|
+
Sessions run in Hermes's `dont_ask` mode to match moi's bypass-permissions trust
|
|
177
|
+
model. Known gaps: no mid-turn steering (moi queues instead), no subagent lanes,
|
|
178
|
+
no reasoning-effort control, and `session/set_model` drops session-scoped MCP
|
|
179
|
+
servers upstream. Two backend quirks are worked around in `acp/session.ts`:
|
|
180
|
+
tool calls left unsettled at turn end are closed (Hermes never completes file
|
|
181
|
+
read/write calls live), and a completing `tool_call_update` carries no title, so
|
|
182
|
+
the established name is kept. See `hermes/NOTES.md`.
|
|
183
|
+
|
|
137
184
|
**Codex — shipped, experimental.** Chat over `codex app-server` (stdio
|
|
138
185
|
JSON-RPC, one process per workspace so `workspaceEnv` injects at spawn —
|
|
139
186
|
`codex/client.ts`): thread create/resume with temp-id rename, per-turn model +
|
|
@@ -248,23 +295,23 @@ doubles as the evaluation rubric for new harnesses.
|
|
|
248
295
|
|
|
249
296
|
Legend: ✅ supported · ⚠️ partial/workaround · ❌ missing.
|
|
250
297
|
|
|
251
|
-
| Feature | Claude Agent SDK | OpenClaw gateway | Codex app-server |
|
|
252
|
-
| ------------------------ | --------------------------------------------------- | ------------------------- | ------------------------------------- |
|
|
253
|
-
| Long-lived session | ✅ subprocess per session | ✅ gateway-side | ✅ server-side, N threads/process |
|
|
254
|
-
| Queue/steer mid-turn | ⚠️ queued next turn | ⚠️ | ✅ `turn/steer` into live turn |
|
|
255
|
-
| Resume | ✅ | ✅ | ✅ + fork |
|
|
256
|
-
| Interrupt | ✅ `interrupt()` | ✅ | ✅ `turn/interrupt` |
|
|
257
|
-
| List models | ✅ `supportedModels()` | ✅ `models.list` | ✅ `model/list` |
|
|
258
|
-
| Live model switch | ✅ `setModel()` | ✅ `sessions.patch` | ✅ per-turn override |
|
|
259
|
-
| Live effort switch | ❌ rebuild | ✅ `thinkingLevel` patch | ✅ per-turn |
|
|
260
|
-
| Token deltas | ✅ opt-in | ✅ `chat` frames | ✅ `item/*/delta` |
|
|
261
|
-
| Images in input | ✅ base64 blocks | ⚠️ materialize to path | ✅ data URL or path |
|
|
262
|
-
| Interactive approvals | ⚠️ (we bypass) | ✅ | ✅ server→client requests (we bypass) |
|
|
263
|
-
| Session list/history API | ✅ `listSessions()` + jsonl | ✅ `sessions.get` | ✅ `thread/list`/`read` |
|
|
264
|
-
| Home card preview | ✅ session file scan | ✅ cached first message | ⚠️ live app-server only |
|
|
265
|
-
| MCP status | ✅ `mcpServerStatus()` | n/a | ✅ `mcpServerStatus/list` |
|
|
266
|
-
| Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ live + rate limits |
|
|
267
|
-
| Structured output | ❌ | ❌ | ✅ per turn |
|
|
298
|
+
| Feature | Claude Agent SDK | OpenClaw gateway | Codex app-server | Hermes (ACP) |
|
|
299
|
+
| ------------------------ | --------------------------------------------------- | ------------------------- | ------------------------------------- | ------------------------------------ |
|
|
300
|
+
| Long-lived session | ✅ subprocess per session | ✅ gateway-side | ✅ server-side, N threads/process | ✅ process per workspace, N sessions |
|
|
301
|
+
| Queue/steer mid-turn | ⚠️ queued next turn | ⚠️ | ✅ `turn/steer` into live turn | ⚠️ queued (ACP has no steer) |
|
|
302
|
+
| Resume | ✅ | ✅ | ✅ + fork | ✅ `session/load` (+ fork) |
|
|
303
|
+
| Interrupt | ✅ `interrupt()` | ✅ | ✅ `turn/interrupt` | ✅ `session/cancel` → `cancelled` |
|
|
304
|
+
| List models | ✅ `supportedModels()` | ✅ `models.list` | ✅ `model/list` | ✅ inline on `session/new` |
|
|
305
|
+
| Live model switch | ✅ `setModel()` | ✅ `sessions.patch` | ✅ per-turn override | ⚠️ drops session MCP servers |
|
|
306
|
+
| Live effort switch | ❌ rebuild | ✅ `thinkingLevel` patch | ✅ per-turn | ❌ no effort concept in ACP |
|
|
307
|
+
| Token deltas | ✅ opt-in | ✅ `chat` frames | ✅ `item/*/delta` | ✅ always on, thinking + text |
|
|
308
|
+
| Images in input | ✅ base64 blocks | ⚠️ materialize to path | ✅ data URL or path | ✅ base64 blocks |
|
|
309
|
+
| Interactive approvals | ⚠️ (we bypass) | ✅ | ✅ server→client requests (we bypass) | ✅ real, with diffs (we bypass) |
|
|
310
|
+
| Session list/history API | ✅ `listSessions()` + jsonl | ✅ `sessions.get` | ✅ `thread/list`/`read` | ✅ `session/list` (cwd + cursor) |
|
|
311
|
+
| Home card preview | ✅ session file scan | ✅ cached first message | ⚠️ live app-server only | ⚠️ live process only |
|
|
312
|
+
| MCP status | ✅ `mcpServerStatus()` | n/a | ✅ `mcpServerStatus/list` | ⚠️ per-session config, no status RPC |
|
|
313
|
+
| Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ live + rate limits | ✅ tokens per turn |
|
|
314
|
+
| Structured output | ❌ | ❌ | ✅ per turn | ❌ |
|
|
268
315
|
|
|
269
316
|
## Design lessons so far
|
|
270
317
|
|