feat(runner): replace server-side bash sandbox with remote runner (#530)

* feat(runner): replace server-side bash sandbox with remote runner

* fix(runner): address review findings for output bounds, key rotation, defaults, and generated uploads

* chore(docker): remove sandbox privileges and env vars from remaining compose files

* feat(cli): add runner start with bundled SRT sandboxing (#535)

* refactor(agent): expose runner bash without skill gating

* feat(cli): add runner start with optional SRT sandboxing

* refactor(cli): remove runner Python dependency

* feat(cli): bundle SRT and use platform-native runner shells

* refactor(cli): delegate runner processes to Execa

* chore(cli): upgrade @anthropic-ai/sandbox-runtime to 0.0.83

* feat(cli): discover Bash for Windows runners

Use Pi-style Bash discovery and launch behavior, exercise the packaged CLI shell, and wait for pending ZIP metadata reads before closing cancelled downloads.

* fix(runner): enforce ownership and safe reconnects

Gate dispatch on reconciliation, retain cancellations across disconnects, and stop replaced clients. Guard the single-server runner topology with a database lease. Restage missing generated inputs, report signal exits, and bound generated-file cleanup.

* feat(webui): add Korean translations for agent runners

* feat(cli): add runner event logging and --verbose flag (#536)

* feat(cli): add runner event logging and --verbose flag

* fix(cli): log runner capacity rejections accurately and use monotonic duration
This commit is contained in:
Yiling-J
2026-11-18 15:58:57 +08:00
committed by GitHub
parent eea844320d
commit 4ac274cdd4
121 changed files with 11600 additions and 5503 deletions
-59
View File
@@ -481,65 +481,6 @@ describe('TeamService', () => {
})
})
it('should create sandbox when team is created', async () => {
const user = await prisma.user.create({
data: { name: 'Test User', email: `test-sandbox-${Date.now()}@example.com`, password: 'pw' },
})
const team = await teamService.createTeam(user, {
name: 'Sandbox Team',
})
const sandbox = await prisma.sandbox.findUnique({
where: { teamId: team.id },
})
expect(sandbox).toBeDefined()
expect(sandbox?.allowedDomains).toContain('github.com')
})
it('should get and update sandbox settings', async () => {
const user = await prisma.user.create({
data: { name: 'Test User', email: `test-settings-${Date.now()}@example.com`, password: 'pw' },
})
const team = await teamService.createTeam(user, {
name: 'Settings Team',
})
// Should have default settings (networkSandboxEnabled is false by default for new teams)
const settings = await teamService.getSandboxSettings(team.id)
expect(settings.networkSandboxEnabled).toBe(false)
expect(settings.allowedDomains).toContain('github.com')
expect(settings.pendingDomains).toEqual([])
// Should update settings
const updated = await teamService.updateSandboxSettings(team.id, {
networkSandboxEnabled: true,
allowedDomains: ['example.com'],
pendingDomains: ['pending.com'],
})
expect(updated.networkSandboxEnabled).toBe(true)
expect(updated.allowedDomains).toEqual(['example.com'])
expect(updated.pendingDomains).toEqual(['pending.com'])
// Should persist to DB
const persisted = await teamService.getSandboxSettings(team.id)
expect(persisted.networkSandboxEnabled).toBe(true)
expect(persisted.allowedDomains).toEqual(['example.com'])
expect(persisted.pendingDomains).toEqual(['pending.com'])
})
it('should return default settings if sandbox is missing for old team', async () => {
const team = await prisma.team.create({
data: { name: 'Old Team' },
})
const settings = await teamService.getSandboxSettings(team.id)
expect(settings.networkSandboxEnabled).toBe(false)
expect(settings.allowedDomains).toEqual([])
expect(settings.pendingDomains).toEqual([])
})
describe('hasWritableRoleInAnyTeam', () => {
it('should return true for user with owner role', async () => {
const user = await prisma.user.create({
-49
View File
@@ -7,7 +7,6 @@ import { getAvatarUrl } from '@shumai/core/src/user/avatar'
import { HTTPException } from 'hono/http-exception'
import { getAllowedAgentRoles } from '@shumai/core/src/agent/permissions'
import { AgentService, agentService } from '@shumai/core/src/agent/agent'
import { sandboxService } from '@shumai/core/src/sandbox/sandbox-service'
import { turntableService } from '@shumai/core/src/turntable/turntable'
import { gotenbergService } from '@shumai/core/src/gotenberg/gotenberg'
import {
@@ -24,8 +23,6 @@ import {
TeamInfo,
GetMeResponse,
UserInfo,
SandboxSettings,
UpdateSandboxSettingsRequest,
TeamSettingsResponse,
AutoArchiveMethod,
AutoArchiveSettings,
@@ -50,7 +47,6 @@ export class TeamService {
threads: 0,
},
},
sandbox: { create: {} },
},
})
await providerService.initBuiltinProviders(team.id)
@@ -68,7 +64,6 @@ export class TeamService {
name: req.name,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
settings: {} as any,
sandbox: { create: {} },
},
})
@@ -513,50 +508,6 @@ export class TeamService {
return this.getSettings(teamId)
}
async getSandboxSettings(teamId: string): Promise<SandboxSettings> {
const sandbox = await prisma.sandbox.findUnique({
where: { teamId },
})
return {
networkSandboxEnabled: sandbox?.networkSandboxEnabled ?? false,
allowedDomains: sandbox?.allowedDomains || [],
pendingDomains: sandbox?.pendingDomains || [],
}
}
async updateSandboxSettings(
teamId: string,
settings: UpdateSandboxSettingsRequest,
): Promise<SandboxSettings> {
const sandbox = await prisma.sandbox.upsert({
where: { teamId },
create: {
teamId,
networkSandboxEnabled: settings.networkSandboxEnabled ?? false,
allowedDomains: settings.allowedDomains ?? [],
pendingDomains: settings.pendingDomains ?? [],
},
update: {
...(settings.networkSandboxEnabled !== undefined && {
networkSandboxEnabled: settings.networkSandboxEnabled,
}),
...(settings.allowedDomains !== undefined && {
allowedDomains: settings.allowedDomains,
}),
...(settings.pendingDomains !== undefined && {
pendingDomains: settings.pendingDomains,
}),
},
})
const effectiveDomains = sandbox.networkSandboxEnabled ? sandbox.allowedDomains : ['*']
await sandboxService.syncAllowedDomains(effectiveDomains, teamId)
return {
networkSandboxEnabled: sandbox.networkSandboxEnabled,
allowedDomains: sandbox.allowedDomains,
pendingDomains: sandbox.pendingDomains,
}
}
async getSignupInfo() {
const count = await prisma.user.count()