Merge remote-tracking branch 'origin/master' into codex/session-scoped-sandbox-roots
# Conflicts: # examples/acp-agent/tests/acp.snapshot.ts # packages/examples/agent-spine-demo/package.json # pnpm-lock.yaml
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
import type { ToolExecution } from '@deepseek-ai/dsh-tools'
|
||||
import { canonicalPath } from '@deepseek-ai/dsh-sandbox'
|
||||
|
||||
const PARENT_PATH_SEGMENT = /(?:^|[\\/])\.\.(?:[\\/]|$)/
|
||||
|
||||
/**
|
||||
* The session workspace cwd for this call, or `undefined` when none applies.
|
||||
* @param exec - the tool-execution context; only its optional `agent` is read.
|
||||
@@ -18,7 +20,8 @@ import { canonicalPath } from '@deepseek-ai/dsh-sandbox'
|
||||
*/
|
||||
export function sessionCwd(exec: ToolExecution): string | undefined {
|
||||
const cwd = exec.agent?.session.header.cwd
|
||||
return cwd === undefined ? undefined : canonicalPath(cwd)
|
||||
if (cwd === undefined || !PARENT_PATH_SEGMENT.test(cwd)) return cwd
|
||||
return canonicalPath(cwd)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user