mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
feat(agent): integrate sandboxed bash tool and sandbox settings
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user