( threadId: string, limit = 8, )
| 996 | } |
| 997 | |
| 998 | export async function getWebCodexThreadRecentMessages( |
| 999 | threadId: string, |
| 1000 | limit = 8, |
| 1001 | ): Promise<{ |
| 1002 | items: WebCodexThreadMessage[]; |
| 1003 | hasMore: boolean; |
| 1004 | }> { |
| 1005 | const filePath = getStoredCodexSessionFileMap().get(threadId); |
| 1006 | if (!filePath || !fs.existsSync(filePath)) { |
| 1007 | return { |
| 1008 | items: [], |
| 1009 | hasMore: false, |
| 1010 | }; |
| 1011 | } |
| 1012 | |
| 1013 | const tail = readFileTail(filePath); |
| 1014 | const messages = parseCodexMessagesFromLines(tail.split('\n')); |
| 1015 | return { |
| 1016 | items: messages.slice(Math.max(0, messages.length - limit)), |
| 1017 | hasMore: messages.length > limit, |
| 1018 | }; |
| 1019 | } |
| 1020 | |
| 1021 | function listWebAutomationsSync(): WebAutomationSummary[] { |
| 1022 | return getStoredAutomationJobs() |
no test coverage detected