Skip to content

Commit 9ee7ca8

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 85ab979 commit 9ee7ca8

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
@@ -790,6 +790,13 @@ export namespace Config {
790790
.enum(["auto", "stacked"])
791791
.optional()
792792
.describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),
793+
session_list_limit: z
794+
.number()
795+
.int()
796+
.min(1)
797+
.max(10000)
798+
.optional()
799+
.describe("Maximum number of sessions to display in session list (default: 150)"),
793800
})
794801

795802
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
@@ -1598,6 +1598,10 @@ export type Config = {
15981598
* Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column
15991599
*/
16001600
diff_style?: "auto" | "stacked"
1601+
/**
1602+
* Maximum number of sessions to display in session list (default: 150)
1603+
*/
1604+
session_list_limit?: number
16011605
}
16021606
server?: ServerConfig
16031607
/**

packages/sdk/openapi.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9220,6 +9220,12 @@
92209220
"description": "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column",
92219221
"type": "string",
92229222
"enum": ["auto", "stacked"]
9223+
},
9224+
"session_list_limit": {
9225+
"description": "Maximum number of sessions to display in session list (default: 150)",
9226+
"type": "integer",
9227+
"minimum": 1,
9228+
"maximum": 10000
92239229
}
92249230
}
92259231
},

0 commit comments

Comments
 (0)