- windsurf: client/pool/local_ls/tool_emulation/tool_names/models 调整 - handler: admin account_data / failover_loop / gateway_handler - repository: scheduler_cache 及测试 - service: windsurf_chat_service / windsurf_gateway_service - deploy: compose 合并为单文件(含 windsurf-ls profile),Dockerfile.ls - cmd: 新增 dump_ls_models / dump_preamble / test_windsurf_tools 辅助工具
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
// dump_ls_models prints the full GetCascadeModelConfigs response from the LS
|
|
// for the given account JWT. Used to reconcile sub2api's static catalog with
|
|
// the authoritative runtime list.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"flag"
|
|
"fmt"
|
|
"net/url"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/Wei-Shaw/sub2api/internal/pkg/windsurf"
|
|
)
|
|
|
|
func main() {
|
|
jwt := flag.String("jwt", os.Getenv("WINDSURF_JWT"), "session token")
|
|
apiURL := flag.String("api", "https://server.self-serve.windsurf.com", "api_server_url")
|
|
flag.Parse()
|
|
if *jwt == "" {
|
|
fmt.Fprintln(os.Stderr, "need -jwt or WINDSURF_JWT")
|
|
os.Exit(2)
|
|
}
|
|
u, _ := url.Parse(*apiURL)
|
|
c, err := windsurf.NewClient(u.String(), "")
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "client:", err)
|
|
os.Exit(1)
|
|
}
|
|
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
|
defer cancel()
|
|
models, err := c.ListModels(ctx, *jwt)
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "ListModels:", err)
|
|
os.Exit(1)
|
|
}
|
|
fmt.Printf("# %d models returned by GetCascadeModelConfigs\n", len(models))
|
|
out, _ := json.MarshalIndent(models, "", " ")
|
|
fmt.Println(string(out))
|
|
}
|