MCPcopy Create free account
hub / github.com/GCWing/BitFun / sessionMatchesWorkspace

Function sessionMatchesWorkspace

src/web-ui/src/flow_chat/utils/workspaceScope.ts:19–32  ·  view source on GitHub ↗
(session: SessionScope, workspace: WorkspaceScope)

Source from the content-addressed store, hash-verified

17type WorkspaceScope = Pick<WorkspaceInfo, 'id' | 'rootPath' | 'connectionId' | 'sshHost'>;
18
19export function sessionMatchesWorkspace(session: SessionScope, workspace: WorkspaceScope): boolean {
20 const sid = session.workspaceId?.trim();
21 const wid = workspace.id?.trim();
22 if (sid && wid && sid === wid) {
23 return true;
24 }
25 // Stale or missing id on the session: still match by path + remote scope.
26 return sessionBelongsToWorkspaceNavRow(
27 session,
28 workspace.rootPath,
29 workspace.connectionId ?? null,
30 workspace.sshHost ?? null
31 );
32}
33
34export function findWorkspaceForSession(
35 session: SessionScope,

Calls 2

trimMethod · 0.80

Tested by

no test coverage detected