mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
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:
@@ -1,9 +1,9 @@
|
||||
import { type ToolRegistration as AgentTool } from '@earendil-works/pi-durable'
|
||||
import { storageBucket } from '@shumai/core/src/asset-read'
|
||||
import { mediaGenerationService } from '@shumai/core/src/media-generation/media-generation'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { sanitizeFilename } from '@shumai/core/src/utils/filename'
|
||||
import { EnabledMediaModel } from '@shumai/dtos'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { Type, type Static, type TSchema } from 'typebox'
|
||||
import { ulid } from 'ulid'
|
||||
import { resolveS3MediaBuffer } from './download-asset'
|
||||
@@ -262,22 +262,19 @@ export function createGenerateVideoTool(
|
||||
seed: p.seed !== null && p.seed !== undefined ? p.seed : undefined,
|
||||
})
|
||||
|
||||
const piDir = path.join(process.cwd(), '.pi')
|
||||
if (!fs.existsSync(piDir)) {
|
||||
fs.mkdirSync(piDir, { recursive: true })
|
||||
}
|
||||
|
||||
const genId = ulid()
|
||||
let filename: string
|
||||
if (p.outputFileName) {
|
||||
const safe = sanitizeFilename(p.outputFileName)
|
||||
filename = safe.endsWith('.mp4') ? safe : `${safe}.mp4`
|
||||
} else {
|
||||
filename = `generated_video_${ulid()}.mp4`
|
||||
filename = `generated_video_${genId}.mp4`
|
||||
}
|
||||
|
||||
const targetPath = path.join(piDir, filename)
|
||||
const relativePath = path.join('.pi', filename)
|
||||
fs.writeFileSync(targetPath, buffer)
|
||||
const safeMime = mimeType || 'video/mp4'
|
||||
const storageKey = `temp/generated/${genId}/${filename}`
|
||||
const relativePath = `.pi/generated/${genId}/${filename}`
|
||||
await s3Service.putObject(storageBucket(), storageKey, buffer, buffer.length, safeMime)
|
||||
|
||||
return {
|
||||
output: [
|
||||
@@ -289,7 +286,7 @@ export function createGenerateVideoTool(
|
||||
details: {
|
||||
fileName: filename,
|
||||
filePath: relativePath,
|
||||
absolutePath: targetPath,
|
||||
storageKey,
|
||||
size: buffer.length,
|
||||
mimeType,
|
||||
provider: modelConfig.provider,
|
||||
|
||||
Reference in New Issue
Block a user