@mobius-os/mobius 0.3.8 → 0.3.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/aimux.ts +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobius-os/mobius",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "description": "Mobius terminal client. Reuses Mobius frontend TypeScript types and jsonl entry shapes.",
6
6
  "bin": {
package/src/aimux.ts CHANGED
@@ -89,6 +89,7 @@ async function pythonForAimux(onProgress?: (p: InstallProgress) => void): Promis
89
89
  // 系统 python(如被精简掉 ensurepip 的容器镜像)。aimux 全部依赖为纯 Python,
90
90
  // 故三平台可共用同一套打包产物,分别按 arch 发布到 CDN。
91
91
  const BUNDLE_VER = '2'
92
+ const BUNDLE_AIMUX_VERSION = '0.1.21'
92
93
  const bundleDir = () => path.join(mobiusHome(), 'python-bundle')
93
94
  const bundlePython = () => WIN
94
95
  ? path.join(bundleDir(), 'python', 'python.exe')
@@ -119,8 +120,19 @@ export function bundleArch(): string | null {
119
120
  export const bundleBaseUrl = () => (process.env.MOBIUS_TUI_PYTHON_BUNDLE_URL || 'https://serve.nutshellai.cn/publish/auto/mobius-tui').replace(/\/$/, '')
120
121
  export const bundleUrl = (arch: string) => `${bundleBaseUrl()}/mobius-python-${arch}-v${BUNDLE_VER}.zip`
121
122
 
123
+ export function bundleHealthCheckCode(platform: NodeJS.Platform = process.platform): string {
124
+ const imports = platform === 'win32'
125
+ ? 'import aimux, aimux.bridge_client, win32_setctime'
126
+ : 'import aimux, aimux.bridge_client'
127
+ return `${imports}; assert aimux.__version__ == '${BUNDLE_AIMUX_VERSION}'`
128
+ }
129
+
122
130
  function bundleReady(): boolean {
123
- return existsSync(bundlePython()) && spawnSync(bundlePython(), ['-c', 'import aimux'], { stdio: 'ignore', windowsHide: true }).status === 0
131
+ return existsSync(bundlePython()) && spawnSync(
132
+ bundlePython(),
133
+ ['-c', bundleHealthCheckCode()],
134
+ { stdio: 'ignore', windowsHide: true },
135
+ ).status === 0
124
136
  }
125
137
 
126
138
  async function downloadBundle(arch: string, onProgress?: (p: InstallProgress) => void): Promise<{ ok: boolean; error?: string; zipPath?: string }> {