From fd41bd6e5f0a68dc8c9a058f131c4de7313f47a7 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 24 Mar 2026 23:49:06 +0000 Subject: [PATCH] save and use session_id --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 7bbc34f..38bc3b3 100644 --- a/server.js +++ b/server.js @@ -1,5 +1,6 @@ const express = require('express'); require('dotenv').config() +const fs = require('fs'); const { execSync } = require('child_process'); const app = express() @@ -7,15 +8,14 @@ app.use(express.json()) app.post('/test', (req, res)=>{ - const resumeFlag = `` + const resumeFlag = process.env.SESSIONID ? `--resume "${process.env.SESSIONID}"` : ''; const result = execSync( `cd /home/matt/pathfinder && claude -p "${req.body.message}" ${resumeFlag} --output-format json --allowedTools "Bash(*)" "Read(*)" "Write(*)" "Edit(*)"`, { encoding: 'utf-8', timeout: 120000 } ); + fs.writeFileSync('.env', `SESSIONID="${JSON.parse(result).session_id}"`, 'utf8'); res.json(JSON.parse(result)) }) -console.log(process.env.SESSIONID); - app.listen(3000);