Commit fb486a0
committed
api: add
The v1 messages endpoint previously only supported backward
pagination via the `before` cursor. Adding an `after` cursor enables
the TUI to recover messages that have been evicted from the in-memory
window when the user scrolls back toward the live tail.
- MessageV2.page accepts an optional `after` cursor (mutually
exclusive with `before`); when set, it returns the next page in
ascending chronological order using a `newer()` predicate.
- Handler validates that only one of `before`/`after` is supplied,
decodes the cursor, and emits the `Link` / `X-Next-Cursor` headers
with the correct direction parameter.
- MessagesQuery schema gains an optional `after` field.
- Tests cover forward pagination across multiple pages and the
before+after-together rejection path.after cursor for forward pagination on /session/:id/message1 parent 0a139ab commit fb486a0
4 files changed
Lines changed: 78 additions & 8 deletions
File tree
- packages/opencode
- src
- server/routes/instance/httpapi
- groups
- handlers
- session
- test/session
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| |||
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| 123 | + | |
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
| |||
119 | 129 | | |
120 | 130 | | |
121 | 131 | | |
122 | | - | |
| 132 | + | |
| 133 | + | |
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
598 | 603 | | |
599 | 604 | | |
600 | 605 | | |
| |||
919 | 924 | | |
920 | 925 | | |
921 | 926 | | |
922 | | - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
923 | 930 | | |
| 931 | + | |
924 | 932 | | |
925 | 933 | | |
926 | | - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
927 | 937 | | |
928 | 938 | | |
929 | 939 | | |
930 | 940 | | |
931 | 941 | | |
932 | | - | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
933 | 946 | | |
934 | 947 | | |
935 | 948 | | |
| |||
947 | 960 | | |
948 | 961 | | |
949 | 962 | | |
950 | | - | |
951 | | - | |
| 963 | + | |
| 964 | + | |
952 | 965 | | |
953 | 966 | | |
954 | 967 | | |
955 | | - | |
| 968 | + | |
956 | 969 | | |
957 | 970 | | |
958 | 971 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
289 | 334 | | |
290 | 335 | | |
291 | 336 | | |
| |||
0 commit comments