MCPcopy
hub / github.com/garrytan/gstack / createSession

Function createSession

design/src/session.ts:36–54  ·  view source on GitHub ↗
(
  responseId: string,
  brief: string,
  outputPath: string,
)

Source from the content-addressed store, hash-verified

34 * Create a new session after initial generation.
35 */
36export function createSession(
37 responseId: string,
38 brief: string,
39 outputPath: string,
40): DesignSession {
41 const id = createSessionId();
42 const session: DesignSession = {
43 id,
44 lastResponseId: responseId,
45 originalBrief: brief,
46 feedbackHistory: [],
47 outputPaths: [outputPath],
48 createdAt: new Date().toISOString(),
49 updatedAt: new Date().toISOString(),
50 };
51
52 fs.writeFileSync(sessionPath(id), JSON.stringify(session, null, 2), { mode: 0o600 });
53 return session;
54}
55
56/**
57 * Read an existing session from disk.

Callers 1

generateFunction · 0.90

Calls 2

createSessionIdFunction · 0.85
sessionPathFunction · 0.85

Tested by

no test coverage detected