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
+6 -3
View File
@@ -45,9 +45,12 @@ describe('SkillService', () => {
},
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mocking s3Service return value
const getObjectSpy = vi.spyOn(s3Service, 'getObject').mockResolvedValue({ buffer: zipBuffer, contentType: 'application/zip' } as any)
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mocking s3Service return value
const getObjectSpy = vi.spyOn(s3Service, 'getObject').mockResolvedValue({
buffer: zipBuffer,
contentType: 'application/zip',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const putObjectSpy = vi.spyOn(s3Service, 'putObject').mockResolvedValue(undefined as any)
const skill = await skillService.upsertSkill(team.id, {
+30
View File
@@ -11,6 +11,7 @@ import {
TeamInfo,
GetMeResponse,
UserInfo,
SandboxSettings,
} from '@/dtos/team'
export class TeamService {
@@ -202,6 +203,35 @@ export class TeamService {
return updated.settings || {}
}
async getSandboxSettings(teamId: string): Promise<SandboxSettings> {
const sandbox = await prisma.sandbox.findUnique({
where: { teamId },
})
return {
allowedDomains: sandbox?.allowedDomains || [
'github.com',
'api.github.com',
'raw.githubusercontent.com',
],
}
}
async updateSandboxSettings(teamId: string, settings: SandboxSettings): Promise<SandboxSettings> {
const sandbox = await prisma.sandbox.upsert({
where: { teamId },
create: {
teamId,
allowedDomains: settings.allowedDomains,
},
update: {
allowedDomains: settings.allowedDomains,
},
})
return {
allowedDomains: sandbox.allowedDomains,
}
}
async getSignupInfo() {
const count = await prisma.user.count()
const defaultTeam = await this.ensureDefaultTeam()