MCPcopy Create free account
hub / github.com/Noumena-Network/code / ensureSession

Function ensureSession

src/tools/shared/spawnMultiAgent.ts:172–187  ·  view source on GitHub ↗

* Creates a new tmux session if it doesn't exist

(sessionName: string)

Source from the content-addressed store, hash-verified

170 * Creates a new tmux session if it doesn't exist
171 */
172async function ensureSession(sessionName: string): Promise<void> {
173 const exists = await hasSession(sessionName)
174 if (!exists) {
175 const result = await execFileNoThrow(TMUX_COMMAND, [
176 'new-session',
177 '-d',
178 '-s',
179 sessionName,
180 ])
181 if (result.code !== 0) {
182 throw new Error(
183 `Failed to create tmux session '${sessionName}': ${result.stderr || 'Unknown error'}`,
184 )
185 }
186 }
187}
188
189/**
190 * Builds CLI flags to propagate from the current session to spawned teammates.

Callers 1

Calls 2

hasSessionFunction · 0.85
execFileNoThrowFunction · 0.50

Tested by

no test coverage detected