feat(task): replace built-in task adaptors with a sandboxed JS plugin system (#7076)

This commit is contained in:
Calcium-Ion
2026-08-29 18:51:57 +08:00
committed by GitHub
parent 7037ac15bd
commit eb48396d5f
336 changed files with 52333 additions and 6369 deletions
@@ -0,0 +1,31 @@
package router
import (
"fmt"
"sort"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func TestHostProtocolRegistryDrivesProtocolRoutesOnce(t *testing.T) {
engine := gin.New()
SetTaskPluginProtocolRouter(engine)
expected := []string{
"POST /v1/responses",
"GET /v1/responses/:response_id",
"POST /v1/videos",
"GET /v1/videos/:task_id",
"GET /v1/videos/:task_id/content",
"HEAD /v1/videos/:task_id/content",
}
actual := make([]string, 0, len(engine.Routes()))
for _, route := range engine.Routes() {
actual = append(actual, fmt.Sprintf("%s %s", route.Method, route.Path))
}
sort.Strings(expected)
sort.Strings(actual)
assert.Equal(t, expected, actual)
}