mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
Share host-wide terminal observations across plugin surfaces and gate them on terminalCollection. Keep directory observations compatible, and carry creation time in worker v6 state so v5 terminals can drain with an unknown timestamp.
14 lines
689 B
TypeScript
14 lines
689 B
TypeScript
// A terminal directory subscription is scoped to a (cwd, workspaceId) pair, not
|
|
// cwd alone: under Model B two workspaces can share a cwd, and each must track
|
|
// and tear down its own live subscription without disturbing the other. An
|
|
// absent workspaceId (old clients) keys to the cwd on its own. The `::`
|
|
// separator cannot collide with a workspace id, which is always `wks_<hex>`.
|
|
export function terminalSubscriptionKey(
|
|
cwd: string | undefined,
|
|
workspaceId: string | undefined,
|
|
): string {
|
|
if (cwd === undefined)
|
|
return workspaceId === undefined ? "terminal-host" : `${workspaceId}::terminal-host`;
|
|
return workspaceId === undefined ? cwd : `${workspaceId}::${cwd}`;
|
|
}
|