更新检测流程
This commit is contained in:
+16
-10
@@ -26,9 +26,8 @@ type Result struct {
|
||||
BytesRead int `json:"bytesRead,omitempty"`
|
||||
RawPreview string `json:"rawPreview,omitempty"`
|
||||
RequestBodyPrefixHex string `json:"requestBodyPrefixHex,omitempty"`
|
||||
// StreamProtocol / StreamNote 仅 Cursor Agent 探测填充,说明二进制流与结论边界
|
||||
StreamProtocol string `json:"streamProtocol,omitempty"`
|
||||
StreamNote string `json:"streamNote,omitempty"`
|
||||
StreamProtocol string `json:"streamProtocol,omitempty"`
|
||||
StreamNote string `json:"streamNote,omitempty"`
|
||||
}
|
||||
|
||||
// ProbeOfficial 按号池模块探测 Token(cursor / windsurf / krio)
|
||||
@@ -39,7 +38,8 @@ func ProbeOfficial(module, rawToken string) Result {
|
||||
}
|
||||
switch module {
|
||||
case "cursor":
|
||||
return probeCursor(tok)
|
||||
// 直接使用 cursor_hi.go 中已有的完整探测函数
|
||||
return probeCursorHiAgent(tok)
|
||||
case "windsurf":
|
||||
return probeWindsurf(tok)
|
||||
case "krio":
|
||||
@@ -57,19 +57,21 @@ func normalizeBearerToken(s string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
// probeCursor Cursor Token 探测(直接使用 cursor_hi.go 的实现)
|
||||
func probeCursor(token string) Result {
|
||||
return probeCursorHiAgent(token)
|
||||
}
|
||||
|
||||
// probeWindsurf WindSurf 探测
|
||||
func probeWindsurf(apiKey string) Result {
|
||||
payload := map[string]interface{}{
|
||||
"metadata": map[string]string{
|
||||
"apiKey": apiKey,
|
||||
"ideName": "windsurf",
|
||||
"ideVersion": "0.0.0",
|
||||
"extensionName": "windsurf",
|
||||
"extensionVersion": "0.0.0",
|
||||
"locale": "zh",
|
||||
"apiKey": apiKey,
|
||||
"ideName": "windsurf",
|
||||
"ideVersion": "0.0.0",
|
||||
"extensionName": "windsurf",
|
||||
"extensionVersion": "0.0.0",
|
||||
"locale": "zh",
|
||||
},
|
||||
}
|
||||
raw, err := json.Marshal(payload)
|
||||
@@ -117,6 +119,7 @@ func probeWindsurf(apiKey string) Result {
|
||||
}
|
||||
}
|
||||
|
||||
// probeKiro Kiro 探测
|
||||
func probeKiro(accessToken string) Result {
|
||||
arn := findProfileArnInJWT(accessToken)
|
||||
if arn == "" {
|
||||
@@ -160,6 +163,7 @@ func probeKiro(accessToken string) Result {
|
||||
}
|
||||
}
|
||||
|
||||
// decodeJWTPayloadMap 解析 JWT payload
|
||||
func decodeJWTPayloadMap(raw string) (map[string]interface{}, error) {
|
||||
tok := normalizeBearerToken(strings.TrimSpace(raw))
|
||||
parts := strings.Split(tok, ".")
|
||||
@@ -177,6 +181,7 @@ func decodeJWTPayloadMap(raw string) (map[string]interface{}, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// findProfileArnInJWT 从 JWT 中查找 profileArn
|
||||
func findProfileArnInJWT(raw string) string {
|
||||
m, err := decodeJWTPayloadMap(raw)
|
||||
if err != nil {
|
||||
@@ -185,6 +190,7 @@ func findProfileArnInJWT(raw string) string {
|
||||
return findProfileArnValue(m)
|
||||
}
|
||||
|
||||
// findProfileArnValue 递归查找 profileArn
|
||||
func findProfileArnValue(v interface{}) string {
|
||||
switch x := v.(type) {
|
||||
case map[string]interface{}:
|
||||
|
||||
Reference in New Issue
Block a user