@agentchatme/openclaw 0.7.821 → 0.7.82111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,28 @@ function classifyNetworkError(err3) {
145
145
  return "retry-transient";
146
146
  }
147
147
 
148
+ // src/version.ts
149
+ var PACKAGE_VERSION = "0.7.82111";
150
+
151
+ // src/client-identity.ts
152
+ var AGENTCHAT_CLIENT_NAME = "openclaw";
153
+ var AGENTCHAT_CLIENT_HEADERS = {
154
+ "X-AgentChat-Client": AGENTCHAT_CLIENT_NAME,
155
+ "X-AgentChat-Client-Version": PACKAGE_VERSION
156
+ };
157
+ function withAgentChatClientIdentity(fetchImpl) {
158
+ return (async (input, init) => {
159
+ const headers = new Headers(
160
+ typeof Request !== "undefined" && input instanceof Request ? input.headers : void 0
161
+ );
162
+ new Headers(init?.headers).forEach((value, key2) => headers.set(key2, value));
163
+ for (const [key2, value] of Object.entries(AGENTCHAT_CLIENT_HEADERS)) {
164
+ headers.set(key2, value);
165
+ }
166
+ return fetchImpl(input, { ...init, headers });
167
+ });
168
+ }
169
+
148
170
  // src/setup-client.ts
149
171
  var DEFAULT_API_BASE = "https://api.agentchat.me";
150
172
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -164,7 +186,8 @@ async function validateApiKey(apiKey, opts = {}) {
164
186
  method: "GET",
165
187
  headers: {
166
188
  Authorization: `Bearer ${apiKey}`,
167
- Accept: "application/json"
189
+ Accept: "application/json",
190
+ ...AGENTCHAT_CLIENT_HEADERS
168
191
  },
169
192
  signal: controller.signal
170
193
  });
@@ -306,7 +329,11 @@ async function post(path3, body, opts) {
306
329
  try {
307
330
  const res = await fetchImpl(url, {
308
331
  method: "POST",
309
- headers: { "content-type": "application/json", accept: "application/json" },
332
+ headers: {
333
+ "content-type": "application/json",
334
+ accept: "application/json",
335
+ ...AGENTCHAT_CLIENT_HEADERS
336
+ },
310
337
  body: JSON.stringify(body),
311
338
  signal: controller.signal
312
339
  });
@@ -1218,7 +1245,12 @@ var AgentchatWsClient = class {
1218
1245
  this.applyEvent({ type: "SOCKET_OPEN", now });
1219
1246
  try {
1220
1247
  this.ws.send(
1221
- JSON.stringify({ type: "hello", api_key: this.config.apiKey })
1248
+ JSON.stringify({
1249
+ type: "hello",
1250
+ api_key: this.config.apiKey,
1251
+ client: AGENTCHAT_CLIENT_NAME,
1252
+ client_version: PACKAGE_VERSION
1253
+ })
1222
1254
  );
1223
1255
  } catch (err3) {
1224
1256
  this.emitError(
@@ -1897,9 +1929,6 @@ var CircuitBreaker = class {
1897
1929
  }
1898
1930
  };
1899
1931
 
1900
- // src/version.ts
1901
- var PACKAGE_VERSION = "0.7.821";
1902
-
1903
1932
  // src/outbound.ts
1904
1933
  var DEFAULT_RETRY_POLICY = {
1905
1934
  maxAttempts: 4,
@@ -2008,7 +2037,8 @@ var OutboundAdapter = class {
2008
2037
  const headers = {
2009
2038
  "authorization": `Bearer ${this.config.apiKey}`,
2010
2039
  "content-type": "application/json",
2011
- "user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`
2040
+ "user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`,
2041
+ ...AGENTCHAT_CLIENT_HEADERS
2012
2042
  };
2013
2043
  let res;
2014
2044
  try {
@@ -2526,7 +2556,8 @@ function getClient({ accountId, config, options }) {
2526
2556
  const client = new agentchatme.AgentChatClient({
2527
2557
  apiKey: config.apiKey,
2528
2558
  baseUrl: config.apiBase,
2529
- ...options
2559
+ ...options,
2560
+ fetch: withAgentChatClientIdentity(options?.fetch ?? globalThis.fetch)
2530
2561
  });
2531
2562
  cache.set(accountId, {
2532
2563
  client,