11"""Growth-center behavior chains: desktop/web event reporting and real-chat helpers.
22
3- Payload shapes mirror the official WorkBuddy desktop client (5.5.6 ) field-for-field, as
3+ Payload shapes mirror the official WorkBuddy desktop client (5.9.3 ) field-for-field, as
44validated by the upstream panel across multiple live accounts. Report hosts follow the
55account's own product endpoint; the desktop fingerprint is stable per uid so repeated
66chains look like one persistent device.
1414
1515import httpx
1616
17- DESKTOP_UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) WorkBuddyDesktop/5.5.6 "
18- "Chrome/132 .0.6834.83 Electron/34.0.0 Safari/537.36" )
17+ DESKTOP_UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) WorkBuddyDesktop/5.9.3 "
18+ "Chrome/148 .0.7778.97 Electron/41.8.1 Safari/537.36" )
1919WEB_UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
2020 "(KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36" )
2121REPORT_PATH = "/v2/report"
@@ -42,13 +42,13 @@ def fingerprint(uid, nickname=""):
4242 now = int (time .time () * 1000 )
4343 return {"timezone" : "Asia/Shanghai" , "reportDelay" : 2000 , "userId" : uid ,
4444 "username" : nickname , "userNickname" : nickname , "product" : "SaaS" ,
45- "releaseDate" : 1789036585355 ,
46- "commit" : "5f9692923c93033111c51ad7b003eb80204a9b75 " ,
47- "ideName" : "WorkBuddy" , "ideType" : "WorkBuddy" , "ideVersion" : "5.5.6 " ,
45+ "releaseDate" : 1789632000000 ,
46+ "commit" : "c41253385fa07bebfcae8a7a4728914f09af96d0 " ,
47+ "ideName" : "WorkBuddy" , "ideType" : "WorkBuddy" , "ideVersion" : "5.9.3 " ,
4848 "machineId" : derive_id (uid , "machine" ), "sessionId" : derive_id (uid , "session" ),
49- "extName" : "workbuddy-desktop" , "extVersion" : "5.5.6 " ,
50- "os" : "win32" , "arch" : "x64" , "osVersion" : "10.0.26220 " ,
51- "cpuCores" : 20 , "memorySize" : 24 , "timestamp" : now , "presentAt" : now }
49+ "extName" : "workbuddy-desktop" , "extVersion" : "5.9.3 " ,
50+ "os" : "win32" , "arch" : "x64" , "osVersion" : "10.0.26200 " ,
51+ "cpuCores" : 24 , "memorySize" : 32 , "timestamp" : now , "presentAt" : now }
5252
5353
5454def _post_json (base , path , headers , payload ):
@@ -106,13 +106,15 @@ def chat_request_event(uid, conversation_id, request_id="", model_id="", model_n
106106 "inputLength" : 12 , "requestModelId" : model_id ,
107107 "requestModelName" : model_name or model_id , "isPlan" : False ,
108108 "isAutoExecuteTerminal" : False , "isAutoModify" : False , "codebaseEnable" : False ,
109- "maxToken" : 0 , "maxSteps" : 0 , "temperature" : 0 , "maxRetries" : 0 ,
109+ "maxToken" : 0 , "maxSteps" : 0 , "temperature" : 0.7 , "maxRetries" : 2 ,
110110 "mentionContexts" : [], "knowledgeId" : [], "knowledgeName" : [], "codebaseId" : "" ,
111111 "mentionContextCount" : 0 , "command" : "" , "expertId" : "" , "recommendId" : "" ,
112112 "skillId" : "" , "skillCount" : 0 , "totalCount" : 0 , "fileUri" : "" ,
113113 "presentAt" : now , "traceId" : "" , "rootRequestId" : request_id ,
114114 "parentConversationId" : conversation_id , "agentName" : "default" ,
115- "agentType" : "conversation" , "userId" : uid }
115+ "agentType" : "conversation" , "device_id" : uid , "device_type" : "desktop" ,
116+ "sdk_version" : "5.9.3" , "chat_session_uuid" : conversation_id ,
117+ "platform" : "windows" , "title" : "对话" , "userId" : uid }
116118
117119
118120def report_chat_activity (base , token , uid , conversation_id , request_id = "" , model_id = "" ,
@@ -260,8 +262,10 @@ def desktop_chat(base, headers, expert_id="", model=FAST_MODEL, prompt="1+1等
260262 "stream_options" : {"include_usage" : True }}
261263 outgoing = {** headers , "X-Domain" : base , "X-Product" : "SaaS" , "X-Conversation-ID" : conversation_id ,
262264 "X-Request-ID" : str (int (time .time () * 1000 )), "X-Agent-Intent" : "craft" ,
263- "X-Agent-Type" : "main" , "X-IDE-Name" : "WorkBuddy" , "X-IDE-Type" : "WorkBuddy" ,
264- "X-IDE-Version" : "5.5.6" , "x-codebuddy-request" : "1" ,
265+ "X-Agent-Type" : "auxiliary" , "X-Agent-Runtime" : "local-agent" ,
266+ "X-IDE-Name" : "WorkBuddy" , "X-IDE-Type" : "WorkBuddy" ,
267+ "X-IDE-Version" : "5.9.3" , "x-codebuddy-request" : "1" ,
268+ "X-Requested-With" : "XMLHttpRequest" , "User-Agent" : DESKTOP_UA ,
265269 "Accept" : "text/event-stream" }
266270 outgoing .pop ("X-Client-Platform" , None )
267271 if expert_id :
0 commit comments