Skip to content

Commit 0037e55

Browse files
feat(tui): add configurable session_list_limit for session picker
Adds session_list_limit config option to limit sessions displayed in the session list dialog (default: 150). Limit only applies when not searching; search uses server-side limit of 30. Remove message_limit as it conflicts with cursor-based pagination (anomalyco#8535) and is now redundant.
1 parent 616329a commit 0037e55

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ export function DialogSessionList() {
3535
const spinnerFrames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
3636

3737
const sessions = createMemo(() => searchResults() ?? sync.data.session)
38+
const isSearching = createMemo(() => search().length > 0)
3839

3940
const options = createMemo(() => {
4041
const today = new Date().toDateString()
42+
const limit = sync.data.config.tui?.session_list_limit ?? 150
4143
return sessions()
4244
.filter((x) => x.parentID === undefined)
4345
.toSorted((a, b) => b.time.updated - a.time.updated)
46+
.slice(0, isSearching() ? undefined : limit)
4447
.map((x) => {
4548
const date = new Date(x.time.updated)
4649
let category = date.toDateString()

packages/opencode/src/config/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,13 @@ export namespace Config {
796796
.enum(["auto", "stacked"])
797797
.optional()
798798
.describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),
799+
session_list_limit: z
800+
.number()
801+
.int()
802+
.min(1)
803+
.max(10000)
804+
.optional()
805+
.describe("Maximum number of sessions to display in session list (default: 150)"),
799806
})
800807

801808
export const Server = z

packages/sdk/js/src/v2/gen/types.gen.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,10 @@ export type Config = {
16091609
* Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column
16101610
*/
16111611
diff_style?: "auto" | "stacked"
1612+
/**
1613+
* Maximum number of sessions to display in session list (default: 150)
1614+
*/
1615+
session_list_limit?: number
16121616
}
16131617
server?: ServerConfig
16141618
/**

packages/sdk/openapi.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9343,6 +9343,12 @@
93439343
"description": "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column",
93449344
"type": "string",
93459345
"enum": ["auto", "stacked"]
9346+
},
9347+
"session_list_limit": {
9348+
"description": "Maximum number of sessions to display in session list (default: 150)",
9349+
"type": "integer",
9350+
"minimum": 1,
9351+
"maximum": 10000
93469352
}
93479353
}
93489354
},

0 commit comments

Comments
 (0)