feat(server): ship browserless npm runtime

This commit is contained in:
Jinwoo-H
2026-08-12 22:43:30 -04:00
committed by Jinwoo-H
parent 150cc6f50c
commit f4cf8422f9
38 changed files with 2627 additions and 44 deletions
+36
View File
@@ -0,0 +1,36 @@
import type { Store } from '../main/persistence'
import type { RuntimeSyncWindowGraph } from '../shared/runtime-types'
export function createServerWindowGraph(store: Store): RuntimeSyncWindowGraph {
const session = store.getWorkspaceSession()
const tabs: RuntimeSyncWindowGraph['tabs'] = []
const leaves: RuntimeSyncWindowGraph['leaves'] = []
let paneRuntimeId = 1
for (const [worktreeId, persistedTabs] of Object.entries(session.tabsByWorktree ?? {})) {
for (const tab of persistedTabs) {
const layout = session.terminalLayoutsByTabId?.[tab.id]
if (!layout) {
continue
}
tabs.push({
tabId: tab.id,
worktreeId,
title: tab.title,
activeLeafId: layout.activeLeafId,
layout: layout.root
})
for (const [leafId, ptyId] of Object.entries(layout.ptyIdsByLeafId ?? {})) {
leaves.push({
tabId: tab.id,
worktreeId,
leafId,
paneRuntimeId: paneRuntimeId++,
ptyId,
paneTitle: layout.titlesByLeafId?.[leafId] ?? null
})
}
}
}
return { tabs, leaves }
}