(threadId: string)
| 772 | } |
| 773 | |
| 774 | export async function getWebCodexThreadDetail(threadId: string): Promise<WebCodexThreadDetail | null> { |
| 775 | const threadList = await listWebCodexThreads(); |
| 776 | const thread = threadList.find((entry) => entry.threadId === threadId); |
| 777 | if (!thread) { |
| 778 | return null; |
| 779 | } |
| 780 | |
| 781 | const allSessions = await listWebSessions(); |
| 782 | const linkedSessions = allSessions |
| 783 | .filter((session) => session.providerKind === 'openai-native' && session.codexThreadId === threadId) |
| 784 | .sort((left, right) => right.updatedAt - left.updatedAt); |
| 785 | |
| 786 | const bindings = getStoredPlatformBindings().filter((binding) => |
| 787 | linkedSessions.some((session) => session.id === binding.bridgeSessionId), |
| 788 | ); |
| 789 | const automations = listWebAutomationsSync().filter((job) => |
| 790 | linkedSessions.some((session) => session.id === job.bridgeSessionId), |
| 791 | ); |
| 792 | const bindingScopes = new Set(bindings.map((binding) => `${binding.platform}:${binding.externalScopeId}`)); |
| 793 | const relatedRecords = getStoredAssistantRecords() |
| 794 | .filter((record) => { |
| 795 | const scopeKey = record.platform && record.scopeId ? `${record.platform}:${record.scopeId}` : null; |
| 796 | return record.contextThreadId === threadId || (scopeKey ? bindingScopes.has(scopeKey) : false); |
| 797 | }) |
| 798 | .sort((left, right) => right.updatedAt - left.updatedAt) |
| 799 | .slice(0, 8) |
| 800 | .map((record) => summarizeAssistantRecord(record)); |
| 801 | |
| 802 | return { |
| 803 | thread, |
| 804 | linkedSessions, |
| 805 | bindings, |
| 806 | automations, |
| 807 | relatedRecords, |
| 808 | }; |
| 809 | } |
| 810 | |
| 811 | export async function getWebCodexThreadSettings( |
| 812 | threadId: string, |
no test coverage detected