更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -24,7 +24,6 @@ const (
|
||||
cursorAgentPath = "/aiserver.v1.ChatService/StreamUnifiedChatWithTools"
|
||||
cursorClientVersion = "2.6.22"
|
||||
cursorHiMaxRead = 512 * 1024
|
||||
// probeHiText 发往官方 Agent 的探测内容(与前端展示 probeMessage 一致)
|
||||
probeHiText = "hi"
|
||||
)
|
||||
|
||||
@@ -34,7 +33,6 @@ func newCursorHTTP2Client() *http.Client {
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{MinVersion: tls.VersionTLS12},
|
||||
}
|
||||
// 与 Cursor 官方一致走 HTTP/2
|
||||
if err := http2.ConfigureTransport(tr); err != nil {
|
||||
return &http.Client{Timeout: 40 * time.Second}
|
||||
}
|
||||
@@ -70,8 +68,6 @@ func cursorEnvVersion() string {
|
||||
return cursorClientVersion
|
||||
}
|
||||
|
||||
// --- protobuf wire (与 cursor_api_demo 对齐) ---
|
||||
|
||||
func pbVarint(v uint64) []byte {
|
||||
var out []byte
|
||||
for v >= 0x80 {
|
||||
@@ -159,12 +155,11 @@ func encodeCursorMessageID(messageID string, role int) []byte {
|
||||
return msg
|
||||
}
|
||||
|
||||
// defaultAgentTools 与 cursor_agent_client.DEFAULT_TOOLS 一致
|
||||
var defaultAgentTools = []int{5, 6, 3, 15, 7, 8, 42}
|
||||
|
||||
func encodeCursorAgentRequest(userContent, modelName string) []byte {
|
||||
msgID := uuid.NewString()
|
||||
cm := 2 // Agent
|
||||
cm := 2
|
||||
userMsg := encodeCursorMessage(userContent, 1, msgID, &cm)
|
||||
|
||||
var msg []byte
|
||||
@@ -261,8 +256,6 @@ func asciiLowerInPlace(b []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// 社区脚本中的「额度用尽」ASCII 前缀(与明文一致,便于在二进制流中 bytes.Contains,无需整句)
|
||||
// 对应明文前缀:Get Cursor Pro for more Agent usage
|
||||
var cursorQuotaExhaustedSigCommunity = []byte{
|
||||
0x47, 0x65, 0x74, 0x20, 0x43, 0x75, 0x72, 0x73,
|
||||
0x6f, 0x72, 0x20, 0x50, 0x72, 0x6f, 0x20, 0x66,
|
||||
@@ -271,12 +264,10 @@ var cursorQuotaExhaustedSigCommunity = []byte{
|
||||
0x61, 0x67, 0x65,
|
||||
}
|
||||
|
||||
// cursorQuotaTipSig 与常见示例一致:raw 全字节里 bytes.Contains(raw, tipSig) → 额度用尽
|
||||
var cursorQuotaTipSig = []byte("Get Cursor Pro for more Agent usage, unlimited Tab, and more.")
|
||||
|
||||
const cursorLimitTipPrefix = "Get Cursor Pro for more Agent usage, unlimited Tab"
|
||||
|
||||
// classifyCursorRawStream 在官方流式二进制/文本中匹配用量与升级提示(ASCII 区不区分大小写 + UTF-8 短语)
|
||||
func classifyCursorRawStream(raw []byte) (blocked bool, reason string) {
|
||||
if len(raw) == 0 {
|
||||
return false, ""
|
||||
@@ -289,7 +280,6 @@ func classifyCursorRawStream(raw []byte) (blocked bool, reason string) {
|
||||
if bytes.Contains(raw, cursorQuotaTipSig) {
|
||||
return true, "流中匹配:" + string(cursorQuotaTipSig)
|
||||
}
|
||||
// 社区脚本:仅到「…Agent usage」的 ASCII 前缀(流里可能只有前半段)
|
||||
if bytes.Contains(raw, cursorQuotaExhaustedSigCommunity) {
|
||||
return true, "流中匹配:Get Cursor Pro for more Agent usage…(社区 QuotaExhaustedSignature 前缀)"
|
||||
}
|
||||
@@ -320,7 +310,7 @@ func classifyCursorRawStream(raw []byte) (blocked bool, reason string) {
|
||||
}
|
||||
|
||||
flat := strings.ToLower(strings.ToValidUTF8(string(raw), "\uFFFD"))
|
||||
flat = strings.ReplaceAll(flat, "\u2019", "'") // 右单引号
|
||||
flat = strings.ReplaceAll(flat, "\u2019", "'")
|
||||
flat = strings.ReplaceAll(flat, "`", "'")
|
||||
if strings.Contains(flat, "you've hit your usage limit") {
|
||||
return true, "流中匹配:you've hit your usage limit(UTF-8)"
|
||||
|
||||
Reference in new issue
Block a user