mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-09 02:08:19 +01:00
fix(design): keep iterate sessions in the OS temp dir and normalize tripwire paths on Windows
This commit is contained in:
1 parent
042dca060b
commit
9e5048cf9c
3 files changed
+8
-7
No files matched your search
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* Session state management for multi-turn design iteration.
|
||||
* Session files are JSON in /tmp, keyed by PID + timestamp.
|
||||
* Session files are JSON in the OS temp directory, keyed by PID + timestamp.
|
||||
*/
|
||||
|
||||
import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
|
||||
export interface DesignSession {
|
||||
@@ -27,7 +28,7 @@ export function createSessionId(): string {
|
||||
* Get the file path for a session.
|
||||
*/
|
||||
export function sessionPath(sessionId: string): string {
|
||||
return path.join("/tmp", `design-session-${sessionId}.json`);
|
||||
return path.join(os.tmpdir(), `design-session-${sessionId}.json`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -167,7 +167,7 @@ describe("image-generation call sites (Responses API)", () => {
|
||||
|
||||
test("iterate: threaded and fresh fallback", async () => {
|
||||
const id = `models-test-${process.pid}-${Date.now()}`;
|
||||
const session = path.join("/tmp", `design-session-${id}.json`);
|
||||
const session = path.join(os.tmpdir(), `design-session-${id}.json`);
|
||||
const write = () => fs.writeFileSync(session, JSON.stringify({ id, lastResponseId: "resp_prev", originalBrief: "b", feedbackHistory: [], outputPaths: [], createdAt: "", updatedAt: "" }));
|
||||
try {
|
||||
write();
|
||||
|
||||
@@ -25,14 +25,14 @@ function flowFiles(): string[] {
|
||||
const out: string[] = [];
|
||||
for (const entry of fs.readdirSync(ROOT, { withFileTypes: true })) {
|
||||
if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules') continue;
|
||||
const skill = path.join(entry.name, 'SKILL.md');
|
||||
const skill = `${entry.name}/SKILL.md`;
|
||||
if (fs.existsSync(path.join(ROOT, skill))) out.push(skill);
|
||||
const sections = path.join(entry.name, 'sections');
|
||||
const sections = `${entry.name}/sections`;
|
||||
if (fs.existsSync(path.join(ROOT, sections))) {
|
||||
for (const f of fs.readdirSync(path.join(ROOT, sections))) if (f.endsWith('.md')) out.push(path.join(sections, f));
|
||||
for (const f of fs.readdirSync(path.join(ROOT, sections))) if (f.endsWith('.md')) out.push(`${sections}/${f}`);
|
||||
}
|
||||
}
|
||||
for (const f of fs.readdirSync(path.join(ROOT, 'scripts/resolvers'))) if (f.endsWith('.ts')) out.push(path.join('scripts/resolvers', f));
|
||||
for (const f of fs.readdirSync(path.join(ROOT, 'scripts/resolvers'))) if (f.endsWith('.ts')) out.push(`scripts/resolvers/${f}`);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user