feat(tui): log event stream connections (#35973)
This commit is contained in:
parent
855a9569b5
commit
b642f9c7bc
3 changed files with 56 additions and 5 deletions
|
|
@ -781,10 +781,19 @@ export function Session() {
|
|||
)
|
||||
: await (async () => {
|
||||
if (options.debug) {
|
||||
const events: unknown[] = []
|
||||
const events: { readonly created: number }[] = []
|
||||
for await (const event of sdk.api.session.log({ sessionID: sessionData.id, follow: false })) {
|
||||
if (event.type !== "log.synced") events.push(event)
|
||||
}
|
||||
// Durable events stay in aggregate order even when their wall-clock timestamps differ.
|
||||
sdk.connection.internal.history().forEach((event) => {
|
||||
const index = events.findIndex((item) => item.created > event.created)
|
||||
if (index === -1) {
|
||||
events.push(event)
|
||||
return
|
||||
}
|
||||
events.splice(index, 0, event)
|
||||
})
|
||||
return JSON.stringify({ info: sessionData, events }, null, 2) + EOL
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue