@mobius-os/mobius 0.3.46 → 0.3.47

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.46",
3
+ "version": "0.3.47",
4
4
  "type": "module",
5
5
  "description": "Mobius terminal client. Reuses Mobius frontend TypeScript types and jsonl entry shapes.",
6
6
  "bin": {
@@ -389,6 +389,12 @@ export function ChatScreen({ client, ready, webUserId, resumeSessionId, onClear,
389
389
  ? <WelcomeCard ready={ready} columns={terminal.columns} resumed={Boolean(resumeSessionId)} modelDisplay={modelDisplay} />
390
390
  : <CompactHeader ready={ready} sessionId={chat.sessionId} columns={terminal.columns} />}
391
391
 
392
+ {chat.switchedAway ? (
393
+ <Box flexShrink={0} borderStyle="round" borderColor="yellow" paddingX={1}>
394
+ <Text color="yellow" bold>注意:智能体已经离开此设备前往新设备({chat.switchedAway})</Text>
395
+ </Box>
396
+ ) : null}
397
+
392
398
  {!showWelcome
393
399
  ? <Box width="100%" flexShrink={0}><Text dimColor wrap="truncate-end"> {navigationPosition}{viewport.hasNewer ? <Text color="yellowBright">↓ 有新内容</Text> : null}{navigationDetail}</Text></Box>
394
400
  : null}
@@ -36,6 +36,8 @@ export interface ChatController {
36
36
  sending: boolean
37
37
  error: string | null
38
38
  sessionId: string | null
39
+ /** 智能体已离开本 TUI 设备、前往的新设备 ID; null = 未离开 (仍绑定本设备或非本设备会话). */
40
+ switchedAway: string | null
39
41
  send: (text: string) => Promise<void>
40
42
  stop: () => Promise<void>
41
43
  pauseToDequeue: () => Promise<void>
@@ -116,6 +118,7 @@ export function useChat({ client, ready, resumeSessionId }: ChatApi): ChatContro
116
118
  const [typing, setTyping] = useState(false)
117
119
  const [sending, setSending] = useState(false)
118
120
  const [error, setError] = useState<string | null>(null)
121
+ const [switchedAway, setSwitchedAway] = useState<string | null>(null)
119
122
  const sseRef = useRef<SseConnection | null>(null)
120
123
  // agent-history mini group store (协议 ①②③ 的 TUI 侧消费形态).
121
124
  const groupSlotsRef = useRef<Map<string, GroupSlot>>(new Map())
@@ -407,6 +410,14 @@ export function useChat({ client, ready, resumeSessionId }: ChatApi): ChatContro
407
410
  if (stopped || epoch !== statusEpochRef.current) return
408
411
  aliveRef.current = !!status.alive
409
412
 
413
+ // 设备切换检测: 本会话最初绑定本 TUI 设备 (initial_aimux_id == myId) 但当前已指向
414
+ // 别处 (aimux_id != myId) → 智能体"已离开本设备前往新设备". 用于渲染显眼提示 (仅 TUI 端).
415
+ const myId = tuiAimuxIdentifier()
416
+ const left = status.initial_aimux_id === myId && status.aimux_id && status.aimux_id !== myId
417
+ ? status.aimux_id
418
+ : null
419
+ setSwitchedAway(left)
420
+
410
421
  if (status.alive && status.working) {
411
422
  workingHintUntilRef.current = 0
412
423
  updateTyping(true)
@@ -552,5 +563,5 @@ export function useChat({ client, ready, resumeSessionId }: ChatApi): ChatContro
552
563
  pollNowRef.current?.()
553
564
  }, [sessionId, client])
554
565
 
555
- return { entries, pendingUser, pending, typing, sending, error, sessionId, send, stop, pauseToDequeue }
566
+ return { entries, pendingUser, pending, typing, sending, error, sessionId, switchedAway, send, stop, pauseToDequeue }
556
567
  }
package/src/types.ts CHANGED
@@ -84,6 +84,7 @@ export interface Issue {
84
84
  export interface PcClientMetadata {
85
85
  work_mode: 'hub' | 'pc' | 'dual'
86
86
  aimux_id: string
87
+ initial_aimux_id?: string
87
88
  local_path?: string
88
89
  is_tui: boolean
89
90
  add_remote_aimux_mcp?: boolean
@@ -137,6 +138,8 @@ export interface SessionRuntimeStatus {
137
138
  agent_backend?: string
138
139
  real_time_info?: string
139
140
  model_available?: boolean
141
+ aimux_id?: string | null
142
+ initial_aimux_id?: string | null
140
143
  }
141
144
 
142
145
  // ── Preferences lookups ──────────────────────────────────────────────────────