@geminilight/mindos 0.5.36 → 0.5.38

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.
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+
3
+ import { useState, useEffect, useCallback } from 'react';
4
+ import { MIN_PANEL_WIDTH, MAX_PANEL_WIDTH_ABS, PANEL_WIDTH } from '@/components/Panel';
5
+ import type { PanelId } from '@/components/ActivityBar';
6
+ import { RAIL_WIDTH_COLLAPSED, RAIL_WIDTH_EXPANDED } from '@/components/ActivityBar';
7
+
8
+ export interface LeftPanelState {
9
+ activePanel: PanelId | null;
10
+ setActivePanel: (p: PanelId | null | ((prev: PanelId | null) => PanelId | null)) => void;
11
+ panelWidth: number | null;
12
+ panelMaximized: boolean;
13
+ railExpanded: boolean;
14
+ railWidth: number;
15
+ panelOpen: boolean;
16
+ effectivePanelWidth: number;
17
+ handlePanelWidthChange: (w: number) => void;
18
+ handlePanelWidthCommit: (w: number) => void;
19
+ handlePanelMaximize: () => void;
20
+ handleExpandedChange: (expanded: boolean) => void;
21
+ }
22
+
23
+ /**
24
+ * Manages left panel state: active panel, width, maximize, rail expansion.
25
+ * Extracted from SidebarLayout to reduce its state complexity.
26
+ */
27
+ export function useLeftPanel(): LeftPanelState {
28
+ const [activePanel, setActivePanel] = useState<PanelId | null>('files');
29
+ const [panelWidth, setPanelWidth] = useState<number | null>(null);
30
+ const [panelMaximized, setPanelMaximized] = useState(false);
31
+ const [railExpanded, setRailExpanded] = useState(false);
32
+
33
+ // Load persisted rail state
34
+ useEffect(() => {
35
+ try {
36
+ if (localStorage.getItem('rail-expanded') === 'true') setRailExpanded(true);
37
+ } catch {}
38
+ }, []);
39
+
40
+ // Load persisted panel width when activePanel changes
41
+ useEffect(() => {
42
+ if (!activePanel) return;
43
+ try {
44
+ const stored = localStorage.getItem('left-panel-width');
45
+ if (stored) {
46
+ const w = parseInt(stored, 10);
47
+ if (w >= MIN_PANEL_WIDTH && w <= MAX_PANEL_WIDTH_ABS) {
48
+ setPanelWidth(w);
49
+ return;
50
+ }
51
+ }
52
+ } catch {}
53
+ setPanelWidth(280);
54
+ }, [activePanel]);
55
+
56
+ // Exit maximize when switching panels
57
+ useEffect(() => { setPanelMaximized(false); }, [activePanel]);
58
+
59
+ const handlePanelWidthChange = useCallback((w: number) => setPanelWidth(w), []);
60
+ const handlePanelWidthCommit = useCallback((w: number) => {
61
+ try { localStorage.setItem('left-panel-width', String(w)); } catch {}
62
+ }, []);
63
+ const handlePanelMaximize = useCallback(() => setPanelMaximized(v => !v), []);
64
+
65
+ const handleExpandedChange = useCallback((expanded: boolean) => {
66
+ setRailExpanded(expanded);
67
+ try { localStorage.setItem('rail-expanded', String(expanded)); } catch {}
68
+ }, []);
69
+
70
+ const railWidth = railExpanded ? RAIL_WIDTH_EXPANDED : RAIL_WIDTH_COLLAPSED;
71
+ const panelOpen = activePanel !== null;
72
+ const effectivePanelWidth = panelWidth ?? (activePanel ? PANEL_WIDTH[activePanel] : 280);
73
+
74
+ return {
75
+ activePanel, setActivePanel,
76
+ panelWidth, panelMaximized, railExpanded, railWidth,
77
+ panelOpen, effectivePanelWidth,
78
+ handlePanelWidthChange, handlePanelWidthCommit, handlePanelMaximize,
79
+ handleExpandedChange,
80
+ };
81
+ }
@@ -234,6 +234,7 @@ export const en = {
234
234
  authTokenClear: 'Clear token',
235
235
  authTokenResetConfirm: 'Regenerate token? All existing MCP clients will need to update their config.',
236
236
  authTokenMcpPort: 'MCP port',
237
+ restartWalkthrough: 'Restart walkthrough',
237
238
  },
238
239
  sync: {
239
240
  emptyTitle: 'Cross-device Sync',
@@ -259,6 +259,7 @@ export const zh = {
259
259
  authTokenClear: '清除令牌',
260
260
  authTokenResetConfirm: '重新生成令牌?所有 MCP 客户端配置都需要更新。',
261
261
  authTokenMcpPort: 'MCP 端口',
262
+ restartWalkthrough: '重新开始引导',
262
263
  },
263
264
  sync: {
264
265
  emptyTitle: '跨设备同步',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geminilight/mindos",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "description": "MindOS — Human-Agent Collaborative Mind System. Local-first knowledge base that syncs your mind to all AI Agents via MCP.",
5
5
  "keywords": [
6
6
  "mindos",
@@ -18,7 +18,21 @@ echo "🧪 Running tests..."
18
18
  npm test
19
19
  echo ""
20
20
 
21
- # 3. Smoke test: pack → install in temp dir → verify CLI works
21
+ # 3. Verify Next.js build
22
+ echo "🔨 Verifying Next.js build..."
23
+ cd app
24
+ if npx next build 2>&1 | tail -5; then
25
+ echo " ✅ Next.js build succeeded"
26
+ else
27
+ echo "❌ Next.js build failed"
28
+ exit 1
29
+ fi
30
+ cd ..
31
+ # Restore any files modified by next build (e.g. next-env.d.ts)
32
+ git checkout -- . 2>/dev/null || true
33
+ echo ""
34
+
35
+ # 4. Smoke test: pack → install in temp dir → verify CLI works
22
36
  echo "🔍 Smoke testing package..."
23
37
  SMOKE_DIR=$(mktemp -d)
24
38
  TARBALL=$(npm pack --pack-destination "$SMOKE_DIR" 2>/dev/null | tail -1)
@@ -79,20 +93,20 @@ cd - >/dev/null
79
93
  echo " 🟢 Smoke test passed"
80
94
  echo ""
81
95
 
82
- # 3. Bump version (creates commit + tag automatically)
96
+ # 5. Bump version (creates commit + tag automatically)
83
97
  echo "📦 Bumping version ($BUMP)..."
84
98
  npm version "$BUMP" -m "%s"
85
99
  VERSION="v$(node -p "require('./package.json').version")"
86
100
  echo " Version: $VERSION"
87
101
  echo ""
88
102
 
89
- # 4. Push commit + tag
103
+ # 6. Push commit + tag
90
104
  echo "🚀 Pushing to origin..."
91
105
  git push origin main
92
106
  git push origin "$VERSION"
93
107
  echo ""
94
108
 
95
- # 5. Wait for CI
109
+ # 7. Wait for CI
96
110
  # Flow: tag push → sync-to-mindos (syncs code + tag to public repo) → public repo publish-npm
97
111
  if command -v gh &>/dev/null; then
98
112
  echo "⏳ Waiting for sync → publish pipeline..."