@mobius-os/mobius 0.3.54 → 0.3.55
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/package.json +1 -1
- package/scripts/build-python-bundles.sh +2 -2
- package/src/aimux.ts +13 -6
- package/tests/aimux.test.tsx +2 -2
package/package.json
CHANGED
package/src/aimux.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type AimuxLauncher =
|
|
|
32
32
|
| { kind: 'exe'; path: string }
|
|
33
33
|
| { kind: 'module'; python: string }
|
|
34
34
|
|
|
35
|
-
const AIMUX_TARGET_VERSION = '0.1.
|
|
35
|
+
const AIMUX_TARGET_VERSION = '0.1.39'
|
|
36
36
|
const AIMUX_PACKAGE = `aimux==${AIMUX_TARGET_VERSION}`
|
|
37
37
|
const WIN = process.platform === 'win32'
|
|
38
38
|
const venvDir = () => path.join(mobiusHome(), 'aimux-venv')
|
|
@@ -92,7 +92,7 @@ async function pythonForAimux(onProgress?: (p: InstallProgress) => void): Promis
|
|
|
92
92
|
// 解压到 ~/.mobius/python-bundle/ 后用 `<python> -m aimux` 运行,彻底绕开宿主机
|
|
93
93
|
// 系统 python(如被精简掉 ensurepip 的容器镜像)。aimux 全部依赖为纯 Python,
|
|
94
94
|
// 故三平台可共用同一套打包产物,分别按 arch 发布到 CDN。
|
|
95
|
-
const BUNDLE_VER = '
|
|
95
|
+
const BUNDLE_VER = '9'
|
|
96
96
|
const BUNDLE_AIMUX_VERSION = AIMUX_TARGET_VERSION
|
|
97
97
|
/** Version expected from the installed or bundled AIMUX runtime. */
|
|
98
98
|
export const AIMUX_VERSION = BUNDLE_AIMUX_VERSION
|
|
@@ -370,17 +370,24 @@ async function readRuntime(hash: string): Promise<RuntimeRecord | null> {
|
|
|
370
370
|
} catch { return null }
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Feed the daemon's watchdog. `last_feed_watchdog` is the liveness signal the
|
|
375
|
+
* daemon reads, so a feed must never be dropped just because the daemon has
|
|
376
|
+
* not written its runtime state yet — that would be a missed heartbeat.
|
|
377
|
+
*/
|
|
373
378
|
async function touchWatchdog(hash: string): Promise<void> {
|
|
374
379
|
await ensureRuntimeDir()
|
|
375
380
|
const file = runtimePath(hash)
|
|
381
|
+
let state: Record<string, unknown> = {}
|
|
382
|
+
try {
|
|
383
|
+
state = JSON.parse(await fs.readFile(file, 'utf8')) as Record<string, unknown>
|
|
384
|
+
} catch { /* AIMUX has not written runtime state yet — start a fresh record */ }
|
|
385
|
+
state.last_feed_watchdog = Date.now()
|
|
376
386
|
try {
|
|
377
|
-
const raw = await fs.readFile(file, 'utf8')
|
|
378
|
-
const state = JSON.parse(raw) as Record<string, unknown>
|
|
379
|
-
state.last_feed_watchdog = Date.now()
|
|
380
387
|
const tmp = `${file}.tmp-${process.pid}`
|
|
381
388
|
await fs.writeFile(tmp, JSON.stringify(state), { mode: 0o600 })
|
|
382
389
|
await fs.rename(tmp, file)
|
|
383
|
-
} catch { /*
|
|
390
|
+
} catch { /* directory not writable; nothing useful to do here */ }
|
|
384
391
|
}
|
|
385
392
|
|
|
386
393
|
function pidAlive(pid: number): boolean {
|
package/tests/aimux.test.tsx
CHANGED
|
@@ -174,11 +174,11 @@ async function testBundleArchAndUrl() {
|
|
|
174
174
|
const arch = bundleArch()
|
|
175
175
|
ok(arch === 'linux-x64' || arch === 'win-x64' || arch === 'mac-x64', `bundleArch returns a supported arch on this host (${arch})`)
|
|
176
176
|
const before = bundleUrl('linux-x64')
|
|
177
|
-
ok(before.includes('mobius-python-linux-x64-
|
|
177
|
+
ok(before.includes('mobius-python-linux-x64-v9') && before.endsWith('.zip'), 'bundleUrl follows the fixed filename pattern')
|
|
178
178
|
const saved = process.env.MOBIUS_TUI_PYTHON_BUNDLE_URL
|
|
179
179
|
process.env.MOBIUS_TUI_PYTHON_BUNDLE_URL = 'https://example.test/cdn/'
|
|
180
180
|
try {
|
|
181
|
-
ok(bundleUrl('win-x64') === 'https://example.test/cdn/mobius-python-win-x64-
|
|
181
|
+
ok(bundleUrl('win-x64') === 'https://example.test/cdn/mobius-python-win-x64-v9.zip', 'MOBIUS_TUI_PYTHON_BUNDLE_URL overrides the CDN base and trims trailing slash')
|
|
182
182
|
} finally { if (saved === undefined) delete process.env.MOBIUS_TUI_PYTHON_BUNDLE_URL; else process.env.MOBIUS_TUI_PYTHON_BUNDLE_URL = saved }
|
|
183
183
|
}
|
|
184
184
|
|