mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-06 08:04:37 +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:
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `sandboxes` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "sandboxes" DROP CONSTRAINT "sandboxes_team_id_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "agents" ADD COLUMN "runner_id" TEXT;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "sandboxes";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "runners" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"description" TEXT,
|
||||
"key_prefix" TEXT NOT NULL,
|
||||
"key_hash" TEXT NOT NULL,
|
||||
"is_default" BOOLEAN NOT NULL DEFAULT false,
|
||||
"last_connected_at" TIMESTAMP(3),
|
||||
"last_disconnected_at" TIMESTAMP(3),
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
"team_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "runners_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "runners_key_hash_key" ON "runners"("key_hash");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "runners_team_id_idx" ON "runners"("team_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "runners_team_id_name_key" ON "runners"("team_id", "name");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "runners" ADD CONSTRAINT "runners_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "agents" ADD CONSTRAINT "agents_runner_id_fkey" FOREIGN KEY ("runner_id") REFERENCES "runners"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
-- Enforce single default runner per team at the database level
|
||||
CREATE UNIQUE INDEX "runners_one_default_per_team_idx" ON "runners"("team_id") WHERE "is_default" = true;
|
||||
@@ -342,7 +342,7 @@ model Team {
|
||||
providers Provider[] @relation("TeamToProvider")
|
||||
skills Skill[] @relation("TeamToSkill")
|
||||
mcpServers McpServer[] @relation("TeamToMcpServer")
|
||||
sandbox Sandbox? @relation("TeamToSandbox")
|
||||
runners Runner[] @relation("TeamToRunner")
|
||||
agents Agent[] @relation("TeamToAgent")
|
||||
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
||||
auditLogs AuditLog[] @relation("TeamToAuditLog")
|
||||
@@ -355,18 +355,26 @@ model Team {
|
||||
@@map("teams")
|
||||
}
|
||||
|
||||
model Sandbox {
|
||||
id String @id @default(ulid())
|
||||
networkSandboxEnabled Boolean @default(false) @map("network_sandbox_enabled")
|
||||
allowedDomains String[] @default(["npmjs.org", "*.npmjs.org", "registry.npmjs.org", "registry.yarnpkg.com", "pypi.org", "*.pypi.org", "github.com", "*.github.com", "api.github.com", "raw.githubusercontent.com"])
|
||||
pendingDomains String[] @default([]) @map("pending_domains")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
model Runner {
|
||||
id String @id @default(ulid())
|
||||
name String
|
||||
description String?
|
||||
keyPrefix String @map("key_prefix")
|
||||
keyHash String @unique @map("key_hash")
|
||||
isDefault Boolean @default(false) @map("is_default")
|
||||
lastConnectedAt DateTime? @map("last_connected_at")
|
||||
lastDisconnectedAt DateTime? @map("last_disconnected_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
teamId String @unique @map("team_id")
|
||||
team Team @relation("TeamToSandbox", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
teamId String @map("team_id")
|
||||
team Team @relation("TeamToRunner", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("sandboxes")
|
||||
agents Agent[] @relation("RunnerToAgent")
|
||||
|
||||
@@unique([teamId, name])
|
||||
@@index([teamId])
|
||||
@@map("runners")
|
||||
}
|
||||
|
||||
model Skill {
|
||||
@@ -891,6 +899,8 @@ model Agent {
|
||||
provider Provider? @relation("ProviderToAgent", fields: [providerId], references: [id], onDelete: SetNull)
|
||||
modelId String? @map("model_id")
|
||||
modelRef Model? @relation("ModelToAgent", fields: [modelId], references: [id], onDelete: SetNull)
|
||||
runnerId String? @map("runner_id")
|
||||
runner Runner? @relation("RunnerToAgent", fields: [runnerId], references: [id], onDelete: SetNull)
|
||||
|
||||
teamId String @map("team_id")
|
||||
team Team @relation("TeamToAgent", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
|
||||
Reference in New Issue
Block a user