MCPcopy Create free account
hub / github.com/cortexkit/magic-context / createSession

Function createSession

packages/plugin/scripts/longmemeval/runner.ts:308–325  ·  view source on GitHub ↗
(
    client: OpencodeClient,
    config: RunnerConfig,
    title: string,
)

Source from the content-addressed store, hash-verified

306}
307
308async function createSession(
309 client: OpencodeClient,
310 config: RunnerConfig,
311 title: string,
312): Promise<string> {
313 const response = await withRetry(config, `session.create:${title}`, (_attempt, signal) =>
314 client.session.create({
315 query: { directory: config.projectDirectory },
316 body: { title },
317 signal,
318 }),
319 );
320 const sessionId = response.data?.id;
321 if (typeof sessionId !== "string" || sessionId.length === 0) {
322 throw new Error(`Session create returned invalid id for ${title}`);
323 }
324 return sessionId;
325}
326
327async function deleteSession(
328 client: OpencodeClient,

Callers 2

ensureReplaySessionFunction · 0.85

Calls 2

withRetryFunction · 0.85
createMethod · 0.45

Tested by

no test coverage detected