feat(agent): integrate sandboxed bash tool and sandbox settings

This commit is contained in:
yiling
2026-05-20 10:36:47 +08:00
parent 9cad96210c
commit 53594194cc
32 changed files with 2205 additions and 110 deletions
+13 -1
View File
@@ -5,6 +5,7 @@ import { SessionEntry, SessionManager } from '@mariozechner/pi-coding-agent'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class DatabaseSessionManager extends (SessionManager as any) {
private dbSessionId: string
private skillEnvs: Record<string, string> = {}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private writeQueue: Promise<any> = Promise.resolve()
@@ -13,6 +14,14 @@ export class DatabaseSessionManager extends (SessionManager as any) {
this.dbSessionId = sessionId
}
addSkillEnvs(envs: Record<string, string>) {
this.skillEnvs = { ...this.skillEnvs, ...envs }
}
getSkillEnvs() {
return this.skillEnvs
}
static async create(params: {
agentId: string
userId?: string
@@ -46,7 +55,10 @@ export class DatabaseSessionManager extends (SessionManager as any) {
if (item.type === 'image' && item.data === '__S3_DATA__' && sourceKeys[keyIdx]) {
const key = sourceKeys[keyIdx]
try {
const { buffer } = await s3Service.getObject(process.env.S3_BUCKET || 'shumai', key)
const { buffer } = await s3Service.getObject(
process.env.S3_BUCKET || 'shumai',
key,
)
item.data = buffer.toString('base64')
} catch (err) {
console.error(`Failed to re-inject image data for key ${key}:`, err)