@brimveyn/aimux 1.10.1 → 1.10.2

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": "@brimveyn/aimux",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "A terminal multiplexer for AI CLIs. Run Claude, Codex, OpenCode side-by-side with tabbed navigation, split panes, and persistent sessions.",
5
5
  "keywords": [
6
6
  "ai",
package/src/app.tsx CHANGED
@@ -32,7 +32,7 @@ import { startAIUsageService } from './services/ai-usage/provider'
32
32
  import { aiUsageStore } from './state/ai-usage-store'
33
33
  import { appStore, useAppStore } from './state/app-store'
34
34
  import { setActiveDispatch, setActiveSideEffectRunner } from './state/dispatch-ref'
35
- import { loadSessionCatalog } from './state/session-catalog'
35
+ import { findMostRecentSession, loadSessionCatalog } from './state/session-catalog'
36
36
  import { loadSnippetCatalog } from './state/snippet-catalog'
37
37
  import { createInitialState } from './state/store'
38
38
  import { KeymapContext } from './ui/keymap-context'
@@ -134,11 +134,12 @@ export function App({
134
134
  ...(userGitPane?.diffCount !== undefined ? { diffCount: userGitPane.diffCount } : {}),
135
135
  }
136
136
 
137
+ const sessionCatalog = loadSessionCatalog()
137
138
  const initial = createInitialState(
138
139
  json.customCommands,
139
- loadSessionCatalog(),
140
+ sessionCatalog,
140
141
  loadSnippetCatalog(),
141
- true,
142
+ sessionCatalog.length === 0,
142
143
  {
143
144
  gitPane: gitPaneOverrides,
144
145
  sessionBarPosition,
@@ -149,6 +150,14 @@ export function App({
149
150
  // Replace the module-level default with the fully-resolved initial state.
150
151
  // Preserves the dispatch baked into the store by app-store.ts.
151
152
  appStore.setState(initial)
153
+ const mostRecent = findMostRecentSession(sessionCatalog)
154
+ if (mostRecent) {
155
+ appStore.getState().dispatch({
156
+ sessionId: mostRecent.id,
157
+ type: 'load-session',
158
+ workspaceSnapshot: mostRecent.workspaceSnapshot,
159
+ })
160
+ }
152
161
  return null
153
162
  })
154
163
 
@@ -96,6 +96,16 @@ export function getSessionCatalogPath(): string {
96
96
  return SESSIONS_PATH
97
97
  }
98
98
 
99
+ export function findMostRecentSession(sessions: SessionRecord[]): SessionRecord | undefined {
100
+ let best: SessionRecord | undefined
101
+ for (const candidate of sessions) {
102
+ if (!best || candidate.lastOpenedAt.localeCompare(best.lastOpenedAt) > 0) {
103
+ best = candidate
104
+ }
105
+ }
106
+ return best
107
+ }
108
+
99
109
  /**
100
110
  * Assign a stable `order` to every session. Records with an existing numeric
101
111
  * `order` keep their slot (sorted ascending); the rest are appended by