moi-computer 0.11.1-next.5 → 0.12.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/client/features/chat/composer/attachments/draft-attachments.ts +21 -4
- package/dist/chunk-e2q5ken7.js +68 -0
- package/dist/{chunk-hvj7tp3y.js → chunk-ph0h6h86.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/server/cli.ts +26 -6
- package/server/moi-scaffold.ts +52 -20
- package/server/workspace-init.ts +6 -3
- package/dist/chunk-9zpvdws4.js +0 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Lc as t,Mc as e}from"/chunk-tpn177bt.js";import{Zc as r}from"/chunk-97eg9mjn.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function c(o){e();let[{mount:i},n,s]=await Promise.all([import("/chunk-
|
|
1
|
+
import{Lc as t,Mc as e}from"/chunk-tpn177bt.js";import{Zc as r}from"/chunk-97eg9mjn.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function c(o){e();let[{mount:i},n,s]=await Promise.all([import("/chunk-e2q5ken7.js"),import("/chunk-2jncyq65.js").then((a)=>a.loadAppConfig()),import("/chunk-nez8sdta.js").then((a)=>a.loadProxyUser())]);t(n?.experimental.collab===!0,s),i(o)}globalThis.__init=c;
|
package/dist/index.html
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
|
-
<link rel="stylesheet" crossorigin href="/chunk-nzwgm8vc.css"><script type="module" crossorigin src="/chunk-
|
|
39
|
+
<link rel="stylesheet" crossorigin href="/chunk-nzwgm8vc.css"><script type="module" crossorigin src="/chunk-ph0h6h86.js"></script></head>
|
|
40
40
|
<body>
|
|
41
41
|
<div id="root"></div>
|
|
42
42
|
|
package/package.json
CHANGED
package/server/cli.ts
CHANGED
|
@@ -409,7 +409,7 @@ const init = defineCommand({
|
|
|
409
409
|
// Provision: bundled skills + the `.moi/` bootstrap (widgets dir +
|
|
410
410
|
// package.json + bun install). An existing `.moi/` is left untouched.
|
|
411
411
|
console.log()
|
|
412
|
-
const { scaffold, skillsDir } = await provisionWorkspace(target, type)
|
|
412
|
+
const { scaffold, skillsDir, installLogPath } = await provisionWorkspace(target, type)
|
|
413
413
|
if (args['experimental-collab']) {
|
|
414
414
|
const { referencePath } = await installCollabSkill(target, type)
|
|
415
415
|
console.log(pc.dim(' Collaboration guide installed to ' + referencePath))
|
|
@@ -418,10 +418,14 @@ const init = defineCommand({
|
|
|
418
418
|
if (scaffold !== 'exists') {
|
|
419
419
|
if (scaffold === 'installing') {
|
|
420
420
|
console.log(pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
421
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
421
422
|
} else if (scaffold === 0) {
|
|
422
423
|
console.log(pc.dim(' Installed widget dependencies in .moi/'))
|
|
423
424
|
} else {
|
|
424
|
-
console.warn(
|
|
425
|
+
console.warn(
|
|
426
|
+
pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
427
|
+
)
|
|
428
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
425
429
|
}
|
|
426
430
|
}
|
|
427
431
|
|
|
@@ -1403,14 +1407,22 @@ const openclawInit = defineCommand({
|
|
|
1403
1407
|
// with the highest precedence, so these win over any same-named bundled or
|
|
1404
1408
|
// per-user skill), plus the `.moi/` bootstrap — the widgets skill assumes
|
|
1405
1409
|
// the folder and its dependencies exist. Existing `.moi/` stays untouched.
|
|
1406
|
-
const {
|
|
1410
|
+
const {
|
|
1411
|
+
scaffold,
|
|
1412
|
+
skillsDir: skillsRoot,
|
|
1413
|
+
installLogPath
|
|
1414
|
+
} = await provisionWorkspace(target.path, 'openclaw')
|
|
1407
1415
|
if (scaffold !== 'exists') {
|
|
1408
1416
|
if (scaffold === 'installing') {
|
|
1409
1417
|
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
1418
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
1410
1419
|
} else if (scaffold === 0) {
|
|
1411
1420
|
console.log('\n' + pc.dim(' Installed widget dependencies in .moi/'))
|
|
1412
1421
|
} else {
|
|
1413
|
-
console.warn(
|
|
1422
|
+
console.warn(
|
|
1423
|
+
'\n' + pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
1424
|
+
)
|
|
1425
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
1414
1426
|
}
|
|
1415
1427
|
}
|
|
1416
1428
|
|
|
@@ -1541,14 +1553,22 @@ const hermesInit = defineCommand({
|
|
|
1541
1553
|
// dir with the highest precedence, so these win over bundled ones), plus
|
|
1542
1554
|
// the `.moi/` bootstrap. The default profile has no workspace directory
|
|
1543
1555
|
// until now — provisionWorkspace creates it.
|
|
1544
|
-
const {
|
|
1556
|
+
const {
|
|
1557
|
+
scaffold,
|
|
1558
|
+
skillsDir: skillsRoot,
|
|
1559
|
+
installLogPath
|
|
1560
|
+
} = await provisionWorkspace(target.path, 'hermes')
|
|
1545
1561
|
if (scaffold !== 'exists') {
|
|
1546
1562
|
if (scaffold === 'installing') {
|
|
1547
1563
|
console.log('\n' + pc.dim(' Widget dependencies still installing in .moi/ (background)'))
|
|
1564
|
+
console.log(pc.dim(' Install log: ' + installLogPath))
|
|
1548
1565
|
} else if (scaffold === 0) {
|
|
1549
1566
|
console.log('\n' + pc.dim(' Installed widget dependencies in .moi/'))
|
|
1550
1567
|
} else {
|
|
1551
|
-
console.warn(
|
|
1568
|
+
console.warn(
|
|
1569
|
+
'\n' + pc.yellow(` bun install failed (exit ${scaffold}) — run it manually in .moi/`)
|
|
1570
|
+
)
|
|
1571
|
+
console.warn(pc.dim(' Install log: ' + installLogPath))
|
|
1552
1572
|
}
|
|
1553
1573
|
}
|
|
1554
1574
|
|
package/server/moi-scaffold.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// `moi openclaw init`). Creates `.moi/widgets/`, writes the widget
|
|
3
3
|
// dependency manifest, and installs dependencies — so the agent never has to
|
|
4
4
|
// bootstrap the folder itself.
|
|
5
|
-
import { mkdir, stat } from 'node:fs/promises'
|
|
5
|
+
import { appendFile, mkdir, open, stat } from 'node:fs/promises'
|
|
6
|
+
import { tmpdir } from 'node:os'
|
|
6
7
|
import { join, resolve, sep } from 'node:path'
|
|
7
8
|
|
|
8
9
|
import { syncAppletDeclarations } from './applets/declarations'
|
|
@@ -40,23 +41,51 @@ export const MOI_PACKAGE_JSON = {
|
|
|
40
41
|
const INSTALL_WAIT_MS = 10_000
|
|
41
42
|
const INSTALL_TIMEOUT_MS = 120_000
|
|
42
43
|
|
|
43
|
-
type InstallDependencies = (moiDir: string) => Promise<number>
|
|
44
|
+
type InstallDependencies = (moiDir: string, logPath: string) => Promise<number>
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
export function createDependencyInstallLogPath(): string {
|
|
47
|
+
return join(tmpdir(), `moi-bun-install-${crypto.randomUUID()}.log`)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function runBunInstall(moiDir: string, logPath: string): Promise<number> {
|
|
51
|
+
const log = await open(logPath, 'wx', 0o600)
|
|
52
|
+
let install: Bun.Subprocess<'ignore', number, number>
|
|
53
|
+
try {
|
|
54
|
+
await log.writeFile(
|
|
55
|
+
`bun install started at ${new Date().toISOString()}\nWorking directory: ${moiDir}\n\n`
|
|
56
|
+
)
|
|
57
|
+
install = Bun.spawn(['bun', 'install'], {
|
|
58
|
+
cwd: moiDir,
|
|
59
|
+
stdin: 'ignore',
|
|
60
|
+
// Direct file descriptors keep capturing both streams after a
|
|
61
|
+
// short-lived CLI exits; parent-owned pipes would lose that output.
|
|
62
|
+
stdout: log.fd,
|
|
63
|
+
stderr: log.fd
|
|
64
|
+
})
|
|
65
|
+
} catch (err) {
|
|
66
|
+
await log.writeFile(
|
|
67
|
+
`\nbun install error: ${err instanceof Error ? err.message : String(err)}\n`
|
|
68
|
+
)
|
|
69
|
+
return 1
|
|
70
|
+
} finally {
|
|
71
|
+
// The child owns duplicated descriptors now. Closing the parent's handle
|
|
72
|
+
// also lets a short-lived CLI exit while the install is still running.
|
|
73
|
+
await log.close()
|
|
74
|
+
}
|
|
75
|
+
// Bun.spawn's built-in timeout keeps the parent alive even after unref().
|
|
76
|
+
// Unref both the child and our timer so a short-lived CLI can exit after
|
|
77
|
+
// its brief wait. The timeout still applies while the parent is running;
|
|
78
|
+
// after parent exit the orphaned install finishes on its own.
|
|
79
|
+
const timeout = setTimeout(() => install.kill('SIGKILL'), INSTALL_TIMEOUT_MS)
|
|
80
|
+
timeout.unref()
|
|
58
81
|
install.unref()
|
|
59
|
-
|
|
82
|
+
try {
|
|
83
|
+
const code = await install.exited
|
|
84
|
+
await appendFile(logPath, `\nbun install exited with code ${code}\n`)
|
|
85
|
+
return code
|
|
86
|
+
} finally {
|
|
87
|
+
clearTimeout(timeout)
|
|
88
|
+
}
|
|
60
89
|
}
|
|
61
90
|
|
|
62
91
|
// Keep machine-local state out of workspaces that are git repos: build output,
|
|
@@ -105,7 +134,8 @@ async function isDirectory(path: string): Promise<boolean> {
|
|
|
105
134
|
export async function scaffoldMoiDir(
|
|
106
135
|
workspacePath: string,
|
|
107
136
|
installDependencies: InstallDependencies = runBunInstall,
|
|
108
|
-
installWaitMs: number = INSTALL_WAIT_MS
|
|
137
|
+
installWaitMs: number = INSTALL_WAIT_MS,
|
|
138
|
+
installLogPath: string = createDependencyInstallLogPath()
|
|
109
139
|
): Promise<'exists' | 'installing' | number> {
|
|
110
140
|
// Backstop against the nested-workspace bug: never scaffold a `.moi/` *inside*
|
|
111
141
|
// another workspace's `.moi/` (which produces the junk `.moi/.moi`). Callers
|
|
@@ -133,7 +163,7 @@ export async function scaffoldMoiDir(
|
|
|
133
163
|
await ensureMoiGitignore(workspacePath)
|
|
134
164
|
await syncAppletDeclarations(workspacePath)
|
|
135
165
|
|
|
136
|
-
const exited = installDependencies(moiDir)
|
|
166
|
+
const exited = installDependencies(moiDir, installLogPath)
|
|
137
167
|
let timer: ReturnType<typeof setTimeout> | undefined
|
|
138
168
|
const result = await Promise.race([
|
|
139
169
|
exited,
|
|
@@ -142,12 +172,14 @@ export async function scaffoldMoiDir(
|
|
|
142
172
|
clearTimeout(timer)
|
|
143
173
|
|
|
144
174
|
if (result === 'installing') {
|
|
145
|
-
console.log(
|
|
175
|
+
console.log(
|
|
176
|
+
`[scaffold] bun install in ${moiDir} still running — continuing in the background; log: ${installLogPath}`
|
|
177
|
+
)
|
|
146
178
|
exited.then(code => {
|
|
147
179
|
if (code === 0) console.log(`[scaffold] background bun install in ${moiDir} finished`)
|
|
148
180
|
else
|
|
149
181
|
console.warn(
|
|
150
|
-
`[scaffold] background bun install in ${moiDir} failed (exit ${code}) — the agent will install deps on demand`
|
|
182
|
+
`[scaffold] background bun install in ${moiDir} failed (exit ${code}) — the agent will install deps on demand; log: ${installLogPath}`
|
|
151
183
|
)
|
|
152
184
|
})
|
|
153
185
|
}
|
package/server/workspace-init.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { WorkspaceType } from '@/lib/types'
|
|
|
11
11
|
export { validateWorkspaceFolderName } from '@/lib/workspace-name'
|
|
12
12
|
|
|
13
13
|
import { harnessFor } from './harness/registry'
|
|
14
|
-
import { scaffoldMoiDir } from './moi-scaffold'
|
|
14
|
+
import { createDependencyInstallLogPath, scaffoldMoiDir } from './moi-scaffold'
|
|
15
15
|
import { installBundledSkills } from './skills-template'
|
|
16
16
|
|
|
17
17
|
// Where each backend loads skills from — the harness owns the answer
|
|
@@ -34,6 +34,8 @@ export type ProvisionResult = {
|
|
|
34
34
|
// install continues in the background, else the install exit code (non-zero
|
|
35
35
|
// means deps are missing — not fatal, the agent installs on demand).
|
|
36
36
|
scaffold: 'exists' | 'installing' | number
|
|
37
|
+
// Unique temporary log for this install attempt; unused when scaffold exists.
|
|
38
|
+
installLogPath: string
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
// Lay down everything a workspace needs: create the folder, copy the bundled
|
|
@@ -47,6 +49,7 @@ export async function provisionWorkspace(
|
|
|
47
49
|
const skillsDir = skillsDirFor(workspaceRoot, type)
|
|
48
50
|
await mkdir(workspaceRoot, { recursive: true })
|
|
49
51
|
await installBundledSkills(skillsDir)
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
+
const installLogPath = createDependencyInstallLogPath()
|
|
53
|
+
const scaffold = await scaffoldMoiDir(workspaceRoot, undefined, undefined, installLogPath)
|
|
54
|
+
return { skillsDir, scaffold, installLogPath }
|
|
52
55
|
}
|