@mobius-os/mobius 0.3.64 → 0.3.66

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobius-os/mobius",
3
- "version": "0.3.64",
3
+ "version": "0.3.66",
4
4
  "type": "module",
5
5
  "description": "Mobius terminal client. Reuses Mobius frontend TypeScript types and jsonl entry shapes.",
6
6
  "bin": {
@@ -13,8 +13,8 @@ set -euo pipefail
13
13
 
14
14
  TAG=20241002
15
15
  PYVER=3.12.7
16
- BUNDLE_VER=13
17
- AIMUX_VERSION=0.3.64
16
+ BUNDLE_VER=14
17
+ AIMUX_VERSION=0.3.66
18
18
  PYPI_INDEX=https://pypi.org/simple
19
19
  WORK="${WORK:-$HOME/python-bundles}"
20
20
  DIST="${DIST:-$WORK/dist}"
package/src/aimux.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { spawn, spawnSync, type ChildProcess, type StdioOptions } from 'node:child_process'
9
9
  import { createHash } from 'node:crypto'
10
- import { promises as fs, existsSync, createWriteStream, mkdirSync, openSync, closeSync } from 'node:fs'
10
+ import { promises as fs, existsSync, createWriteStream, mkdirSync, openSync, closeSync, readFileSync, writeFileSync } from 'node:fs'
11
11
  import os from 'node:os'
12
12
  import path from 'node:path'
13
13
  import { Readable } from 'node:stream'
@@ -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.3.64'
35
+ const AIMUX_TARGET_VERSION = '0.3.66'
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')
@@ -93,7 +93,7 @@ async function pythonForAimux(onProgress?: (p: InstallProgress) => void): Promis
93
93
  // 系统 python(如被精简掉 ensurepip 的容器镜像)。aimux 全部依赖为纯 Python,
94
94
  // 故三平台可共用同一套打包产物,分别按 arch 发布到 CDN。
95
95
  /** Plan B 内置运行时包版本;每次发版跟 aimux pin 一起 +1,测试也从这里取。 */
96
- export const BUNDLE_VER = '13'
96
+ export const BUNDLE_VER = '14'
97
97
  const BUNDLE_AIMUX_VERSION = AIMUX_TARGET_VERSION
98
98
  /** Version expected from the installed or bundled AIMUX runtime. */
99
99
  export const AIMUX_VERSION = BUNDLE_AIMUX_VERSION
@@ -365,14 +365,41 @@ export function aimuxWorkspaceHash(username = currentUsername(), cwd = process.c
365
365
  return createHash('sha256').update(`${username}:${path.resolve(cwd)}`).digest('hex').slice(0, 10)
366
366
  }
367
367
 
368
- export function tuiAimuxIdentifier(hostname = os.hostname(), cwd = process.cwd(), username = currentUsername()): string {
368
+ // ── GUI (computer use) authorization ─────────────────────────────────────
369
+ // Machine-level choice made in the first-run wizard: when true the reverse
370
+ // client registers as gui-<host>-<hash> and connects with --enable-gui, so
371
+ // the remote exposes the remote_gui_* (computer use) toolset.
372
+ const GUI_AUTH_FILE = 'tui-gui-authorized.json'
373
+ let guiAuthorizedCache: boolean | undefined = undefined
374
+
375
+ export function tuiGuiAuthorized(): boolean {
376
+ if (guiAuthorizedCache === undefined) {
377
+ try {
378
+ const raw = readFileSync(path.join(mobiusHome(), GUI_AUTH_FILE), 'utf8')
379
+ guiAuthorizedCache = (JSON.parse(raw) as { gui?: boolean })?.gui === true
380
+ } catch { guiAuthorizedCache = false }
381
+ }
382
+ return guiAuthorizedCache
383
+ }
384
+
385
+ export function setTuiGuiAuthorized(value: boolean): void {
386
+ guiAuthorizedCache = value
387
+ try {
388
+ mkdirSync(mobiusHome(), { recursive: true })
389
+ writeFileSync(path.join(mobiusHome(), GUI_AUTH_FILE), JSON.stringify({ gui: value }), { mode: 0o600 })
390
+ } catch { /* unwritable home: the in-memory cache still holds this session */ }
391
+ }
392
+
393
+ export function tuiAimuxIdentifier(hostname = os.hostname(), cwd = process.cwd(), username = currentUsername(), guiEnabled = tuiGuiAuthorized()): string {
369
394
  const host = hostname.toLowerCase().replace(/[^a-z0-9_.-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32)
370
395
  // One machine may run several Mobius TUIs for different projects (and for
371
396
  // different users). A hostname-only identifier makes every reverse client
372
397
  // register with the same name and --replace continuously evicts its siblings.
373
398
  // The (username, cwd) hash is stable across restarts/resume but unique per
374
399
  // user and per workspace, so separate projects/users never collide.
375
- return `tui-${host || 'pc'}-${aimuxWorkspaceHash(username, cwd)}`
400
+ // GUI-authorized machines register under a gui- prefix so the capability is
401
+ // visible in the remote name itself (web device picker, remote ls).
402
+ return `${guiEnabled ? 'gui' : 'tui'}-${host || 'pc'}-${aimuxWorkspaceHash(username, cwd)}`
376
403
  }
377
404
 
378
405
  // ── shared daemon runtime JSON (one reverse connect per user+workspace) ──
@@ -437,6 +464,7 @@ export function reverseConnectArgs(
437
464
  platform: NodeJS.Platform = process.platform,
438
465
  silentFlag: string | null = null,
439
466
  runtimeFile: string | null = null,
467
+ enableGui = false,
440
468
  ): string[] {
441
469
  return [
442
470
  'reverse', 'connect', `${server.replace(/\/$/, '')}/aimux_bridge`,
@@ -445,6 +473,7 @@ export function reverseConnectArgs(
445
473
  '--replace',
446
474
  ...(runtimeFile ? ['--runtime', runtimeFile, '--watchdog', runtimeFile] : []),
447
475
  ...(platform === 'win32' && silentFlag ? [silentFlag] : []),
476
+ ...(enableGui ? ['--enable-gui'] : []),
448
477
  ]
449
478
  }
450
479
 
@@ -479,6 +508,15 @@ export function pickSilentFlag(helpText: string, platform: NodeJS.Platform = pro
479
508
  return null
480
509
  }
481
510
 
511
+ /**
512
+ * Does this aimux build advertise --enable-gui (0.3.64+)? Older installs
513
+ * reject unknown options outright, so the flag is only sent when the help
514
+ * text confirms it — same defensive pattern as pickSilentFlag.
515
+ */
516
+ export function pickEnableGuiFlag(helpText: string): boolean {
517
+ return /--enable-gui\b/.test(helpText)
518
+ }
519
+
482
520
  /** Result of a bridge heartbeat: is the stream up, and did the JWT just get rejected? */
483
521
  export interface AimuxBridgeProbe { connected: boolean; authError: boolean }
484
522
 
@@ -577,7 +615,7 @@ export class AimuxSupervisor {
577
615
  if (pid !== null && pidAlive(pid)) { await touchWatchdog(this.hash); return }
578
616
  const { server, token, identifier, onStatus } = this.opts
579
617
  onStatus({ state: 'starting', phase: 'connecting', detail: '正在启动 AIMUX 守护进程…', identifier, attempt: this.reconnectAttempt })
580
- const child = this.opts.spawnProcess?.(token) ?? spawnDetachedDaemon({ kind: 'exe', path: aimuxExe() }, reverseConnectArgs(server, identifier, token, process.platform, null, runtimePath(this.hash)))
618
+ const child = this.opts.spawnProcess?.(token) ?? spawnDetachedDaemon({ kind: 'exe', path: aimuxExe() }, reverseConnectArgs(server, identifier, token, process.platform, null, runtimePath(this.hash), tuiGuiAuthorized()))
581
619
  child.on('error', (e: Error) => { appendAimuxLog(installLogQueue, `\n[aimux spawn error] ${e.stack || e.message}\n`) })
582
620
  child.unref?.()
583
621
  this.reconnectAttempt = 0
@@ -702,6 +740,9 @@ interface StartOptions {
702
740
  // not probed yet this process). Cached so reconnects reuse it without re-running
703
741
  // `aimux reverse connect --help`. See reverseConnectArgs for why this is probed.
704
742
  let cachedSilentFlag: string | null | undefined = undefined
743
+ // Same caching for --enable-gui support (aimux 0.3.64+): sending it to an older
744
+ // build crashes the supervisor with "No such option".
745
+ let cachedEnableGui: boolean | undefined = undefined
705
746
 
706
747
  export async function startAimuxConnection(opts: StartOptions): Promise<void> {
707
748
  const onStatus = opts.onStatus ?? (() => {})
@@ -727,15 +768,23 @@ export async function startAimuxConnection(opts: StartOptions): Promise<void> {
727
768
  // Windows only: ask the installed aimux which console-hiding flag it accepts
728
769
  // before spawning, so a version mismatch (older PyPI/bundle aimux without
729
770
  // --slient-v2) can't crash-loop the supervisor with "No such option".
730
- if (WIN && cachedSilentFlag === undefined) {
771
+ const needGuiFlag = tuiGuiAuthorized()
772
+ if (cachedSilentFlag === undefined || (needGuiFlag && cachedEnableGui === undefined)) {
731
773
  const help = await probeReverseConnectHelp(launcher)
732
- cachedSilentFlag = pickSilentFlag(help)
733
- logInstall(`reverse-connect silent flag probe → ${cachedSilentFlag ?? '(none supported; sending no flag)'}\n`)
774
+ if (WIN && cachedSilentFlag === undefined) {
775
+ cachedSilentFlag = pickSilentFlag(help)
776
+ logInstall(`reverse-connect silent flag probe → ${cachedSilentFlag ?? '(none supported; sending no flag)'}\n`)
777
+ }
778
+ if (needGuiFlag && cachedEnableGui === undefined) {
779
+ cachedEnableGui = pickEnableGuiFlag(help)
780
+ logInstall(`reverse-connect --enable-gui probe → ${cachedEnableGui ? 'supported' : 'NOT supported (skipping; upgrade aimux to 0.3.64+)'}\n`)
781
+ }
734
782
  }
735
783
  const silentFlag = cachedSilentFlag
784
+ const enableGui = needGuiFlag && cachedEnableGui === true
736
785
  supervisor = new AimuxSupervisor({
737
786
  server: opts.server, token: opts.token, identifier, onStatus, refreshToken: opts.refreshToken,
738
- spawnProcess: token => spawnDetachedDaemon(launcher, reverseConnectArgs(opts.server, identifier, token, process.platform, silentFlag, runtimePath(aimuxWorkspaceHash()))),
787
+ spawnProcess: token => spawnDetachedDaemon(launcher, reverseConnectArgs(opts.server, identifier, token, process.platform, silentFlag, runtimePath(aimuxWorkspaceHash()), enableGui)),
739
788
  })
740
789
  await supervisor.start()
741
790
  })().finally(() => { installing = null })
@@ -747,6 +796,20 @@ export async function stopAimuxConnection(): Promise<void> {
747
796
  await current?.stop()
748
797
  }
749
798
 
799
+ /**
800
+ * Re-do the reverse connection after the GUI authorization choice changed:
801
+ * the identifier flips tui-⇄gui-, so the old daemon must die first (its
802
+ * runtime JSON is keyed by workspace hash, not identifier) and a fresh one
803
+ * spawns with/without --enable-gui. No-op when no connection is up yet —
804
+ * the next startAimuxConnection picks the new flag up anyway.
805
+ */
806
+ export async function restartAimuxConnectionForGuiChange(): Promise<void> {
807
+ const opts = lastStartOpts
808
+ await stopAimuxConnection()
809
+ await stopDaemonFromRuntime()
810
+ if (opts) await startAimuxConnection(opts)
811
+ }
812
+
750
813
  /** SIGTERM 掉本工作区 runtime JSON 里记录的守护进程,并删掉该文件。
751
814
  * 不这么做的话,新 supervisor 会按 pid 复用到刚升级前的旧 daemon。 */
752
815
  async function stopDaemonFromRuntime(): Promise<void> {
@@ -27,7 +27,7 @@ import {
27
27
  bindCwdToProject, cwd, getCwdPreference, loadDir2Project, loadProjectsCache,
28
28
  saveProjectsCache, setCwdIssue, updateIssuePreference, type IssuePreference,
29
29
  } from '../config.js'
30
- import { tuiAimuxIdentifier } from '../aimux.js'
30
+ import { tuiAimuxIdentifier, tuiGuiAuthorized} from '../aimux.js'
31
31
  import type { Issue, Project, SessionModelOption } from '../types.js'
32
32
 
33
33
  export interface ConfigResult {
@@ -82,6 +82,7 @@ export function ConfigFlow({ client, issue, onDone }: {
82
82
  local_path: process.cwd(),
83
83
  is_tui: true,
84
84
  add_remote_aimux_mcp: true,
85
+ ...(tuiGuiAuthorized() ? { gui_authorized: true } : {}),
85
86
  },
86
87
  })
87
88
  if (doneRef.current) return
@@ -281,6 +282,7 @@ export function ReconfigFlow({ client, onDone, onCancel }: {
281
282
  local_path: process.cwd(),
282
283
  is_tui: true,
283
284
  add_remote_aimux_mcp: true,
285
+ ...(tuiGuiAuthorized() ? { gui_authorized: true } : {}),
284
286
  },
285
287
  })
286
288
  if (doneRef.current) return
@@ -15,14 +15,20 @@ import React, { useEffect, useState } from 'react'
15
15
  import { Box, Text } from 'ink'
16
16
  import { Select, TextInput, type SelectItem } from './primitives.js'
17
17
  import { MobiusClient } from '../api.js'
18
+ import { restartAimuxConnectionForGuiChange, setTuiGuiAuthorized, tuiGuiAuthorized } from '../aimux.js'
18
19
  import {
19
20
  bindCwdToProject, cwd, getCwdPreference, loadDir2Project, loadProjectsCache,
20
21
  saveProjectsCache, setCwdIssue, updateIssuePreference, type IssuePreference,
21
22
  } from '../config.js'
22
23
  import type { Issue, Memory, Project, SessionModelOption, Skill } from '../types.js'
23
24
 
24
- type PrefStep = 'issue' | 'model' | 'language' | 'skills' | 'memories'
25
- const STEP_ORDER: PrefStep[] = ['model', 'language', 'skills', 'memories']
25
+ type PrefStep = 'issue' | 'model' | 'language' | 'gui' | 'skills' | 'memories'
26
+ // GUI authorization is only meaningful where a computer-use helper exists
27
+ // (Windows/macOS in this release); other platforms never see the step.
28
+ const GUI_STEP_PLATFORMS: NodeJS.Platform[] = ['win32', 'darwin']
29
+ const STEP_ORDER: PrefStep[] = GUI_STEP_PLATFORMS.includes(process.platform)
30
+ ? ['model', 'language', 'gui', 'skills', 'memories']
31
+ : ['model', 'language', 'skills', 'memories']
26
32
 
27
33
  export interface ReadyState {
28
34
  project: Project
@@ -48,6 +54,10 @@ export function PrepScreen({ client, onReady, onQuit }: {
48
54
  const [memories, setMemories] = useState<Memory[]>([])
49
55
  const [defaultModel, setDefaultModel] = useState<string | null>(null)
50
56
  const [statusMsg, setStatusMsg] = useState<string>('')
57
+ // GUI 授权的确认子屏: 选"是"后先停下来高亮提醒(Windows 会弹 UAC), 用户再确认才真正生效
58
+ // GUI authorization confirm sub-screen: pause with a highlighted notice (a
59
+ // UAC prompt follows on Windows) before the choice takes effect.
60
+ const [guiConfirm, setGuiConfirm] = useState(false)
51
61
  const thisCwd = cwd()
52
62
 
53
63
  // ── bootstrap ────────────────────────────────────────────────────────────
@@ -213,6 +223,54 @@ export function PrepScreen({ client, onReady, onQuit }: {
213
223
  items={[{ label: '中文', value: 'zh' }, { label: 'English', value: 'en' }]}
214
224
  onSelect={v => completeStep('language', { language: v as 'zh' | 'en' })} />
215
225
  : null}
226
+ {step === 'gui' && !guiConfirm
227
+ ? <Select
228
+ title="是否授权操作图形界面 (GUI/computer use)"
229
+ items={[
230
+ { label: `否(默认)`, value: 'no', desc: '仅命令行/文件方式操作本机' },
231
+ { label: `是`, value: 'yes', desc: '以 gui- 前缀注册 bridge client 并启用界面操作工具' },
232
+ ]}
233
+ onSelect={v => {
234
+ if (v === 'yes') {
235
+ // 先停在确认屏: 让用户对即将出现的系统授权弹窗有预期, 不做突袭
236
+ // Pause on the confirm screen first so the OS prompt never
237
+ // ambushes the user.
238
+ setGuiConfirm(true)
239
+ return
240
+ }
241
+ if (tuiGuiAuthorized()) {
242
+ setTuiGuiAuthorized(false)
243
+ void restartAimuxConnectionForGuiChange()
244
+ }
245
+ completeStep('gui', {})
246
+ }} />
247
+ : null}
248
+ {step === 'gui' && guiConfirm
249
+ ? <Box flexDirection="column" borderStyle="round" borderColor="yellow" paddingX={1}>
250
+ <Text bold color="yellow">⚠ 即将授权操作图形界面</Text>
251
+ <Text color="yellow">确认后{process.platform === 'win32' ? '系统会弹出 UAC 管理员授权窗口' : '将启用界面操作工具'},请留意屏幕上的弹窗并点击确认。</Text>
252
+ <Text color="yellow">授权后本机以 gui- 前缀注册,智能体可以操作本机图形界面(含{process.platform === 'win32' ? '管理员' : ''}窗口)。</Text>
253
+ <Box marginTop={1}>
254
+ <Select
255
+ title="继续吗?"
256
+ items={[
257
+ { label: '继续并授权', value: 'go', desc: process.platform === 'win32' ? '回车后请到 UAC 弹窗点击"是"' : '启用界面操作' },
258
+ { label: '取消', value: 'cancel', desc: '返回上一题,不做任何改动' },
259
+ ]}
260
+ onSelect={v => {
261
+ if (v !== 'go') { setGuiConfirm(false); return }
262
+ setTuiGuiAuthorized(true)
263
+ // 标识符在 tui-⇄gui- 间切换, 旧守护进程必须换掉才能带上 --enable-gui
264
+ // (Windows 下新客户端启动时会请求管理员权限 → UAC 弹窗)
265
+ // The identifier flips tui-⇄gui-, so the daemon restarts with
266
+ // --enable-gui (which triggers the UAC request on Windows).
267
+ void restartAimuxConnectionForGuiChange()
268
+ setGuiConfirm(false)
269
+ completeStep('gui', {})
270
+ }} />
271
+ </Box>
272
+ </Box>
273
+ : null}
216
274
  {step === 'skills'
217
275
  ? <MultiPicker title={`选择启用的 Skill(默认全部启用,空格取消)`} items={toItems(skills)}
218
276
  excluded={prefs.excluded_skill_ids}
@@ -17,7 +17,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
17
17
  import { MobiusClient, ApiError } from '../api.js'
18
18
  import { SseConnection } from '../sse.js'
19
19
  import { updateIssuePreference } from '../config.js'
20
- import { tuiAimuxIdentifier, probeAimuxBridgeConnection } from '../aimux.js'
20
+ import { tuiGuiAuthorized, tuiAimuxIdentifier, probeAimuxBridgeConnection } from '../aimux.js'
21
21
  import { viewsForEntry } from '../lib/entry-view.js'
22
22
  import type { AnyEntry, HistoryPendingOpener } from '../types.js'
23
23
  import type { ReadyState } from '../components/PrepScreen.js'
@@ -493,6 +493,7 @@ export function useChat({ client, ready, resumeSessionId }: ChatApi): ChatContro
493
493
  local_path: process.cwd(),
494
494
  is_tui: true,
495
495
  add_remote_aimux_mcp: true,
496
+ ...(tuiGuiAuthorized() ? { gui_authorized: true } : {}),
496
497
  },
497
498
  })
498
499
  const sid = s.session_id
@@ -7,7 +7,7 @@ import os from 'node:os'
7
7
  import path from 'node:path'
8
8
  import { render } from 'ink-testing-library'
9
9
  import { AimuxStatusLine } from '../src/components/AimuxStatus.js'
10
- import { AimuxSupervisor, probeAimuxBridgeConnection, BUNDLE_VER, bundleArch, bundleUrl, spawnLauncher, ensureFromBundle, downloadBundleForTest, reverseConnectArgs, pickSilentFlag, versionAtLeast, aimuxLogPath, bundleHealthCheckCode, tuiAimuxIdentifier, AIMUX_VERSION } from '../src/aimux.js'
10
+ import { AimuxSupervisor, probeAimuxBridgeConnection, BUNDLE_VER, bundleArch, bundleUrl, spawnLauncher, ensureFromBundle, downloadBundleForTest, reverseConnectArgs, pickSilentFlag, versionAtLeast, aimuxLogPath, bundleHealthCheckCode, tuiAimuxIdentifier, AIMUX_VERSION, tuiGuiAuthorized, setTuiGuiAuthorized, pickEnableGuiFlag } from '../src/aimux.js'
11
11
 
12
12
  const delay = (ms: number) => new Promise<void>(resolve => setTimeout(resolve, ms))
13
13
  let pass = 0, fail = 0
@@ -226,6 +226,34 @@ function testPickSilentFlag() {
226
226
  ok(pickSilentFlag(' --silent-v2 Hide console.', 'linux') === null, 'off-Windows → always null')
227
227
  }
228
228
 
229
+ function testGuiAuthorization() {
230
+ console.log('\n[AIMUX 6c] GUI authorization: identifier prefix + --enable-gui args')
231
+ // Default (flag off): classic tui- prefix, no --enable-gui.
232
+ ok(tuiAimuxIdentifier('host-a', '/w', 'alice', false).startsWith('tui-host-a-'), 'flag off keeps the tui- prefix')
233
+ // Authorized: gui- prefix on the same host/hash — the capability shows in the remote name.
234
+ const tuiId = tuiAimuxIdentifier('host-a', '/w', 'alice', false)
235
+ const guiId = tuiAimuxIdentifier('host-a', '/w', 'alice', true)
236
+ ok(guiId.startsWith('gui-host-a-'), 'authorized client registers as gui-<host>-<hash>')
237
+ ok(guiId.endsWith(tuiId.split('-').slice(-1)[0]), 'gui- identifier keeps the same workspace hash')
238
+ ok(tuiAimuxIdentifier('host-a', '/w', 'alice', false) !== guiId, 'prefix flip changes the identifier')
239
+ // reverse connect args only carry --enable-gui when asked.
240
+ const plain = reverseConnectArgs('https://mobius.test/', 'tui-x', 't', 'linux', null, null, false)
241
+ const gui = reverseConnectArgs('https://mobius.test/', 'gui-x', 't', 'linux', null, null, true)
242
+ ok(!plain.includes('--enable-gui'), 'flag off sends no --enable-gui')
243
+ ok(gui.includes('--enable-gui'), 'authorized connection passes --enable-gui')
244
+ // Probe gates on what aimux advertises (0.3.64+), mirroring pickSilentFlag.
245
+ ok(pickEnableGuiFlag(' --enable-gui Start the GUI helper.') === true, 'probe sees --enable-gui when advertised')
246
+ ok(pickEnableGuiFlag(' --silent-v2 Hide console.') === false, 'probe stays false without --enable-gui')
247
+ // setTuiGuiAuthorized flips the module cache and the default identifier prefix with it.
248
+ const before = tuiAimuxIdentifier('host-b', '/w2', 'bob')
249
+ setTuiGuiAuthorized(true)
250
+ const after = tuiAimuxIdentifier('host-b', '/w2', 'bob')
251
+ ok(before.startsWith('tui-') && after.startsWith('gui-'), 'writing the flag flips the default identifier prefix')
252
+ ok(tuiGuiAuthorized() === true, 'flag reads back true after write')
253
+ setTuiGuiAuthorized(false)
254
+ ok(tuiAimuxIdentifier('host-b', '/w2', 'bob').startsWith('tui-'), 'clearing the flag restores the tui- prefix')
255
+ }
256
+
229
257
  function testVersionAtLeast() {
230
258
  console.log('\n[AIMUX 6c] aimux pin is a floor, not an exact match')
231
259
  // /upgrade 装的是 PyPI 最新版,通常比 pin 新;不能被 pin 校验判成"没装好"又拽回去。
@@ -310,6 +338,7 @@ async function main() {
310
338
  await testSpawnLauncher()
311
339
  testReverseConnectArgs()
312
340
  testPickSilentFlag()
341
+ testGuiAuthorization()
313
342
  testVersionAtLeast()
314
343
  testAimuxIdentifierScopesWorkspace()
315
344
  testBundleHealthCheck()