fix: read workspace from x-csc-directory header in session creation
This commit is contained in:
parent
02161dd2a6
commit
5c3f1e16db
|
|
@ -122,6 +122,11 @@ export function createSessionRoutes(
|
||||||
hooks?: Record<string, unknown>
|
hooks?: Record<string, unknown>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const headerDir = c.req.header('x-csc-directory')
|
||||||
|
|| c.req.header('x-opencode-directory')
|
||||||
|
const cwd = body.cwd
|
||||||
|
|| (headerDir ? decodeURIComponent(headerDir) : undefined)
|
||||||
|
|
||||||
let permissionMode = body.permission_mode
|
let permissionMode = body.permission_mode
|
||||||
if (!permissionMode && body.permission) {
|
if (!permissionMode && body.permission) {
|
||||||
const hasDeny = body.permission.some(r => r.action === 'deny')
|
const hasDeny = body.permission.some(r => r.action === 'deny')
|
||||||
|
|
@ -135,7 +140,7 @@ export function createSessionRoutes(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const handle = await sessionManager.createSession({
|
const handle = await sessionManager.createSession({
|
||||||
cwd: body.cwd,
|
cwd,
|
||||||
model: body.model,
|
model: body.model,
|
||||||
permissionMode,
|
permissionMode,
|
||||||
systemPrompt: body.system_prompt,
|
systemPrompt: body.system_prompt,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user