-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconstants.go
More file actions
116 lines (106 loc) Β· 4.95 KB
/
Copy pathconstants.go
File metadata and controls
116 lines (106 loc) Β· 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Package metaai provides programmatic
// access to Meta AI (https://meta.ai) β chat (via the clippy WebSocket binary
// protocol), image/video generation, image upload/analysis, conversation history,
// and topic-based session management.
//
// The primary entry point is the Client type (see NewClient).
//
// Wire-format ground truth for the clippy protocol is documented in
// docs/protocol.md and derived from a live browser capture (2026-06-19).
package metaai
// Endpoint URLs observed in the live web client.
const (
WebsocketURL = "wss://gateway.meta.ai/ws/clippy"
GraphqlURL = "https://meta.ai/api/graphql"
ChatGraphqlURL = "https://www.meta.ai/api/graphql"
MetaAIOrigin = "https://meta.ai"
MetaAIHomeURL = "https://meta.ai"
UploadURLFormat = "https://rupload.meta.ai/gen_ai_document_gen_ai_tenant/%s"
)
// DGW WebSocket query-string parameter values for the clippy connection.
// Captured from the live browser; must match exactly.
const (
DGWAppID = "1522763855472543"
DGWAppVersion = "1.0.0"
DGWAuthType = "15:0"
DGWVersion = "5"
DGWUUID = "0"
DGWTier = "prod"
)
// DefaultUserAgent mirrors the browser UA used by the live site (Chrome 149).
const DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
// Chat modes accepted by prompt and chat requests.
const (
ModeLearn = "learn"
ModeAnalyze = "analyze"
ModeCreateImage = "create_image"
ModeCreateVideo = "create_video"
)
// Kadabra entry points observed in live captures.
const (
EntryPointHome = "KADABRA__HOME__UNIFIED_INPUT_BAR"
EntryPointChat = "KADABRA__CHAT__UNIFIED_INPUT_BAR"
)
// Default capability strings sent in the chat SEND frame (top.f18 repeated).
// Captured from the live browser.
var DefaultCapabilities = []string{
"stocks",
"weather",
"meta_knowledge_search_carousel",
"meta_catalog_search_carousel",
"media_gallery",
}
// Capability hash sent in envelope.f19.f1. Captured from the live browser;
// opaque to this client β copied verbatim.
const CapabilityHash = "e2b88f9846379cbc26960fa3ae1d22201dfb19df7890ae6a3ac8a28870bac682"
// MaxRetries is the default retry limit for transient requests.
const MaxRetries = 3
// DocID holds persisted-query document IDs for the GraphQL HTTP endpoint.
// Supporting operations only (config, mark-seen, latency, history, media).
// Chat sendMessage itself goes over the WebSocket.
//
// Values are overridable via the META_AI_* env vars in EnvKey. Defaults match
// the live capture.
type DocID struct {
Default string // hardcoded default
EnvKey []string // env var names, tried in order
}
// DocIDs groups all persisted-query doc IDs used by the SDK.
var DocIDs = struct {
ConversationRegistration string // e7f80258β¦ (pre-send: register conversation id)
ConversationConfig string // 2b7fcdc8β¦ (logInvitationImpression / conversationDepth / agentType)
ModeSetter string // c32bbe99β¦ (pre-send: set conversation mode think_hard/fast)
BootstrapA string // 954e9b19β¦ (variables:{})
BootstrapB string // 1a336150β¦ (variables:{})
BootstrapC string // 659ce505β¦ (variables:{})
FetchConversationStatus string // 9ec38c71β¦ ({id, includeMessageList:false})
MarkSeen string // 0b2cb3a4β¦ (= META_AI_LAST_SEEN_DOC_ID)
Latency string // 26999e5d⦠(= META_AI_LATENCY_DOC_ID)
History string // e6214ae9β¦ (META_AI_HISTORY_DOC_ID)
FetchMedia string // ecc43cc5β¦ (META_AI_DOC_ID_FETCH_MEDIA)
TextToImage string // 2f707e4a⦠(image gen SSE)
TextToVideo string // 2f707e4a⦠(video gen SSE)
ExtendVideo string // 865d6fe8β¦
FetchConversation string // 9f7f4e20β¦
PollMedia string // 335a1ff1β¦
MediaLibraryFeed string // 3ee648d9β¦ (media library feed query)
}{
ConversationRegistration: "e7f802582dbfed8e181b012e010993eb",
ConversationConfig: "2b7fcdc841885a7263eccebaab5cfa3e",
ModeSetter: "c32bbe999c48e64e855dc63177d5153f",
BootstrapA: "954e9b193487fa4af750af87906e4313",
BootstrapB: "1a336150dbfcb081bfca357bac91b601",
BootstrapC: "659ce5056fb5c37f7311ab04d8e928f3",
FetchConversationStatus: "9ec38c71319524c705534312900bf6db",
MarkSeen: "0b2cb3a499606dfe326807a2b8b7ee20",
Latency: "26999e5d1366c257595b7fafa7822c31",
History: "e6214ae98a2da65944658b5b49cc5f00",
FetchMedia: "ecc43cc5adc3443611ed22bd8608a371",
TextToImage: "2f707e4a86f4b01adba97e1376cbdc14",
MediaLibraryFeed: "3ee648d9976908559a9013a0b520322b",
TextToVideo: "2f707e4a86f4b01adba97e1376cbdc14",
ExtendVideo: "865d6fe804a7ea98fbce7e562b1d61ce",
FetchConversation: "9f7f4e20336400df0ea882b6131d2dd6",
PollMedia: "335a1ff137a82e22e0a9724d4bf70b6f",
}